You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/10/06 17:39:40 UTC
svn commit: r1811354 - in /uima/uimaj/trunk:
jVinci/src/main/java/org/apache/vinci/transport/document/
jVinci/src/main/java/org/apache/vinci/transport/vns/service/
uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/
uimaj-component-te...
Author: schor
Date: Fri Oct 6 17:39:40 2017
New Revision: 1811354
URL: http://svn.apache.org/viewvc?rev=1811354&view=rev
Log:
no Jira - slight refactor of xml factory creation, with warnings added
Added:
uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta.java
uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta_Type.java
Removed:
uima/uimaj/trunk/uimaj-document-annotation/src/test/java/test/
Modified:
uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java
uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java
uima/uimaj/trunk/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/Descriptor.java
uima/uimaj/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotatorTester.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/XMLUtils.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java
uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java
uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java
uima/uimaj/trunk/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml
uima/uimaj/trunk/uimaj-eclipse-update-site/pom.xml
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java
uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/XmlDetagger.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmlDetagger.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASFileOpenEventHandler.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java
uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java
Modified: uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java (original)
+++ uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/document/XMLToVinci.java Fri Oct 6 17:39:40 2017
@@ -56,7 +56,7 @@ public class XMLToVinci {
spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (SAXNotRecognizedException | SAXNotSupportedException
| ParserConfigurationException e) {
- throw new RuntimeException(e);
+ System.err.println("Warning: SAXParserFactory didn't recognized the feature http://apache.org/xml/features/disallow-doctype-decl");
}
}
/**
@@ -264,7 +264,13 @@ public class XMLToVinci {
}
// prevent undeclared namespace warnings.
try {
- xr.setFeature("http://xml.org/sax/features/namespaces", false);
+ try {
+ xr.setFeature("http://xml.org/sax/features/namespaces", false);
+ } catch (SAXNotRecognizedException e) {
+ System.err.println("Warning: XMLReader didn't recognize the feature http://xml.org/sax/features/namespaces");
+ } catch (SAXNotSupportedException e) {
+ System.err.println("Warning: XMLReader doesn't support the feature http://xml.org/sax/features/namespaces");
+ }
VinciFrameHandler handler = new VinciFrameHandler();
xr.setContentHandler(handler);
xr.setErrorHandler(handler);
Modified: uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java (original)
+++ uima/uimaj/trunk/jVinci/src/main/java/org/apache/vinci/transport/vns/service/ServiceRegistry.java Fri Oct 6 17:39:40 2017
@@ -29,6 +29,7 @@ import java.util.Hashtable;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -408,7 +409,12 @@ public class ServiceRegistry {
public void load(String fname) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ try {
+ dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ } catch (ParserConfigurationException e) {
+ System.err.println("Warning: DocumentBuilderFactory doesn't support the feature http://apache.org/xml/features/disallow-doctype-decl");
+ }
+
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
Modified: uima/uimaj/trunk/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/Descriptor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/Descriptor.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/Descriptor.java (original)
+++ uima/uimaj/trunk/uimaj-adapter-vinci/src/main/java/org/apache/uima/adapter/vinci/util/Descriptor.java Fri Oct 6 17:39:40 2017
@@ -19,17 +19,16 @@
package org.apache.uima.adapter.vinci.util;
-import java.io.File;
-
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.internal.util.XMLUtils;
+import org.apache.uima.util.Level;
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.DefaultHandler;
-import org.apache.uima.UIMAFramework;
-import org.apache.uima.util.Level;
/**
* Instance of this class handles parsing of the xml descriptor files. It also retrieves values of
@@ -72,8 +71,7 @@ public class Descriptor extends DefaultH
private Document parse(String configFile) {
Document doc = null;
try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false);
+ SAXParserFactory factory = XMLUtils.createSAXParserFactory();
factory.setValidating(false);
// Create the builder and parse the file
Modified: uima/uimaj/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotatorTester.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotatorTester.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotatorTester.java (original)
+++ uima/uimaj/trunk/uimaj-component-test-util/src/main/java/org/apache/uima/test/junit_extension/AnnotatorTester.java Fri Oct 6 17:39:40 2017
@@ -33,6 +33,7 @@ import org.apache.uima.analysis_engine.A
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.impl.XCASDeserializer;
import org.apache.uima.collection.CasConsumer;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ResourceConfigurationException;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceManager;
@@ -367,7 +368,7 @@ public class AnnotatorTester {
CAS cas = CasCreationUtils.createCas(tsDesc, null,
new FsIndexDescription[0]);
- SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+ SAXParser parser = XMLUtils.createSAXParserFactory().newSAXParser();
XCASDeserializer xcasDeserializer = new XCASDeserializer(cas
.getTypeSystem());
parser.parse(xcasFile, xcasDeserializer.getXCASHandler(cas));
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java Fri Oct 6 17:39:40 2017
@@ -43,7 +43,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
/**
* XCAS Deserializer. Takes an XCAS and reads it into a CAS.
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java Fri Oct 6 17:39:40 2017
@@ -65,7 +65,6 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.helpers.XMLReaderFactory;
/**
* XMI CAS deserializer. Used to read in a CAS from XML Metadata Interchange (XMI) format.
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/impl/UIMAFramework_impl.java Fri Oct 6 17:39:40 2017
@@ -44,6 +44,7 @@ import org.apache.uima.collection.Collec
import org.apache.uima.collection.CollectionProcessingManager;
import org.apache.uima.collection.metadata.CpeDescription;
import org.apache.uima.internal.util.I18nUtil;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ConfigurationManager;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceManager;
@@ -474,8 +475,8 @@ public class UIMAFramework_impl extends
// TOOD: Need UtilityClassLoader here? I don't think we do; this works
// with XML4J v3. This is a good thing, since the UtilityClassLoader writes
// to the logger, which isn't created yet!
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+
+ SAXParserFactory factory = XMLUtils.createSAXParserFactory();
SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/XMLUtils.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/XMLUtils.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/XMLUtils.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/internal/util/XMLUtils.java Fri Oct 6 17:39:40 2017
@@ -23,11 +23,22 @@ import java.io.IOException;
import java.io.Writer;
import java.lang.reflect.Constructor;
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXTransformerFactory;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.util.Level;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -520,16 +531,72 @@ public abstract class XMLUtils {
(c >= 0xE000 && c <= 0xFFFD));
}
- /**
- * @return an xml reader set up properly
- * @throws SAXException -
- */
+ public static SAXParserFactory createSAXParserFactory() {
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ try {
+ factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ } catch (SAXNotRecognizedException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "SAXParserFactory didn't recognized feature http://apache.org/xml/features/disallow-doctype-decl");
+ } catch (SAXNotSupportedException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "SAXParserFactory doesn't support feature http://apache.org/xml/features/disallow-doctype-decl");
+ } catch (ParserConfigurationException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "SAXParserFactory doesn't support feature http://apache.org/xml/features/disallow-doctype-decl");
+ }
+ return factory;
+ }
+
public static XMLReader createXMLReader() throws SAXException {
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
- xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
- xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
- xmlReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ try {
+ xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ xmlReader.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ xmlReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",false);
+ } catch (SAXNotRecognizedException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "XMLReader didn't recognized feature http://apache.org/xml/features/disallow-doctype-decl");
+ } catch (SAXNotSupportedException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "XMLReader doesn't support feature http://apache.org/xml/features/disallow-doctype-decl");
+ }
return xmlReader;
}
+
+ public static SAXTransformerFactory createSaxTransformerFactory() {
+ SAXTransformerFactory saxTransformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ try {
+ saxTransformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+ saxTransformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
+ } catch (IllegalArgumentException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "SAXTransformerFactory didn't recognized setting attribute XMLConstants.ACCESS_EXTERNAL_DTD or XMLConstants.ACCESS_EXTERNAL_STYLESHEET");
+ }
+ return saxTransformerFactory;
+ }
+ public static TransformerFactory createTransformerFactory() {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ try {
+ transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+ transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
+ } catch (IllegalArgumentException e) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "TransformerFactory didn't recognized setting attribute XMLConstants.ACCESS_EXTERNAL_DTD or XMLConstants.ACCESS_EXTERNAL_STYLESHEET");
+ }
+ return transformerFactory;
+ }
+
+ public static DocumentBuilderFactory createDocumentBuilderFactory() {
+ DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+ try {
+ documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ } catch (ParserConfigurationException e1) {
+ UIMAFramework.getLogger().log(Level.WARNING,
+ "DocumentBuilderFactory didn't recognized setting feature http://apache.org/xml/features/disallow-doctype-decl");
+ }
+ return documentBuilderFactory;
+ }
}
+
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/pear/util/XMLUtil.java Fri Oct 6 17:39:40 2017
@@ -35,6 +35,7 @@ import javax.xml.parsers.ParserConfigura
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.uima.internal.util.XMLUtils;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
@@ -124,8 +125,7 @@ public class XMLUtil {
SAXParser parser = null;
try {
// get SAX parser factory
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ SAXParserFactory factory = XMLUtils.createSAXParserFactory();
// set default SAX parser features
factory.setFeature(NAMESPACES_FEATURE_ID, DEFAULT_NAMESPACES);
factory.setFeature(NAMESPACE_PREFIXES_FEATURE_ID, DEFAULT_NAMESPACE_PREFIXES);
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/XMLSerializer.java Fri Oct 6 17:39:40 2017
@@ -24,7 +24,6 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
-import javax.xml.XMLConstants;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
@@ -57,12 +56,7 @@ public class XMLSerializer {
// or the class found in any jar that has an entry: META-INF/service/javax.xml.transform.TransformerFactory
// or a platform default.
- private static final SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory
- .newInstance();
-
- static { transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
- transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
- }
+ private static final SAXTransformerFactory transformerFactory = XMLUtils.createSaxTransformerFactory();
private TransformerHandler mHandler;
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/SaxDeserializer_impl.java Fri Oct 6 17:39:40 2017
@@ -27,6 +27,7 @@ import javax.xml.transform.sax.SAXTransf
import javax.xml.transform.sax.TransformerHandler;
import org.apache.uima.UIMARuntimeException;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.SaxDeserializer;
import org.apache.uima.util.XMLParser;
@@ -52,8 +53,7 @@ public class SaxDeserializer_impl implem
static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
- private static final SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory
- .newInstance();
+ private static final SAXTransformerFactory transformerFactory = XMLUtils.createSaxTransformerFactory();
private DOMResult mDOMResult;
Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/util/impl/XMLParser_impl.java Fri Oct 6 17:39:40 2017
@@ -156,8 +156,7 @@ public class XMLParser_impl implements X
XMLParser.ParsingOptions aOptions) throws InvalidXMLException {
URL urlToParse = aInput.getURL();
try {
- SAXParserFactory factory = SAXParserFactory.newInstance();
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ SAXParserFactory factory = XMLUtils.createSAXParserFactory();
// Turn on namespace support
factory.setNamespaceAware(true);
Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/XMLSerializerTest.java Fri Oct 6 17:39:40 2017
@@ -27,6 +27,7 @@ import javax.xml.transform.TransformerFa
import junit.framework.TestCase;
+import org.apache.uima.internal.util.XMLUtils;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.AttributesImpl;
@@ -58,9 +59,7 @@ public class XMLSerializerTest extends T
// if (xmlStr.contains("1.0")) {
// useful to investigate issues when bad XML output is produced
// related to which Java implementation is being used
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
- transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
+ TransformerFactory transformerFactory = XMLUtils.createTransformerFactory();
Transformer t = transformerFactory.newTransformer();
t.setOutputProperty(OutputKeys.VERSION, "1.1");
Added: uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta.java?rev=1811354&view=auto
==============================================================================
--- uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta.java (added)
+++ uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta.java Fri Oct 6 17:39:40 2017
@@ -0,0 +1,279 @@
+
+
+/* First created by JCasGen Mon Oct 02 16:39:47 EDT 2017 */
+package org.apache.uima.jcas.tcas;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.jcas.cas.TOP_Type;
+
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.jcas.cas.IntegerArray;
+
+
+/**
+ * Updated by JCasGen Mon Oct 02 16:39:47 EDT 2017
+ * XML source: C:/au/svnCheckouts/trunk/uimaj-current/uimaj/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml
+ * @generated */
+public class DocMeta extends DocumentAnnotation {
+ /** @generated
+ * @ordered
+ */
+ @SuppressWarnings ("hiding")
+ public final static int typeIndexID = JCasRegistry.register(DocMeta.class);
+ /** @generated
+ * @ordered
+ */
+ @SuppressWarnings ("hiding")
+ public final static int type = typeIndexID;
+ /** @generated
+ * @return index of the type
+ */
+ @Override
+ public int getTypeIndexID() {return typeIndexID;}
+
+ /** Never called. Disable default constructor
+ * @generated */
+ protected DocMeta() {/* intentionally empty block */}
+
+ /** Internal - constructor used by generator
+ * @generated
+ * @param addr low level Feature Structure reference
+ * @param type the type of this Feature Structure
+ */
+ public DocMeta(int addr, TOP_Type type) {
+ super(addr, type);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ */
+ public DocMeta(JCas jcas) {
+ super(jcas);
+ readObject();
+ }
+
+ /** @generated
+ * @param jcas JCas to which this Feature Structure belongs
+ * @param begin offset to the begin spot in the SofA
+ * @param end offset to the end spot in the SofA
+ */
+ public DocMeta(JCas jcas, int begin, int end) {
+ super(jcas);
+ setBegin(begin);
+ setEnd(end);
+ readObject();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * Write your own initialization here
+ * <!-- end-user-doc -->
+ *
+ * @generated modifiable
+ */
+ private void readObject() {/*default - does nothing empty block */}
+
+
+
+ //*--------------*
+ //* Feature: feat
+
+ /** getter for feat - gets
+ * @generated
+ * @return value of the feature
+ */
+ public String getFeat() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat == null)
+ jcasType.jcas.throwFeatMissing("feat", "org.apache.uima.jcas.tcas.DocMeta");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat);}
+
+ /** setter for feat - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setFeat(String v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat == null)
+ jcasType.jcas.throwFeatMissing("feat", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat, v);}
+
+
+ //*--------------*
+ //* Feature: feat2
+
+ /** getter for feat2 - gets
+ * @generated
+ * @return value of the feature
+ */
+ public String getFeat2() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat2 == null)
+ jcasType.jcas.throwFeatMissing("feat2", "org.apache.uima.jcas.tcas.DocMeta");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat2);}
+
+ /** setter for feat2 - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setFeat2(String v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat2 == null)
+ jcasType.jcas.throwFeatMissing("feat2", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat2, v);}
+
+
+ //*--------------*
+ //* Feature: feat3
+
+ /** getter for feat3 - gets
+ * @generated
+ * @return value of the feature
+ */
+ public String getFeat3() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat3 == null)
+ jcasType.jcas.throwFeatMissing("feat3", "org.apache.uima.jcas.tcas.DocMeta");
+ return jcasType.ll_cas.ll_getStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat3);}
+
+ /** setter for feat3 - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setFeat3(String v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_feat3 == null)
+ jcasType.jcas.throwFeatMissing("feat3", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setStringValue(addr, ((DocMeta_Type)jcasType).casFeatCode_feat3, v);}
+
+
+ //*--------------*
+ //* Feature: arraystr
+
+ /** getter for arraystr - gets
+ * @generated
+ * @return value of the feature
+ */
+ public StringArray getArraystr() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arraystr == null)
+ jcasType.jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ return (StringArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr)));}
+
+ /** setter for arraystr - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setArraystr(StringArray v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arraystr == null)
+ jcasType.jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr, jcasType.ll_cas.ll_getFSRef(v));}
+
+ /** indexed getter for arraystr - gets an indexed value -
+ * @generated
+ * @param i index in the array to get
+ * @return value of the element at index i
+ */
+ public String getArraystr(int i) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arraystr == null)
+ jcasType.jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr), i);
+ return jcasType.ll_cas.ll_getStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr), i);}
+
+ /** indexed setter for arraystr - sets an indexed value -
+ * @generated
+ * @param i index in the array to set
+ * @param v value to set into the array
+ */
+ public void setArraystr(int i, String v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arraystr == null)
+ jcasType.jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr), i);
+ jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arraystr), i, v);}
+
+
+ //*--------------*
+ //* Feature: arrayints
+
+ /** getter for arrayints - gets
+ * @generated
+ * @return value of the feature
+ */
+ public IntegerArray getArrayints() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayints == null)
+ jcasType.jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ return (IntegerArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints)));}
+
+ /** setter for arrayints - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setArrayints(IntegerArray v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayints == null)
+ jcasType.jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints, jcasType.ll_cas.ll_getFSRef(v));}
+
+ /** indexed getter for arrayints - gets an indexed value -
+ * @generated
+ * @param i index in the array to get
+ * @return value of the element at index i
+ */
+ public int getArrayints(int i) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayints == null)
+ jcasType.jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints), i);
+ return jcasType.ll_cas.ll_getIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints), i);}
+
+ /** indexed setter for arrayints - sets an indexed value -
+ * @generated
+ * @param i index in the array to set
+ * @param v value to set into the array
+ */
+ public void setArrayints(int i, int v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayints == null)
+ jcasType.jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints), i);
+ jcasType.ll_cas.ll_setIntArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayints), i, v);}
+
+
+ //*--------------*
+ //* Feature: arrayFs
+
+ /** getter for arrayFs - gets
+ * @generated
+ * @return value of the feature
+ */
+ public FSArray getArrayFs() {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayFs == null)
+ jcasType.jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs)));}
+
+ /** setter for arrayFs - sets
+ * @generated
+ * @param v value to set into the feature
+ */
+ public void setArrayFs(FSArray v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayFs == null)
+ jcasType.jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.ll_cas.ll_setRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs, jcasType.ll_cas.ll_getFSRef(v));}
+
+ /** indexed getter for arrayFs - gets an indexed value -
+ * @generated
+ * @param i index in the array to get
+ * @return value of the element at index i
+ */
+ public Annotation getArrayFs(int i) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayFs == null)
+ jcasType.jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs), i);
+ return (Annotation)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs), i)));}
+
+ /** indexed setter for arrayFs - sets an indexed value -
+ * @generated
+ * @param i index in the array to set
+ * @param v value to set into the array
+ */
+ public void setArrayFs(int i, Annotation v) {
+ if (DocMeta_Type.featOkTst && ((DocMeta_Type)jcasType).casFeat_arrayFs == null)
+ jcasType.jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs), i);
+ jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((DocMeta_Type)jcasType).casFeatCode_arrayFs), i, jcasType.ll_cas.ll_getFSRef(v));}
+ }
+
+
\ No newline at end of file
Added: uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta_Type.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta_Type.java?rev=1811354&view=auto
==============================================================================
--- uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta_Type.java (added)
+++ uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocMeta_Type.java Fri Oct 6 17:39:40 2017
@@ -0,0 +1,289 @@
+
+/* First created by JCasGen Mon Oct 02 16:39:47 EDT 2017 */
+package org.apache.uima.jcas.tcas;
+
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JCasRegistry;
+import org.apache.uima.cas.impl.TypeImpl;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.FeatureImpl;
+import org.apache.uima.cas.Feature;
+
+/**
+ * Updated by JCasGen Mon Oct 02 16:39:47 EDT 2017
+ * @generated */
+public class DocMeta_Type extends DocumentAnnotation_Type {
+ /** @generated */
+ @SuppressWarnings ("hiding")
+ public final static int typeIndexID = DocMeta.typeIndexID;
+ /** @generated
+ @modifiable */
+ @SuppressWarnings ("hiding")
+ public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.apache.uima.jcas.tcas.DocMeta");
+
+ /** @generated */
+ final Feature casFeat_feat;
+ /** @generated */
+ final int casFeatCode_feat;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public String getFeat(int addr) {
+ if (featOkTst && casFeat_feat == null)
+ jcas.throwFeatMissing("feat", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_feat);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setFeat(int addr, String v) {
+ if (featOkTst && casFeat_feat == null)
+ jcas.throwFeatMissing("feat", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setStringValue(addr, casFeatCode_feat, v);}
+
+
+
+ /** @generated */
+ final Feature casFeat_feat2;
+ /** @generated */
+ final int casFeatCode_feat2;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public String getFeat2(int addr) {
+ if (featOkTst && casFeat_feat2 == null)
+ jcas.throwFeatMissing("feat2", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_feat2);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setFeat2(int addr, String v) {
+ if (featOkTst && casFeat_feat2 == null)
+ jcas.throwFeatMissing("feat2", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setStringValue(addr, casFeatCode_feat2, v);}
+
+
+
+ /** @generated */
+ final Feature casFeat_feat3;
+ /** @generated */
+ final int casFeatCode_feat3;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public String getFeat3(int addr) {
+ if (featOkTst && casFeat_feat3 == null)
+ jcas.throwFeatMissing("feat3", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getStringValue(addr, casFeatCode_feat3);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setFeat3(int addr, String v) {
+ if (featOkTst && casFeat_feat3 == null)
+ jcas.throwFeatMissing("feat3", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setStringValue(addr, casFeatCode_feat3, v);}
+
+
+
+ /** @generated */
+ final Feature casFeat_arraystr;
+ /** @generated */
+ final int casFeatCode_arraystr;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public int getArraystr(int addr) {
+ if (featOkTst && casFeat_arraystr == null)
+ jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getRefValue(addr, casFeatCode_arraystr);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setArraystr(int addr, int v) {
+ if (featOkTst && casFeat_arraystr == null)
+ jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setRefValue(addr, casFeatCode_arraystr, v);}
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @return value at index i in the array
+ */
+ public String getArraystr(int addr, int i) {
+ if (featOkTst && casFeat_arraystr == null)
+ jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i);
+ return ll_cas.ll_getStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i);
+ }
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @param v value to set
+ */
+ public void setArraystr(int addr, int i, String v) {
+ if (featOkTst && casFeat_arraystr == null)
+ jcas.throwFeatMissing("arraystr", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i, v, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i);
+ ll_cas.ll_setStringArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arraystr), i, v);
+ }
+
+
+ /** @generated */
+ final Feature casFeat_arrayints;
+ /** @generated */
+ final int casFeatCode_arrayints;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public int getArrayints(int addr) {
+ if (featOkTst && casFeat_arrayints == null)
+ jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getRefValue(addr, casFeatCode_arrayints);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setArrayints(int addr, int v) {
+ if (featOkTst && casFeat_arrayints == null)
+ jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setRefValue(addr, casFeatCode_arrayints, v);}
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @return value at index i in the array
+ */
+ public int getArrayints(int addr, int i) {
+ if (featOkTst && casFeat_arrayints == null)
+ jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ return ll_cas.ll_getIntArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i);
+ return ll_cas.ll_getIntArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i);
+ }
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @param v value to set
+ */
+ public void setArrayints(int addr, int i, int v) {
+ if (featOkTst && casFeat_arrayints == null)
+ jcas.throwFeatMissing("arrayints", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ ll_cas.ll_setIntArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i, v, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i);
+ ll_cas.ll_setIntArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayints), i, v);
+ }
+
+
+ /** @generated */
+ final Feature casFeat_arrayFs;
+ /** @generated */
+ final int casFeatCode_arrayFs;
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @return the feature value
+ */
+ public int getArrayFs(int addr) {
+ if (featOkTst && casFeat_arrayFs == null)
+ jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ return ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs);
+ }
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param v value to set
+ */
+ public void setArrayFs(int addr, int v) {
+ if (featOkTst && casFeat_arrayFs == null)
+ jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ ll_cas.ll_setRefValue(addr, casFeatCode_arrayFs, v);}
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @return value at index i in the array
+ */
+ public int getArrayFs(int addr, int i) {
+ if (featOkTst && casFeat_arrayFs == null)
+ jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i);
+ return ll_cas.ll_getRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i);
+ }
+
+ /** @generated
+ * @param addr low level Feature Structure reference
+ * @param i index of item in the array
+ * @param v value to set
+ */
+ public void setArrayFs(int addr, int i, int v) {
+ if (featOkTst && casFeat_arrayFs == null)
+ jcas.throwFeatMissing("arrayFs", "org.apache.uima.jcas.tcas.DocMeta");
+ if (lowLevelTypeChecks)
+ ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i, v, true);
+ jcas.checkArrayBounds(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i);
+ ll_cas.ll_setRefArrayValue(ll_cas.ll_getRefValue(addr, casFeatCode_arrayFs), i, v);
+ }
+
+
+
+
+ /** initialize variables to correspond with Cas Type and Features
+ * @generated
+ * @param jcas JCas
+ * @param casType Type
+ */
+ public DocMeta_Type(JCas jcas, Type casType) {
+ super(jcas, casType);
+ casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
+
+
+ casFeat_feat = jcas.getRequiredFeatureDE(casType, "feat", "uima.cas.String", featOkTst);
+ casFeatCode_feat = (null == casFeat_feat) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_feat).getCode();
+
+
+ casFeat_feat2 = jcas.getRequiredFeatureDE(casType, "feat2", "uima.cas.String", featOkTst);
+ casFeatCode_feat2 = (null == casFeat_feat2) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_feat2).getCode();
+
+
+ casFeat_feat3 = jcas.getRequiredFeatureDE(casType, "feat3", "uima.cas.String", featOkTst);
+ casFeatCode_feat3 = (null == casFeat_feat3) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_feat3).getCode();
+
+
+ casFeat_arraystr = jcas.getRequiredFeatureDE(casType, "arraystr", "uima.cas.StringArray", featOkTst);
+ casFeatCode_arraystr = (null == casFeat_arraystr) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_arraystr).getCode();
+
+
+ casFeat_arrayints = jcas.getRequiredFeatureDE(casType, "arrayints", "uima.cas.IntegerArray", featOkTst);
+ casFeatCode_arrayints = (null == casFeat_arrayints) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_arrayints).getCode();
+
+
+ casFeat_arrayFs = jcas.getRequiredFeatureDE(casType, "arrayFs", "uima.cas.FSArray", featOkTst);
+ casFeatCode_arrayFs = (null == casFeat_arrayFs) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_arrayFs).getCode();
+
+ }
+}
+
+
+
+
\ No newline at end of file
Modified: uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java (original)
+++ uima/uimaj/trunk/uimaj-document-annotation/src/test/java/org/apache/uima/jcas/tcas/DocumentAnnotationTest.java Fri Oct 6 17:39:40 2017
@@ -25,12 +25,16 @@ import java.io.IOException;
import org.apache.uima.UIMAFramework;
import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.CASException;
import org.apache.uima.cas.SerialFormat;
import org.apache.uima.cas.impl.BinaryCasSerDes4.CasCompare;
import org.apache.uima.cas.impl.BinaryCasSerDes6;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.jcas.cas.IntegerArray;
+import org.apache.uima.jcas.cas.StringArray;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.metadata.TypeSystemDescription;
import org.apache.uima.resource.metadata.impl.TypePriorities_impl;
@@ -38,10 +42,10 @@ import org.apache.uima.resource.metadata
import org.apache.uima.test.junit_extension.JUnitExtension;
import org.apache.uima.util.CasCreationUtils;
import org.apache.uima.util.CasIOUtils;
+import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.XMLInputSource;
import junit.framework.TestCase;
-import test.DocMeta;
public class DocumentAnnotationTest extends TestCase {
@@ -113,4 +117,35 @@ public class DocumentAnnotationTest exte
// System.out.println(target.getDocumentAnnotation());
assertTrue(new BinaryCasSerDes6(source).compareCASes((CASImpl)source, (CASImpl)target));
}
+
+ public void testToString() throws InvalidXMLException, IOException, ResourceInitializationException, CASException {
+ File typeSystemFile = JUnitExtension.getFile("ExampleCas/testTypeSystem_docmetadata.xml");
+ TypeSystemDescription typeSystem = UIMAFramework.getXMLParser().parseTypeSystemDescription(
+ new XMLInputSource(typeSystemFile));
+
+ source = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), null);
+ jcas = source.getJCas();
+
+ DocMeta d = new DocMeta(jcas);
+ d.setFeat("a string");
+ d.setFeat2("b string");
+ d.setFeat3("c string");
+
+ FSArray fsa = new FSArray(jcas, 2);
+ fsa.set(0, new Annotation(jcas, 1,2));
+ fsa.set(1, new Annotation(jcas, 3,4));
+ d.setArrayFs(fsa);
+
+ IntegerArray intarr = new IntegerArray(jcas, 2);
+ intarr.set(0, 10);
+ intarr.set(1, -10);
+ d.setArrayints(intarr);
+
+ StringArray strarr = new StringArray(jcas, 2);
+ strarr.set(0, "first");
+ strarr.set(1, "second");
+ d.setArraystr(strarr);
+
+ System.out.println(d.toString());
+ }
}
Modified: uima/uimaj/trunk/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml (original)
+++ uima/uimaj/trunk/uimaj-document-annotation/src/test/resources/ExampleCas/testTypeSystem_docmetadata.xml Fri Oct 6 17:39:40 2017
@@ -6,7 +6,7 @@
<vendor/>
<types>
<typeDescription>
- <name>test.DocMeta</name>
+ <name>org.apache.uima.jcas.tcas.DocMeta</name>
<description/>
<supertypeName>uima.tcas.DocumentAnnotation</supertypeName>
<features>
@@ -15,6 +15,33 @@
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
+ <featureDescription>
+ <name>feat2</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>feat3</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+
+ <featureDescription>
+ <name>arraystr</name>
+ <description/>
+ <rangeTypeName>uima.cas.StringArray</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>arrayints</name>
+ <description/>
+ <rangeTypeName>uima.cas.IntegerArray</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>arrayFs</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>uima.tcas.Annotation</elementType>
+ </featureDescription>
</features>
</typeDescription>
</types>
Modified: uima/uimaj/trunk/uimaj-eclipse-update-site/pom.xml
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-eclipse-update-site/pom.xml?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-eclipse-update-site/pom.xml (original)
+++ uima/uimaj/trunk/uimaj-eclipse-update-site/pom.xml Fri Oct 6 17:39:40 2017
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
- <version>2.8.0</version>
+ <version>2.10.1</version>
<relativePath />
</parent>
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java Fri Oct 6 17:39:40 2017
@@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigura
import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.editor.AnnotationStyle;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.util.XMLSerializer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -91,12 +92,7 @@ public class DotCorpusSerializer {
* @throws CoreException -
*/
public static DotCorpus parseDotCorpus(InputStream dotCorpusStream) throws CoreException {
- DocumentBuilderFactory documentBuilderFacoty = DocumentBuilderFactory.newInstance();
- try {
- documentBuilderFacoty.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- } catch (ParserConfigurationException e1) {
- throw new RuntimeException(e1);
- }
+ DocumentBuilderFactory documentBuilderFacoty = XMLUtils.createDocumentBuilderFactory();
DocumentBuilder documentBuilder;
Modified: uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/XmlDetagger.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/XmlDetagger.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/XmlDetagger.java (original)
+++ uima/uimaj/trunk/uimaj-examples/src/main/java/org/apache/uima/examples/XmlDetagger.java Fri Oct 6 17:39:40 2017
@@ -22,7 +22,6 @@ package org.apache.uima.examples;
import java.io.InputStream;
import java.util.Iterator;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -33,11 +32,10 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ResourceInitializationException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.helpers.DefaultHandler;
/**
@@ -55,16 +53,8 @@ public class XmlDetagger extends CasAnno
*/
public static final String PARAM_XMLTAG = "XmlTagContainingText";
- private SAXParserFactory parserFactory = SAXParserFactory.newInstance();
- { try {
- parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- } catch (SAXNotRecognizedException | SAXNotSupportedException
- | ParserConfigurationException e) {
- throw new RuntimeException(e);
- }
- }
-
-
+ private SAXParserFactory parserFactory = XMLUtils.createSAXParserFactory();
+
private Type sourceDocInfoType;
private String mXmlTagContainingText = null;
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmlDetagger.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmlDetagger.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmlDetagger.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/components/XmlDetagger.java Fri Oct 6 17:39:40 2017
@@ -36,6 +36,7 @@ import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.util.InvalidXMLException;
import org.apache.uima.util.XMLInputSource;
@@ -60,16 +61,7 @@ public class XmlDetagger extends CasAnno
*/
public static final String PARAM_TEXT_TAG = "XmlTagContainingText";
- private SAXParserFactory parserFactory = SAXParserFactory.newInstance();
-
- { try {
- parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- } catch (SAXNotRecognizedException | SAXNotSupportedException
- | ParserConfigurationException e) {
- throw new RuntimeException(e);
- }
- }
-
+ private SAXParserFactory parserFactory = XMLUtils.createSAXParserFactory();
private Type sourceDocInfoType;
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java Fri Oct 6 17:39:40 2017
@@ -100,6 +100,7 @@ import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.XmiCasDeserializer;
import org.apache.uima.internal.util.Timer;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ResourceManager;
import org.apache.uima.resource.ResourceSpecifier;
import org.apache.uima.tools.cpm.PerformanceReportDialog;
@@ -572,8 +573,7 @@ public class MainFrame extends JFrame {
setXcasFileOpenDir(xmiCasFile.getParentFile());
Timer time = new Timer();
time.start();
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ SAXParserFactory saxParserFactory = XMLUtils.createSAXParserFactory();
SAXParser parser = saxParserFactory.newSAXParser();
XmiCasDeserializer xmiCasDeserializer = new XmiCasDeserializer(getCas().getTypeSystem());
getCas().reset();
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASFileOpenEventHandler.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASFileOpenEventHandler.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASFileOpenEventHandler.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/XCASFileOpenEventHandler.java Fri Oct 6 17:39:40 2017
@@ -30,6 +30,7 @@ import javax.xml.parsers.SAXParserFactor
import org.apache.uima.cas.impl.XCASDeserializer;
import org.apache.uima.internal.util.Timer;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.tools.cvd.MainFrame;
/**
@@ -61,8 +62,7 @@ public class XCASFileOpenEventHandler im
this.main.setXcasFileOpenDir(xcasFile.getParentFile());
Timer time = new Timer();
time.start();
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ SAXParserFactory saxParserFactory = XMLUtils.createSAXParserFactory();
SAXParser parser = saxParserFactory.newSAXParser();
XCASDeserializer xcasDeserializer = new XCASDeserializer(this.main.getCas()
.getTypeSystem());
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/docanalyzer/AnnotationViewerDialog.java Fri Oct 6 17:39:40 2017
@@ -41,12 +41,29 @@ import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
-import javax.swing.*;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.ListCellRenderer;
+import javax.swing.SpringLayout;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
@@ -57,6 +74,7 @@ import org.apache.uima.analysis_engine.A
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.internal.util.BrowserUtil;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.tools.images.Images;
import org.apache.uima.tools.stylemap.ColorParser;
@@ -552,7 +570,7 @@ public class AnnotationViewerDialog exte
Document parse = null;
try {
stream = new FileInputStream(aStyleMapFile);
- DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ DocumentBuilder db = XMLUtils.createDocumentBuilderFactory().newDocumentBuilder();
parse = db.parse(stream);
} catch (FileNotFoundException e) {
throw new UIMARuntimeException(e);
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/stylemap/StyleMapXmlParser.java Fri Oct 6 17:39:40 2017
@@ -28,6 +28,7 @@ import javax.xml.parsers.ParserConfigura
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
+import org.apache.uima.internal.util.XMLUtils;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -58,8 +59,7 @@ public class StyleMapXmlParser extends D
public StyleMapXmlParser(String xmlFile) {
try {
// create new SAX Parser
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ SAXParserFactory saxParserFactory = XMLUtils.createSAXParserFactory();
SAXParser parser = saxParserFactory.newSAXParser();
XMLReader reader = parser.getXMLReader();
Modified: uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java?rev=1811354&r1=1811353&r2=1811354&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java (original)
+++ uima/uimaj/trunk/uimaj-tools/src/main/java/org/apache/uima/tools/util/htmlview/AnnotationViewGenerator.java Fri Oct 6 17:39:40 2017
@@ -42,6 +42,7 @@ import org.apache.uima.UIMARuntimeExcept
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.analysis_engine.TypeOrFeature;
import org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData;
+import org.apache.uima.internal.util.XMLUtils;
import org.apache.uima.resource.metadata.Capability;
import org.apache.uima.resource.metadata.TypeDescription;
import org.apache.uima.resource.metadata.TypeSystemDescription;
@@ -86,9 +87,7 @@ public class AnnotationViewGenerator {
*/
public AnnotationViewGenerator(File aOutputDir) {
mOutputDir = aOutputDir;
- mTFactory = TransformerFactory.newInstance();
- mTFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
- mTFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
+ mTFactory = XMLUtils.createTransformerFactory();
// the viewer uses several files located via the classpath
// parse xsl files into templates