hlship 2005/03/14 14:28:48
Modified: . status.xml
framework/src/test/hivemind/test/services
TestBuilderFactory.java
framework/src/java/org/apache/hivemind/service/impl
BuilderFactoryLogic.java
Log:
Have BuilderFactory re-throw exceptions, rather than return null.
Revision Changes Path
1.111 +1 -0 jakarta-hivemind/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/status.xml,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- status.xml 1 Mar 2005 20:40:10 -0000 1.110
+++ status.xml 14 Mar 2005 22:28:48 -0000 1.111
@@ -34,6 +34,7 @@
<action type="fix" dev="JC" fixes-bug="HIVEMIND-96" >Interceptors can
now be ordered by name rather than interceptor factory id.</action>
<action type="fix" dev="JC" fixes-bug="HIVEMIND-45" >Created a
ServiceInterceptorFactory supporting AOP Alliance MethodInterceptors.</action>
<action type="update" dev="HLS"> Upgrade Groovy to 1.0-beta-10.
</action>
+ <action type="update" dev="HLS"> Make BuilderFactory rethrow
construction exceptions, rather than swallow them and return null. </action>
</release>
<release version="1.1-alpha-2" date="Feb 23 2005">
<action type="update" dev="HLS"> Better, prettier HiveDoc. </action>
1.24 +11 -15
jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java
Index: TestBuilderFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- TestBuilderFactory.java 10 Feb 2005 01:04:35 -0000 1.23
+++ TestBuilderFactory.java 14 Mar 2005 22:28:48 -0000 1.24
@@ -537,9 +537,6 @@
MockControl mc = newControl(Module.class);
Module module = (Module) mc.getMock();
- MockControl elc = newControl(ErrorLog.class);
- ErrorLog el = (ErrorLog) elc.getMock();
-
MockControl lc = newControl(Log.class);
Log log = (Log) lc.getMock();
@@ -561,17 +558,6 @@
module.containsService(StringHolder.class);
mc.setReturnValue(false, 2);
- fp.getErrorLog();
- fpc.setReturnValue(el);
-
- el.error(
- "Error building service foo: Unable to find constructor
applicable for autowiring. "
- + "Use explicit constructor parameters.",
- null,
- new ApplicationRuntimeException(""));
- elc.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
- { null, null, new TypeMatcher() }));
-
replayControls();
BuilderParameter parameter = new BuilderParameter();
@@ -579,7 +565,17 @@
parameter.setClassName(ConstructorAutowireTarget.class.getName());
parameter.setAutowireServices(true);
- assertNull(execute(fp, parameter));
+ try
+ {
+ execute(fp, parameter);
+ unreachable();
+ }
+ catch (ApplicationRuntimeException ex)
+ {
+ assertEquals(
+ "Error building service foo: Unable to find constructor
applicable for autowiring. Use explicit constructor parameters.",
+ ex.getMessage());
+ }
verifyControls();
}
1.14 +6 -9
jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java
Index: BuilderFactoryLogic.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderFactoryLogic.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- BuilderFactoryLogic.java 10 Feb 2005 01:04:34 -0000 1.13
+++ BuilderFactoryLogic.java 14 Mar 2005 22:28:48 -0000 1.14
@@ -70,27 +70,24 @@
public Object createService()
{
- Object result = null;
-
try
{
- result = instantiateCoreServiceInstance();
+ Object result = instantiateCoreServiceInstance();
setProperties(result);
registerForEvents(result);
invokeInitializer(result);
+
+ return result;
}
catch (Exception ex)
{
- error(
- ServiceMessages.failureBuildingService(_serviceId, ex),
- _parameter.getLocation(),
- ex);
+ throw new
ApplicationRuntimeException(ServiceMessages.failureBuildingService(
+ _serviceId,
+ ex), _parameter.getLocation(), ex);
}
-
- return result;
}
private void error(String message, Location location, Throwable cause)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]