Revision: ea2feb79b867 Branch: default Author: Brandon Roller <brandon.r.roller@xxxxxxxxx> Date: Tue Jul 16 11:46:19 2013 Log: Added another exception http://code.google.com/p/brailleblaster/source/detail?r=ea2feb79b867&repo=newdesign Modified: /src/main/org/brailleblaster/wordprocessor/BBDocument.java /src/main/org/brailleblaster/wordprocessor/Normalizer.java =======================================--- /src/main/org/brailleblaster/wordprocessor/BBDocument.java Tue Jul 16 11:09:48 2013 +++ /src/main/org/brailleblaster/wordprocessor/BBDocument.java Tue Jul 16 11:46:19 2013
@@ -37,6 +37,7 @@ import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.net.ConnectException; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; @@ -141,19 +142,25 @@ } catch(ConnectException e){new Notify("Brailleblaster failed to access necessary materials from online. Please check your internet connection and try again.");
+ //e.printStackTrace(); + printErrors(e); + return false; + } + catch(UnknownHostException e){+ new Notify("Brailleblaster failed to access necessary materials from online. Please check your internet connection and try again.");
e.printStackTrace(); printErrors(e); - return false; + return false } catch (ParsingException e) { new Notify("Problem processing " + fileName + " See stack trace."); - e.printStackTrace(); + //e.printStackTrace(); printErrors(e); return false; } catch (IOException e) {new Notify ("IO error occurred while parsing " + fileName + " See stack trace.");
- e.printStackTrace(); + //e.printStackTrace(); printErrors(e); return false; } =======================================--- /src/main/org/brailleblaster/wordprocessor/Normalizer.java Tue Jul 16 11:09:48 2013 +++ /src/main/org/brailleblaster/wordprocessor/Normalizer.java Tue Jul 16 11:46:19 2013
@@ -6,6 +6,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.net.ConnectException; +import java.net.UnknownHostException; import java.util.logging.Level; import java.util.logging.Logger; @@ -44,25 +45,30 @@ try { dBuilder = dbFactory.newDocumentBuilder(); this.doc = dBuilder.parse(this.f); - } + } catch(ConnectException e){new Notify("Brailleblaster failed to access necessary materials from online. Please check your internet connection and try again.");
- e.printStackTrace(); + // e.printStackTrace(); printErrors(e); } + catch(UnknownHostException e){+ new Notify("Brailleblaster failed to access necessary materials from online. Please check your internet connection and try again.");
+ // e.printStackTrace(); + printErrors(e); + } catch (ParserConfigurationException e) {new Notify("An error occurred while reading the document. Please check whehther the document contains vaild XML.");
- e.printStackTrace(); + // e.printStackTrace(); printErrors(e); } catch (SAXException e) {new Notify("An error occurred while reading the document. Please check whehther the document contains vaild XML.");
- e.printStackTrace(); + // e.printStackTrace(); printErrors(e); } catch (IOException e) { new Notify("An error occurred while reading the document."); - e.printStackTrace(); + // e.printStackTrace(); printErrors(e); } } @@ -74,8 +80,10 @@ } public void createNewNormalizedFile(String path){ - normalize(); - write(this.doc, path); + if(this.doc != null){ + normalize(); + write(this.doc, path); + } } private void normalize(){