You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is, my zip file (the Core R4 Profile) contains Json files, and the JsonParser closes the stream after parsing each zip entry, although more entries are available on the zip stream.
Explanation:
This method is looping through the entries in the zip file (which is perfectly fine): SimpleWorkerContext:
The loadDefinitions() calls the JsonParser, which in turn calls this: TextFile:
public static String streamToString(InputStream input) throws IOException {
InputStreamReader sr = new InputStreamReader(input, "UTF-8");
StringBuilder b = new StringBuilder();
//while (sr.ready()) { Commented out by Claude Nanjo (1/14/2014) - sr.ready() always returns false - please remove if change does not impact other areas of codebase
int i = -1;
while((i = sr.read()) > -1) {
char c = (char) i;
b.append(c);
}
sr.close();
return b.toString().replace("\uFEFF", "");
}
This closes the InputStream, which causes the entire zip stream to be closed, causing everything to fail.
Also, reading a file byte for byte seems horribly inefficient!
The text was updated successfully, but these errors were encountered:
I try to create a SimpleWorkerContext given a zip file on the classpath:
This results in a
IOException: Stream closed
.The reason is, my zip file (the Core R4 Profile) contains Json files, and the JsonParser closes the stream after parsing each zip entry, although more entries are available on the zip stream.
Explanation:
This method is looping through the entries in the zip file (which is perfectly fine):
SimpleWorkerContext:
The
loadDefinitions()
calls the JsonParser, which in turn calls this:TextFile:
This closes the InputStream, which causes the entire zip stream to be closed, causing everything to fail.
Also, reading a file byte for byte seems horribly inefficient!
The text was updated successfully, but these errors were encountered: