update to Gradle 3.5, suppress empty XML value in PicaXML

This commit is contained in:
Jörg Prante 2017-05-09 22:40:26 +02:00
parent d73164601d
commit 0d76b4b868
6 changed files with 22 additions and 12 deletions

View file

@ -42,7 +42,7 @@ dependencies {
testCompile "org.xbib:bibliographic-character-sets:${project.property('bibliographic-character-sets.version')}" testCompile "org.xbib:bibliographic-character-sets:${project.property('bibliographic-character-sets.version')}"
testCompile "org.xbib:content-core:${project.property('content-core.version')}" testCompile "org.xbib:content-core:${project.property('content-core.version')}"
asciidoclet "org.asciidoctor:asciidoclet:${project.property('asciidoclet.version')}" asciidoclet "org.asciidoctor:asciidoclet:${project.property('asciidoclet.version')}"
wagon "org.apache.maven.wagon:wagon-ssh-external:${project.property('wagon-ssh-external.version')}" wagon "org.apache.maven.wagon:wagon-ssh:${project.property('wagon-ssh.version')}"
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8

View file

@ -1,6 +1,6 @@
group = org.xbib group = org.xbib
name = marc name = marc
version = 1.0.11 version = 1.0.12
junit.version = 4.12 junit.version = 4.12
xalan.version = 2.7.2 xalan.version = 2.7.2
@ -9,4 +9,4 @@ system-rules.version = 1.16.0
bibliographic-character-sets.version = 1.0.0 bibliographic-character-sets.version = 1.0.0
content-core.version = 1.0.7 content-core.version = 1.0.7
asciidoclet.version = 1.5.4 asciidoclet.version = 1.5.4
wagon-ssh-external.version = 2.10 wagon-ssh.version = 2.12

View file

@ -6,7 +6,7 @@ task xbibUpload(type: Upload) {
if (project.hasProperty('xbibUsername')) { if (project.hasProperty('xbibUsername')) {
mavenDeployer { mavenDeployer {
configuration = configurations.wagon configuration = configurations.wagon
repository(url: uri('scpexe://xbib.org/repository')) { repository(url: uri('sftp://xbib.org/repository')) {
authentication(userName: xbibUsername, privateKey: xbibPrivateKey) authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
} }
} }

Binary file not shown.

View file

@ -1,6 +1,6 @@
#Thu Feb 23 17:00:52 CET 2017 #Tue May 09 22:21:42 CEST 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-all.zip

View file

@ -89,7 +89,6 @@ public class PicaXMLContentHandler extends MarcContentHandler implements PicaCon
tag = value.substring(0, 3); tag = value.substring(0, 3);
indicator = value.substring(3); indicator = value.substring(3);
} }
} }
MarcField.Builder builder = MarcField.builder().tag(tag).indicator(indicator); MarcField.Builder builder = MarcField.builder().tag(tag).indicator(indicator);
stack.push(builder); stack.push(builder);
@ -105,18 +104,23 @@ public class PicaXMLContentHandler extends MarcContentHandler implements PicaCon
tag = value.substring(0, 3); tag = value.substring(0, 3);
indicator = value.substring(3); indicator = value.substring(3);
} }
} }
MarcField.Builder builder = MarcField.builder().tag(tag).indicator(indicator); MarcField.Builder builder = MarcField.builder().tag(tag).indicator(indicator);
stack.push(builder); stack.push(builder);
break; break;
} }
case SUBFIELD: { case SUBFIELD: {
stack.peek().subfield(atts.getValue(CODE_ATTRIBUTE), null); String subfieldId = atts.getValue(CODE_ATTRIBUTE);
if (!subfieldId.isEmpty()) {
stack.peek().subfield(subfieldId, null);
}
break; break;
} }
case SUBF_TAG: { case SUBF_TAG: {
stack.peek().subfield(atts.getValue(ID_ATTRIBUTE), null); String subfieldId = atts.getValue(ID_ATTRIBUTE);
if (!subfieldId.isEmpty()) {
stack.peek().subfield(subfieldId, null);
}
break; break;
} }
case GLOBAL_TAG: case GLOBAL_TAG:
@ -146,7 +150,11 @@ public class PicaXMLContentHandler extends MarcContentHandler implements PicaCon
break; break;
} }
case TAG_ATTRIBUTE: { case TAG_ATTRIBUTE: {
MarcField marcField = stack.pop().value(content.toString()).build(); MarcField.Builder marcFieldBuilder = stack.pop();
if (content.length() > 0) {
marcFieldBuilder.value(content.toString());
}
MarcField marcField = marcFieldBuilder.build();
if (marcValueTransformers != null) { if (marcValueTransformers != null) {
marcField = marcValueTransformers.transformValue(marcField); marcField = marcValueTransformers.transformValue(marcField);
} }
@ -155,7 +163,9 @@ public class PicaXMLContentHandler extends MarcContentHandler implements PicaCon
} }
case SUBFIELD: case SUBFIELD:
case SUBF_TAG: { case SUBF_TAG: {
stack.peek().subfieldValue(content.toString()); if (content.length() > 0) {
stack.peek().subfieldValue(content.toString());
}
break; break;
} }
case GLOBAL_TAG: case GLOBAL_TAG: