users@glassfish.java.net

Re: Glassfish redeploy fails, fop.jar still loaded

From: <glassfish_at_javadesktop.org>
Date: Mon, 09 Mar 2009 10:55:29 PDT

Thanks for the stack trace.

1. The fragment I pasted below from org.apache.xmlgraphics.util.Service.providers shows that the method fails to close the opened InputStream in either the normal case or in case of an exception. That causes locked JARs on Windows systems.

2. What release of batik are you using?

The org.apache.batik.util.Service.providers method is very similar to the one in xmlgraphics but in the latest tagged rev of the source it has a finally block that should close the opened stream in all cases. Here is the link to the diff when this was changed: http://svn.apache.org/viewvc/xmlgraphics/batik/tags/batik-1_7/sources/org/apache/batik/util/Service.java?r1=475477&r2=522271&diff_format=h

It sounds as if it's time to file a bug against xmlgraphics and to see if there is a later release of batik (in which this problem has been fixed) which you can use.

- Tim


Code fragment from latest tagged rev of org.apache.xmlgraphics.util.Service.providers - view it in its entirety at http://svn.apache.org/viewvc/xmlgraphics/commons/tags/commons-1_3_1/src/java/org/apache/xmlgraphics/util/Service.java?revision=662756&view=markup

        while (e.hasMoreElements()) {
            try {
                URL u = (URL)e.nextElement();

                InputStream is = u.openStream();
                Reader r = new InputStreamReader(is, "UTF-8");
                BufferedReader br = new BufferedReader(r);

...irrelevant code removed...

            } catch (Exception ex) {
                // Just try the next file...
            } catch (LinkageError le) {
                // Just try the next file...
            }
        }
[Message sent by forum member 'tjquinn' (tjquinn)]

http://forums.java.net/jive/thread.jspa?messageID=335900