-
Notifications
You must be signed in to change notification settings - Fork 34
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
Emit marc:leader as first element #549
Conversation
9970929
to
df203ee
Compare
Following hints from IDE: - remove ignored blank lines in javadoc - remove unused variables - inline variable - simplify expressions that are always true
df203ee
to
07aa5fb
Compare
@@ -247,11 +239,12 @@ private static class Encoder extends DefaultStreamPipe<ObjectReceiver<String>> { | |||
private String currentEntity = ""; | |||
|
|||
private boolean emitNamespace = true; | |||
private Object[] namespacePrefix = new Object[]{emitNamespace ? NAMESPACE_PREFIX : EMPTY}; | |||
private Object[] namespacePrefix = new Object[]{NAMESPACE_PREFIX}; |
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.
Why did you change this? Now one has to remember to adjust this line as well should the default for emitNamespace
be switched one day.
@@ -353,7 +346,7 @@ else if (!appendLeader(name, value)) { | |||
if (value != null) { | |||
writeEscaped(value.trim()); | |||
} | |||
writeTag(Tag.controlfield::close); | |||
writeTag(Tag.controlfield::close, false); |
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.
What does this change do? It seems to be ineffective. And also counterintuitive: Why would a close tag have arguments/attributes?
@@ -408,9 +401,20 @@ private void writeFooter() { | |||
* @param str the unescaped sequence to be written | |||
*/ | |||
private void writeRaw(final String str) { | |||
|
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.
Why this empty line?
@@ -432,11 +436,11 @@ private void writeEscaped(final String str) { | |||
|
|||
private void writeLeader() { | |||
final String leader = leaderBuilder.toString(); | |||
if (!leader.isEmpty()) { | |||
if (leaderBuilder.length() > 0) { |
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.
Why this change?
String actual = resultCollector.toString(); | ||
assertEquals(expected, actual); | ||
} | ||
|
||
@Test | ||
public void issue548_failWhenLeaderIsNotFirst() { |
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.
What's the purpose of this test? It's already covered by the previous one.
@@ -136,7 +133,6 @@ public void setEmitNamespace(final boolean emitNamespace) { | |||
|
|||
/** | |||
* Sets the flag to decide whether to omit the XML declaration. | |||
* |
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 previous formatting looked much clearer to me...
Fixes #548.