Heiko,
could you please follow up on this?
cheers
-thomas
-------- Forwarded Message --------
From: Leonardo Penczek <lpenczek(a)gmail.com>
To: thomas.diesler(a)jboss.com
Subject: Big problem with WebXMLRewriterImpl.java rename
Date: Thu, 29 Nov 2007 12:11:25 -0200
In WindowsNT systems, your modification in these lines doesn't work:
FileInputStream stream = new FileInputStream(webXML);
String modifyProperty =
(String)dep.getProperty("org.jboss.ws.webapp.modify");
// JBWS 1762
if ((modifyProperty == null) || (!modifyProperty.equals("false")))
{
String suffix =
(String)dep.getProperty("org.jboss.ws.webapp.descriptor.suffix");
if (suffix == null)
suffix = ".org";
File orgWebXML = new File(webXML.getCanonicalPath() + suffix);
// Rename the web.xml
if (webXML.renameTo(orgWebXML) == false)
throw new WebServiceException("Cannot rename web.xml: "
+ orgWebXML);
stream = new FileInputStream(orgWebXML);
}
As you open a FileInputStream over webXML, it can't be renamed to
orgWebXML because the stream is open in this point, and Windows blocks
te rename operation.
It can be solved as below:
// WindowsNT correction
FileInputStream stream = null;
String modifyProperty =
(String)dep.getProperty("org.jboss.ws.webapp.modify");
// JBWS 1762
if ((modifyProperty == null) || (!modifyProperty.equals("false")))
{
String suffix =
(String)dep.getProperty("org.jboss.ws.webapp.descriptor.suffix");
if (suffix == null)
suffix = ".org";
File orgWebXML = new File(webXML.getCanonicalPath() + suffix);
// Rename the web.xml
if (webXML.renameTo(orgWebXML) == false)
throw new WebServiceException("Cannot rename web.xml: "
+ orgWebXML);
stream = new FileInputStream(orgWebXML);
} else {
stream = new FileInputStream(webXML);
}
Cheers,
Leonardo Penczek
--
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
Web Service Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Show replies by date