ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r991554 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse: ./ cpcontainer/ revdepexplorer/ ui/editors/xml/ ui/menu/ ui/views/ workspaceresolver/
Date Wed, 01 Sep 2010 14:42:09 GMT
Author: hibou
Date: Wed Sep  1 14:42:09 2010
New Revision: 991554

URL: http://svn.apache.org/viewvc?rev=991554&view=rev
Log:
Improvement of error reporting: all errors are now reported via a popup and in the problems
view

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyResolveJob.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ResolveRequest.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/IvyUtil.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/SyncIvyFilesJob.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/RetrieveAction.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/views/ReportView.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/CachedIvy.java
Wed Sep  1 14:42:09 2010
@@ -69,7 +69,7 @@ public abstract class CachedIvy {
         this.ivySettingsLastModified = ivySettingsLastModified;
     }
 
-    private void setConfStatus(IvyDEException ex) {
+    public void setErrorMarker(IvyDEException ex) {
         IvyMarkerManager ivyMarkerManager = IvyPlugin.getDefault().getIvyMarkerManager();
         IStatus status;
         if (ex != null) {
@@ -95,11 +95,29 @@ public abstract class CachedIvy {
 
     protected abstract boolean isResolveInWorkspace();
 
-    public Ivy getCachedIvy() throws IvyDEException {
+    public Ivy getCachedIvy() {
         if (ivy != null) {
             return ivy;
         }
-        return getIvy();
+        try {
+            getIvy();
+            setErrorMarker(null);
+            return ivy;
+        } catch (IvyDEException e) {
+            setErrorMarker(e);
+            return null;
+        }
+    }
+
+    public Ivy getSafelyIvy() {
+        try {
+            getIvy();
+            setErrorMarker(null);
+            return ivy;
+        } catch (IvyDEException e) {
+            setErrorMarker(e);
+            return null;
+        }
     }
 
     public Ivy getIvy() throws IvyDEException {
@@ -126,18 +144,13 @@ public abstract class CachedIvy {
                             "Parsing error of the default Ivy settings",
                             "The default Ivy settings file could not be parsed: " + e.getMessage(),
                             e);
-                    setConfStatus(ex);
                     throw ex;
                 } catch (IOException e) {
                     ivy = null;
-                    IvyDEException ex = new IvyDEException(
-                            "Read error of the default Ivy settings",
+                    throw new IvyDEException("Read error of the default Ivy settings",
                             "The default Ivy settings file could not be read: " + e.getMessage(),
e);
-                    setConfStatus(ex);
-                    throw ex;
                 }
             }
-            setConfStatus(null);
             return ivy;
         }
 
@@ -146,11 +159,8 @@ public abstract class CachedIvy {
         try {
             url = new URL(settingsPath);
         } catch (MalformedURLException e) {
-            IvyDEException ex = new IvyDEException("Incorrect url of the Ivy settings",
-                    "The Ivy settings url '" + settingsPath + "' is incorrect: " + e.getMessage(),
-                    e);
-            setConfStatus(ex);
-            throw ex;
+            throw new IvyDEException("Incorrect url of the Ivy settings", "The Ivy settings
url '"
+                    + settingsPath + "' is incorrect: " + e.getMessage(), e);
         }
         if (url.getProtocol().startsWith("file")) {
             // first try the standard way
@@ -172,32 +182,25 @@ public abstract class CachedIvy {
                     ivySettingsLastModified = 0;
                 } catch (ParseException e) {
                     ivy = null;
-                    IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
+                    throw new IvyDEException("Parsing error of the Ivy settings",
                             "The ivy settings file '" + settingsPath + "' could not be parsed:
"
                                     + e.getMessage(), e);
-                    setConfStatus(ex);
-                    throw ex;
                 } catch (IOException e) {
                     ivy = null;
-                    IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
+                    throw new IvyDEException("Read error of the Ivy settings",
                             "The ivy settings file '" + settingsPath + "' could not be read:
"
                                     + e.getMessage(), e);
-                    setConfStatus(ex);
-                    throw ex;
                 }
             }
         }
-        setConfStatus(null);
         return ivy;
     }
 
     private Ivy getIvy(File file) throws IvyDEException {
         String ivySettingsPath = getIvySettingsPath();
         if (!file.exists()) {
-            IvyDEException ex = new IvyDEException("Ivy settings file not found",
-                    "The Ivy settings file '" + ivySettingsPath + "' cannot be found", null);
-            setConfStatus(ex);
-            throw ex;
+            throw new IvyDEException("Ivy settings file not found", "The Ivy settings file
'"
+                    + ivySettingsPath + "' cannot be found", null);
         }
 
         if (file.lastModified() != ivySettingsLastModified || !isLoadSettingsOnDemandPath())
{
@@ -212,18 +215,14 @@ public abstract class CachedIvy {
                 ivy.configure(file);
             } catch (ParseException e) {
                 ivy = null;
-                IvyDEException ex = new IvyDEException("Parsing error of the Ivy settings",
+                throw new IvyDEException("Parsing error of the Ivy settings",
                         "The ivy settings file '" + ivySettingsPath + "' could not be parsed:
"
                                 + e.getMessage(), e);
-                setConfStatus(ex);
-                throw ex;
             } catch (IOException e) {
                 ivy = null;
-                IvyDEException ex = new IvyDEException("Read error of the Ivy settings",
+                throw new IvyDEException("Read error of the Ivy settings",
                         "The ivy settings file '" + ivySettingsPath + "' could not be read:
"
                                 + e.getMessage(), e);
-                setConfStatus(ex);
-                throw ex;
             }
             ivySettingsLastModified = file.lastModified();
         }
@@ -259,29 +258,23 @@ public abstract class CachedIvy {
                     try {
                         is = new FileInputStream(getProject().getLocation().append(file).toFile());
                     } catch (FileNotFoundException e) {
-                        IvyDEException ex = new IvyDEException("Property file not found",
-                                "The property file '" + file + "' could not be found", e);
-                        setConfStatus(ex);
-                        throw ex;
+                        throw new IvyDEException("Property file not found", "The property
file '"
+                                + file + "' could not be found", e);
                     }
                 } else {
                     try {
                         is = new FileInputStream(file);
                     } catch (FileNotFoundException e) {
-                        IvyDEException ex = new IvyDEException("Property file not found",
-                                "The property file '" + file + "' was not found", e);
-                        setConfStatus(ex);
-                        throw ex;
+                        throw new IvyDEException("Property file not found", "The property
file '"
+                                + file + "' was not found", e);
                     }
                 }
                 Properties props = new Properties();
                 try {
                     props.load(is);
                 } catch (IOException e) {
-                    IvyDEException ex = new IvyDEException("Not a property file",
-                            "The property file '" + file + "' could not be loaded", e);
-                    setConfStatus(ex);
-                    throw ex;
+                    throw new IvyDEException("Not a property file", "The property file '"
+ file
+                            + "' could not be loaded", e);
                 }
                 try {
                     is.close();
@@ -315,46 +308,71 @@ public abstract class CachedIvy {
         return file;
     }
 
-    public ModuleDescriptor getCachedModuleDescriptor() throws IvyDEException {
+    public ModuleDescriptor getCachedModuleDescriptor() {
         if (md != null) {
             return md;
         }
-        return getModuleDescriptor(getCachedIvy());
+        try {
+            if (ivy == null) {
+                ivy = getIvy();
+            }
+            getModuleDescriptor(ivy);
+            setErrorMarker(null);
+            return md;
+        } catch (IvyDEException e) {
+            setErrorMarker(e);
+            return null;
+        }
     }
 
     public ModuleDescriptor getModuleDescriptor() throws IvyDEException {
         return getModuleDescriptor(getIvy());
     }
 
+    public ModuleDescriptor getCachedModuleDescriptor(Ivy i) {
+        if (md != null) {
+            return md;
+        }
+        try {
+            getModuleDescriptor(i);
+            setErrorMarker(null);
+            return md;
+        } catch (IvyDEException e) {
+            setErrorMarker(e);
+            return null;
+        }
+    }
+
+    public ModuleDescriptor getSafelyModuleDescriptor(Ivy i) {
+        try {
+            getModuleDescriptor(i);
+            setErrorMarker(null);
+            return md;
+        } catch (IvyDEException e) {
+            setErrorMarker(e);
+            return null;
+        }
+    }
+
     public ModuleDescriptor getModuleDescriptor(Ivy i) throws IvyDEException {
         File file = getIvyFile();
         if (!file.exists()) {
-            IvyDEException ex = new IvyDEException("Ivy file not found", "The ivy.xml file
'"
+            throw new IvyDEException("Ivy file not found", "The ivy.xml file '"
                     + file.getAbsolutePath() + "' was not found", null);
-            setConfStatus(ex);
-            throw ex;
         }
         try {
             md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(i.getSettings(),
                 file.toURI().toURL(), false);
-            setConfStatus(null);
             return md;
         } catch (MalformedURLException e) {
-            IvyDEException ex = new IvyDEException("Incorrect URL of the Ivy file",
+            throw new IvyDEException("Incorrect URL of the Ivy file",
                     "The URL to the ivy.xml file is incorrect: '" + file.getAbsolutePath()
+ "'", e);
-            setConfStatus(ex);
-            throw ex;
         } catch (ParseException e) {
-            IvyDEException ex = new IvyDEException("Parsing error of the Ivy file",
-                    "The ivy file '" + file.getAbsolutePath() + "' could not be parsed: "
-                            + e.getMessage(), e);
-            setConfStatus(ex);
-            throw ex;
+            throw new IvyDEException("Parsing error of the Ivy file", "The ivy file '"
+                    + file.getAbsolutePath() + "' could not be parsed: " + e.getMessage(),
e);
         } catch (IOException e) {
-            IvyDEException ex = new IvyDEException("Read error of the Ivy file", "The ivy
file '"
+            throw new IvyDEException("Read error of the Ivy file", "The ivy file '"
                     + file.getAbsolutePath() + "' could not be read: " + e.getMessage(),
e);
-            setConfStatus(ex);
-            throw ex;
         }
     }
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainer.java
Wed Sep  1 14:42:09 2010
@@ -216,9 +216,15 @@ public class IvyClasspathContainer imple
         return jdtVersion;
     }
 
-    public URL getReportUrl() throws IvyDEException {
-        Ivy ivy = state.getIvy();
-        ModuleDescriptor md = state.getModuleDescriptor();
+    public URL getReportUrl() {
+        Ivy ivy = state.getCachedIvy();
+        if (ivy == null) {
+            return null;
+        }
+        ModuleDescriptor md = state.getCachedModuleDescriptor(ivy);
+        if (md == null) {
+            return null;
+        }
         String resolveId = ResolveOptions.getDefaultResolveId(md);
         try {
             return ivy.getResolutionCacheManager().getConfigurationResolveReportInCache(resolveId,
@@ -234,4 +240,7 @@ public class IvyClasspathContainer imple
         launchResolve(false,  null);
     }
 
+    public String toString() {
+        return conf.toString();
+    }
 }

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=991554&r1=991553&r2=991554&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 Sep  1 14:42:09 2010
@@ -18,6 +18,7 @@
 package org.apache.ivyde.eclipse.cpcontainer;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -29,7 +30,6 @@ import org.apache.ivy.core.sort.ModuleDe
 import org.apache.ivy.core.sort.WarningNonMatchingVersionReporter;
 import org.apache.ivy.plugins.circular.CircularDependencyStrategy;
 import org.apache.ivy.plugins.circular.WarnCircularDependencyStrategy;
-import org.apache.ivy.plugins.version.LatestVersionMatcher;
 import org.apache.ivy.plugins.version.VersionMatcher;
 import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyMarkerManager;
@@ -80,6 +80,11 @@ public class IvyResolveJob extends Job {
 
         Map/* <ModuleDescriptor, ResolveRequest> */inworkspaceModules = new LinkedHashMap();
         List/* <ResolveRequest> */otherModules = new ArrayList();
+        Map/* <ResolveRequest, Ivy> */ivys = new HashMap();
+        Map/* <ResolveRequest, ModuleDescriptor> */mds = new HashMap();
+
+        MultiStatus errorsStatus = new MultiStatus(IvyPlugin.ID, IStatus.ERROR,
+                "Some projects fail to be resolved", null);
 
         // 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
@@ -90,48 +95,51 @@ public class IvyResolveJob extends Job {
             while (itRequests.hasNext()) {
                 ResolveRequest request = (ResolveRequest) itRequests.next();
                 IvyClasspathContainerState state = request.getContainer().getState();
-                Ivy ivy = state.getIvy();
+                Ivy ivy;
+                try {
+                    ivy = state.getIvy();
+                } catch (IvyDEException e) {
+                    state.setErrorMarker(e);
+                    errorsStatus.add(e.asStatus(IStatus.ERROR, "Failed to configure Ivy for
"
+                            + request));
+                    continue;
+                }
+                state.setErrorMarker(null);
+                ivys.put(request, ivy);
                 // IVYDE-168 : Ivy needs the IvyContext in the threadlocal in order to found
the
                 // default branch
                 ivy.pushContext();
                 ModuleDescriptor md;
                 try {
                     md = state.getModuleDescriptor(ivy);
+                } catch (IvyDEException e) {
+                    state.setErrorMarker(e);
+                    errorsStatus.add(e.asStatus(IStatus.ERROR, "Failed to load the descriptor
for "
+                            + request));
+                    continue;
                 } finally {
                     ivy.popContext();
                 }
+                state.setErrorMarker(null);
+                mds.put(request, md);
                 if (request.getContainer().getConf().isInheritedResolveInWorkspace()) {
                     inworkspaceModules.put(md, request);
                 } else {
                     otherModules.add(request);
                 }
             }
-        } catch (IvyDEException e) {
-            return new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, e.getMessage(),
e);
-        } catch (Throwable e) {
-            return new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, "Unexpected error
["
-                    + e.getClass().getName() + "]: " + e.getMessage(), e);
         } finally {
             Thread.currentThread().setContextClassLoader(old);
         }
 
-        MultiStatus errorsStatus = new MultiStatus(IvyPlugin.ID, IStatus.ERROR,
-                "Some projects fail to be resolved", null);
-
         if (!inworkspaceModules.isEmpty()) {
             // for the modules which are using the workspace resolver, make sure
             // we resolve them in the correct order
 
             // The version matcher used will be the one configured for the first project
             ResolveRequest request = (ResolveRequest) inworkspaceModules.values().iterator().next();
-            Ivy ivy;
-            try {
-                // here we expect to find the ivy and the md we have just computed
-                ivy = request.getContainer().getState().getCachedIvy();
-            } catch (IvyDEException e) {
-                return new Status(IStatus.ERROR, IvyPlugin.ID, "Unexpected error");
-            }
-            VersionMatcher versionMatcher = ivy.getSettings().getVersionMatcher();
+            VersionMatcher versionMatcher = ((Ivy) ivys.get(request)).getSettings()
+                    .getVersionMatcher();
 
             WarningNonMatchingVersionReporter nonMatchingVersionReporter = new WarningNonMatchingVersionReporter();
             CircularDependencyStrategy circularDependencyStrategy = WarnCircularDependencyStrategy
@@ -143,7 +151,9 @@ public class IvyResolveJob extends Job {
             Iterator it = sortedModuleDescriptors.iterator();
             while (it.hasNext()) {
                 request = (ResolveRequest) inworkspaceModules.get(it.next());
-                boolean canceled = launchResolveThread(request, monitor, errorsStatus);
+                Ivy ivy = (Ivy) ivys.get(request);
+                ModuleDescriptor md = (ModuleDescriptor) mds.get(request);
+                boolean canceled = launchResolveThread(request, monitor, errorsStatus, ivy,
md);
                 if (canceled) {
                     return Status.CANCEL_STATUS;
                 }
@@ -154,7 +164,9 @@ public class IvyResolveJob extends Job {
             Iterator it = otherModules.iterator();
             while (it.hasNext()) {
                 ResolveRequest request = (ResolveRequest) it.next();
-                boolean canceled = launchResolveThread(request, monitor, errorsStatus);
+                Ivy ivy = (Ivy) ivys.get(request);
+                ModuleDescriptor md = (ModuleDescriptor) mds.get(request);
+                boolean canceled = launchResolveThread(request, monitor, errorsStatus, ivy,
md);
                 if (canceled) {
                     return Status.CANCEL_STATUS;
                 }
@@ -169,8 +181,8 @@ public class IvyResolveJob extends Job {
     }
 
     private boolean launchResolveThread(ResolveRequest request, IProgressMonitor monitor,
-            MultiStatus errorsStatus) {
-        IStatus jobStatus = launchResolveThread(request, monitor);
+            MultiStatus errorsStatus, Ivy ivy, ModuleDescriptor md) {
+        IStatus jobStatus = launchResolveThread(request, monitor, ivy, md);
         switch (jobStatus.getCode()) {
             case IStatus.CANCEL:
                 return true;
@@ -186,22 +198,14 @@ public class IvyResolveJob extends Job {
         return false;
     }
 
-    private IStatus launchResolveThread(ResolveRequest request, IProgressMonitor monitor)
{
+    private IStatus launchResolveThread(ResolveRequest request, IProgressMonitor monitor,
Ivy ivy,
+            ModuleDescriptor md) {
         if (monitor.isCanceled()) {
             return Status.CANCEL_STATUS;
         }
 
-        IvyClasspathContainerConfiguration conf = request.getContainer().getConf();
-        Ivy ivy;
-        ModuleDescriptor md;
-        try {
-            // here we expect to find the ivy and the md we have just computed
-            ivy = request.getContainer().getState().getCachedIvy();
-            md = request.getContainer().getState().getCachedModuleDescriptor();
-        } catch (IvyDEException e) {
-            return new Status(IStatus.ERROR, IvyPlugin.ID, "Unexpected error");
-        }
         boolean usePreviousResolveIfExist = request.isUsePreviousResolveIfExist();
+        IvyClasspathContainerConfiguration conf = request.getContainer().getConf();
         final IvyClasspathResolver resolver = new IvyClasspathResolver(conf, ivy, md,
                 usePreviousResolveIfExist, monitor);
         final IStatus[] status = new IStatus[1];

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ResolveRequest.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ResolveRequest.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ResolveRequest.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ResolveRequest.java
Wed Sep  1 14:42:09 2010
@@ -35,4 +35,8 @@ public class ResolveRequest {
     public boolean isUsePreviousResolveIfExist() {
         return usePreviousResolveIfExist;
     }
+    
+    public String toString() {
+        return ivycp.toString();
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/IvyUtil.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/IvyUtil.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/IvyUtil.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/IvyUtil.java
Wed Sep  1 14:42:09 2010
@@ -28,6 +28,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
@@ -64,7 +65,7 @@ public final class IvyUtil {
     public static MultiRevisionDependencyDescriptor[] getDependencyDescriptorsByProjects(
             IProject[] projects) {
         // a temporary cache of multi-revision dependency descriptors
-        Map/* <ModuleId, MultiRevisionDependencyDescriptor> */moduleDescriptorMap =
new HashMap();
+        Map/* <ModuleId, MultiRevisionDependencyDescriptor> */mdMap = new HashMap();
 
         for (int i = 0; i < projects.length; i++) {
             List containers = IvyClasspathUtil.getIvyClasspathContainers(projects[i]);
@@ -72,35 +73,29 @@ public final class IvyUtil {
 
             while (containerIter.hasNext()) {
                 IvyClasspathContainer container = (IvyClasspathContainer) containerIter.next();
-                try {
-                    DependencyDescriptor[] descriptors = container.getState().getModuleDescriptor()
-                            .getDependencies();
-                    for (int j = 0; j < descriptors.length; j++) {
-                        DependencyDescriptor descriptor = descriptors[j];
-                        MultiRevisionDependencyDescriptor syncableDependencyDescriptor
-                                = (MultiRevisionDependencyDescriptor) moduleDescriptorMap
-                                        .get(descriptor.getDependencyId());
-
-                        if (syncableDependencyDescriptor == null) {
-                            syncableDependencyDescriptor = new MultiRevisionDependencyDescriptor(
-                                    descriptor.getDependencyId());
-
-                            moduleDescriptorMap.put(descriptor.getDependencyId(),
-                                syncableDependencyDescriptor);
-                        }
+                ModuleDescriptor md = container.getState().getCachedModuleDescriptor();
+                if (md == null) {
+                    continue;
+                }
+                DependencyDescriptor[] descriptors = md.getDependencies();
+                for (int j = 0; j < descriptors.length; j++) {
+                    DependencyDescriptor descriptor = descriptors[j];
+                    MultiRevisionDependencyDescriptor syncabledd = (MultiRevisionDependencyDescriptor)
mdMap
+                            .get(descriptor.getDependencyId());
+
+                    if (syncabledd == null) {
+                        syncabledd = new MultiRevisionDependencyDescriptor(
+                                descriptor.getDependencyId());
 
-                        syncableDependencyDescriptor.addDependencyDescriptor(container, descriptor);
+                        mdMap.put(descriptor.getDependencyId(), syncabledd);
                     }
-                } catch (IvyDEException e) {
-                    e.show(IStatus.ERROR, "Inconsistent Ivy Classpath Container",
-                        "Unable to find a module descriptor associated with"
-                                + container.getState().getIvyFile().getPath());
-                    continue;
+
+                    syncabledd.addDependencyDescriptor(container, descriptor);
                 }
             }
         }
 
-        List/* <MultiRevisionDependencyDescriptor> */sorted = new ArrayList(moduleDescriptorMap
+        List/* <MultiRevisionDependencyDescriptor> */sorted = new ArrayList(mdMap
                 .values());
 
         Collections.sort(sorted, new Comparator/* <MultiRevisionDependencyDescriptor>
*/() {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/SyncIvyFilesJob.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/SyncIvyFilesJob.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/SyncIvyFilesJob.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/revdepexplorer/SyncIvyFilesJob.java
Wed Sep  1 14:42:09 2010
@@ -37,7 +37,6 @@ import org.apache.ivy.plugins.namespace.
 import org.apache.ivy.plugins.namespace.NamespaceTransformer;
 import org.apache.ivy.plugins.parser.xml.UpdateOptions;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater;
-import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainerConfiguration;
@@ -110,20 +109,14 @@ public class SyncIvyFilesJob extends Wor
         for (int i = 0; i < containers.length; i++) {
             IvyClasspathContainer container = containers[i];
 
-            ModuleDescriptor moduleDescriptor;
-            try {
-                moduleDescriptor = container.getState().getModuleDescriptor();
-            } catch (IvyDEException e) {
-                errorStatuses
-                        .add(new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR,
-                                "Failed to get module descriptor at "
-                                        + container.getConf().getIvyXmlPath(), e));
+            ModuleDescriptor md = container.getState().getCachedModuleDescriptor();
+            if (md == null) {
                 continue;
             }
 
             Map/* <ModuleRevisionId, String> */newRevisions = new HashMap();
 
-            DependencyDescriptor[] dependencies = moduleDescriptor.getDependencies();
+            DependencyDescriptor[] dependencies = md.getDependencies();
             for (int j = 0; j < dependencies.length; j++) {
                 for (int k = 0; k < multiRevisionDependencies.length; k++) {
                     MultiRevisionDependencyDescriptor multiRevision = multiRevisionDependencies[k];

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/EclipseIvyModelSettings.java
Wed Sep  1 14:42:09 2010
@@ -21,7 +21,6 @@ import java.util.List;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivyde.common.model.IvyModelSettings;
-import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
@@ -64,12 +63,7 @@ public class EclipseIvyModelSettings imp
         if (ivycp == null) {
             return null;
         }
-        try {
-            return ivycp.getState().getIvy();
-        } catch (IvyDEException e) {
-            e.log(IStatus.WARNING, null);
-            return null;
-        }
+        return ivycp.getState().getCachedIvy();
     }
 
     public void logError(String message, Exception e) {

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/IvyMenuContributionItem.java
Wed Sep  1 14:42:09 2010
@@ -26,13 +26,12 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
-import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyNature;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
@@ -169,7 +168,7 @@ public class IvyMenuContributionItem ext
                 // only one container
                 IvyClasspathContainer ivycp = (IvyClasspathContainer) ((Set) containers.values()
                         .iterator().next()).iterator().next();
-                Ivy ivy = getSafelyIvy(ivycp);
+                Ivy ivy = ivycp.getState().getCachedIvy();
                 if (ivy != null) {
                     addCleanableForSingleContainer(menuManager, items, ivy);
                 }
@@ -258,16 +257,6 @@ public class IvyMenuContributionItem ext
         cplist.add(ivycp);
     }
 
-    private Ivy getSafelyIvy(IvyClasspathContainer ivycp) {
-        try {
-            return ivycp.getState().getCachedIvy();
-        } catch (IvyDEException e) {
-            e.log(IStatus.WARNING, "Cache deletion actions could not be populated for "
-                    + ivycp.getConf().toString());
-            return null;
-        }
-    }
-
     private void addCleanableForSingleContainer(MenuManager menuManager,
             List/* <IContributionItem> */items, Ivy ivy) {
         List/* <Cleanable> */allCleanables = new ArrayList();
@@ -305,7 +294,7 @@ public class IvyMenuContributionItem ext
             Iterator itContainer = set.iterator();
             while (itContainer.hasNext()) {
                 IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
-                Ivy ivy = getSafelyIvy(ivycp);
+                Ivy ivy = ivycp.getState().getCachedIvy();
                 if (ivy != null) {
                     addResolutionCleanable(allCleanables, ivy);
                     addResolutionCleanable(resolutionCleanables, ivy);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/RetrieveAction.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/RetrieveAction.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/RetrieveAction.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/menu/RetrieveAction.java
Wed Sep  1 14:42:09 2010
@@ -19,11 +19,11 @@ package org.apache.ivyde.eclipse.ui.menu
 
 import org.apache.ivy.Ivy;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivyde.eclipse.IvyDEException;
 import org.apache.ivyde.eclipse.IvyMarkerManager;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.retrieve.IvyRetriever;
 import org.apache.ivyde.eclipse.retrieve.StandaloneRetrieveSetup;
+import org.apache.ivyde.eclipse.retrieve.StandaloneRetrieveSetupState;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.action.Action;
@@ -37,13 +37,13 @@ public class RetrieveAction extends Acti
     }
 
     public void run() {
-        Ivy ivy;
-        ModuleDescriptor md;
-        try {
-            ivy = retrieveSetup.getState().getCachedIvy();
-            md = retrieveSetup.getState().getCachedModuleDescriptor();
-        } catch (IvyDEException e) {
-            e.log(IStatus.ERROR, null);
+        StandaloneRetrieveSetupState state = retrieveSetup.getState();
+        Ivy ivy = state.getSafelyIvy();
+        if (ivy == null) {
+            return;
+        }
+        ModuleDescriptor md = state.getSafelyModuleDescriptor(ivy);
+        if (md == null) {
             return;
         }
         IvyRetriever retriever = new IvyRetriever(ivy, md, false, new NullProgressMonitor(),

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/views/ReportView.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/views/ReportView.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/views/ReportView.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/views/ReportView.java
Wed Sep  1 14:42:09 2010
@@ -57,16 +57,8 @@ public class ReportView extends ViewPart
                     .getIvyClasspathContainer((IStructuredSelection) sel);
             if (ivycp != null) {
                 browser.setUrl("");
-                URL report;
-                try {
-                    report = ivycp.getReportUrl();
-                } catch (IvyDEException e) {
-                    e.log(IStatus.WARNING, "Impossible show the report for " + ivycp.getConf());
-                    e.show(IStatus.WARNING, "Show Ivy report failure",
-                        "Impossible show the report for " + ivycp.getConf());
-                    return;
-                }
-                if (!browser.setUrl(report.toExternalForm())) {
+                URL report = ivycp.getReportUrl();
+                if (report == null || !browser.setUrl(report.toExternalForm())) {
                     browser.setUrl("");
                     Message.warn("impossible to set report view url to " + report.toExternalForm());
                 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java?rev=991554&r1=991553&r2=991554&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResolver.java
Wed Sep  1 14:42:09 2010
@@ -171,13 +171,8 @@ public class WorkspaceResolver extends A
             Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
             while (itContainer.hasNext()) {
                 IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
-                ModuleDescriptor md;
-                try {
-                    md = ivycp.getState().getCachedModuleDescriptor();
-                } catch (IvyDEException e) {
-                    IvyPlugin.log(IStatus.WARNING, "Resolve in workspace for '"
-                            + resolvingJavaProject.getElementName() + "' cannot depend on
"
-                            + ivycp.getDescription() + " [" + e.getMessage() + "]", null);
+                ModuleDescriptor md = ivycp.getState().getCachedModuleDescriptor();
+                if (md == null) {
                     continue;
                 }
 



Mime
View raw message