jakarta-bcel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r694866 - in /jakarta/bcel/trunk/src/main/java/org/apache/bcel: classfile/ generic/ util/
Date Sat, 13 Sep 2008 01:44:14 GMT
Author: dbrosius
Date: Fri Sep 12 18:44:14 2008
New Revision: 694866

URL: http://svn.apache.org/viewvc?rev=694866&view=rev
Log:
Better exceptioning, -- don't lose exception stack traces

Modified:
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassFormatException.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGenException.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java
    jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassFormatException.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassFormatException.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassFormatException.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/ClassFormatException.java Fri
Sep 12 18:44:14 2008
@@ -34,4 +34,8 @@
     public ClassFormatException(String s) {
         super(s);
     }
+    
+    public ClassFormatException(String s, Throwable initCause) {
+    	super(s, initCause);
+    }
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/classfile/Utility.java Fri Sep 12 18:44:14
2008
@@ -162,7 +162,7 @@
         } catch (IOException e) {
             System.out.println(buf.toString());
             e.printStackTrace();
-            throw new ClassFormatException("Byte code error: " + e);
+            throw new ClassFormatException("Byte code error: " + e, e);
         }
         return buf.toString();
     }
@@ -568,7 +568,7 @@
                 index += unwrap(consumed_chars); // update position
             }
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
         return (String[]) vec.toArray(new String[vec.size()]);
     }
@@ -600,7 +600,7 @@
             index = signature.lastIndexOf(')') + 1;
             type = signatureToString(signature.substring(index), chopit);
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
         return type;
     }
@@ -687,7 +687,7 @@
             // Read return type after `)'
             type = signatureToString(signature.substring(index), chopit);
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
         if (buf.length() > 1) {
             buf.setLength(buf.length() - 2);
@@ -834,7 +834,7 @@
                     throw new ClassFormatException("Invalid signature: `" + signature + "'");
             }
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid signature: " + e + ":" + signature);
+            throw new ClassFormatException("Invalid signature: " + signature, e);
         }
     }
 
@@ -943,7 +943,7 @@
             index = signature.lastIndexOf(')') + 1;
             return typeOfSignature(signature.substring(index));
         } catch (StringIndexOutOfBoundsException e) {
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
     }
 
@@ -984,7 +984,7 @@
                     throw new ClassFormatException("Invalid method signature: " + signature);
             }
         } catch (StringIndexOutOfBoundsException e) {
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
     }
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGenException.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGenException.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGenException.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/ClassGenException.java Fri Sep
12 18:44:14 2008
@@ -33,4 +33,8 @@
     public ClassGenException(String s) {
         super(s);
     }
+    
+    public ClassGenException(String s, Throwable initCause) {
+    	super(s, initCause);
+    }
 }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionFactory.java Fri Sep
12 18:44:14 2008
@@ -562,7 +562,7 @@
             try {
                 i = (Instruction) java.lang.Class.forName(name).newInstance();
             } catch (Exception e) {
-                throw new RuntimeException("Could not find instruction: " + name);
+                throw new RuntimeException("Could not find instruction: " + name, e);
             }
             return i;
         } else if ((src_type instanceof ReferenceType) && (dest_type instanceof ReferenceType))
{

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/InstructionList.java Fri Sep
12 18:44:14 2008
@@ -185,7 +185,7 @@
                 count++;
             }
         } catch (IOException e) {
-            throw new ClassGenException(e.toString());
+            throw new ClassGenException(e.toString(), e);
         }
         byte_positions = new int[count]; // Trim to proper size
         System.arraycopy(pos, 0, byte_positions, 0, count);
@@ -968,7 +968,7 @@
                 instructions.add(Instruction.readInstruction(bytes));
             }
         } catch (IOException e) {
-            throw new ClassGenException(e.toString());
+            throw new ClassGenException(e.toString(), e);
         }
         return (Instruction[]) instructions.toArray(new Instruction[instructions.size()]);
     }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/generic/Type.java Fri Sep 12 18:44:14
2008
@@ -207,7 +207,7 @@
             int index = signature.lastIndexOf(')') + 1;
             return getType(signature.substring(index));
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
     }
 
@@ -232,7 +232,7 @@
                 index += unwrap(consumed_chars); // update position
             }
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
         types = new Type[vec.size()];
         vec.toArray(types);
@@ -335,7 +335,7 @@
                 index += consumed(coded);
             }
         } catch (StringIndexOutOfBoundsException e) { // Should never occur
-            throw new ClassFormatException("Invalid method signature: " + signature);
+            throw new ClassFormatException("Invalid method signature: " + signature, e);
         }
         return res;
     }

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/ClassLoaderRepository.java Fri Sep
12 18:44:14 2008
@@ -95,7 +95,7 @@
             storeClass(RC);
             return RC;
         } catch (IOException e) {
-            throw new ClassNotFoundException(e.toString());
+            throw new ClassNotFoundException(className + " not found: " + e.toString(), e);
         }
     }
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/JavaWrapper.java Fri Sep 12 18:44:14
2008
@@ -48,7 +48,7 @@
         try {
             return (java.lang.ClassLoader) Class.forName(s).newInstance();
         } catch (Exception e) {
-            throw new RuntimeException(e.toString());
+            throw new RuntimeException(e.toString(), e);
         }
     }
 

Modified: jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java
URL: http://svn.apache.org/viewvc/jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java?rev=694866&r1=694865&r2=694866&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java (original)
+++ jakarta/bcel/trunk/src/main/java/org/apache/bcel/util/SyntheticRepository.java Fri Sep
12 18:44:14 2008
@@ -126,7 +126,7 @@
             return loadClass(_path.getInputStream(className), className);
         } catch (IOException e) {
             throw new ClassNotFoundException("Exception while looking for class " + className
-                    + ": " + e.toString());
+                    + ": " + e.toString(), e);
         }
     }
 
@@ -169,7 +169,7 @@
             }
         } catch (IOException e) {
             throw new ClassNotFoundException("Exception while looking for class " + className
-                    + ": " + e.toString());
+                    + ": " + e.toString(), e);
         }
         throw new ClassNotFoundException("SyntheticRepository could not load " + className);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org


Mime
View raw message