Skip to content

Commit df203ee

Browse files
committed
Remove unnecesary code
Following hints from IDE: - remove ignored blank lines in javadoc - remove unused variables - inline variable - simplify expressions that are always true
1 parent ca71bb6 commit df203ee

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

metafacture-biblio/src/main/java/org/metafacture/biblio/marc21/MarcXmlEncoder.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ public final class MarcXmlEncoder extends DefaultStreamPipe<ObjectReceiver<Strin
4848
public static final boolean PRETTY_PRINTED = true;
4949
public static final boolean OMIT_XML_DECLARATION = false;
5050
public static final boolean ENSURE_CORRECT_MARC21_XML = false;
51-
52-
private static final String ROOT_OPEN = "<marc:collection xmlns:marc=\"http://www.loc.gov/MARC21/slim\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\">";
53-
private static final String ROOT_CLOSE = "</marc:collection>";
54-
5551
private enum Tag {
5652

5753
collection(" xmlns%s=\"" + NAMESPACE + "\"%s"),
@@ -106,7 +102,6 @@ public String close(final Object[] args) {
106102
private static final int TAG_END = 3;
107103

108104
private final Encoder encoder = new Encoder();
109-
private final Marc21Decoder decoder = new Marc21Decoder();
110105
private final Marc21Encoder wrapper = new Marc21Encoder();
111106

112107
private DefaultStreamPipe<ObjectReceiver<String>> pipe;
@@ -115,6 +110,7 @@ public String close(final Object[] args) {
115110
* Creates an instance of {@link MarcXmlEncoder}.
116111
*/
117112
public MarcXmlEncoder() {
113+
Marc21Decoder decoder = new Marc21Decoder();
118114
decoder.setEmitLeaderAsWhole(true);
119115

120116
wrapper
@@ -136,7 +132,6 @@ public void setEmitNamespace(final boolean emitNamespace) {
136132

137133
/**
138134
* Sets the flag to decide whether to omit the XML declaration.
139-
*
140135
* <strong>Default value: {@value #OMIT_XML_DECLARATION}</strong>
141136
*
142137
* @param currentOmitXmlDeclaration true if the XML declaration is omitted, otherwise
@@ -148,7 +143,6 @@ public void omitXmlDeclaration(final boolean currentOmitXmlDeclaration) {
148143

149144
/**
150145
* Sets the XML version.
151-
*
152146
* <strong>Default value: {@value #XML_VERSION}</strong>
153147
*
154148
* @param xmlVersion the XML version
@@ -159,7 +153,6 @@ public void setXmlVersion(final String xmlVersion) {
159153

160154
/**
161155
* Sets the XML encoding.
162-
*
163156
* <strong>Default value: {@value #XML_ENCODING}</strong>
164157
*
165158
* @param xmlEncoding the XML encoding
@@ -173,7 +166,6 @@ public void setXmlEncoding(final String xmlEncoding) {
173166
* If true, the input data is validated to ensure correct MARC21. Also the leader may be generated.
174167
* It acts as a wrapper: the input is piped to {@link org.metafacture.biblio.marc21.Marc21Encoder}, whose output is piped to {@link org.metafacture.biblio.marc21.Marc21Decoder}, whose output is piped to {@link org.metafacture.biblio.marc21.MarcXmlEncoder}.
175168
* This validation and treatment of the leader is more safe but comes with a performance impact.
176-
*
177169
* <strong>Default value: {@value #ENSURE_CORRECT_MARC21_XML}</strong>
178170
*
179171
* @param ensureCorrectMarc21Xml if true the input data is validated to ensure correct MARC21. Also the leader may be generated.
@@ -184,7 +176,6 @@ public void setEnsureCorrectMarc21Xml(final boolean ensureCorrectMarc21Xml) {
184176

185177
/**
186178
* Formats the resulting xml by indentation. Aka "pretty printing".
187-
*
188179
* <strong>Default value: {@value #PRETTY_PRINTED}</strong>
189180
*
190181
* @param formatted true if formatting is activated, otherwise false
@@ -247,7 +238,7 @@ private static class Encoder extends DefaultStreamPipe<ObjectReceiver<String>> {
247238
private String currentEntity = "";
248239

249240
private boolean emitNamespace = true;
250-
private Object[] namespacePrefix = new Object[]{emitNamespace ? NAMESPACE_PREFIX : EMPTY};
241+
private Object[] namespacePrefix = new Object[]{NAMESPACE_PREFIX};
251242

252243
private int indentationLevel;
253244
private boolean formatted = PRETTY_PRINTED;

0 commit comments

Comments
 (0)