You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by hu...@apache.org on 2014/09/12 14:45:03 UTC

svn commit: r1624524 - /aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java

Author: hughesj
Date: Fri Sep 12 12:45:02 2014
New Revision: 1624524

URL: http://svn.apache.org/r1624524
Log:
ARIES-1204: fix StringIndexOutOfBoundsException for Blueprint apps that have constructors with multiple exceptions

Modified:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java?rev=1624524&r1=1624523&r2=1624524&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java (original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/gen/ProxySubclassAdapter.java Fri Sep 12 12:45:02 2014
@@ -146,7 +146,16 @@ public class ProxySubclassAdapter extend
       // So what we do is build up the calling of the superclasses constructor using nulls and default values. This means that the 
       // class bytes can be verified by the JVM, and then in the ProxySubclassGenerator, we load the class without invoking the 
       // constructor. 
-      Method constructor = Method.getMethod(constructors[0].toGenericString());
+      String constructorString = constructors[0].toGenericString();
+      Method constructor = null;
+      if (constructorString.indexOf(")") != -1) {
+        //If constructor throws two or more exceptions, getMethod(String) will report a StringIndexOutOfBounds exception,
+        //so attempt to remove exceptions
+        constructor = Method.getMethod(constructorString.substring(0, constructorString.indexOf(")") + 1));
+      } else {
+	//As a backup, just pass in the generic string as before
+        constructor = Method.getMethod(constructorString);
+      }
       
       Type[] argTypes = constructor.getArgumentTypes();
       if (argTypes.length == 0) {