commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandy...@apache.org
Subject svn commit: r386281 - in /jakarta/commons/proper/pool/trunk: src/java/org/apache/commons/pool/impl/ xdocs/
Date Thu, 16 Mar 2006 08:03:36 GMT
Author: sandymac
Date: Thu Mar 16 00:03:28 2006
New Revision: 386281

URL: http://svn.apache.org/viewcvs?rev=386281&view=rev
Log:
Where there is no factory calling addObject is bogus so throw an IllegalStateExecption.

Modified:
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
    jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
    jakarta/commons/proper/pool/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=386281&r1=386280&r2=386281&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Thu Mar 16 00:03:28 2006
@@ -1084,6 +1084,9 @@
      */
     public synchronized void addObject() throws Exception {
         assertOpen();
+        if (_factory == null) {
+            throw new IllegalStateException("Cannot add objects without a factory.");
+        }
         Object obj = _factory.makeObject();
         addObjectToPool(obj, false);
     }

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java?rev=386281&r1=386280&r2=386281&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
Thu Mar 16 00:03:28 2006
@@ -175,6 +175,9 @@
      */
     public synchronized void addObject() throws Exception {
         assertOpen();
+        if (_factory == null) {
+            throw new IllegalStateException("Cannot add objects without a factory.");
+        }
         Object obj = _factory.makeObject();
 
         boolean success = true;

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java?rev=386281&r1=386280&r2=386281&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
Thu Mar 16 00:03:28 2006
@@ -276,14 +276,12 @@
             } else {
                 staleObj = obj;
             }
-            if(null != _factory) {
-                try {
-                    _factory.destroyObject(key, staleObj);
-                } catch (Exception e) {
-                    // Don't swallow destroying the newly created object.
-                    if (obj == staleObj) {
-                        throw e;
-                    }
+            try {
+                _factory.destroyObject(key, staleObj);
+            } catch (Exception e) {
+                // Don't swallow destroying the newly created object.
+                if (obj == staleObj) {
+                    throw e;
                 }
             }
         } else {

Modified: jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java?rev=386281&r1=386280&r2=386281&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
(original)
+++ jakarta/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/StackObjectPool.java
Thu Mar 16 00:03:28 2006
@@ -286,12 +286,13 @@
      */
     public synchronized void addObject() throws Exception {
         assertOpen();
+        if (_factory == null) {
+            throw new IllegalStateException("Cannot add objects without a factory.");
+        }
         Object obj = _factory.makeObject();
 
         boolean success = true;
-        if(null != _factory) {
-            _factory.passivateObject(obj);
-        }
+        _factory.passivateObject(obj);
 
         boolean shouldDestroy = !success;
 

Modified: jakarta/commons/proper/pool/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/pool/trunk/xdocs/changes.xml?rev=386281&r1=386280&r2=386281&view=diff
==============================================================================
--- jakarta/commons/proper/pool/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/pool/trunk/xdocs/changes.xml Thu Mar 16 00:03:28 2006
@@ -22,6 +22,9 @@
   <body>
 
     <release version="2.0" date="pending" description="Significant clean ups">
+      <action dev="sandymac" type="update">
+        Where there is no factory calling addObject is bogus so throw an IllegalStateExecption.
+      </action>
       <action dev="sandymac" type="fix">
         Edited all KeyedObjectPool related JavaDocs to have meaningful and correct content.
       </action>



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


Mime
View raw message