[jbosstools-issues] [JBoss JIRA] (JBIDE-10232) exploded deploy does not work on windows because of use of File#renameTo

Martin Malina (JIRA) jira-events at lists.jboss.org
Mon May 14 07:44:18 EDT 2012


     [ https://issues.jboss.org/browse/JBIDE-10232?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Malina closed JBIDE-10232.
---------------------------------



Verified on Windows XP with jbdevstudio-product-universal-5.0.0.v201205101833M-H138-Beta3.jar
                
> exploded deploy does not work on windows because of use of File#renameTo
> ------------------------------------------------------------------------
>
>                 Key: JBIDE-10232
>                 URL: https://issues.jboss.org/browse/JBIDE-10232
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: JBossAS/Servers
>         Environment: JBossAS Tools:   Version: 2.3.0.v20111104-1515-H45-M4
> Java version: 1.5.0_22, vendor: Sun Microsystems Inc.
> Java home: C:\devtools\java\jdk1.5.0_22\jre
> Default locale: en_CA, platform encoding: Cp1252
> OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"
>            Reporter: Jim Sellers
>            Assignee: Rob Stryker
>             Fix For: 3.3.0.M5
>
>
> Setup: in a project on windows with an ear / war / jar in an exploded format and having started the server in debug mode. If you make any changes to a file in the jar, the jar will be rebuilt and try to be deployed. This seems to work but it pops up an error dialog box *every time*.  The error message looks like the following:
> {code}
> Error renaming C:\devtools\jboss\jboss-4.2.3.GA\server\default\tmp\jbosstoolsTemp\tmp2587902707203199490.jar to C:\devtools\jboss\jboss-4.2.3.GA\server\default\deploy\MyExampleEAR.ear\MyExampleWAR.war\WEB-INF\lib\MyDependantJar-2.3-SNAPSHOT.jar.
> This may be caused by your server's temporary deploy directory being on a different filesystem than the final destination.
> You may adjust these settings in the server editor.
> {code}
> For the method org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil#safeRename(File,File,int) it calls File#renameTo(File) for moving the file from the temp directory to WEB-INF/lib.  From the javadocs for renameTo it says that this might not work if the file in the destination already exists.
> Possible fixes:
> # before calling the rename, try to delete on the destination file ( to.delete() )
> # org.apache.commons.io.FileUtils#moveFile(File,File) tries to call the renameTo and if that fails it falls back to coping the file to the destination.
> {code:JAVA|title=Sample Unit test}
>     /* This test needs to be run on windows. */
>     @Test
>     public void testCopyForWindows() throws IOException {
>         File from = File.createTempFile("source", ".txt");
>         File to = File.createTempFile("target", ".txt");
>         File[] files = {from, to};
>         for (File file : files) {
>             // set for cleanup
>             file.deleteOnExit();
>             assertTrue("file should exist" + file.getAbsolutePath(), file.exists());
>             assertTrue("file should be writable" + file.getAbsolutePath(), file.canWrite());
>         }
>         // if safeRename was not private!
>         assertTrue("should have been able to rename the file", safeRename(from, to, 10));
>     }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list