Author: acumiskey
Date: Tue Jul 22 02:44:49 2008
New Revision: 678694

URL: http://svn.apache.org/viewvc?rev=678694&view=rev
Log:
Added a finalize() just in case a problem occurs during rendering and close() 
never gets called.

Modified:
    
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectCache.java

Modified: 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectCache.java
URL: 
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectCache.java?rev=678694&r1=678693&r2=678694&view=diff
==============================================================================
--- 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectCache.java
 (original)
+++ 
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectCache.java
 Tue Jul 22 02:44:49 2008
@@ -109,17 +109,33 @@
      */
     public void clear() {
         try {
-            raFile.close();
-            tempFile.delete();
+            if (raFile != null) {
+                raFile.close();
+                raFile = null;
+            }
+            if (tempFile != null) {
+                tempFile.delete();
+                tempFile = null;
+            }
         } catch (IOException e) {
-            log.error("Failed to close temporary file: " + e.getMessage());
+            log.error("Failed to close/delete temporary file: " + 
e.getMessage());
         } finally {
             synchronized (cacheMap) {
-                cacheMap.remove(id); // remove ourselves from the cache map
+                // remove ourselves from the cache map
+                cacheMap.remove(id); 
             }
         }
     }
 
+    /** [EMAIL PROTECTED] */
+    public void finalize() throws Throwable {
+        try {
+            clear();
+        } finally {
+            super.finalize();
+        }
+    }
+    
     /**
      * Stores a named data object in the cache
      * 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to