hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject cvs commit: jakarta-hivemind/framework/src/java/org/apache/hivemind/impl MessageFormatter.java
Date Thu, 10 Jun 2004 13:29:31 GMT
hlship      2004/06/10 06:29:30

  Modified:    framework/src/java/org/apache/hivemind
                        HiveMindMessages.properties
               framework/src/test/hivemind/test/services TestServices.java
               framework/src/java/org/apache/hivemind/test
                        HiveMindTestCase.java
               framework/src/java/org/apache/hivemind/service/impl
                        ServiceMessages.java BuilderFactory.java
               framework/src/java/org/apache/hivemind/util
                        UtilMessages.java
               framework/src/test/org/apache/hivemind/util
                        TestPropertyUtils.java
               framework/src/java/org/apache/hivemind/impl
                        MessageFormatter.java
  Added:       framework/src/java/org/apache/hivemind/service/impl
                        ServiceStrings.properties
               framework/src/java/org/apache/hivemind/util
                        UtilStrings.properties
  Log:
  HIVEMIND-4: Enhance logging of exceptions when setting a service property to a contribution
  
  Revision  Changes    Path
  1.16      +1 -31     jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties
  
  Index: HiveMindMessages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/HiveMindMessages.properties,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HiveMindMessages.properties	9 Jun 2004 14:52:57 -0000	1.15
  +++ HiveMindMessages.properties	10 Jun 2004 13:29:30 -0000	1.16
  @@ -43,7 +43,6 @@
   impl.no-such-service-point=Service extension point {0} does not exist.
   impl.registry-already-started=The HiveMind Registry has been started.
   
  -DefaultsSymbolSource.duplicate-symbol=Default for symbol ''{0}'' (at {1}) duplicates prior
value (at {2}) and has been ignored.
   
   DefaultClassResolver.unable-to-load-class=Could not load class {0} from {1}: {2}
   
  @@ -121,21 +120,12 @@
   
   RegistryAssemblyImpl.duplicate-schema=Schema {0} (at {1}) conflicts with existing schema
at {2}.
   
  -# javassist package
   
  -AbstractServiceExtensionPoint.error-instantiating-interceptor=Service interceptor factory
{0} failed to create {1} interceptor for service {2} as class {3}: {4}
   
  -# javassist.impl package
   
  -ClassFactoryImpl.unable-to-lookup=Unable to lookup {0}: {1}
  -ClassFactoryImpl.unable-to-create-class=Unable to create class {0} as subclass of {1}:
{2}
   
  -ClassFabImpl.unable-to-write-class=Unable to create class {0}: {1}
  -ClassFabImpl.unable-to-add-field=Unable to add field {0} to class {1}: {2}
  -ClassFabImpl.unable-to-add-method=Unable to add method {0} to class {1}: {2}
  -ClassFabImpl.unable-to-add-constructor=Unable to add constructor to class {0}: {1}
   
  -MethodFabImpl.unable-to-add-catch=Unable to add catch block for exception {0} to class
{1}: {2}
  +
   
   # schema.rules package
   
  @@ -177,34 +167,14 @@
   
   # service.impl package
   
  -service.unable-to-initialize-service=Unable to initialize service {0} (by invoking method
{1} on {2}, at {3}): {4}
   
   BaseEJBProxy.result-not-usable=Remote stub {0} from home interface ''{1}'' ({2}) does not
implement the EJB remote interface {3}.
   
  -EventLinkImpl.unable-to-introspect-class=Unable to introspect {0} (at {1}): {2}
  -EventLinkImpl.not-compatible-with-event={0} (at {1}) does not implement the {2} listener
interface (for event set ''{3}'' of {4}).
  -EventLinkImpl.no-matches={0} (at {1}) does not implement any listener interfaces compatible
with {2}.
  -EventLinkerImpl.no-such-event-set={0} does not implement an event set named ''{1}'' (at
{2}).
   
   # servlet
   
   HiveMindFilter.init=Constructing HiveMind Registry.
   HiveMindFilter.cleanup-error=Unable to cleanup current thread: {0}
  -
  -# util package
  -
  -PropertyAdaptor.no-writer=Property {0} of object {1} is read-only (at {2}).
  -PropertyAdaptor.write-failure=Unable to update property {0} of object {1} (at {2}): {3}
  -PropertyAdaptor.no-reader=Property {0} of object {1} is write-only (at {2}).
  -PropertyAdaptor.read-failure=Unable to read property {0} of object {1} (at {2}): {3}
  -
  -ClassAdaptor.no-such-property=Class {0} does not contain a property named ''{1}'' (at {2}).
  -
  -PropertyUtils.null-object=Attempt to read or update properties of null (at {0}).
  -PropertyUtils.unable-to-introspect=Unable to introspect properties of class {0} (at {1}):
{2}
  -
  -ConstructorUtils.no-matching-constructor=Unable to find a constructor for class {0}.
  -ConstructorUtils.invoke-failed=Failure invoking constructor for class {0} (at {1}): {2}
   
   # order package
   
  
  
  
  1.15      +15 -7     jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java
  
  Index: TestServices.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestServices.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- TestServices.java	18 May 2004 15:34:01 -0000	1.14
  +++ TestServices.java	10 Jun 2004 13:29:30 -0000	1.15
  @@ -279,7 +279,7 @@
       {
           RegistryInfrastructure r = buildFrameworkRegistry("BuilderAccessFailure.xml");
   
  -        interceptLogging("hivemind.test.services.BuilderAccessFailure");
  +        // interceptLogging("hivemind.test.services.BuilderAccessFailure");
   
           BuilderAccess s =
               (BuilderAccess) r.getService(
  @@ -291,11 +291,19 @@
           // s is a proxy, invoke a service method to force the creation of the
           // service (and the error).
   
  -        s.getExtensionPointId();
  -
  -        assertLoggedMessagePattern(
  -            "Class hivemind\\.test\\.services\\.impl\\.BuilderAccessImpl "
  -                + "does not contain a property named 'EVIL' \\(at .*\\)\\.");
  +        try
  +        {
  +            s.getExtensionPointId();
  +            unreachable();
  +        }
  +        catch (ApplicationRuntimeException ex)
  +        {
  +            assertExceptionRegexp(
  +                ex,
  +                "Unable to construct service hivemind\\.test\\.services\\.BuilderAccessFailure:
"
  +                    + "Class hivemind\\.test\\.services\\.impl\\.BuilderAccessImpl "
  +                    + "does not contain a property named 'EVIL' \\(at .*?\\)\\.");
  +        }
       }
   
       public void testConstructorFactory() throws Exception
  
  
  
  1.5       +34 -5     jakarta-hivemind/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java
  
  Index: HiveMindTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- HiveMindTestCase.java	5 Jun 2004 19:09:13 -0000	1.4
  +++ HiveMindTestCase.java	10 Jun 2004 13:29:30 -0000	1.5
  @@ -167,6 +167,30 @@
       }
   
       /**
  +     * Checks that the message for an exception matches a regular expression.
  +     */
  +
  +    protected void assertExceptionRegexp(Throwable ex, String pattern) throws Exception
  +    {
  +        String message = ex.getMessage();
  +        assertNotNull(message);
  +
  +        setupMatcher();
  +
  +        Pattern compiled = _compiler.compile(pattern);
  +
  +        if (_matcher.contains(message, compiled))
  +            return;
  +
  +        throw new AssertionFailedError(
  +            "Exception message ("
  +                + message
  +                + ") does not contain regular expression ["
  +                + pattern
  +                + "].");
  +    }
  +
  +    /**
        * Digs down through (potentially) a stack of ApplicationRuntimeExceptions until it
        * reaches the originating exception, which is returned.
        */
  @@ -247,14 +271,10 @@
   
       protected void assertLoggedMessagePattern(String pattern, List events) throws Exception
       {
  -        if (_compiler == null)
  -            _compiler = new Perl5Compiler();
  +        setupMatcher();
   
           Pattern compiled = null;
   
  -        if (_matcher == null)
  -            _matcher = new Perl5Matcher();
  -
           int count = events.size();
   
           for (int i = 0; i < count; i++)
  @@ -272,6 +292,15 @@
           }
   
           throw new AssertionFailedError("Could not find logging event: " + pattern);
  +    }
  +
  +    private void setupMatcher()
  +    {
  +        if (_compiler == null)
  +            _compiler = new Perl5Compiler();
  +
  +        if (_matcher == null)
  +            _matcher = new Perl5Matcher();
       }
   
       /**
  
  
  
  1.3       +48 -40    jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/ServiceMessages.java
  
  Index: ServiceMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/ServiceMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServiceMessages.java	6 Jun 2004 00:29:25 -0000	1.2
  +++ ServiceMessages.java	10 Jun 2004 13:29:30 -0000	1.3
  @@ -19,9 +19,12 @@
   import javassist.CtClass;
   import javassist.CtMethod;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.HiveMind;
   import org.apache.hivemind.InterceptorStack;
   import org.apache.hivemind.Location;
  +import org.apache.hivemind.impl.MessageFormatter;
   
   /**
    * Messages for the service.impl package.
  @@ -30,6 +33,10 @@
    */
   final class ServiceMessages
   {
  +    private static final Log LOG = LogFactory.getLog(ServiceMessages.class);
  +
  +    private static final MessageFormatter _formatter =
  +        new MessageFormatter(LOG, ServiceMessages.class, "ServiceStrings");
   
       public static String unableToInitializeService(
           String serviceId,
  @@ -38,14 +45,14 @@
           Location location,
           Throwable ex)
       {
  -        return HiveMind.format(
  -            "service.unable-to-initialize-service",
  +        return _formatter.format(
  +            "unable-to-initialize-service",
               new Object[] {
                   serviceId,
                   methodName,
                   serviceClass.getName(),
                   location,
  -                ex.getMessage()});
  +                _formatter.extractMessage(ex)});
       }
   
       public static String errorInstantiatingInterceptor(
  @@ -54,71 +61,67 @@
           Class interceptorClass,
           Throwable cause)
       {
  -        return HiveMind.format(
  -            "AbstractServiceExtensionPoint.error-instantiating-interceptor",
  +        return _formatter.format(
  +            "error-instantiating-interceptor",
               new Object[] {
                   serviceId,
                   stack.getServiceInterface().getName(),
                   stack.getServiceExtensionPointId(),
                   interceptorClass.getName(),
  -                cause.getMessage()});
  +                _formatter.extractMessage(cause)});
       }
   
       public static String unableToAddField(String fieldName, CtClass ctClass, Throwable
cause)
       {
  -        return HiveMind.format(
  -            "ClassFabImpl.unable-to-add-field",
  +        return _formatter.format(
  +            "unable-to-add-field",
               fieldName,
               ctClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToAddMethod(String methodName, CtClass ctClass, Throwable
cause)
       {
  -        return HiveMind.format(
  -            "ClassFabImpl.unable-to-add-method",
  +        return _formatter.format(
  +            "unable-to-add-method",
               methodName,
               ctClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToAddConstructor(CtClass ctClass, Throwable cause)
       {
  -        return HiveMind.format(
  -            "ClassFabImpl.unable-to-add-constructor",
  +        return _formatter.format(
  +            "unable-to-add-constructor",
               ctClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToWriteClass(CtClass ctClass, Throwable cause)
       {
  -        return HiveMind.format(
  -            "ClassFabImpl.unable-to-write-class",
  +        return _formatter.format(
  +            "unable-to-write-class",
               ctClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToCreateClass(String name, Class superClass, Throwable cause)
       {
  -        return HiveMind.format(
  -            "ClassFactoryImpl.unable-to-create-class",
  +        return _formatter.format(
  +            "unable-to-create-class",
               name,
               superClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToLookupClass(String name, Throwable cause)
       {
  -        return HiveMind.format("ClassFactoryImpl.unable-to-lookup", name, cause.getMessage());
  +        return _formatter.format("unable-to-lookup", name, _formatter.extractMessage(cause));
       }
   
       public static String duplicateSymbol(String symbol, Location location, Location priorLocation)
       {
  -        return HiveMind.format(
  -            "DefaultsSymbolSource.duplicate-symbol",
  -            symbol,
  -            location,
  -            priorLocation);
  +        return _formatter.format("duplicate-symbol", symbol, location, priorLocation);
       }
   
       public static String notCompatibleWithEvent(
  @@ -127,8 +130,8 @@
           EventSetDescriptor set,
           Object producer)
       {
  -        return HiveMind.format(
  -            "EventLinkImpl.not-compatible-with-event",
  +        return _formatter.format(
  +            "not-compatible-with-event",
               new Object[] {
                   consumer,
                   location,
  @@ -139,12 +142,12 @@
   
       public static String noSuchEventSet(Object producer, String name, Location location)
       {
  -        return HiveMind.format("EventLinkerImpl.no-such-event-set", producer, name, location);
  +        return _formatter.format("no-such-event-set", producer, name, location);
       }
   
       public static String noEventMatches(Object consumer, Location location, Object producer)
       {
  -        return HiveMind.format("EventLinkImpl.no-matches", consumer, location, producer);
  +        return _formatter.format("no-event-matches", consumer, location, producer);
       }
   
       public static String unableToAddListener(
  @@ -154,25 +157,30 @@
           Location location,
           Throwable cause)
       {
  -        return HiveMind.format(
  -            "EventLinkerImpl.unable-to-add-listener",
  -            new Object[] { producer, set.getName(), consumer, location, cause.getMessage()});
  +        return _formatter.format(
  +            "unable-to-add-listener",
  +            new Object[] {
  +                consumer,
  +                producer,
  +                set.getName(),
  +                location,
  +                _formatter.extractMessage(cause)});
       }
   
       public static String unableToIntrospectClass(Class targetClass, Throwable cause)
       {
  -        return HiveMind.format(
  -            "EventLinkImpl.unable-to-introspect-class",
  +        return _formatter.format(
  +            "unable-to-introspect-class",
               targetClass.getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String unableToAddCatch(Class exceptionClass, CtMethod method, Throwable
cause)
       {
  -        return HiveMind.format(
  -            "MethodFabImpl.unable-to-add-catch",
  +        return _formatter.format(
  +            "unable-to-add-catch",
               exceptionClass.getName(),
               method.getDeclaringClass().getName(),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   }
  
  
  
  1.7       +6 -11     jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java
  
  Index: BuilderFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BuilderFactory.java	5 Jun 2004 19:09:13 -0000	1.6
  +++ BuilderFactory.java	10 Jun 2004 13:29:30 -0000	1.7
  @@ -111,20 +111,15 @@
               if (propertyName == null)
                   continue;
   
  -            try
  -            {
  -                Class targetType = PropertyUtils.getPropertyType(target, propertyName,
facet);
  +            Class targetType = PropertyUtils.getPropertyType(target, propertyName, facet);
   
  -                Object value = facet.getFacetValue(serviceId, invokingModule, targetType);
  +            Object value = facet.getFacetValue(serviceId, invokingModule, targetType);
   
  -                HiveMind.setLocation(value, HiveMind.getLocation(facet));
  +            HiveMind.setLocation(value, HiveMind.getLocation(facet));
   
  -                PropertyUtils.write(target, propertyName, value, facet);
  -            }
  -            catch (Exception ex)
  -            {
  -                log.error(ex.getMessage());
  -            }
  +			// Allow exceptions when setting properties to propogate up
  +			
  +            PropertyUtils.write(target, propertyName, value, facet);
           }
       }
   
  
  
  
  1.1                  jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/ServiceStrings.properties
  
  Index: ServiceStrings.properties
  ===================================================================
  #
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  unable-to-initialize-service=Unable to initialize service {0} (by invoking method {1} on
{2}, at {3}): {4}
  error-instantiating-interceptor=Service interceptor factory {0} failed to create {1} interceptor
for service {2} as class {3}: {4}
  unable-to-add-field=Unable to add field {0} to class {1}: {2}
  unable-to-add-method=Unable to add method {0} to class {1}: {2}
  unable-to-add-constructor=Unable to add constructor to class {0}: {1}
  unable-to-write-class=Unable to create class {0}: {1}
  unable-to-create-class=Unable to create class {0} as subclass of {1}: {2}
  unable-to-lookup=Unable to lookup {0}: {1}
  unable-to-add-catch=Unable to add catch block for exception {0} to class {1}: {2}
  duplicate-symbol=Default for symbol ''{0}'' (at {1}) duplicates prior value (at {2}) and
has been ignored.
  not-compatible-with-event={0} (at {1}) does not implement the {2} listener interface (for
event set ''{3}'' of {4}).
  no-such-event-set={0} does not implement an event set named ''{1}'' (at {2}).
  no-event-matches={0} (at {1}) does not implement any listener interfaces compatible with
{2}.
  unable-to-introspect-class=Unable to introspect {0}: {1}
  unable-to-add-listener=Unable to add {0} as listener of {1} (event set {2}, at {3}): {4}
  
  
  
  
  1.2       +29 -21    jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilMessages.java
  
  Index: UtilMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilMessages.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UtilMessages.java	5 Jun 2004 19:09:12 -0000	1.1
  +++ UtilMessages.java	10 Jun 2004 13:29:30 -0000	1.2
  @@ -16,7 +16,10 @@
   
   import java.lang.reflect.Constructor;
   
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.hivemind.HiveMind;
  +import org.apache.hivemind.impl.MessageFormatter;
   
   /**
    * Messages for the util package.
  @@ -25,10 +28,15 @@
    */
   final class UtilMessages
   {
  +    private static final Log LOG = LogFactory.getLog(UtilMessages.class);
  +
  +    private static final MessageFormatter _formatter =
  +        new MessageFormatter(LOG, UtilMessages.class, "UtilStrings");
  +
       public static String noSuchProperty(Object target, String propertyName, Object location)
       {
  -        return HiveMind.format(
  -            "ClassAdaptor.no-such-property",
  +        return _formatter.format(
  +            "no-such-property",
               target.getClass().getName(),
               propertyName,
               HiveMind.getLocationString(location));
  @@ -36,25 +44,25 @@
   
       public static String noMatchingConstructor(Class targetClass, Object location)
       {
  -        return HiveMind.format(
  -            "ConstructorUtils.no-matching-constructor",
  +        return _formatter.format(
  +            "no-matching-constructor",
               targetClass.getName(),
               HiveMind.getLocationString(location));
       }
   
       public static String invokeFailed(Constructor constructor, Object location, Throwable
cause)
       {
  -        return HiveMind.format(
  -            "ConstructorUtils.invoke-failed",
  +        return _formatter.format(
  +            "invoke-failed",
               constructor.getDeclaringClass().getName(),
               HiveMind.getLocationString(location),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   
       public static String noPropertyWriter(String propertyName, Object target, Object location)
       {
  -        return HiveMind.format(
  -            "PropertyAdaptor.no-writer",
  +        return _formatter.format(
  +            "no-writer",
               propertyName,
               target,
               HiveMind.getLocationString(location));
  @@ -66,19 +74,19 @@
           Object location,
           Throwable cause)
       {
  -        return HiveMind.format(
  -            "PropertyAdaptor.write-failure",
  +        return _formatter.format(
  +            "write-failure",
               new Object[] {
                   propertyName,
                   target,
                   HiveMind.getLocationString(location),
  -                cause.getMessage()});
  +                _formatter.extractMessage(cause)});
       }
   
       public static String noReader(String propertyName, Object target, Object location)
       {
  -        return HiveMind.format(
  -            "PropertyAdaptor.no-reader",
  +        return _formatter.format(
  +            "no-reader",
               propertyName,
               target,
               HiveMind.getLocationString(location));
  @@ -90,26 +98,26 @@
           Object location,
           Throwable cause)
       {
  -        return HiveMind.format(
  -            "PropertyAdaptor.read-failure",
  +        return _formatter.format(
  +            "read-failure",
               new Object[] {
                   propertyName,
                   target,
                   HiveMind.getLocationString(location),
  -                cause.getMessage()});
  +                _formatter.extractMessage(cause)});
       }
   
       public static String nullObject(Object location)
       {
  -        return HiveMind.format("PropertyUtils.null-object", HiveMind.getLocationString(location));
  +        return _formatter.format("null-object", HiveMind.getLocationString(location));
       }
   
       public static String unableToIntrospect(Class targetClass, Object location, Throwable
cause)
       {
  -        return HiveMind.format(
  -            "PropertyUtils.unable-to-introspect",
  +        return _formatter.format(
  +            "unable-to-introspect",
               targetClass.getName(),
               HiveMind.getLocationString(location),
  -            cause.getMessage());
  +            _formatter.extractMessage(cause));
       }
   }
  
  
  
  1.1                  jakarta-hivemind/framework/src/java/org/apache/hivemind/util/UtilStrings.properties
  
  Index: UtilStrings.properties
  ===================================================================
  #
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  no-such-property=Class {0} does not contain a property named ''{1}'' (at {2}).
  no-matching-constructor=Unable to find a constructor for class {0}.
  invoke-failed=Failure invoking constructor for class {0} (at {1}): {2}
  no-writer=Property {0} of object {1} is read-only (at {2}).
  write-failure=Unable to update property {0} of object {1} (at {2}): {3}
  no-reader=Property {0} of object {1} is write-only (at {2}).
  read-failure=Unable to read property {0} of object {1} (at {2}): {3}
  null-object=Attempt to read or update properties of null (at {0}).
  unable-to-introspect=Unable to introspect properties of class {0} (at {1}): {2}
  
  
  
  1.2       +3 -3      jakarta-hivemind/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java
  
  Index: TestPropertyUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/util/TestPropertyUtils.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPropertyUtils.java	9 Jun 2004 14:55:32 -0000	1.1
  +++ TestPropertyUtils.java	10 Jun 2004 13:29:30 -0000	1.2
  @@ -230,7 +230,7 @@
           {
               assertEquals(
                   "Unable to read property failure of object PropertyUtilsExceptionBean "
  -                    + "(at classpath:/foo/bar, line 17): null",
  +                    + "(at classpath:/foo/bar, line 17): java.lang.reflect.InvocationTargetException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
               assertEquals(l, ex.getLocation());
  @@ -251,7 +251,7 @@
           {
               assertEquals(
                   "Unable to update property failure of object PropertyUtilsExceptionBean
"
  -                    + "(at classpath:/foo/bar, line 17): null",
  +                    + "(at classpath:/foo/bar, line 17): java.lang.reflect.InvocationTargetException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
               assertEquals(l, ex.getLocation());
  @@ -273,7 +273,7 @@
               assertEquals(
                   "Unable to introspect properties of class "
                       + "org.apache.hivemind.util.TestPropertyUtils$UglyBean "
  -                    + "(at classpath:/foo/bar, line 212): null",
  +                    + "(at classpath:/foo/bar, line 212): java.lang.NullPointerException",
                   ex.getMessage());
               assertEquals(b, ex.getComponent());
               assertEquals(l, ex.getLocation());
  
  
  
  1.2       +13 -0     jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/MessageFormatter.java
  
  Index: MessageFormatter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/MessageFormatter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MessageFormatter.java	9 Jun 2004 14:52:44 -0000	1.1
  +++ MessageFormatter.java	10 Jun 2004 13:29:30 -0000	1.2
  @@ -94,4 +94,17 @@
           }
       }
   
  +    public String extractMessage(Throwable t)
  +    {
  +        if (t == null)
  +            return null;
  +
  +        String message = t.getMessage();
  +
  +        if (message == null)
  +            return t.getClass().getName();
  +
  +        return message;
  +    }
  +
   }
  
  
  

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


Mime
View raw message