]> source.dussan.org Git - poi.git/commitdiff
Exception Chaining: Added support for java 1.4 style exception chaining. Believe...
authorJason Height <jheight@apache.org>
Mon, 24 Jul 2006 12:40:25 +0000 (12:40 +0000)
committerJason Height <jheight@apache.org>
Mon, 24 Jul 2006 12:40:25 +0000 (12:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@425026 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/dev/BiffViewer.java
src/java/org/apache/poi/hssf/eventmodel/EventRecordFactory.java
src/java/org/apache/poi/hssf/record/FormulaRecord.java
src/java/org/apache/poi/hssf/record/RecordFactory.java
src/java/org/apache/poi/hssf/record/RecordFormatException.java
src/java/org/apache/poi/hssf/record/RecordInputStream.java
src/java/org/apache/poi/hssf/record/formula/Ptg.java

index 29d75fb5f6474fc238810ebfaa4f8b311282c29f..df62f7c6dc830a9e648d83c392710652882fe89b 100644 (file)
@@ -111,7 +111,7 @@ public class BiffViewer {
                 }
             activeRecord.dump();
         } catch (IOException e) {
-            throw new RecordFormatException("Error reading bytes");
+            throw new RecordFormatException("Error reading bytes", e);
         }
         Record[] retval = new Record[records.size()];
 
index 438107ac4551f2a6a43c110b7416be4f582bf590..2532ad72fbf294f50a1b25b3e384074571b23f4c 100644 (file)
@@ -332,9 +332,7 @@ public class EventRecordFactory
         }
         catch (Exception introspectionException)
         {
-            introspectionException.printStackTrace();
-            throw new RecordFormatException(
-                "Unable to construct record instance, the following exception occured: " + introspectionException.getMessage());
+            throw new RecordFormatException("Unable to construct record instance" , introspectionException);
         }
         if (retval instanceof RKRecord)
         {
index a3b189d47f8f4fed3156de775a1d3126f7f8db5a..64f0525dada30a47f31461c74d70afd6d2d54d3d 100644 (file)
@@ -102,7 +102,7 @@ public class FormulaRecord
           field_7_expression_len = in.readShort();
           field_8_parsed_expr    = Ptg.createParsedExpressionTokens(field_7_expression_len, in);
         } catch (java.lang.UnsupportedOperationException uoe)  {
-          throw new RecordFormatException(uoe.toString());
+          throw new RecordFormatException(uoe);
         }
     }
 
index f9c86a3cec25a9d4467bcf49a1e8a3f1a50f8669..9f5901c050ea4955311df61174cb68ead82b630d 100644 (file)
@@ -222,9 +222,7 @@ public class RecordFactory
         }
         catch (Exception introspectionException)
         {
-            introspectionException.printStackTrace();
-            throw new RecordFormatException(
-                "Unable to construct record instance, the following exception occured: " + introspectionException.getMessage());
+            throw new RecordFormatException("Unable to construct record instance",introspectionException);
         }
         if (retval instanceof RKRecord)
         {
@@ -316,9 +314,8 @@ public class RecordFactory
             }
             catch (Exception illegalArgumentException)
             {
-                illegalArgumentException.printStackTrace();
                 throw new RecordFormatException(
-                    "Unable to determine record types");
+                    "Unable to determine record types", illegalArgumentException);
             }
             result.put(new Short(sid), constructor);
         }
index f2050a3f857e8e22c48e3ae7972864cf70f9630a..d708f5eb0b33b314dd6156382e22e2c6e985a372 100644 (file)
@@ -30,4 +30,12 @@ public class RecordFormatException
     {
         super(exception);
     }
+    
+    public RecordFormatException(String exception, Throwable thr) {
+      super(exception, thr);
+    }
+    
+    public RecordFormatException(Throwable thr) {
+      super(thr);
+    }
 }
index 00c9200d5b44706a36e3f932aaf8330a3e113ee5..7bc3671fee204cbf3ec02d0a426985e8eac2502d 100755 (executable)
@@ -54,7 +54,7 @@ public class RecordInputStream extends InputStream
       //Dont increment the pos just yet (technically we are at the start of
       //the record stream until nextRecord is called).      
     } catch (IOException ex) {
-      throw new RecordFormatException("Error reading bytes");
+      throw new RecordFormatException("Error reading bytes", ex);
     }
   }
   
index 4e7df5b8695a9ee60470595dfe5ef9e0341f2ae6..5574076db85c223623f849708525fbd46a022f9d 100644 (file)
@@ -327,7 +327,7 @@ public abstract class Ptg
             default :
 
                  //retval = new UnknownPtg();
-                 throw new java.lang.UnsupportedOperationException(
+                 throw new java.lang.UnsupportedOperationException(" Unknown Ptg in Formula: 0x"+
                         Integer.toHexString(( int ) id) + " (" + ( int ) id + ")");
         }