You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2009/02/25 15:32:38 UTC

svn commit: r747796 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: META-INF/MANIFEST.MF src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java

Author: hibou
Date: Wed Feb 25 14:32:38 2009
New Revision: 747796

URL: http://svn.apache.org/viewvc?rev=747796&view=rev
Log:
IVYDE-35:
 - add an optional dependency on xerces
 - make the ivy resolve process thread have an IvyDE class loader in its context, so in Ivy the SaxParserFactory will find xerces

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF?rev=747796&r1=747795&r2=747796&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/META-INF/MANIFEST.MF Wed Feb 25 14:32:38 2009
@@ -19,7 +19,8 @@
  org.apache.ivyde.eclipse.ui.preferences,
  org.apache.ivyde.eclipse.ui.views,
  org.apache.ivyde.eclipse.ui.wizards
-Require-Bundle: org.eclipse.ui,
+Require-Bundle: org.apache.xerces;resolution:=optional,
+ org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.jface.text,
  org.eclipse.ui.editors,

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java?rev=747796&r1=747795&r2=747796&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java Wed Feb 25 14:32:38 2009
@@ -187,6 +187,10 @@
         final IStatus[] status = new IStatus[1];
         final IClasspathEntry[][] classpathEntries = new IClasspathEntry[1][];
 
+        // Ivy use the SaxParserFactory, and we want it to instanciate the xerces parser which is in
+        // the dependencies of IvyDE, so accessible via the current classloader
+        ClassLoader old = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(IvyResolveJob.class.getClassLoader());
         try {
             this.ivy = conf.getIvy();
             this.md = conf.getModuleDescriptor();
@@ -195,6 +199,8 @@
         } catch (Throwable e) {
             return new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, "Unexpected error ["
                     + e.getClass().getCanonicalName() + "]: " + e.getMessage(), e);
+        } finally {
+            Thread.currentThread().setContextClassLoader(old);
         }
 
         Thread resolver = new Thread() {
@@ -211,15 +217,17 @@
                     List problemMessages;
 
                     // context Classloader hook for commonlogging used by httpclient
+                    // It will also be used by the SaxParserFactory in Ivy
                     ClassLoader old = Thread.currentThread().getContextClassLoader();
                     Thread.currentThread().setContextClassLoader(
                         IvyResolveJob.class.getClassLoader());
                     try {
-                        Map/*<ModuleRevisionId, IvyNode>*/ dependencies = Collections.EMPTY_MAP;
+                        Map/* <ModuleRevisionId, IvyNode> */dependencies = Collections.EMPTY_MAP;
                         Set configurations = new HashSet();
                         configurations.addAll(conf.getConfs());
                         if (conf.getInheritedDoRetrieve()) {
-                            configurations.addAll(Arrays.asList(conf.getInheritedRetrieveConfs().split(",")));
+                            configurations.addAll(Arrays.asList(conf.getInheritedRetrieveConfs()
+                                    .split(",")));
                         }
 
                         if (configurations.contains("*")) {