ResFileDecoder: moved exception catching to outer decode() method, so it can handle decoders exceptions.

This commit is contained in:
Ryszard Wiśniewski 2010-08-27 21:04:36 +02:00
parent 28186f8d22
commit 604b15c1cc

View File

@ -54,6 +54,7 @@ public class ResFileDecoder {
outFileName = outResName + ext;
}
try {
if (typeName.equals("raw")) {
decode(inDir, inFileName, outDir, outFileName, "raw");
return;
@ -71,6 +72,11 @@ public class ResFileDecoder {
}
decode(inDir, inFileName, outDir, outFileName, "xml");
} catch (AndrolibException ex) {
LOGGER.log(Level.SEVERE, String.format(
"Could not decode file \"%s\" to \"%s\"",
inFileName, outFileName), ex);
}
}
public void decode(Directory inDir, String inFileName, Directory outDir,
@ -81,18 +87,10 @@ public class ResFileDecoder {
mDecoders.decode(in, out, decoder);
in.close();
out.close();
} catch (AndrolibException ex) {
LOGGER.log(Level.SEVERE, String.format(
"Could not decode file \"%s\" to \"%s\"",
inFileName, outFileName), ex);
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, String.format(
"Could not decode file \"%s\" to \"%s\"",
inFileName, outFileName), ex);
throw new AndrolibException(ex);
} catch (DirectoryException ex) {
LOGGER.log(Level.SEVERE, String.format(
"Could not decode file \"%s\" to \"%s\"",
inFileName, outFileName), ex);
throw new AndrolibException(ex);
}
}