Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated XMLReaderFactory by SAXParserFactory #594

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.net.URLDecoder;
import java.net.URLEncoder;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.TransformerException;

import org.eclipse.core.runtime.IProgressMonitor;
Expand All @@ -42,7 +44,6 @@
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

/**
* If a cache flag is set in the layer style blackboard this interceptor will return a
Expand Down Expand Up @@ -213,10 +214,18 @@ private Filter readFilter(String textData) {
GMLFilterDocument filterDocument = new GMLFilterDocument(filterGeometry);

try {
// parse xml
XMLReader reader = XMLReaderFactory.createXMLReader();

// parse XML

SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);

SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();

reader.setContentHandler(filterDocument);
reader.parse(input);

} catch (Exception e) {
return Filter.INCLUDE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.net.URLDecoder;
import java.net.URLEncoder;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.TransformerException;

import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -49,7 +51,6 @@
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

/**
* If a filter or a query is in the layer style blackboard under the key: the {@link #KEY} then this
Expand Down Expand Up @@ -302,10 +303,18 @@ private Filter readFilter(String textData) {
GMLFilterDocument filterDocument = new GMLFilterDocument(filterGeometry);

try {
// parse xml
XMLReader reader = XMLReaderFactory.createXMLReader();

// parse XML

SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);

SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();

reader.setContentHandler(filterDocument);
reader.parse(input);

} catch (Exception e) {
return Filter.INCLUDE;
}
Expand Down
Loading