Skip to content

Commit

Permalink
fix up parsing of images from zip template packs. Closes #163
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowmage45 committed Nov 19, 2014
1 parent 893e958 commit 1d1f47e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void loadStructureImage(String imageName, InputStream is)
try
{
MessageDigest md = MessageDigest.getInstance("MD5");
DigestInputStream dis = new DigestInputStream(is, md);
DigestInputStream dis = new DigestInputStream(is, md);//InputStream is closed externally
BufferedImage image = ImageIO.read(is);
if(image!=null && image.getWidth()==AWStructureStatics.structureImageWidth && image.getHeight()==AWStructureStatics.structureImageHeight)
{
Expand All @@ -187,7 +187,7 @@ private void loadStructureImage(String imageName, InputStream is)
{
AWLog.logError("Attempted to load improper sized template image: "+imageName+ " with dimensions of: "+image.getWidth()+"x"+image.getHeight()+". Specified width/height is: "+AWStructureStatics.structureImageWidth+"x"+AWStructureStatics.structureImageHeight);
}
dis.close();
// dis.close();
}
catch (IOException e)
{
Expand Down Expand Up @@ -352,7 +352,16 @@ else if(isProbableImage(currentFile))
{
try
{
loadStructureImage(currentFile.getName(), new FileInputStream(currentFile));
FileInputStream fis = new FileInputStream(currentFile);
loadStructureImage(currentFile.getName(), fis);
try
{
fis.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
catch (FileNotFoundException e)
{
Expand Down
Binary file not shown.

0 comments on commit 1d1f47e

Please sign in to comment.