prepare for build under Java 9
This commit is contained in:
parent
5289b080a1
commit
1037f9308a
14 changed files with 70 additions and 39 deletions
|
@ -2,7 +2,7 @@
|
|||
plugins {
|
||||
id "org.sonarqube" version "2.6.1"
|
||||
id "io.codearte.nexus-staging" version "0.11.0"
|
||||
id "org.xbib.gradle.plugin.asciidoctor" version "1.5.4.1.0"
|
||||
id "org.xbib.gradle.plugin.asciidoctor" version "1.5.6.0.1"
|
||||
}
|
||||
|
||||
printf "Host: %s\nOS: %s %s %s\nJVM: %s %s %s %s\nGroovy: %s\nGradle: %s\n" +
|
||||
|
@ -42,8 +42,8 @@ allprojects {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
testCompile 'junit:junit:4.12'
|
||||
wagon 'org.apache.maven.wagon:wagon-ssh:3.0.0'
|
||||
testCompile "junit:junit:${project.property('junit.version')}"
|
||||
wagon "org.apache.maven.wagon:wagon-ssh:${project.property('wagon.version')}"
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
|
@ -75,12 +75,15 @@ allprojects {
|
|||
classifier 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
classifier 'javadoc'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar, javadocJar
|
||||
}
|
||||
|
||||
if (project.hasProperty('signing.keyId')) {
|
||||
signing {
|
||||
sign configurations.archives
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
dependencies {
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:${project.property('jackson.version')}"
|
||||
testCompile('junit:junit:4.12') {
|
||||
testCompile("junit:junit:${project.property('junit.version')}") {
|
||||
exclude group: 'org.hamcrest'
|
||||
}
|
||||
testCompile('org.mockito:mockito-core:1.9.5') {
|
||||
testCompile("org.mockito:mockito-core:${project.property('mockito.version')}") {
|
||||
exclude group: 'org.hamcrest'
|
||||
}
|
||||
testCompile 'org.hamcrest:hamcrest-all:1.3'
|
||||
testCompile "org.hamcrest:hamcrest-all:${project.property('hamcrest.version')}"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.xbib.content.json.pointer;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.only;
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.xml.sax.InputSource;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -41,6 +40,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
/**
|
||||
* RdfXmlParser is an admittedly convoluted hand-coded SAX parser for RDF/XML.
|
||||
|
@ -71,7 +73,7 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
// counter for blank node generation
|
||||
private int bn = 0;
|
||||
|
||||
public RdfXmlContentParser(InputStream in) throws IOException {
|
||||
public RdfXmlContentParser(InputStream in) {
|
||||
this(new InputStreamReader(in, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
|
@ -98,14 +100,19 @@ public class RdfXmlContentParser<R extends RdfContentParams> implements RdfConst
|
|||
public RdfXmlContentParser<R> parse() throws IOException {
|
||||
try {
|
||||
parse(new InputSource(reader));
|
||||
} catch (SAXException ex) {
|
||||
} catch (SAXException | ParserConfigurationException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public RdfXmlContentParser<R> parse(InputSource source) throws IOException, SAXException {
|
||||
parse(XMLReaderFactory.createXMLReader(), source);
|
||||
public RdfXmlContentParser<R> parse(InputSource source) throws IOException, SAXException, ParserConfigurationException {
|
||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setValidating(false);
|
||||
SAXParser parser = factory.newSAXParser();
|
||||
XMLReader xmlReader = parser.getXMLReader();
|
||||
parse(xmlReader, source);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.xbib.content.rdf.io.sink.XmlSink;
|
|||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
@ -58,8 +59,7 @@ public final class StreamProcessor<S extends Sink> extends BaseStreamProcessor {
|
|||
source.process(reader, mimeType, baseUri);
|
||||
}
|
||||
|
||||
public void setReader(XMLReader xmlReader) throws SAXException {
|
||||
public void setReader(XMLReader xmlReader) throws SAXException, ParserConfigurationException {
|
||||
((XmlSource) source).setXmlReader(xmlReader);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,15 @@ import org.xbib.content.rdf.io.sink.XmlSink;
|
|||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
final class XmlSource extends AbstractSource<XmlSink> {
|
||||
|
||||
|
@ -20,17 +22,19 @@ final class XmlSource extends AbstractSource<XmlSink> {
|
|||
super(sink);
|
||||
}
|
||||
|
||||
public static XMLReader getDefaultXmlReader() throws SAXException {
|
||||
XMLReader result = XMLReaderFactory.createXMLReader();
|
||||
result.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
return result;
|
||||
public static XMLReader getDefaultXmlReader() throws SAXException, ParserConfigurationException {
|
||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setValidating(false);
|
||||
SAXParser parser = factory.newSAXParser();
|
||||
return parser.getXMLReader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(Reader reader, String mimeType, String baseUri) throws IOException {
|
||||
try {
|
||||
initXmlReader();
|
||||
} catch (SAXException e) {
|
||||
} catch (SAXException | ParserConfigurationException e) {
|
||||
throw new IOException("can not instantinate XMLReader", e);
|
||||
}
|
||||
try {
|
||||
|
@ -53,7 +57,7 @@ final class XmlSource extends AbstractSource<XmlSink> {
|
|||
}
|
||||
}
|
||||
|
||||
private void initXmlReader() throws SAXException {
|
||||
private void initXmlReader() throws SAXException, ParserConfigurationException {
|
||||
if (xmlReader == null) {
|
||||
xmlReader = getDefaultXmlReader();
|
||||
}
|
||||
|
@ -61,7 +65,7 @@ final class XmlSource extends AbstractSource<XmlSink> {
|
|||
xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", sink);
|
||||
}
|
||||
|
||||
public void setXmlReader(XMLReader xmlReader) throws SAXException {
|
||||
public void setXmlReader(XMLReader xmlReader) throws SAXException, ParserConfigurationException {
|
||||
if (xmlReader == null) {
|
||||
this.xmlReader = getDefaultXmlReader();
|
||||
} else {
|
||||
|
|
|
@ -9,13 +9,15 @@ import org.xbib.content.rdf.util.NormalizeEolFilter;
|
|||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
/**
|
||||
* An XML reader for parsing XML into triples.
|
||||
|
@ -33,7 +35,7 @@ public class XmlContentParser<P extends RdfContentParams> implements RdfContentP
|
|||
|
||||
private boolean validate = false;
|
||||
|
||||
public XmlContentParser(InputStream in) throws IOException {
|
||||
public XmlContentParser(InputStream in) {
|
||||
this(new InputStreamReader(in, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
|
@ -73,9 +75,13 @@ public class XmlContentParser<P extends RdfContentParams> implements RdfContentP
|
|||
@Override
|
||||
public XmlContentParser<P> parse() throws IOException {
|
||||
try {
|
||||
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
|
||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setValidating(false);
|
||||
SAXParser parser = factory.newSAXParser();
|
||||
XMLReader xmlReader = parser.getXMLReader();
|
||||
parse(xmlReader, new InputSource(reader));
|
||||
} catch (SAXException ex) {
|
||||
} catch (SAXException | ParserConfigurationException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
return this;
|
||||
|
@ -88,8 +94,6 @@ public class XmlContentParser<P extends RdfContentParams> implements RdfContentP
|
|||
}
|
||||
reader.setContentHandler(handler);
|
||||
}
|
||||
reader.setFeature("http://xml.org/sax/features/namespaces", namespaces);
|
||||
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", validate);
|
||||
reader.parse(source);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class EuropeanaEDMReaderTest extends StreamTester {
|
|||
Resource resource = resourceIterator.next();
|
||||
builder.receive(resource);
|
||||
}
|
||||
//System.err.println(builder.string());
|
||||
assertStream(getClass().getResource("edm.nt").openStream(),
|
||||
builder.streamInput());
|
||||
}
|
||||
|
|
|
@ -70,14 +70,14 @@ public class StaxEventContentHandler extends AbstractStaxContentHandler {
|
|||
@Override
|
||||
protected void startElementInternal(QName name, Attributes atts, SimpleNamespaceContext namespaceContext)
|
||||
throws XMLStreamException {
|
||||
List<?> attributes = getAttributes(atts);
|
||||
List<?> namespaces = createNamespaces(namespaceContext);
|
||||
List<Attribute> attributes = getAttributes(atts);
|
||||
List<Namespace> namespaces = createNamespaces(namespaceContext);
|
||||
consumeEvent(eventFactory.createStartElement(name, attributes.iterator(), namespaces.iterator()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void endElementInternal(QName name, SimpleNamespaceContext namespaceContext) throws XMLStreamException {
|
||||
List<?> namespaces = createNamespaces(namespaceContext);
|
||||
List<Namespace> namespaces = createNamespaces(namespaceContext);
|
||||
consumeEvent(eventFactory.createEndElement(name, namespaces.iterator()));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.xbib.content.xml.transform;
|
|||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.XMLReader;
|
||||
import org.xml.sax.helpers.XMLReaderFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
@ -18,6 +17,9 @@ import java.util.List;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
|
@ -107,12 +109,16 @@ public class TransformerURIResolver implements URIResolver, Closeable {
|
|||
throw new TransformerException("href could not be resolved: " + href);
|
||||
}
|
||||
try {
|
||||
XMLReader reader = XMLReaderFactory.createXMLReader();
|
||||
SAXParserFactory factory = SAXParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
factory.setValidating(false);
|
||||
SAXParser parser = factory.newSAXParser();
|
||||
XMLReader reader = parser.getXMLReader();
|
||||
inputStreams.add(in);
|
||||
SAXSource source = new SAXSource(reader, new InputSource(in));
|
||||
source.setSystemId(systemId);
|
||||
return source;
|
||||
} catch (SAXException e) {
|
||||
} catch (SAXException | ParserConfigurationException e) {
|
||||
throw new TransformerException("no XML reader for SAX source in URI resolving for:" + href, e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
group = org.xbib
|
||||
name = content
|
||||
version = 1.2.4
|
||||
version = 1.3.0
|
||||
|
||||
jackson.version = 2.8.11
|
||||
xbib-net.version = 1.0.0
|
||||
jackson.version = 2.8.11
|
||||
junit.version = 4.12
|
||||
hamcrest.version = 1.3
|
||||
mockito.version = 2.13.0
|
||||
wagon.version = 3.0.0
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
|
||||
task xbibUpload(type: Upload, dependsOn: build) {
|
||||
group = 'publish'
|
||||
configuration = configurations.archives
|
||||
uploadDescriptor = true
|
||||
repositories {
|
||||
if (project.hasProperty('xbibUsername')) {
|
||||
mavenDeployer {
|
||||
configuration = configurations.wagon
|
||||
repository(url: uri('sftp://xbib.org/repository')) {
|
||||
repository(url: uri(project.property('xbibUrl'))) {
|
||||
authentication(userName: xbibUsername, privateKey: xbibPrivateKey)
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +16,7 @@ task xbibUpload(type: Upload, dependsOn: build) {
|
|||
}
|
||||
|
||||
task sonatypeUpload(type: Upload, dependsOn: build) {
|
||||
group = 'publish'
|
||||
configuration = configurations.archives
|
||||
uploadDescriptor = true
|
||||
repositories {
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sat Jan 27 20:21:20 CET 2018
|
||||
#Tue Feb 06 23:13:29 CET 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
|
||||
|
|
Loading…
Reference in a new issue