Skip to content

Commit

Permalink
Merge pull request #13 from adamwy/master
Browse files Browse the repository at this point in the history
FORGE-1835: BootstrapClassLoader should use temporary dir to unpack furn...
  • Loading branch information
gastaldi committed May 19, 2014
2 parents e5e3fb3 + 39d0dab commit ba34435
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private List<URL> handle(File file)
@SuppressWarnings("deprecation")
private List<URL> handleZipFile(File file) throws IOException
{
File tempDir = OperatingSystemUtils.createTempDir();
List<URL> result = new ArrayList<URL>();
try
{
Expand All @@ -162,7 +163,7 @@ private List<URL> handleZipFile(File file) throws IOException
file.getAbsolutePath() + "/" + entry.getName(), entry.getSize(),
new Date(entry.getTime())));

result.add(copy(entry.getName(),
result.add(copy(tempDir, entry.getName(),
JarLocator.class.getClassLoader().getResource(name).openStream()
).toURL());
}
Expand All @@ -176,9 +177,10 @@ private List<URL> handleZipFile(File file) throws IOException
return result;
}

private File copy(String name, InputStream input)
private File copy(File targetDir, String name, InputStream input)
{
File outputFile = new File("target", name);
File outputFile = new File(targetDir, name);

outputFile.getParentFile().mkdirs();

FileOutputStream output = null;
Expand Down

0 comments on commit ba34435

Please sign in to comment.