-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDAP-75 #22
SDAP-75 #22
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,30 +62,28 @@ public Object execute() { | |
e2.printStackTrace(); | ||
} | ||
|
||
FileWriter fw; | ||
try { | ||
fw = new FileWriter(file.getAbsoluteFile()); | ||
try(FileWriter fw = new FileWriter(file.getAbsoluteFile())){ | ||
bw = new BufferedWriter(fw); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
File[] files = new File(this.props.getProperty(MudrodConstants.ONTOLOGY_INPUT_PATH)).listFiles(); | ||
for (File file_in : files) { | ||
String ext = FilenameUtils.getExtension(file_in.getAbsolutePath()); | ||
if ("owl".equals(ext)) { | ||
try { | ||
loadxml(file_in.getAbsolutePath()); | ||
getAllClass(); | ||
} catch (JDOMException e1) { | ||
e1.printStackTrace(); | ||
} catch (IOException e1) { | ||
e1.printStackTrace(); | ||
File[] files = new File(this.props.getProperty(MudrodConstants.ONTOLOGY_INPUT_PATH)).listFiles(); | ||
for (File file_in : files) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
String ext = FilenameUtils.getExtension(file_in.getAbsolutePath()); | ||
if ("owl".equals(ext)) { | ||
try { | ||
loadxml(file_in.getAbsolutePath()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
getAllClass(); | ||
} catch (JDOMException e1) { | ||
e1.printStackTrace(); | ||
} catch (IOException e1) { | ||
e1.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
} | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never leave comment stubs present in production level code. Either LOG or rethrow this exception. |
||
e.printStackTrace(); | ||
} | ||
|
||
try { | ||
bw.close(); | ||
} catch (IOException e) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,7 @@ public Object execute() { | |
e.printStackTrace(); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not be printing these stack traces, we should be logging them or re-throwing the exceptions. |
||
Thread.currentThread().interrupt(); | ||
} catch (ExecutionException e) { | ||
e.printStackTrace(); | ||
} finally { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this
BufferedWriter
not also be pulled into thetry-with-resources
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ontology module is written by you and I'm not familiar with functions in the class. I found bw is defined as a class variable and can't be pulled it into the try-with-resource since bw is used in other functions.