jon 01/07/20 14:27:52
Modified: src/java/org/apache/turbine/services/db/util IDBroker.java
LargeSelect.java
Log:
added a nullpointer check to IDBroker
added patch by Scott Dietrich <[EMAIL PROTECTED]> to LargeSelect that
fixes some issues he was having with getting it to work properly
Revision Changes Path
1.9 +7 -2
jakarta-turbine/src/java/org/apache/turbine/services/db/util/IDBroker.java
Index: IDBroker.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/db/util/IDBroker.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- IDBroker.java 2001/07/17 23:01:02 1.8
+++ IDBroker.java 2001/07/20 21:27:52 1.9
@@ -114,7 +114,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
- * @version $Id: IDBroker.java,v 1.8 2001/07/17 23:01:02 jvanzyl Exp $
+ * @version $Id: IDBroker.java,v 1.9 2001/07/20 21:27:52 jon Exp $
*/
public class IDBroker
implements Runnable, IdGenerator
@@ -371,6 +371,11 @@
int numOfIdsToReturn)
throws Exception
{
+ if (tableName == null)
+ {
+ throw new Exception ("getNextIds(): tableName == null");
+ }
+
// A note about the synchronization: I (jmcnally) looked at
// the synchronized blocks to avoid thread issues that were
// being used in this and the storeId method. I do not think
@@ -397,7 +402,7 @@
availableIds = (List)ids.get(tableName);
}
- int size = availableIds.size()<numOfIdsToReturn ?
+ int size = availableIds.size() < numOfIdsToReturn ?
availableIds.size() : numOfIdsToReturn;
BigDecimal[] results = new BigDecimal[size];
1.4 +6 -2
jakarta-turbine/src/java/org/apache/turbine/services/db/util/LargeSelect.java
Index: LargeSelect.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/services/db/util/LargeSelect.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LargeSelect.java 2001/07/17 20:36:05 1.3
+++ LargeSelect.java 2001/07/20 21:27:52 1.4
@@ -78,8 +78,8 @@
* As the author has had no need for such a class, it remains
* untested and in all likelihood contains several bugs.
*
- * @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
- * @version $Id: LargeSelect.java,v 1.3 2001/07/17 20:36:05 jmcnally Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
+ * @version $Id: LargeSelect.java,v 1.4 2001/07/20 21:27:52 jon Exp $
*/
public class LargeSelect
implements Runnable
@@ -203,6 +203,7 @@
{
this.memoryLimit = memoryLimit;
this.name = name;
+ results = new Vector();
query = BasePeer.createQueryString(criteria);
dbName = criteria.getDbName();
blockEnd = blockBegin + memoryLimit - 1;
@@ -353,6 +354,7 @@
results.addElement( tempResults.elementAt(i) );
}
currentlyFilledTo += miniblock;
+ qds.clearRecords();
}
}
catch (Exception e)
@@ -365,7 +367,9 @@
try
{
if (qds != null)
+ {
qds.close();
+ }
TurbineDB.releaseConnection(db);
}
catch(Exception e)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]