jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r467501 - in /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core: SessionImpl.java WorkspaceImpl.java
Date Tue, 24 Oct 2006 21:53:04 GMT
Author: jukka
Date: Tue Oct 24 14:53:03 2006
New Revision: 467501

URL: http://svn.apache.org/viewvc?view=rev&rev=467501
Log:
JCR-602: Replaced last Xerces dependencies.

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?view=diff&rev=467501&r1=467500&r2=467501
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Tue Oct 24 14:53:03 2006
@@ -50,8 +50,6 @@
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
@@ -77,6 +75,9 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
 import javax.security.auth.Subject;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.TransformerException;
 import javax.xml.transform.sax.SAXTransformerFactory;
@@ -1075,16 +1076,13 @@
         ImportHandler handler = (ImportHandler)
                 getImportContentHandler(parentAbsPath, uuidBehavior);
         try {
-            XMLReader parser =
-                    XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
-            parser.setContentHandler(handler);
-            parser.setErrorHandler(handler);
-            // being paranoid...
-            parser.setFeature("http://xml.org/sax/features/namespaces", true);
-            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                    false);
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            factory.setFeature(
+                    "http://xml.org/sax/features/namespace-prefixes", false);
 
-            parser.parse(new InputSource(in));
+            SAXParser parser = factory.newSAXParser();
+            parser.parse(new InputSource(in), handler);
         } catch (SAXException se) {
             // check for wrapped repository exception
             Exception e = se.getException();
@@ -1095,6 +1093,8 @@
                 log.debug(msg);
                 throw new InvalidSerializedDataException(msg, se);
             }
+        } catch (ParserConfigurationException e) {
+            throw new RepositoryException("SAX parser configuration error", e);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&rev=467501&r1=467500&r2=467501
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Tue Oct 24 14:53:03 2006
@@ -40,8 +40,6 @@
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
@@ -62,6 +60,10 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
@@ -726,16 +728,13 @@
         ImportHandler handler =
                 (ImportHandler) getImportContentHandler(parentAbsPath, uuidBehavior);
         try {
-            XMLReader parser =
-                    XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
-            parser.setContentHandler(handler);
-            parser.setErrorHandler(handler);
-            // being paranoid...
-            parser.setFeature("http://xml.org/sax/features/namespaces", true);
-            parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
-                    false);
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            factory.setFeature(
+                    "http://xml.org/sax/features/namespace-prefixes", false);
 
-            parser.parse(new InputSource(in));
+            SAXParser parser = factory.newSAXParser();
+            parser.parse(new InputSource(in), handler);
         } catch (SAXException se) {
             // check for wrapped repository exception
             Exception e = se.getException();
@@ -746,6 +745,8 @@
                 log.debug(msg);
                 throw new InvalidSerializedDataException(msg, se);
             }
+        } catch (ParserConfigurationException e) {
+            throw new RepositoryException("SAX parser configuration error", e);
         }
     }
 



Mime
View raw message