Forum Discussion
nicorette
13 years agoOccasional Contributor
I have googled your source-code and find the following:
source: http://www.soapui.org/xref/com/eviware/ ... oject.html
The close-calls sould be moved into a finally-block because if there are any exceptions before the files will be never closed. However, i don't know whether this change could fix the described issue.
You can see also that exception-handling is missing.
source: http://www.soapui.org/xref/com/eviware/ ... oject.html
private static void normalizeLineBreak( File target, File tmpFile )
{
try
{
FileReader fr = new FileReader( tmpFile );
BufferedReader in = new BufferedReader( fr );
FileWriter fw = new FileWriter( target );
BufferedWriter out = new BufferedWriter( fw );
String line = "";
while( ( line = in.readLine() ) != null )
{
out.write( line );
out.newLine();
out.flush();
}
out.close();
fw.close();
in.close();
fr.close();
}
catch( FileNotFoundException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch( IOException e )
{
// TODO Auto-generated catch block
e.printStackTrace();
}
if( !tmpFile.delete() )
{
SoapUI.getErrorLog().warn( "Failed to delete temporary file: " + tmpFile.getAbsolutePath() );
tmpFile.deleteOnExit();
}
}
The close-calls sould be moved into a finally-block because if there are any exceptions before the files will be never closed. However, i don't know whether this change could fix the described issue.
You can see also that exception-handling is missing.
Related Content
- 4 years ago
- 8 years ago
- 8 years ago
- 10 months ago
- 13 years ago
Recent Discussions
- 24 days ago