Skip to content
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

Merged
merged 3 commits into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,27 @@ public Object execute() {
e2.printStackTrace();
}

FileWriter fw;
try {
fw = new FileWriter(file.getAbsoluteFile());
try(FileWriter fw = new FileWriter(file.getAbsoluteFile())){
bw = new BufferedWriter(fw);
Copy link
Member

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 the try-with-resources?

Copy link
Contributor Author

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.

} 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 fileIn : files) {
String ext = FilenameUtils.getExtension(fileIn.getAbsolutePath());
if ("owl".equals(ext)) {
try {
loadXml(fileIn.getAbsolutePath());
getAllClass();
} catch (JDOMException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}

}

}
} catch (IOException e) {
e.printStackTrace();
}

try {
bw.close();
} catch (IOException e) {
Expand All @@ -109,7 +106,7 @@ public Object execute() {
* @throws JDOMException JDOMException
* @throws IOException IOException
*/
public void loadxml(String filePathName) throws JDOMException, IOException {
public void loadXml(String filePathName) throws JDOMException, IOException {
SAXBuilder saxBuilder = new SAXBuilder();
File file = new File(filePathName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public Object execute() {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
Copy link
Member

Choose a reason for hiding this comment

The 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 {
Expand Down