Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2003-10-14 16:59:34 +0000
committerMichael Valenta2003-10-14 16:59:34 +0000
commit714e2f372de0c79d9a0713c9335dded65ce93e4c (patch)
tree0e631740698a8573f5856fd99906ae89920205db
parent142ddf47170be317faee1bf74ebe5cb611812bc1 (diff)
downloadeclipse.platform.team-714e2f372de0c79d9a0713c9335dded65ce93e4c.tar.gz
eclipse.platform.team-714e2f372de0c79d9a0713c9335dded65ce93e4c.tar.xz
eclipse.platform.team-714e2f372de0c79d9a0713c9335dded65ce93e4c.zip
44609: Remove dependencies on Xerces from Team plugins
-rw-r--r--bundles/org.eclipse.team.core/.classpath1
-rw-r--r--bundles/org.eclipse.team.core/.project1
-rw-r--r--bundles/org.eclipse.team.core/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java37
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java13
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.classpath1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/.project1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java24
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java48
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java21
-rw-r--r--bundles/org.eclipse.team.ui/.classpath1
-rw-r--r--bundles/org.eclipse.team.ui/.project1
-rw-r--r--bundles/org.eclipse.team.ui/plugin.xml1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java27
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java15
16 files changed, 137 insertions, 57 deletions
diff --git a/bundles/org.eclipse.team.core/.classpath b/bundles/org.eclipse.team.core/.classpath
index 02fe18230..c2a45fe37 100644
--- a/bundles/org.eclipse.team.core/.classpath
+++ b/bundles/org.eclipse.team.core/.classpath
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src/"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.team.core/.project b/bundles/org.eclipse.team.core/.project
index 2ed89860c..c3f50735a 100644
--- a/bundles/org.eclipse.team.core/.project
+++ b/bundles/org.eclipse.team.core/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.core</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
<project>org.eclipse.core.runtime</project>
diff --git a/bundles/org.eclipse.team.core/plugin.xml b/bundles/org.eclipse.team.core/plugin.xml
index ed8b7129d..4cbef5874 100644
--- a/bundles/org.eclipse.team.core/plugin.xml
+++ b/bundles/org.eclipse.team.core/plugin.xml
@@ -15,7 +15,6 @@
<requires>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.apache.xerces"/>
</requires>
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
index 01f4d8a19..66f9785ec 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLContentHandler.java
@@ -38,9 +38,10 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
/**
* @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
+ public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
SaveContext ctx = (SaveContext)contextStack.peek();
- if (!localName.equals(ctx.getName())) {
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (!elementName.equals(ctx.getName())) {
// keep going
} else {
last = (SaveContext)contextStack.pop();
@@ -56,9 +57,10 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
*/
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
SaveContext context = new SaveContext();
- context.setName(localName);
+ String elementName = getElementName(namespaceURI, localName, qName);
+ context.setName(elementName);
for (int i = 0; i < atts.getLength(); i++) {
- String attrName = atts.getLocalName(i);
+ String attrName = getAttributeName(atts, i);
String attrValue = atts.getValue(i);
context.putString(attrName, attrValue);
}
@@ -66,8 +68,33 @@ public class SaveContextXMLContentHandler extends DefaultHandler {
buffer = new StringBuffer();
contextStack.push(context);
}
-
+
public SaveContext getSaveContext() {
return last;
}
+
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for subscribers doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
+
+ /*
+ * See getElementName() reasoning for why this method is needed.
+ */
+ private String getAttributeName(Attributes atts, int i) {
+ String localName = atts.getLocalName(i);
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return atts.getQName(i);
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
index a27ac6a1a..1e6edbda9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/SaveContextXMLWriter.java
@@ -24,7 +24,10 @@ import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
-import org.apache.xerces.parsers.SAXParser;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
@@ -191,10 +194,10 @@ public class SaveContextXMLWriter extends PrintWriter {
File file = pluginStateLocation.append(filename).toFile(); //$NON-NLS-1$
if (file.exists()) {
is = new BufferedInputStream(new FileInputStream(file));
- SAXParser parser = new SAXParser();
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
SaveContextXMLContentHandler handler = new SaveContextXMLContentHandler();
- parser.setContentHandler(handler);
- parser.parse(new InputSource(is));
+ parser.parse(new InputSource(is), handler);
return handler.getSaveContext();
}
return null;
@@ -202,6 +205,8 @@ public class SaveContextXMLWriter extends PrintWriter {
throw new TeamException(Policy.bind("RepositoryManager.ioException"), ex); //$NON-NLS-1$
} catch (IOException e) {
throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
+ } catch (ParserConfigurationException e) {
+ throw new TeamException(Policy.bind("RepositoryManager.ioException"), e); //$NON-NLS-1$
} finally {
if(is != null) {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/.classpath b/bundles/org.eclipse.team.cvs.ui/.classpath
index 99cb73b4a..1049098b9 100644
--- a/bundles/org.eclipse.team.cvs.ui/.classpath
+++ b/bundles/org.eclipse.team.cvs.ui/.classpath
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.core.resources"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
diff --git a/bundles/org.eclipse.team.cvs.ui/.project b/bundles/org.eclipse.team.cvs.ui/.project
index 9ca902df0..49e69c4d8 100644
--- a/bundles/org.eclipse.team.cvs.ui/.project
+++ b/bundles/org.eclipse.team.cvs.ui/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.cvs.ui</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.compare</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 152d31a4c..defc08385 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -13,7 +13,6 @@
</library>
</runtime>
<requires>
- <import plugin="org.apache.xerces"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.resources"/>
<import plugin="org.eclipse.ui"/>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
index bbcc4c963..f3f3d58f2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/CommentHistoryContentHandler.java
@@ -41,11 +41,13 @@ class CommentHistoryContentHandler extends DefaultHandler {
String qName,
Attributes atts)
throws SAXException {
- if (localName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
+
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
buffer = new StringBuffer();
return;
}
- if (localName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
+ if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
comments = new Vector(RepositoryManager.MAX_COMMENTS);
return;
}
@@ -55,15 +57,29 @@ class CommentHistoryContentHandler extends DefaultHandler {
* @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
public void endElement(String namespaceURI, String localName, String qName) {
- if (localName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_COMMENT)) {
comments.add(buffer.toString());
buffer = null;
return;
}
- if (localName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
+ if (elementName.equals(RepositoryManager.ELEMENT_COMMIT_HISTORY)) {
RepositoryManager.previousComments = new String[comments.size()];
comments.copyInto(RepositoryManager.previousComments);
return;
}
}
+
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for project sets doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
index d40b0cfdb..75288c944 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoriesViewContentHandler.java
@@ -72,25 +72,26 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
* @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String)
*/
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
-
- if (!localName.equals(tagStack.peek())) {
- throw new SAXException(Policy.bind("RepositoriesViewContentHandler.unmatchedTag", localName)); //$NON-NLS-1$
+
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (!elementName.equals(tagStack.peek())) {
+ throw new SAXException(Policy.bind("RepositoriesViewContentHandler.unmatchedTag", elementName)); //$NON-NLS-1$
}
- if (localName.equals(REPOSITORIES_VIEW_TAG)) {
+ if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
// all done
- } else if (localName.equals(REPOSITORY_TAG)) {
+ } else if (elementName.equals(REPOSITORY_TAG)) {
if (!ignoreElements) {
manager.add(currentRepositoryRoot);
}
currentRepositoryRoot = null;
- } else if (localName.equals(WORKING_SET_TAG)) {
+ } else if (elementName.equals(WORKING_SET_TAG)) {
// This tag is no longer used
ignoreElements = false;
- } else if (localName.equals(CURRENT_WORKING_SET_TAG)) {
+ } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
// This tag is no longer used
ignoreElements = false;
- } else if (localName.equals(MODULE_TAG)) {
+ } else if (elementName.equals(MODULE_TAG)) {
if (! ignoreElements && currentRepositoryRoot != null) {
currentRepositoryRoot.addTags(currentRemotePath,
(CVSTag[]) tags.toArray(new CVSTag[tags.size()]));
@@ -110,10 +111,11 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
String qName,
Attributes atts)
throws SAXException {
-
- if (localName.equals(REPOSITORIES_VIEW_TAG)) {
+
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals(REPOSITORIES_VIEW_TAG)) {
// just started
- } else if (localName.equals(REPOSITORY_TAG)) {
+ } else if (elementName.equals(REPOSITORY_TAG)) {
String id = atts.getValue(ID_ATTRIBUTE);
if (id == null) {
throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", REPOSITORY_TAG, ID_ATTRIBUTE)); //$NON-NLS-1$
@@ -133,14 +135,14 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
((CVSRepositoryLocation)root).setReadLocation(readLocation);
String writeLocation = atts.getValue(WRITE_ID_ATTRIBUTE);
((CVSRepositoryLocation)root).setWriteLocation(writeLocation);
- } else if (localName.equals(WORKING_SET_TAG)) {
+ } else if (elementName.equals(WORKING_SET_TAG)) {
String name = atts.getValue(NAME_ATTRIBUTE);
if (name == null) {
throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", WORKING_SET_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
}
// Ignore any elements until the corresponding end tag is reached
ignoreElements = true;
- } else if (localName.equals(MODULE_TAG)) {
+ } else if (elementName.equals(MODULE_TAG)) {
String path = atts.getValue(PATH_ATTRIBUTE);
if (path == null) {
throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", MODULE_TAG, PATH_ATTRIBUTE)); //$NON-NLS-1$
@@ -150,7 +152,7 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
path = RepositoryRoot.asDefinedModulePath(path);
}
startModule(path);
- } else if (localName.equals(TAG_TAG)) {
+ } else if (elementName.equals(TAG_TAG)) {
String type = atts.getValue(TYPE_ATTRIBUTE);
if (type == null) {
type = DEFAULT_TAG_TYPE;
@@ -160,7 +162,7 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
throw new SAXException(Policy.bind("RepositoriesViewContentHandler.missingAttribute", TAG_TAG, NAME_ATTRIBUTE)); //$NON-NLS-1$
}
tags.add(new CVSTag(name, getCVSTagType(type)));
- } else if (localName.equals(AUTO_REFRESH_FILE_TAG)) {
+ } else if (elementName.equals(AUTO_REFRESH_FILE_TAG)) {
String path = atts.getValue(FULL_PATH_ATTRIBUTE);
if (path == null) {
// get the old path attribute format which was relative to the module
@@ -175,13 +177,13 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
}
}
if (path != null) autoRefreshFiles.add(path);
- } else if (localName.equals(CURRENT_WORKING_SET_TAG)) {
+ } else if (elementName.equals(CURRENT_WORKING_SET_TAG)) {
// Ignore any elements until the corresponding end tag is reached
ignoreElements = true;
}
// empty buffer
buffer = new StringBuffer();
- tagStack.push(localName);
+ tagStack.push(elementName);
}
private void startModule(String path) {
@@ -202,4 +204,16 @@ public class RepositoriesViewContentHandler extends DefaultHandler {
return CVSTag.VERSION;
}
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for project sets doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
index eee7f8953..b2420f74f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java
@@ -31,7 +31,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.xerces.parsers.SAXParser;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
@@ -428,21 +431,25 @@ public class RepositoryManager {
}
private void readState(InputStream stream) throws IOException, TeamException {
- SAXParser parser = new SAXParser();
- parser.setContentHandler(new RepositoriesViewContentHandler(this));
try {
- parser.parse(new InputSource(stream));
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+ parser.parse(new InputSource(stream), new RepositoriesViewContentHandler(this));
} catch (SAXException ex) {
throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", REPOSITORIES_VIEW_FILE), ex); //$NON-NLS-1$
+ } catch (ParserConfigurationException ex) {
+ throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", REPOSITORIES_VIEW_FILE), ex); //$NON-NLS-1$
}
}
private void readCommentHistory(InputStream stream) throws IOException, TeamException {
- SAXParser parser = new SAXParser();
- parser.setContentHandler(new CommentHistoryContentHandler());
try {
- parser.parse(new InputSource(stream));
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+ parser.parse(new InputSource(stream), new CommentHistoryContentHandler());
} catch (SAXException ex) {
throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", COMMENT_HIST_FILE), ex); //$NON-NLS-1$
+ } catch (ParserConfigurationException ex) {
+ throw new CVSException(Policy.bind("RepositoryManager.parsingProblem", COMMENT_HIST_FILE), ex); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.team.ui/.classpath b/bundles/org.eclipse.team.ui/.classpath
index bd0325657..28f06a050 100644
--- a/bundles/org.eclipse.team.ui/.classpath
+++ b/bundles/org.eclipse.team.ui/.classpath
@@ -5,7 +5,6 @@
<classpathentry kind="src" path="/org.eclipse.team.core"/>
<classpathentry kind="src" path="/org.eclipse.ui"/>
<classpathentry kind="src" path="/org.eclipse.compare"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
diff --git a/bundles/org.eclipse.team.ui/.project b/bundles/org.eclipse.team.ui/.project
index f64f798e5..98a3aebac 100644
--- a/bundles/org.eclipse.team.ui/.project
+++ b/bundles/org.eclipse.team.ui/.project
@@ -3,7 +3,6 @@
<name>org.eclipse.team.ui</name>
<comment></comment>
<projects>
- <project>org.apache.xerces</project>
<project>org.eclipse.compare</project>
<project>org.eclipse.core.boot</project>
<project>org.eclipse.core.resources</project>
diff --git a/bundles/org.eclipse.team.ui/plugin.xml b/bundles/org.eclipse.team.ui/plugin.xml
index a0afb6871..ed1b0d5f9 100644
--- a/bundles/org.eclipse.team.ui/plugin.xml
+++ b/bundles/org.eclipse.team.ui/plugin.xml
@@ -17,7 +17,6 @@
<import plugin="org.eclipse.team.core"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.compare"/>
- <import plugin="org.apache.xerces"/>
</requires>
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
index f3f05277f..1d58bdff1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetContentHandler.java
@@ -32,7 +32,8 @@ public class ProjectSetContentHandler extends DefaultHandler {
* @see ContentHandler#startElement(String, String, String, Attributes)
*/
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- if (localName.equals("psf")) { //$NON-NLS-1$
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
map = new HashMap();
inPsf = true;
String version = atts.getValue("version"); //$NON-NLS-1$
@@ -40,14 +41,14 @@ public class ProjectSetContentHandler extends DefaultHandler {
return;
}
if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
+ if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
if (!inPsf) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_provider_must_be_contained_in_element_psf_4")); //$NON-NLS-1$
inProvider = true;
id = atts.getValue("id"); //$NON-NLS-1$
references = new ArrayList();
return;
}
- if (localName.equals("project")) { //$NON-NLS-1$
+ if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
if (!inProvider) throw new SAXException(Policy.bind("ProjectSetContentHandler.Element_project_must_be_contained_in_element_provider_7")); //$NON-NLS-1$
inProject = true;
String reference = atts.getValue("reference"); //$NON-NLS-1$
@@ -60,18 +61,19 @@ public class ProjectSetContentHandler extends DefaultHandler {
* @see ContentHandler#endElement(String, String, String)
*/
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals("psf")) { //$NON-NLS-1$
+ String elementName = getElementName(namespaceURI, localName, qName);
+ if (elementName.equals("psf")) { //$NON-NLS-1$ //$NON-NLS-2$
inPsf = false;
return;
}
if (isVersionOne) return;
- if (localName.equals("provider")) { //$NON-NLS-1$
+ if (elementName.equals("provider")) { //$NON-NLS-1$ //$NON-NLS-2$
map.put(id, references);
references = null;
inProvider = false;
return;
}
- if (localName.equals("project")) { //$NON-NLS-1$
+ if (elementName.equals("project")) { //$NON-NLS-1$ //$NON-NLS-2$
inProject = false;
return;
}
@@ -84,4 +86,17 @@ public class ProjectSetContentHandler extends DefaultHandler {
public boolean isVersionOne() {
return isVersionOne;
}
+
+ /*
+ * Couldn't figure out from the SAX API exactly when localName vs. qName is used.
+ * However, the XML for project sets doesn't use namespaces so either of the two names
+ * is fine. Therefore, use whichever one is provided.
+ */
+ private String getElementName(String namespaceURI, String localName, String qName) {
+ if (localName != null && localName.length() > 0) {
+ return localName;
+ } else {
+ return qName;
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
index 86807bb76..f29f19f97 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java
@@ -20,7 +20,10 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.xerces.parsers.SAXParser;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
@@ -77,11 +80,11 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
lastFile = filename;
reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$
- SAXParser parser = new SAXParser();
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
ProjectSetContentHandler handler = new ProjectSetContentHandler();
- parser.setContentHandler(handler);
InputSource source = new InputSource(reader);
- parser.parse(source);
+ parser.parse(source, handler);
Map map = handler.getReferences();
List newProjects = new ArrayList();
@@ -114,6 +117,8 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
throw new InvocationTargetException(e);
} catch (TeamException e) {
throw new InvocationTargetException(e);
+ } catch (ParserConfigurationException e) {
+ throw new InvocationTargetException(e);
} finally {
if (reader != null) {
try {
@@ -143,7 +148,7 @@ public class ProjectSetImportWizard extends Wizard implements IImportWizard {
return result[0];
}
- private void createWorkingSet(String workingSetName, IProject[] projects) {
+ /* private */ void createWorkingSet(String workingSetName, IProject[] projects) {
IWorkingSetManager manager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager();
IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
if (oldSet == null) {

Back to the top