add null checks
This commit is contained in:
parent
a98816e315
commit
19f4d74d3e
2 changed files with 9 additions and 2 deletions
|
@ -136,6 +136,9 @@ public class MarcField implements Comparable<MarcField> {
|
|||
}
|
||||
|
||||
public boolean isTagValid() {
|
||||
if (tag == null) {
|
||||
return true;
|
||||
}
|
||||
return tag.length() == 3
|
||||
&& ((tag.charAt(0) >= '0' && tag.charAt(0) <= '9')
|
||||
|| (tag.charAt(0) >= 'A' && tag.charAt(0) <= 'Z'))
|
||||
|
@ -149,6 +152,9 @@ public class MarcField implements Comparable<MarcField> {
|
|||
if (isControl()) {
|
||||
return true;
|
||||
}
|
||||
if (indicator == null) {
|
||||
return true;
|
||||
}
|
||||
boolean b = indicator.length() <= 9;
|
||||
for (int i = 0; i < indicator.length(); i++) {
|
||||
b = indicator.charAt(i) == ' '
|
||||
|
@ -167,6 +173,9 @@ public class MarcField implements Comparable<MarcField> {
|
|||
if (isControl()) {
|
||||
return true;
|
||||
}
|
||||
if (subfieldIds == null) {
|
||||
return true;
|
||||
}
|
||||
boolean b = true;
|
||||
for (int i = 0; i < subfieldIds.length(); i++) {
|
||||
b = subfieldIds.charAt(i) == ' '
|
||||
|
|
|
@ -20,8 +20,6 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.xbib.marc.Marc;
|
||||
import org.xbib.marc.MarcXchangeConstants;
|
||||
import org.xbib.marc.json.MarcJsonWriter;
|
||||
import org.xbib.marc.xml.MarcXchangeWriter;
|
||||
|
||||
|
|
Loading…
Reference in a new issue