From batik-commits-return-1103epatrick@example.org Mon Jul 13 10:27:58 2009
Return-Path: <batik-commits-return-1103epatrick@example.org>
Delivered-To: epatrick@example.org
Received: (qmail 8955 invoked from network); 13 Jul 2009 10:27:58 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 13 Jul 2009 10:27:58 -0000
Received: (qmail 54286 invoked by uid 500); 13 Jul 2009 10:28:08 -0000
Delivered-To: epatrick@example.org
Received: (qmail 54241 invoked by uid 500); 13 Jul 2009 10:28:07 -0000
Mailing-List: contact epatrick@example.org; run by ezmlm
Precedence: bulk
List-Help: <mailto:epatrick@example.org>
List-Unsubscribe: <mailto:epatrick@example.org>
List-Post: <mailto:epatrick@example.org>
List-Id: <batik-commits.xmlgraphics.apache.org>
Reply-To: epatrick@example.org
Delivered-To: mailing list epatrick@example.org
Received: (qmail 54232 invoked by uid 99); 13 Jul 2009 10:28:07 -0000
Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 10:28:07 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 10:28:05 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 7A0AD2388893; Mon, 13 Jul 2009 10:27:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r793536 - in /xmlgraphics/batik/trunk/sources/org/apache/batik:
 bridge/SVGImageElementBridge.java dom/svg/AbstractElement.java
 dom/svg/SVGOMElement.java ext/awt/image/codec/jpeg/JPEGRegistryEntry.java
 ext/awt/image/codec/png/PNGRed.java
Date: Mon, 13 Jul 2009 10:27:45 -0000
To: epatrick@example.org
From: epatrick@example.org
X-Mailer: svnmailer-1.0.8
Message-Id: <epatrick@example.org>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: deweese
Date: Mon Jul 13 10:27:44 2009
New Revision: 793536

URL: http://svn.apache.org/viewvc?rev=793536&view=rev
Log:
1) Now closes streams when it is done reading the image.
2) Fixed Duplicate 'id' problem for version="1.2" documents.

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractElement.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMElement.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/jpeg/JPEGRegistryEntry.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java?rev=793536&r1=793535&r2=793536&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java Mon Jul 13 10:27:44 2009
@@ -258,6 +258,11 @@
             Filter img = reg.readURL(reference, purl, colorspace,
                                      false, false);
             if (img != null) {
+                try {
+                    reference.tie();
+                } catch (IOException ioe) {
+                    // This would be from a close,  Let it slide...
+                }
                 // It's a bouncing baby Raster...
                 return createRasterImageNode(ctx, e, img, purl);
             }
@@ -284,21 +289,26 @@
              * Next see if it's an XML document.
              */
             Document doc = loader.loadDocument(purl.toString(), reference);
+            reference.release();
             imgDocument = (SVGDocument)doc;
             return createSVGImageNode(ctx, e, imgDocument);
         } catch (BridgeException ex) {
+            reference.release();
             throw ex;
         } catch (SecurityException secEx ) {
+            reference.release();
             throw new BridgeException(ctx, e, secEx, ERR_URI_UNSECURE,
                                       new Object[] {purl});
         } catch (InterruptedIOException iioe) {
+            reference.release();
             if (HaltingThread.hasBeenHalted())
                 throw new InterruptedBridgeException();
 
         } catch (InterruptedBridgeException ibe) {
+            reference.release();
             throw ibe;
         } catch (Exception ex) {
-            /* Nothing to do */
+            /* Do nothing drop out... */
             // ex.printStackTrace();
         }
 
@@ -352,21 +362,46 @@
             throw new IOException("Reset unsupported");
         }
 
-        public void retry() throws IOException {
+        public synchronized void retry() throws IOException {
             super.reset();
+            wasClosed = false;
+            isTied = false;
         }
 
-        public void close() throws IOException {
-            /* do nothing */
+        public synchronized void close() throws IOException {
+            wasClosed = true;
+            if (isTied) {
+                super.close();
+                // System.err.println("Closing stream - from close");
+            }
         }
 
+        /**
+         * Let stream know that it is perminately tied to one
+         * image decoder.  This means that it can allow that
+         * decoder to close the stream.
+         */
+        public synchronized void tie() throws IOException {
+            isTied = true;
+            if (wasClosed) {
+                super.close();
+                // System.err.println("Closing stream - from tie");
+            }
+        }
+
+        /**
+         * Close the stream.
+         */
         public void release() {
             try {
                 super.close();
+                // System.err.println("Closing stream - from release");
             } catch (IOException ioe) {
                 // Like Duh! what would you do close it again?
             }
         }
+        boolean wasClosed = false;
+        boolean isTied = false;
     }
 
     protected ProtectedStream openStream(Element e, ParsedURL purl)

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractElement.java?rev=793536&r1=793535&r2=793536&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/AbstractElement.java Mon Jul 13 10:27:44 2009
@@ -125,7 +125,7 @@
                 Attr a =
                     getAttributeNodeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE);
                 if (a == null) {
-                    setAttributeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE, newv);
+                    setAttributeNS(XML_NAMESPACE_URI, XML_ID_QNAME, newv);
                 } else if (!a.getNodeValue().equals(newv)) {
                     a.setNodeValue(newv);
                 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMElement.java?rev=793536&r1=793535&r2=793536&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMElement.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/dom/svg/SVGOMElement.java Mon Jul 13 10:27:44 2009
@@ -157,7 +157,7 @@
      */
     public void setId(String id) {
         if (((SVGOMDocument) ownerDocument).isSVG12) {
-            setAttributeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE, id);
+            setAttributeNS(XML_NAMESPACE_URI, XML_ID_QNAME, id);
             Attr a = getAttributeNodeNS(null, SVG_ID_ATTRIBUTE);
             if (a != null) {
                 a.setNodeValue(id);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/jpeg/JPEGRegistryEntry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/jpeg/JPEGRegistryEntry.java?rev=793536&r1=793535&r2=793536&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/jpeg/JPEGRegistryEntry.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/jpeg/JPEGRegistryEntry.java Mon Jul 13 10:27:44 2009
@@ -101,6 +101,9 @@
                                 throw new IOException
                                     ("JPEG File was truncated");
                         }
+                        decoder = null;
+                        is.close();
+
                         dr.setBounds(new Rectangle2D.Double
                                      (0, 0, image.getWidth(),
                                       image.getHeight()));

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java?rev=793536&r1=793535&r2=793536&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGRed.java Mon Jul 13 10:27:44 2009
@@ -479,6 +479,8 @@
                 properties.put("significant_bits", significantBits);
             }
         }
+        distream.close();
+        stream.close();
     }
 
     private static String getChunkType(DataInputStream distream) {
@@ -783,6 +785,13 @@
         }
 
         decodeImage(interlaceMethod == 1);
+
+        // Free resources associated with compressed data.
+        dataStream.close();
+        infStream.close();
+        seqStream.close();
+        streamVec = null;
+
         SampleModel sm = theTile.getSampleModel();
         ColorModel  cm;
 



From batik-commits-return-1104epatrick@example.org Wed Jul 22 01:07:24 2009
Return-Path: <batik-commits-return-1104epatrick@example.org>
Delivered-To: epatrick@example.org
Received: (qmail 6728 invoked from network); 22 Jul 2009 01:07:24 -0000
Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155)
  by minotaur.apache.org with SMTP; 22 Jul 2009 01:07:24 -0000
Received: (qmail 8090 invoked by uid 500); 22 Jul 2009 01:08:29 -0000
Delivered-To: epatrick@example.org
Received: (qmail 8048 invoked by uid 500); 22 Jul 2009 01:08:29 -0000
Mailing-List: contact epatrick@example.org; run by ezmlm
Precedence: bulk
List-Help: <mailto:epatrick@example.org>
List-Unsubscribe: <mailto:epatrick@example.org>
List-Post: <mailto:epatrick@example.org>
List-Id: <batik-commits.xmlgraphics.apache.org>
Reply-To: epatrick@example.org
Delivered-To: mailing list epatrick@example.org
Received: (qmail 8039 invoked by uid 99); 22 Jul 2009 01:08:29 -0000
Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2009 01:08:29 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=10.0
	tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155)
    by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2009 01:08:26 +0000
Received: by eris.apache.org (Postfix, from userid 65534)
	id 6A01123888FE; Wed, 22 Jul 2009 01:08:05 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r796596 -
 /xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
Date: Wed, 22 Jul 2009 01:08:05 -0000
To: epatrick@example.org
From: epatrick@example.org
X-Mailer: svnmailer-1.0.8
Message-Id: <epatrick@example.org>
X-Virus-Checked: Checked by ClamAV on apache.org

Author: deweese
Date: Wed Jul 22 01:08:05 2009
New Revision: 796596

URL: http://svn.apache.org/viewvc?rev=796596&view=rev
Log:
Close DeflaterOutputStream

Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java?rev=796596&r1=796595&r2=796596&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/codec/png/PNGImageEncoder.java Wed Jul 22 01:08:05 2009
@@ -502,7 +502,9 @@
         }
 
         dos.finish();
+        dos.close();
         ios.flush();
+        ios.close();
     }
 
     private void writeIEND() throws IOException {
@@ -782,6 +784,7 @@
                 DeflaterOutputStream dos = new DeflaterOutputStream(cs);
                 dos.write(value);
                 dos.finish();
+                dos.close();
 
                 cs.writeToStream(dataOutput);
                 cs.close();
@@ -1034,5 +1037,6 @@
         writeIEND();
 
         dataOutput.flush();
+        dataOutput.close();
     }
 }




{'source': 'Apache Software Foundation Public Mail Archives'}