jeremias    2004/04/04 04:12:29

  Modified:    src/java/org/apache/fop/apps InputHandler.java
               src/java/org/apache/fop/render/rtf RTFHandler.java
  Log:
  Ordinary Java code should never throw Error instances, use RuntimeException instead. 
That said, RuntimeException is equally suboptimal here. We should probably create an 
exception class like SAXException for the handler methods.
  
  Revision  Changes    Path
  1.11      +1 -1      xml-fop/src/java/org/apache/fop/apps/InputHandler.java
  
  Index: InputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/InputHandler.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- InputHandler.java 16 Mar 2004 05:25:16 -0000      1.10
  +++ InputHandler.java 4 Apr 2004 11:12:28 -0000       1.11
  @@ -83,7 +83,7 @@
           try {
               return new InputSource(new URL("file", null, path).toString());
           } catch (java.net.MalformedURLException e) {
  -            throw new Error("unexpected MalformedURLException");
  +            throw new RuntimeException("unexpected MalformedURLException");
           }
       }
   
  
  
  
  1.23      +39 -39    xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java
  
  Index: RTFHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- RTFHandler.java   4 Apr 2004 06:29:44 -0000       1.22
  +++ RTFHandler.java   4 Apr 2004 11:12:29 -0000       1.23
  @@ -282,10 +282,10 @@
               }
           } catch (IOException ioe) {
               log.error("startFlow: " + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startFlow: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -307,7 +307,7 @@
               }
           } catch (Exception e) {
               log.error("endFlow: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -344,10 +344,10 @@
           } catch (IOException ioe) {
               // TODO could we throw Exception in all FOInputHandler events?
               log.error("startBlock: " + ioe.getMessage());
  -            throw new Error("IOException: " + ioe);
  +            throw new RuntimeException("IOException: " + ioe);
           } catch (Exception e) {
               log.error("startBlock: " + e.getMessage());
  -            throw new Error("Exception: " + e);
  +            throw new RuntimeException("Exception: " + e);
           }
       }
   
  @@ -390,10 +390,10 @@
               
           } catch (IOException ioe) {
               log.error("startBlock:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startBlock:" + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -418,7 +418,7 @@
               builderContext.pushContainer(tc.newTable(atts, tableContext));
           } catch (Exception e) {
               log.error("startTable:" + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
   
           builderContext.pushTableContext(tableContext);
  @@ -452,7 +452,7 @@
               builderContext.getTableContext().setNextColumnRowSpanning(new 
Integer(0), null);
           } catch (Exception e) {
               log.error("startColumn: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
   
       }
  @@ -513,13 +513,13 @@
               textrun.pushAttributes(rtfAttr);
           } catch (IOException ioe) {
               log.error("startInline:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (FOPException fe) {
               log.error("startInline:" + fe.getMessage());
  -            throw new Error(fe.getMessage());
  +            throw new RuntimeException(fe.getMessage());
           } catch (Exception e) {
               log.error("startInline:" + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -541,10 +541,10 @@
               textrun.popAttributes();
           } catch (IOException ioe) {
               log.error("startInline:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startInline:" + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -564,7 +564,7 @@
               tbl.setHeaderAttribs(atts);
           } catch (Exception e) {
               log.error("startBody: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -581,7 +581,7 @@
               tbl.setHeaderAttribs(null);
           } catch (Exception e) {
               log.error("endBody: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -611,7 +611,7 @@
               builderContext.getTableContext().selectFirstColumn();
           } catch (Exception e) {
               log.error("startRow: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -673,7 +673,7 @@
               builderContext.pushContainer(cell);
           } catch (Exception e) {
               log.error("startCell: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -708,13 +708,13 @@
               builderContext.pushContainer(newList);
           } catch (IOException ioe) {
               log.error("startList: " + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (FOPException fe) {
               log.error("startList: " + fe.getMessage());
  -            throw new Error(fe.getMessage());
  +            throw new RuntimeException(fe.getMessage());
           } catch (Exception e) {
               log.error("startList: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -744,13 +744,13 @@
               builderContext.pushContainer(list.newListItem());
           } catch (IOException ioe) {
               log.error("startList: " + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (FOPException fe) {
               log.error("startList: " + fe.getMessage());
  -            throw new Error(fe.getMessage());
  +            throw new RuntimeException(fe.getMessage());
           } catch (Exception e) {
               log.error("startList: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -781,10 +781,10 @@
               builderContext.pushContainer(label);
           } catch (IOException ioe) {
               log.error("startPageNumber:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startPageNumber: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -868,10 +868,10 @@
               
           } catch (IOException ioe) {
               log.error("startLink:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startLink: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -992,10 +992,10 @@
           } catch (IOException ioe) {
               // TODO could we throw Exception in all FOInputHandler events?
               log.error("startFootnote: " + ioe.getMessage());
  -            throw new Error("IOException: " + ioe);
  +            throw new RuntimeException("IOException: " + ioe);
           } catch (Exception e) {
               log.error("startFootnote: " + e.getMessage());
  -            throw new Error("Exception: " + e);
  +            throw new RuntimeException("Exception: " + e);
           }
       }
       
  @@ -1028,10 +1028,10 @@
           } catch (IOException ioe) {
               // TODO could we throw Exception in all FOInputHandler events?
               log.error("startFootnoteBody: " + ioe.getMessage());
  -            throw new Error("IOException: " + ioe);
  +            throw new RuntimeException("IOException: " + ioe);
           } catch (Exception e) {
               log.error("startFootnoteBody: " + e.getMessage());
  -            throw new Error("Exception: " + e);
  +            throw new RuntimeException("Exception: " + e);
           }
       }
       
  @@ -1053,10 +1053,10 @@
           } catch (IOException ioe) {
               // TODO could we throw Exception in all FOInputHandler events?
               log.error("endFootnoteBody: " + ioe.getMessage());
  -            throw new Error("IOException: " + ioe);
  +            throw new RuntimeException("IOException: " + ioe);
           } catch (Exception e) {
               log.error("endFootnoteBody: " + e.getMessage());
  -            throw new Error("Exception: " + e);
  +            throw new RuntimeException("Exception: " + e);
           }
       }
   
  @@ -1084,10 +1084,10 @@
            } catch (IOException ioe) {
               // FIXME could we throw Exception in all FOInputHandler events?
               log.error("characters: " + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("characters:" + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  @@ -1113,10 +1113,10 @@
               textrun.addPageNumber(rtfAttr);
           } catch (IOException ioe) {
               log.error("startPageNumber:" + ioe.getMessage());
  -            throw new Error(ioe.getMessage());
  +            throw new RuntimeException(ioe.getMessage());
           } catch (Exception e) {
               log.error("startPageNumber: " + e.getMessage());
  -            throw new Error(e.getMessage());
  +            throw new RuntimeException(e.getMessage());
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to