aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1103326 - in /aries/trunk/proxy/proxy-impl/src/main: java/org/apache/aries/proxy/impl/ java/org/apache/aries/proxy/impl/weaving/ resources/org/apache/aries/proxy/nls/
Date Sun, 15 May 2011 11:29:35 GMT
Author: not
Date: Sun May 15 11:29:34 2011
New Revision: 1103326

URL: http://svn.apache.org/viewvc?rev=1103326&view=rev
Log:
ARIES-467 Fix proxy so it once again has all its messages in an NLS friendly messages file.

Modified:
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyMethodAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/OSGiFriendlyClassWriter.java
    aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
    aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/AbstractProxyManager.java
Sun May 15 11:29:34 2011
@@ -60,7 +60,7 @@ public abstract class AbstractProxyManag
       throws UnableToProxyException 
   {
     if(dispatcher == null)
-      throw new NullPointerException("A dispatcher must be specified for a delegating proxy
handler");
+      throw new NullPointerException(NLS.MESSAGES.getMessage("no.dispatcher"));
     
     if (template instanceof WovenProxy) {
       WovenProxy proxy = ((WovenProxy) template).

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyAdapter.java
Sun May 15 11:29:34 2011
@@ -32,6 +32,7 @@ import java.util.concurrent.Callable;
 
 import org.apache.aries.proxy.InvocationListener;
 import org.apache.aries.proxy.UnableToProxyException;
+import org.apache.aries.proxy.impl.NLS;
 import org.apache.aries.proxy.impl.gen.Constants;
 import org.apache.aries.proxy.weaving.WovenProxy;
 import org.objectweb.asm.ClassAdapter;
@@ -237,9 +238,7 @@ abstract class AbstractWovenProxyAdapter
     } catch (ClassNotFoundException e) {
       // If this happens we're about to hit bigger trouble on verify, so we can
       // just throw it
-      throw new RuntimeException("Unable to load the super type "
-          + superName.replace('/', '.') + " for class "
-          + typeBeingWoven.getClassName(), e);
+      throw new RuntimeException(NLS.MESSAGES.getMessage("cannot.load.superclass", superName.replace('/',
'.'), typeBeingWoven.getClassName()), e);
     }
   }
 
@@ -319,9 +318,8 @@ abstract class AbstractWovenProxyAdapter
             knownMethods, transformedMethods), ClassReader.SKIP_CODE | 
             ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
       } catch (IOException e) {
-        //This should never happen!
-        throw new RuntimeException("Error processing " + c.getName() + " when weaving "
-            + typeBeingWoven.getClassName(), e);
+        // This should never happen! <= famous last words (not)
+        throw new RuntimeException(NLS.MESSAGES.getMessage("unexpected.error.processing.class",
c.getName(), typeBeingWoven.getClassName()), e);
       }
     }
     // If we need to implement woven proxy in this class then write the methods
@@ -475,9 +473,8 @@ abstract class AbstractWovenProxyAdapter
         if(hasNoArgsConstructor)
           methodAdapter.invokeConstructor(typeBeingWoven, NO_ARGS_CONSTRUCTOR);
         else
-          throw new RuntimeException(new UnableToProxyException(typeBeingWoven.getClassName(),
"The class " + 
-              typeBeingWoven.getClassName() + " and its supertype " + superType.getClassName()
+
-              " do not have no-args constructors and cannot be woven."));
+          throw new RuntimeException(new UnableToProxyException(typeBeingWoven.getClassName(),

+              NLS.MESSAGES.getMessage("type.lacking.no.arg.constructor", typeBeingWoven.getClassName(),
superType.getClassName())));
       }
       methodAdapter.loadThis();
       methodAdapter.loadArg(0);

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyMethodAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyMethodAdapter.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyMethodAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/AbstractWovenProxyMethodAdapter.java
Sun May 15 11:29:34 2011
@@ -32,6 +32,7 @@ import static org.objectweb.asm.Opcodes.
 import java.util.Arrays;
 
 import org.apache.aries.proxy.InvocationListener;
+import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.Opcodes;
@@ -473,8 +474,7 @@ abstract class AbstractWovenProxyMethodA
       ilMethod = clazz.getMethod(name, argTypes);
     } catch (Exception e) {
       //Should be impossible!
-      throw new RuntimeException("Error finding Invocation Listener method " + name
-          + " " + Arrays.toString(argTypes), e);
+      throw new RuntimeException(NLS.MESSAGES.getMessage("error.finding.invocation.listener.method",
name, Arrays.toString(argTypes)), e);
     }
     //get the ASM method
     return new Method(name, Type.getReturnType(ilMethod), Type.getArgumentTypes(ilMethod));

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/MethodCopyingClassAdapter.java
Sun May 15 11:29:34 2011
@@ -23,6 +23,7 @@ import java.util.Set;
 
 import org.apache.aries.proxy.FinalModifierException;
 import org.apache.aries.proxy.UnableToProxyException;
+import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.Attribute;
 import org.objectweb.asm.ClassReader;
@@ -102,9 +103,8 @@ final class MethodCopyingClassAdapter ex
       // package
       if((access & (ACC_PUBLIC | ACC_PROTECTED | ACC_PRIVATE)) == 0) {
         if(!!!samePackage)
-          throw new RuntimeException("The method " + name + " in class " + 
-              superToCopy.getName() + " cannot be called by " + overridingClassType.getClassName()
-              + " because it is in a different package", new UnableToProxyException(superToCopy));
+          throw new RuntimeException(NLS.MESSAGES.getMessage("method.from.superclass.is.hidden",
name, superToCopy.getName(), overridingClassType.getClassName()),
+                                     new UnableToProxyException(superToCopy));
       }
       //Safe to copy a call to this method!
       Type superType = Type.getType(superToCopy);

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/OSGiFriendlyClassWriter.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/OSGiFriendlyClassWriter.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/OSGiFriendlyClassWriter.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/OSGiFriendlyClassWriter.java
Sun May 15 11:29:34 2011
@@ -23,6 +23,7 @@ import java.io.InputStream;
 import java.util.HashSet;
 import java.util.Set;
 
+import org.apache.aries.proxy.impl.NLS;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
 /**
@@ -108,7 +109,7 @@ final class OSGiFriendlyClassWriter exte
         }
       }
       
-      throw new RuntimeException("Unable to locate common superclass, start looking outside
the loader's bundle");
+      throw new RuntimeException(NLS.MESSAGES.getMessage("no.common.superclass", arg0, arg1));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }

Modified: aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/weaving/ProxyWeavingHook.java
Sun May 15 11:29:34 2011
@@ -21,6 +21,7 @@ package org.apache.aries.proxy.impl.weav
 import java.util.List;
 
 import org.apache.aries.proxy.UnableToProxyException;
+import org.apache.aries.proxy.impl.NLS;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.hooks.weaving.WeavingException;
 import org.osgi.framework.hooks.weaving.WeavingHook;
@@ -30,8 +31,7 @@ import org.slf4j.LoggerFactory;
 
 public final class ProxyWeavingHook implements WeavingHook {
 
-  private static final Logger LOGGER = LoggerFactory
-  .getLogger(ProxyWeavingHook.class);
+  private static final Logger LOGGER = LoggerFactory.getLogger(ProxyWeavingHook.class);
   /** An import of the WovenProxy package */
   private static final String IMPORT_A = "org.apache.aries.proxy.weaving";
   /** 
@@ -67,14 +67,12 @@ public final class ProxyWeavingHook impl
           e.getCause() instanceof UnableToProxyException){
         //This is a weaving failure that should be logged, but the class
         //can still be loaded
-        LOGGER.info("The class " + wovenClass.getClassName() + " cannot be woven, it may"
+
-        		"not be possible for the runtime to proxy this class. The failure was : ", e);
+        LOGGER.info(NLS.MESSAGES.getMessage("cannot.weave", wovenClass.getClassName()), e);
       } else {
+        String failureMessage = NLS.MESSAGES.getMessage("fatal.weaving.failure", wovenClass.getClassName());
         //This is a failure that should stop the class loading!
-        LOGGER.error("There was a serious error trying to weave the class " 
-            + wovenClass.getClassName(), e);
-        throw new WeavingException("There was a serious error trying to weave the class "

-          + wovenClass.getClassName(), e);
+        LOGGER.error(failureMessage, e);
+        throw new WeavingException(failureMessage, e);
       }
     }
     

Modified: aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
URL: http://svn.apache.org/viewvc/aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties?rev=1103326&r1=1103325&r2=1103326&view=diff
==============================================================================
--- aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
(original)
+++ aries/trunk/proxy/proxy-impl/src/main/resources/org/apache/aries/proxy/nls/ProxyImplMessages.properties
Sun May 15 11:29:34 2011
@@ -23,3 +23,27 @@
 bundle.uninstalled=The bundle {0} at version {1} with id {2} has been uninstalled.
 # {0} name of class
 class.is.class=The class {0} is not an interface and therefore a proxy cannot be generated.
+no.dispatcher=A dispatcher must be specified for a delegating proxy handler. This is most
likely a bug in the code calling the ProxyManager.
+# {0} The name of the super class
+# {1} The name of the class
+cannot.load.superclass=Unable to load the super type {0} for class {1}.
+# {0}
+# {1} The class being weaved
+unexpected.error.processing.class=Unexpected error processing {0} when weaving {1}.
+# {0} The class being weaved
+# {1} The super class
+type.lacking.no.arg.constructor=The class {0} and its superclass {1} do not have no-args
constructors and cannot be woven.
+# {0} The method on the invocation listener
+# {1} A list of parameter types
+error.finding.invocation.listener.method=Error finding InvocationListener method {0} with
argument types {1}.
+# {0} The name of the method
+# {1} The class the method is in.
+# {2} 
+method.from.superclass.is.hidden=The method {0} in class {1} cannot be called by {2} because
it is in a different package.
+# {0} A class
+# {1} Another class
+no.common.superclass=The class {0} and {1} do not have a common super class.
+# {0} The class that cannot be woven
+cannot.weave=The class {0} cannot be woven, it may not be possible for the runtime to proxy
this class.
+# {0} The class that could not be woven.
+fatal.weaving.failure=There was a serious error trying to weave the class {0}. See the associated
exception for more information.



Mime
View raw message