[jboss-user] [JBossWS] - Big problem with WebXMLRewriterImpl.java rename

heiko.braun@jboss.com do-not-reply at jboss.com
Fri Nov 30 05:53:52 EST 2007


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4109230#4109230

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4109230



More information about the jboss-user mailing list