New issue 41 by firecree...@gmail.com: InputStream, InputStreamReader and
BufferReader are not closed
http://code.google.com/p/daisydiff/issues/detail?id=41
I have a resource locking problem. The Streams that are opened by the Main
Class are not closed by the application.
Line 99 => InputStream oldStream, newStream;
Line 167-169 => BufferedReader and InputStreamReader
Comment #1 on issue 41 by kkape...@gmail.com: InputStream,
InputStreamReader and BufferReader are not closed
http://code.google.com/p/daisydiff/issues/detail?id=41
(No comment was entered for this change.)
Comment #2 on issue 41 by kkape...@gmail.com: InputStream,
InputStreamReader and BufferReader are not closed
http://code.google.com/p/daisydiff/issues/detail?id=41
If the streams are closed properly the issue goes away?
Have you already fixed it yourself? Do you have a patch?
I move the initialization of oldStream and newStream object outside the
try->catch->block
....
String[] css = new String[]{};
InputStream oldStream = null;
InputStream newStream = null;
....
and add a finally block
finally {
try {
if(oldStream != null) oldStream.close();
} catch (IOException e) {
//ignore this exception
}
try {
if(newStream != null) newStream.close();
} catch (IOException e) {
//ignore this exception
}
}
furthermore it would be helpful to rewrite Line 167-169
InputStreamReader oldReader = null;
BufferedReader oldBuffer = null;
InputStreamReader newISReader = null;
BufferedReader newBuffer = null;
try {
oldReader = new InputStreamReader(oldStream);
oldBuffer = new BufferedReader(oldReader);
newISReader = new InputStreamReader(newStream);
newBuffer = new BufferedReader(newISReader);
DaisyDiff.diffTag(oldBuffer, newBuffer, postProcess);
} catch (Exception e) {
System.out.println(e);
} finally {
oldBuffer.close();
newBuffer.close();
oldReader.close();
newISReader.close();
}
Can you perform a diff on your code to create a patch and post it here? I
will apply it to trunk after testing.
A local test shows, that this will prevent a resource blocking problem.
Attachments:
Main.java 10.6 KB
Comment #6 on issue 41 by kkape...@gmail.com: InputStream,
InputStreamReader and BufferReader are not closed
http://code.google.com/p/daisydiff/issues/detail?id=41
Fixed in subversion r175