tfischer 2005/06/27 13:34:41
Modified: src/generator/src/templates/om Peer.vm
xdocs changes.xml
src/java/org/apache/torque/util BasePeer.java
Log:
If a MapBuilder cannot be instantiated when initializing a Peer class, a
Runtime Exception is now thrown instead of just logging the error
Revision Changes Path
1.16 +1 -0 db-torque/src/generator/src/templates/om/Peer.vm
Index: Peer.vm
===================================================================
RCS file: /home/cvs/db-torque/src/generator/src/templates/om/Peer.vm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Peer.vm 8 May 2005 16:19:31 -0000 1.15
+++ Peer.vm 27 Jun 2005 20:34:41 -0000 1.16
@@ -94,6 +94,7 @@
catch (Exception e)
{
log.error("Could not initialize Peer", e);
+ throw new RuntimeException(e);
}
}
else
1.166 +4 -0 db-torque/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- changes.xml 26 Jun 2005 06:49:59 -0000 1.165
+++ changes.xml 27 Jun 2005 20:34:41 -0000 1.166
@@ -28,6 +28,10 @@
<body>
<release version="3.2-dev" date="in CVS">
+ <action type="fix" dev="tfischer" issue="TRQS304">
+ If a Peer class cannot instantiate its Map Builder, a Runtime
Exception is now
+ thrown (instead of just logging the error).
+ </action>
<action type="add" dev="tfischer">
The database schema.xml is now validated against the DTD. The
generator stops
and displays an error message if the schema.xml does not satisfy the
DTD.
1.82 +5 -7 db-torque/src/java/org/apache/torque/util/BasePeer.java
Index: BasePeer.java
===================================================================
RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/BasePeer.java,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- BasePeer.java 1 Jun 2005 21:05:03 -0000 1.81
+++ BasePeer.java 27 Jun 2005 20:34:41 -0000 1.82
@@ -1338,10 +1338,11 @@
* MapBuilder instances are cached in this class for speed.
*
* @param name name of the MapBuilder
- * @return A MapBuilder, or null (and logs the error) if the
- * MapBuilder was not found.
+ * @return A MapBuilder, not null
+ * @throws TorqueException if the Map Builder cannot be instantiated
*/
public static MapBuilder getMapBuilder(String name)
+ throws TorqueException
{
synchronized (mapBuilders)
{
@@ -1383,13 +1384,10 @@
}
catch (Exception e)
{
- // Have to catch possible exceptions because method is
- // used in initialization of Peers. Log the exception and
- // return null.
log.error("BasePeer.MapBuilder failed trying to instantiate:
"
+ name, e);
+ throw new TorqueException(e);
}
- return null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]