-
Notifications
You must be signed in to change notification settings - Fork 181
Fix [MDEP-931] Replace PrintWriter with Writer in AbstractSerializing Visitor and subclasses #530
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
base: master
Are you sure you want to change the base?
Conversation
…Visitor and subclasses
List<DependencyNode> children = node.getChildren(); | ||
for (DependencyNode child : children) { | ||
writer.write("\t\"" + node.toNodeString() + "\" -> \"" + child.toNodeString() + "\" ; " | ||
+ System.lineSeparator()); |
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.
Output should be platform independent. That is, use \n
writer.flush(); | ||
return true; | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to write to DOT output", e); |
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.
UncheckedIOException but really we need to figure out how to not thrown an exception at all here, or perhaps change the method signature. Possibly we need to put everything in a StringWriter first and then write the string later.
} | ||
return true; | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to write to DOT output", e); |
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.
ditto
writer.flush(); | ||
return true; | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to write GraphML node", e); |
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.
ditto
} | ||
return true; | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to write GraphML edge or footer", e); |
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.
ditto
writer.write(sb.toString()); | ||
writer.flush(); | ||
} catch (IOException e) { | ||
throw new RuntimeException("Failed to write JSON output", e); |
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.
ditto
try { | ||
if (node.getParent() == null || node.getParent() == node) { | ||
// dump edges on last node endVisit | ||
writer.write("#" + System.lineSeparator()); |
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.
\n
} | ||
writer.flush(); | ||
} else { | ||
DependencyNode p = node.getParent(); |
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.
p --> parent
writer.write("#" + System.lineSeparator()); | ||
for (EdgeAppender edge : edges) { | ||
writer.write(edge.toString()); | ||
writer.write(System.lineSeparator()); |
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.
\n
Following this checklist to help us incorporate your
contribution quickly and easily:
Fixes https://issues.apache.org/jira/browse/MDEP-931
cc @elharo
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
mvn verify
to make sure basic checks pass.A more thorough check will be performed on your pull request automatically.
mvn -Prun-its verify
).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.