[shrinkwrap-issues] [JBoss JIRA] Commented: (SHRINKWRAP-197) export archive to a temporary file name

Dan Allen (JIRA) jira-events at lists.jboss.org
Mon Jun 28 00:16:46 EDT 2010


    [ https://jira.jboss.org/browse/SHRINKWRAP-197?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12537156#action_12537156 ] 

Dan Allen commented on SHRINKWRAP-197:
--------------------------------------

Proposed logic:

/**
 * The prefix assigned to the temporary file where the archive is exported
 */
private static final String EXPORT_FILE_PREFIX = "export";

...

final File exported;
try
{
   // If this method returns successfully then it is guaranteed that:
   // 1. The file denoted by the returned abstract pathname did not exist before this method was invoked, and
   // 2. Neither this method nor any of its variants will return the same abstract pathname again in the current invocation of the virtual machine.
   exported = File.createTempFile(EXPORT_FILE_PREFIX, name, TMP_DIR);
}
catch (IOException e)
{
   throw new RuntimeException("Could not create temporary File in " + TMP_DIR + " to write exported archive", e);
}
// We are overwriting the temporary file placeholder reserved by File#createTemplateFile()
archive.as(ZipExporter.class).exportZip(exported, true);

> export archive to a temporary file name
> ---------------------------------------
>
>                 Key: SHRINKWRAP-197
>                 URL: https://jira.jboss.org/browse/SHRINKWRAP-197
>             Project: ShrinkWrap
>          Issue Type: Bug
>          Components: ext-jetty
>    Affects Versions: 1.0.0-alpha-10
>            Reporter: Dan Allen
>            Assignee: Dan Allen
>             Fix For: 1.0.0-alpha-11
>
>
> The archive is exported to a file with the same name as the archive in the temporary directory. That file is set to be deleted when the JVM exits. However, if there is more than one deployment in the same test suite that uses the same test name (typically test.war), then the second deployment will fail because there is a file in the way.
> The expected behavior is that the archive is exported to a unique temporary file. It shouldn't matter what the name of the file is as its purpose is to pass the archive contents to Jetty to be extracted.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the shrinkwrap-issues mailing list