db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r552325 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
Date Sun, 01 Jul 2007 15:23:54 GMT
Author: kahatlen
Date: Sun Jul  1 08:23:53 2007
New Revision: 552325

URL: http://svn.apache.org/viewvc?view=rev&rev=552325
Log:
DERBY-2885 (cleanup)

Some more cleanup of EmbedConnection.clearLOBMapping():
  1) Store the map in a local variable instead of calling
     getlobHMObj() a number of times.
  2) Replace two disjoint if statements with if/else-if + THROWASSERT
     if none of them matches.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?view=diff&rev=552325&r1=552324&r2=552325
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Sun Jul
 1 08:23:53 2007
@@ -2357,20 +2357,19 @@
 		//free all the lob resources in the HashMap
 		//initialize the locator value to 0 and
 		//the hash table object to null.
-		if (rootConnection.lobHashMap != null) {
-			for (Iterator e = getlobHMObj().values().iterator();
-				e.hasNext() ;) {
-				Object obj = e.next();
-				if (obj instanceof Clob)  {
-					EmbedClob temp = (EmbedClob)obj;
-					temp.free();
-				}
-				if (obj instanceof Blob) {
-					EmbedBlob temp = (EmbedBlob)obj;
-					temp.free();
+		HashMap map = rootConnection.lobHashMap;
+		if (map != null) {
+			for (Iterator it = map.values().iterator(); it.hasNext(); ) {
+				Object obj = it.next();
+				if (obj instanceof EmbedClob) {
+					((EmbedClob) obj).free();
+				} else if (obj instanceof EmbedBlob) {
+					((EmbedBlob) obj).free();
+				} else if (SanityManager.DEBUG) {
+					SanityManager.THROWASSERT("Unexpected value: " + obj);
 				}
 			}
-			getlobHMObj().clear();
+			map.clear();
 		}
 	}
 



Mime
View raw message