Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 81591 invoked from network); 15 May 2008 20:37:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 May 2008 20:37:56 -0000 Received: (qmail 42479 invoked by uid 500); 15 May 2008 20:37:58 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 42455 invoked by uid 500); 15 May 2008 20:37:58 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 42440 invoked by uid 99); 15 May 2008 20:37:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 May 2008 13:37:58 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 May 2008 20:37:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D0A362388A12; Thu, 15 May 2008 13:37:27 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r656824 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse: ./ cpcontainer/ cpcontainer/fragmentinfo/ ui/actions/ ui/core/model/ ui/editors/ ui/editors/xml/ ui/preferences/ ui/views/ ui/wizards/ Date: Thu, 15 May 2008 20:37:26 -0000 To: notifications@ant.apache.org From: hibou@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080515203727.D0A362388A12@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hibou Date: Thu May 15 13:37:26 2008 New Revision: 656824 URL: http://svn.apache.org/viewvc?rev=656824&view=rev Log: Check everywhere how Exceptions are handled, so they are always precisely logged Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/FileExtFilter.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/IvyClasspathContainerConfiguration.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.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/IvydeContainerPage.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.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/ui/wizards/IvyNewWizard.java ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizardPage.java Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java Thu May 15 13:37:26 2008 @@ -18,7 +18,10 @@ package org.apache.ivyde.eclipse; import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; import java.net.URL; +import java.text.ParseException; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; @@ -35,7 +38,6 @@ import org.apache.ivyde.eclipse.ui.console.IvyConsole; import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper; import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants; -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; @@ -236,7 +238,8 @@ public ResourceBundle getResourceBundle() { try { if (resourceBundle == null) - resourceBundle = ResourceBundle.getBundle("org.apache.ivyde.eclipse.IvyPluginResources"); + resourceBundle = ResourceBundle + .getBundle("org.apache.ivyde.eclipse.IvyPluginResources"); } catch (MissingResourceException x) { resourceBundle = new ResourceBundle() { protected Object handleGetObject(String key) { @@ -281,24 +284,17 @@ } /** - * Get the Ivy instance for the specified project and the settings of the configured container - * on the project. + * Get the Ivy instance for the specified project. * * @param javaProject * the Java project - * @param ivySettingsPath - * the settings to use - * @return the configured Ivy instance, null if it failed + * @return the configured Ivy instance, null if there is no Ivy for this project + * @throws IOException + * @throws ParseException + * @throws FileNotFoundException */ - // TODO: check that every caller of this function can properly handle a returned null public static synchronized Ivy getIvy(IJavaProject javaProject) { - IvyClasspathContainer cp; - try { - cp = IvyClasspathUtil.getIvyClassPathContainer(javaProject); - } catch (JavaModelException e) { - // TODO log and better handle the error - return null; - } + IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(javaProject); if (cp == null) { return null; } @@ -309,14 +305,11 @@ * Get the Ivy instance for the specified project and the specified settings *

* - * @param javaProject - * the Java project * @param ivySettingsPath * the settings to use * @return the configured Ivy instance, null if it failed */ - // TODO: check that every caller of this function can properly handle a returned null - public static synchronized Ivy getIvy(/*IJavaProject javaProject, */String ivySettingsPath) { + public static synchronized Ivy getIvy(String ivySettingsPath) { IvyConfig ic; try { if (ivySettingsPath == null || ivySettingsPath.trim().length() == 0) { @@ -422,6 +415,6 @@ } public BundleContext getBundleContext() { - return this.bundleContext; + return this.bundleContext; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/FileExtFilter.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/FileExtFilter.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/FileExtFilter.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/FileExtFilter.java Thu May 15 13:37:26 2008 @@ -50,8 +50,9 @@ try { IResource[] resources = ((IContainer) element).members(); for (int i = 0; i < resources.length; i++) { - if (select(viewer, parent, resources[i])) + if (select(viewer, parent, resources[i])) { return true; + } } } catch (CoreException e) { IvyPlugin.log(e); 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=656824&r1=656823&r2=656824&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 Thu May 15 13:37:26 2008 @@ -26,14 +26,13 @@ import java.util.Comparator; import org.apache.ivy.Ivy; -import org.apache.ivy.core.module.descriptor.ModuleDescriptor; import org.apache.ivy.core.resolve.ResolveOptions; -import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry; import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.IvyPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IClasspathContainer; @@ -178,12 +177,12 @@ private IvyResolveJob computeClasspathEntries(final boolean usePreviousResolveIfExist, boolean notify, boolean isUser) { try { - // resolve job already running synchronized (this) { if (job != null) { + // resolve job already running return job; } - job = new IvyResolveJob(this, usePreviousResolveIfExist, notify, conf, javaProject); + job = new IvyResolveJob(this, usePreviousResolveIfExist, notify, conf); job.setUser(isUser); job.setRule(RESOLVE_EVENT_RULE); return job; @@ -275,7 +274,8 @@ } } } catch (JavaModelException e) { - Message.error(e.getMessage()); + // unless there are some issues with the JDT, this should never happen + IvyPlugin.log(e); } } @@ -293,15 +293,17 @@ } public URL getReportUrl() { + Ivy ivy = IvyPlugin.getIvy(conf.getInheritedIvySettingsPath()); + if (ivy == null) { + return null; + } + String resolveId = ResolveOptions.getDefaultResolveId(conf.md); try { - Ivy ivy = IvyPlugin.getIvy(conf.getInheritedIvySettingsPath()); - URL ivyURL = ivyXmlFile.toURL(); - ModuleDescriptor md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor( - ivy.getSettings(), ivyURL, false); - String resolveId = ResolveOptions.getDefaultResolveId(md); return ivy.getResolutionCacheManager().getConfigurationResolveReportInCache(resolveId, - md.getConfigurationsNames()[0]).toURL(); - } catch (Exception ex) { + conf.md.getConfigurationsNames()[0]).toURL(); + } catch (MalformedURLException e) { + // should never happen + IvyPlugin.log(IStatus.ERROR, "The URL generated by Ivy is incorrect", e); return null; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfiguration.java Thu May 15 13:37:26 2008 @@ -29,26 +29,31 @@ import java.util.Collection; import java.util.List; +import org.apache.ivy.Ivy; import org.apache.ivy.core.module.descriptor.ModuleDescriptor; import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry; import org.apache.ivyde.eclipse.IvyPlugin; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IJavaProject; /** - * path: - * org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/ivy.xml/conf/ivysetting.xml/acceptedTypes/sourceTypes/javadocTypes/sourceSuffixes/javadocSuffixes/doRetrieve/retrievePattern/order + * path: org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER? ivyXmlPath=ivy.xml &confs=default + * &ivySettingsPath=file:///ivysetting.xml &acceptedTypes=jar &sourceTypes=source + * &javadocTypes=javadoc &sourceSuffixes=-sources,-source,-src + * &javadocSuffixes=-javadocs,-javadoc,-doc,-docs &doRetrieve=true + * &retrievePattern=lib/[conf]/[artifact].[ext] &alphaOrder=true */ public class IvyClasspathContainerConfiguration { - IJavaProject javaProject; + final IJavaProject javaProject; String ivyXmlPath; - List/* */confs = Arrays.asList(new String[] {"default"}); + List/* */confs = Arrays.asList(new String[] {"*"}); String ivySettingsPath; @@ -70,13 +75,29 @@ ModuleDescriptor md; - public IvyClasspathContainerConfiguration(IJavaProject javaProject, String ivyXmlPath, - List confs) { + /** + * Constructor + * + * @param javaProject + * the classpath container's Java project, null is not bind to a + * project + * @param ivyXmlPath + * the path to the ivy.xml + */ + public IvyClasspathContainerConfiguration(IJavaProject javaProject, String ivyXmlPath) { this.javaProject = javaProject; this.ivyXmlPath = ivyXmlPath; - this.confs = confs; } + /** + * Constructor + * + * @param javaProject + * the classpath container's Java project, null is not bind to a + * project + * @param path + * the path of the classpath container + */ public IvyClasspathContainerConfiguration(IJavaProject javaProject, IPath path) { this.javaProject = javaProject; if (path.segmentCount() > 2) { @@ -119,10 +140,10 @@ try { value = parameter.length > 1 ? URLDecoder.decode(parameter[1], "UTF-8") : ""; } catch (UnsupportedEncodingException e) { - // TODO this should not happend, but if it happend it can break eclipse, a project - // can be displayed abnormally. This exception should be raised at the UI level, - // either in the error log or in an popup to the user - throw new RuntimeException(e); + // this should never never happen + String message = "The UTF-8 encoding support is required is decode the path of the container."; + IvyPlugin.log(IStatus.ERROR, message, e); + throw new RuntimeException(message, e); } if (parameter[0].equals("ivyXmlPath")) { ivyXmlPath = value; @@ -162,7 +183,7 @@ } } if (isProjectSpecific) { - // in this V1 version, it is just some paranoïd check + // in this V1 version, it is just some paranoid check checkNonNullConf(); } } @@ -220,10 +241,9 @@ path.append(URLEncoder.encode(Boolean.toString(alphaOrder), "UTF-8")); } } catch (UnsupportedEncodingException e) { - // TODO this should not happend, but if it happend it can break eclipse, a project - // can be displayed abnormally. This exception should be raised at the UI level, - // either in the error log or in an popup to the user - throw new RuntimeException(e); + String message = "The UTF-8 encoding support is required is endecode the path of the container."; + IvyPlugin.log(IStatus.ERROR, message, e); + throw new RuntimeException(message, e); } return new Path(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID).append(path.toString()); } @@ -232,11 +252,15 @@ return ivyXmlPath; } + public IJavaProject getJavaProject() { + return javaProject; + } + public String getInheritedIvySettingsPath() { if (ivySettingsPath == null) { return IvyPlugin.getPreferenceStoreHelper().getIvySettingsPath(); } - if (javaProject == null) { + if (javaProject == null || ivySettingsPath.trim().length() == 0) { return ivySettingsPath; } URL url; @@ -297,6 +321,7 @@ public boolean getInheritedDoRetrieve() { if (javaProject == null) { + // no project means no retrieve possible return false; } if (ivySettingsPath == null) { @@ -338,16 +363,20 @@ } public void resolveModuleDescriptor() throws ParseException, MalformedURLException, IOException { - URL url; md = null; + URL url; if (javaProject != null) { IFile file = javaProject.getProject().getFile(ivyXmlPath); url = new File(file.getLocation().toOSString()).toURL(); } else { url = new File(ivyXmlPath).toURL(); } - md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor( - IvyPlugin.getIvy(getInheritedIvySettingsPath()).getSettings(), url, false); + Ivy ivy = IvyPlugin.getIvy(getInheritedIvySettingsPath()); + if (ivy == null) { + return; + } + md = ModuleDescriptorParserRegistry.getInstance().parseDescriptor(ivy.getSettings(), url, + false); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathInitializer.java Thu May 15 13:37:26 2008 @@ -17,7 +17,6 @@ */ package org.apache.ivyde.eclipse.cpcontainer; -import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.IPackageFragmentExtraInfo; import org.eclipse.core.runtime.CoreException; @@ -51,6 +50,7 @@ try { container = JavaCore.getClasspathContainer(containerPath, project); } catch (JavaModelException ex) { + // unless there are issues with the JDT, this should never happen IvyPlugin.log(IStatus.ERROR, "Unable to get container for " + containerPath.toString(), ex); return; @@ -109,13 +109,7 @@ // force refresh of ivy classpath entry in ui thread Display.getDefault().asyncExec(new Runnable() { public void run() { - IvyClasspathContainer ivycp; - try { - ivycp = IvyClasspathUtil.getIvyClassPathContainer(project); - } catch (JavaModelException e) { - Message.error(e.getMessage()); - return; - } + IvyClasspathContainer ivycp = IvyClasspathUtil.getIvyClasspathContainer(project); if (ivycp != null) { ivycp.scheduleRefresh(true); } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathUtil.java Thu May 15 13:37:26 2008 @@ -17,13 +17,15 @@ */ package org.apache.ivyde.eclipse.cpcontainer; +import java.io.File; +import java.net.URI; +import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; -import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.IvyPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -69,6 +71,7 @@ project.setRawClasspath(entries, project.getOutputLocation(), null); } catch (CoreException e) { + // unless there are issues with the JDT, this should never happen IvyPlugin.log(e); } } @@ -108,8 +111,7 @@ * @return * @throws JavaModelException */ - public static IvyClasspathContainer getIvyClasspathContainer(IStructuredSelection selection) - throws JavaModelException { + public static IvyClasspathContainer getIvyClasspathContainer(IStructuredSelection selection) { if (selection == null) { return null; } @@ -120,7 +122,7 @@ return (IvyClasspathContainer) element; } if (element instanceof IJavaProject) { - return getIvyClassPathContainer((IJavaProject) element); + return getIvyClasspathContainer((IJavaProject) element); } if (element instanceof IAdaptable) { cp = (IvyClasspathContainer) ((IAdaptable) element) @@ -129,7 +131,7 @@ IJavaProject p = (IJavaProject) ((IAdaptable) element) .getAdapter(IJavaProject.class); if (p != null) { - cp = getIvyClassPathContainer(p); + cp = getIvyClasspathContainer(p); } } } @@ -139,37 +141,23 @@ if (element instanceof ClassPathContainer) { // FIXME: we shouldn't check against internal JDT API but there are not adaptable to // useful class - return getIvyClassPathContainer(((ClassPathContainer) element).getJavaProject()); + return getIvyClasspathContainer(((ClassPathContainer) element).getJavaProject()); } } return null; } + public static boolean isIvyClasspathContainer(IPath containerPath) { + return containerPath.segment(0).equals(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID); + } + /** * Search the Ivy classpath container within the specified Java project * * @param javaProject * the project to search into * @return the Ivy classpath container if found, otherwise return null - * @throws JavaModelException */ - public static IvyClasspathContainer getIvyClassPathContainer(IJavaProject javaProject) - throws JavaModelException { - IClasspathEntry[] cpe = javaProject.getRawClasspath(); - for (int i = 0; i < cpe.length; i++) { - IClasspathEntry entry = cpe[i]; - if (isIvyClasspathContainer(entry.getPath())) { - return (IvyClasspathContainer) JavaCore.getClasspathContainer(entry.getPath(), - javaProject); - } - } - return null; - } - - public static boolean isIvyClasspathContainer(IPath containerPath) { - return containerPath.segment(0).equals(IvyClasspathContainer.IVY_CLASSPATH_CONTAINER_ID); - } - public static IvyClasspathContainer getIvyClasspathContainer(IJavaProject javaProject) { try { IClasspathEntry[] entries = javaProject.getRawClasspath(); @@ -186,7 +174,8 @@ } } } catch (JavaModelException e) { - Message.error(e.getMessage()); + // unless there are issues with the JDT, this should never happen + IvyPlugin.log(e); } return null; } 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=656824&r1=656823&r2=656824&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 Thu May 15 13:37:26 2008 @@ -18,6 +18,7 @@ package org.apache.ivyde.eclipse.cpcontainer; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -52,7 +53,6 @@ import org.apache.ivy.core.resolve.DownloadOptions; import org.apache.ivy.core.resolve.ResolveOptions; import org.apache.ivy.core.retrieve.RetrieveOptions; -import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry; import org.apache.ivy.plugins.report.XmlReportParser; import org.apache.ivy.plugins.repository.TransferEvent; import org.apache.ivy.plugins.repository.TransferListener; @@ -94,9 +94,13 @@ private final IvyClasspathContainer container; - public IvyResolveJob(IvyClasspathContainer container, boolean usePreviousResolveIfExist, boolean notify, IvyClasspathContainerConfiguration conf, IJavaProject javaProject) { - super("Resolve " + (javaProject == null ? "" : javaProject.getProject().getName() + "/") + conf.ivyXmlPath - + " dependencies"); + public IvyResolveJob(IvyClasspathContainer container, boolean usePreviousResolveIfExist, + boolean notify, IvyClasspathContainerConfiguration conf) throws FileNotFoundException, + ParseException, IOException { + super("Resolve " + + (conf.getJavaProject() == null ? "" : conf.getJavaProject().getProject() + .getName() + + "/") + conf.ivyXmlPath + " dependencies"); this.container = container; _usePreviousResolveIfExist = usePreviousResolveIfExist; _notify = notify; @@ -276,9 +280,9 @@ problems.append(msg).append("\n"); } status[0] = new Status(IStatus.ERROR, IvyPlugin.ID, IStatus.ERROR, - "Impossible to resolve dependencies of " + conf.md.getModuleRevisionId() - + ":\n" + problems + "\nSee IvyConsole for further details", - null); + "Impossible to resolve dependencies of " + + conf.md.getModuleRevisionId() + ":\n" + problems + + "\nSee IvyConsole for further details", null); return; } @@ -445,8 +449,8 @@ extraAtt.put("classifier", metaClassifier); Artifact metaArtifact = new DefaultArtifact(artifact.getModuleRevisionId(), artifact .getPublicationDate(), artifact.getName(), metaType, "jar", extraAtt); - RepositoryCacheManager cache = ivy.getSettings().getResolver( - artifact.getModuleRevisionId()).getRepositoryCacheManager(); + RepositoryCacheManager cache = ivy.getSettings() + .getResolver(artifact.getModuleRevisionId()).getRepositoryCacheManager(); if (cache instanceof DefaultRepositoryCacheManager) { File metaArtifactFile = ((DefaultRepositoryCacheManager) cache) .getArchiveFileInCache(metaArtifact); @@ -460,32 +464,29 @@ ivy.getResolveEngine().download(metaArtifact, new DownloadOptions()); if (metaArtifactFile.exists()) { return new Path(metaArtifactFile.getAbsolutePath()); - } else { - // meta artifact not found, we store this information to avoid other - // attempts later - Message.info(metaType + " not found for " + artifact); - try { - attempt.getParentFile().mkdirs(); - attempt.createNewFile(); - } catch (IOException e) { - Message.error("impossible to create attempt file " + attempt + ": " + e); - } - return null; } - } - } else { - Message.info("checking " + metaType + " for " + artifact); - ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(metaArtifact, - new DownloadOptions()); - if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) { - return new Path(metaAdr.getLocalFile().getAbsolutePath()); - } else { + // meta artifact not found, we store this information to avoid other + // attempts later Message.info(metaType + " not found for " + artifact); - Message - .verbose("Attempt not stored in cache because a non Default cache implementation is used."); + try { + attempt.getParentFile().mkdirs(); + attempt.createNewFile(); + } catch (IOException e) { + Message.error("impossible to create attempt file " + attempt + ": " + e); + } return null; } } + Message.info("checking " + metaType + " for " + artifact); + ArtifactDownloadReport metaAdr = ivy.getResolveEngine().download(metaArtifact, + new DownloadOptions()); + if (metaAdr.getLocalFile() != null && metaAdr.getLocalFile().exists()) { + return new Path(metaAdr.getLocalFile().getAbsolutePath()); + } + Message.info(metaType + " not found for " + artifact); + Message + .verbose("Attempt not stored in cache because a non Default cache implementation is used."); + return null; } private IPath getSourceAttachment(Path classpathArtifact, Path sourcesArtifact) { @@ -512,13 +513,22 @@ classpathArtifact); if (url == null) { - try { - Path path = javadocArtifact; - if (path != null) { - url = new URL("jar:" + path.toFile().toURI().toURL().toExternalForm() + "!/"); + Path path = javadocArtifact; + if (path != null) { + String u; + try { + u = "jar:" + path.toFile().toURI().toURL().toExternalForm() + "!/"; + try { + url = new URL(u); + } catch (MalformedURLException e) { + // this should not happen + IvyPlugin.log(IStatus.ERROR, + "The jar URL for the javadoc is not formed correctly " + u, e); + } + } catch (MalformedURLException e) { + // this should not happen + IvyPlugin.log(IStatus.ERROR, "The path has not a correct URL: " + path, e); } - } catch (MalformedURLException e) { - // ignored } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvydeContainerPage.java Thu May 15 13:37:26 2008 @@ -61,7 +61,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; @@ -164,8 +163,8 @@ ((IvyClasspathContainer) cp).scheduleResolve(); } } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + // unless there are issues with the JDT, this should never happen + IvyPlugin.log(e); } return true; } @@ -176,8 +175,7 @@ public void setSelection(IClasspathEntry entry) { if (entry == null) { - conf = new IvyClasspathContainerConfiguration(project, "ivy.xml", Arrays - .asList(new String[] {"*"})); + conf = new IvyClasspathContainerConfiguration(project, "ivy.xml"); } else { conf = new IvyClasspathContainerConfiguration(project, entry.getPath()); } @@ -232,7 +230,7 @@ ivyFilePathText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { conf.ivyXmlPath = ivyFilePathText.getText(); - checkIvyXmlFile(); + resolveModuleDescriptor(); refreshConfigurationTable(); checkCompleted(); } @@ -278,7 +276,8 @@ } } } else { - FileDialog dialog = new FileDialog(IvyPlugin.getActiveWorkbenchShell(), SWT.OPEN); + FileDialog dialog = new FileDialog(IvyPlugin.getActiveWorkbenchShell(), + SWT.OPEN); dialog.setText("Choose an ivy.xml"); path = dialog.open(); } @@ -286,7 +285,7 @@ if (path != null) { conf.ivyXmlPath = path; ivyFilePathText.setText(path); - checkIvyXmlFile(); + resolveModuleDescriptor(); refreshConfigurationTable(); checkCompleted(); } @@ -312,6 +311,7 @@ new GridData(GridData.FILL, GridData.FILL, true, true)); confTableViewer.setContentProvider(new IStructuredContentProvider() { public Object[] getElements(Object inputElement) { + resolveModuleDescriptor(); if (conf.md != null) { return conf.md.getConfigurations(); } @@ -374,6 +374,8 @@ projectSpecificButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateFieldsStatus(); + conf.ivySettingsPath = settingsText.getText(); + checkCompleted(); } }); @@ -403,6 +405,12 @@ settingsText .setToolTipText("The url where your ivysettings file can be found. \nUse 'default' to reference the default ivy settings. \nRelative paths are handled relative to the project. Example: 'file://./ivysettings.xml'."); settingsText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); + settingsText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + conf.ivySettingsPath = settingsText.getText(); + checkCompleted(); + } + }); browse = new Button(configComposite, SWT.NONE); browse.setText("Browse"); @@ -413,7 +421,9 @@ try { settingsText.setText(f.toURL().toExternalForm()); } catch (MalformedURLException ex) { - // this cannot happend + // this cannot happen + IvyPlugin.log(IStatus.ERROR, + "The file got from the file browser has not a valid URL", ex); } } } @@ -498,7 +508,7 @@ private void loadFromConf() { ivyFilePathText.setText(conf.ivyXmlPath); - checkIvyXmlFile(); + resolveModuleDescriptor(); confTableViewer.setInput(conf.ivyXmlPath); initTableSelection(); @@ -562,7 +572,7 @@ return null; } - void checkIvyXmlFile() { + void resolveModuleDescriptor() { try { ivyXmlError = null; conf.resolveModuleDescriptor(); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/fragmentinfo/PreferenceStoreInfo.java Thu May 15 13:37:26 2008 @@ -20,7 +20,9 @@ import java.net.MalformedURLException; import java.net.URL; +import org.apache.ivyde.eclipse.IvyPlugin; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.jface.preference.IPreferenceStore; @@ -59,6 +61,7 @@ try { return new URL(srcPath); } catch (MalformedURLException e) { + IvyPlugin.log(IStatus.WARNING, "The path for the doc attachement is not a valid URL", e); return null; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/OpenIvyFileAction.java Thu May 15 13:37:26 2008 @@ -17,13 +17,11 @@ */ package org.apache.ivyde.eclipse.ui.actions; -import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; @@ -53,14 +51,8 @@ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { - IvyClasspathContainer cp; - try { - cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil - .getSelectionInJavaPackageView()); - } catch (JavaModelException e) { - Message.error(e.getMessage()); - return; - } + IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil + .getSelectionInJavaPackageView()); if (cp != null) { IFile file = cp.getIvyFile(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/RefreshAction.java Thu May 15 13:37:26 2008 @@ -17,10 +17,8 @@ */ package org.apache.ivyde.eclipse.ui.actions; -import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; -import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindow; @@ -42,14 +40,8 @@ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { - IvyClasspathContainer cp; - try { - cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil - .getSelectionInJavaPackageView()); - } catch (JavaModelException e) { - Message.error(e.getMessage()); - return; - } + IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil + .getSelectionInJavaPackageView()); if (cp != null) { cp.scheduleRefresh(true); } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/actions/ResolveAction.java Thu May 15 13:37:26 2008 @@ -17,10 +17,8 @@ */ package org.apache.ivyde.eclipse.ui.actions; -import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; -import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.ui.IWorkbenchWindow; @@ -42,14 +40,8 @@ * @see IWorkbenchWindowActionDelegate#run */ public void run(IAction action) { - IvyClasspathContainer cp; - try { - cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil - .getSelectionInJavaPackageView()); - } catch (JavaModelException e) { - Message.error(e.getMessage()); - return; - } + IvyClasspathContainer cp = IvyClasspathUtil.getIvyClasspathContainer(IvyClasspathUtil + .getSelectionInJavaPackageView()); if (cp != null) { cp.scheduleResolve(); } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyFile.java Thu May 15 13:37:26 2008 @@ -25,6 +25,9 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.IStatus; + public class IvyFile { private static final Pattern ATTRIBUTE_NAME_PATTERN = Pattern .compile("[^\"]*\"[\\s]*=[\\s]*([\\w\\-]+)"); @@ -147,12 +150,8 @@ } public int getStringIndexBackward(String string, int documentOffset) { - try { - String text = _doc.substring(0, documentOffset); - return text.lastIndexOf(string); - } catch (Exception e) { - } - return -1; + String text = _doc.substring(0, documentOffset); + return text.lastIndexOf(string); } public int getStringIndexForward(String string) { @@ -160,11 +159,7 @@ } public int getStringIndexForward(String string, int documentOffset) { - try { - return _doc.indexOf(string, documentOffset); - } catch (Exception e) { - } - return -1; + return _doc.indexOf(string, documentOffset); } public Map getAllAttsValues() { @@ -208,7 +203,8 @@ } } } catch (Exception e) { - e.printStackTrace(); + // FIXME : what is really catched here ? + IvyPlugin.log(IStatus.WARNING, "Something bad happened", e); } return result; } @@ -400,6 +396,8 @@ continue; } } catch (IndexOutOfBoundsException e) { + // FIXME hu ? need some comments + IvyPlugin.log(IStatus.WARNING, "Something bad happened", e); return null; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/IvyModel.java Thu May 15 13:37:26 2008 @@ -40,6 +40,7 @@ import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jdt.core.IJavaProject; public class IvyModel { @@ -285,11 +286,8 @@ orgAtt.setValueProvider(new IValueProvider() { public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) { List ret = listDependencyTokenValues(att.getName(), ivyFile); - try { - ret.add(IvyPlugin.getDefault().getPreferenceStore().getString( - PreferenceConstants.ORGANISATION)); - } catch (Exception ex) { - } + ret.add(IvyPlugin.getDefault().getPreferenceStore().getString( + PreferenceConstants.ORGANISATION)); String org = ivyFile.getOrganisation(); if (org != null) { ret.add(org); @@ -428,7 +426,8 @@ ret.add("*"); return (String[]) ret.toArray(new String[ret.size()]); } catch (ParseException e) { - System.err.println(e); + IvyPlugin.log(IStatus.ERROR, "The dependencies of " + mrid + + " could not be parsed", e); return null; } } @@ -482,7 +481,8 @@ ret.add("*"); return (String[]) ret.toArray(new String[ret.size()]); } catch (ParseException e) { - System.err.println(e); + IvyPlugin.log(IStatus.ERROR, "The dependencies of " + + mrid + " could not be parsed", e); return new String[] {"*"}; } } @@ -528,7 +528,8 @@ return (String[]) ret .toArray(new String[ret.size()]); } catch (ParseException e) { - System.err.println(e); + IvyPlugin.log(IStatus.ERROR, "The dependencies of " + + mrid + " could not be parsed", e); return new String[] {"*"}; } } @@ -713,7 +714,8 @@ try { _defaults.load(IvyModel.class.getResourceAsStream("defaults.properties")); } catch (IOException e) { - e.printStackTrace(); + // should never never happen + IvyPlugin.log(IStatus.ERROR, "The default properties could not be loaded", e); } } @@ -725,7 +727,7 @@ return IvyPlugin.getIvy(_javaProject); } - private List listDependencyTokenValues(String att, IvyFile ivyfile) { + List listDependencyTokenValues(String att, IvyFile ivyfile) { Map allAttsValues = ivyfile.getAllAttsValues(); String org = ivyfile.getOrganisation(); if (org != null && !allAttsValues.containsKey("org")) { Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/core/model/PreferenceValueProvider.java Thu May 15 13:37:26 2008 @@ -27,10 +27,6 @@ } public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) { - try { - return new String[] {IvyPlugin.getDefault().getPreferenceStore().getString(_name)}; - } catch (Exception e) { - return null; - } + return new String[] {IvyPlugin.getDefault().getPreferenceStore().getString(_name)}; } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/IvyEditor.java Thu May 15 13:37:26 2008 @@ -17,6 +17,7 @@ */ package org.apache.ivyde.eclipse.ui.editors; +import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; import org.apache.ivyde.eclipse.ui.core.IvyFileEditorInput; @@ -29,6 +30,7 @@ import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jface.dialogs.ErrorDialog; @@ -96,8 +98,8 @@ int index = addPage(new OverviewFormPage(this)); setPageText(index, "Information"); } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + // Should not happen + IvyPlugin.log(IStatus.ERROR, "The overview page could not be created", e); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/IvyContentAssistProcessor.java Thu May 15 13:37:26 2008 @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; +import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.ui.core.model.IvyFile; import org.apache.ivyde.eclipse.ui.core.model.IvyModel; import org.apache.ivyde.eclipse.ui.core.model.IvyTag; @@ -31,6 +32,7 @@ import org.apache.ivyde.eclipse.ui.core.model.Proposal; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jface.text.BadLocationException; @@ -66,7 +68,9 @@ try { ivyFileString = doc.get(0, doc.getLength()); } catch (BadLocationException e) { - e.printStackTrace(); + // Unless there is a bug in JFace, this should never never happen + IvyPlugin.log(IStatus.ERROR, "Getting the content of the document " + doc.toString() + + " failed", e); return null; } IProject project = getProject(); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/NonRuleBasedDamagerRepairer.java Thu May 15 13:37:26 2008 @@ -17,6 +17,8 @@ */ package org.apache.ivyde.eclipse.ui.editors.xml; +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocument; @@ -103,6 +105,8 @@ return new Region(start, end - start); } catch (BadLocationException x) { + // FIXME hu ? needs some comment + IvyPlugin.log(IStatus.WARNING, "Something bad happened", x); } } Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLDoubleClickStrategy.java Thu May 15 13:37:26 2008 @@ -17,6 +17,8 @@ */ package org.apache.ivyde.eclipse.ui.editors.xml; +import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextDoubleClickStrategy; @@ -82,6 +84,8 @@ fText.setSelectedRange(offset, len); return true; } catch (BadLocationException x) { + // FIXME hu ? needs some comment + IvyPlugin.log(IStatus.WARNING, "Something bad happened", x); } return false; @@ -121,6 +125,8 @@ return true; } catch (BadLocationException x) { + // FIXME hu ? needs some comment + IvyPlugin.log(IStatus.WARNING, "Something bad happened", x); } return false; Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyPreferencePage.java Thu May 15 13:37:26 2008 @@ -22,6 +22,7 @@ import org.apache.ivy.Ivy; import org.apache.ivyde.eclipse.IvyPlugin; +import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.preference.BooleanFieldEditor; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.FileFieldEditor; @@ -89,13 +90,14 @@ String f = super.changePressed(); if (f == null) { return null; - } else { - File d = new File(f); - try { - return d.toURL().toExternalForm(); - } catch (MalformedURLException e) { - return null; - } + } + File d = new File(f); + try { + return d.toURL().toExternalForm(); + } catch (MalformedURLException e) { + // should never happen + IvyPlugin.log(IStatus.ERROR, "A file from the file chooser is not an URL", e); + return null; } } @@ -198,8 +200,9 @@ spacerData.horizontalSpan = 3; spacer.setLayoutData(spacerData); - BooleanFieldEditor alphaOrder = new BooleanFieldEditor(PreferenceConstants.ALPHABETICAL_ORDER, - "Order alphabetically the artifacts in the classpath container", fieldParent); + BooleanFieldEditor alphaOrder = new BooleanFieldEditor( + PreferenceConstants.ALPHABETICAL_ORDER, + "Order alphabetically the artifacts in the classpath container", fieldParent); addField(alphaOrder); spacer = new Label(fieldParent, SWT.NONE); 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=656824&r1=656823&r2=656824&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 Thu May 15 13:37:26 2008 @@ -22,7 +22,6 @@ import org.apache.ivy.util.Message; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer; import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil; -import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; @@ -51,13 +50,8 @@ public void selectionChanged(IWorkbenchPart part, ISelection sel) { if (sel instanceof IStructuredSelection) { - IvyClasspathContainer ivycp; - try { - ivycp = IvyClasspathUtil.getIvyClasspathContainer((IStructuredSelection) sel); - } catch (JavaModelException e) { - Message.error(e.getMessage()); - return; - } + IvyClasspathContainer ivycp = IvyClasspathUtil + .getIvyClasspathContainer((IStructuredSelection) sel); if (ivycp != null) { _browser.setUrl(""); URL report = ivycp.getReportUrl(); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizard.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizard.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizard.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizard.java Thu May 15 13:37:26 2008 @@ -24,6 +24,7 @@ import java.io.InputStreamReader; import java.lang.reflect.InvocationTargetException; +import org.apache.ivyde.eclipse.IvyPlugin; import org.apache.ivyde.eclipse.ui.core.IvyFileEditorInput; import org.apache.ivyde.eclipse.ui.editors.IvyEditor; import org.eclipse.core.resources.IContainer; @@ -145,6 +146,8 @@ } stream.close(); } catch (IOException e) { + throw new CoreException(new Status(IStatus.ERROR, IvyPlugin.ID, + "The ivy.xml could not be created", e)); } monitor.worked(1); monitor.setTaskName("Opening file for editing..."); @@ -156,6 +159,8 @@ page.openEditor(new IvyFileEditorInput(file), IvyEditor.ID, true); // IDE.openEditor(page, file, IvyEditor.ID, true); } catch (PartInitException e) { + // this should not happen + IvyPlugin.log(IStatus.ERROR, "The editor could not be opened", e); } } }); Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizardPage.java URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizardPage.java?rev=656824&r1=656823&r2=656824&view=diff ============================================================================== --- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizardPage.java (original) +++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/wizards/IvyNewWizardPage.java Thu May 15 13:37:26 2008 @@ -169,26 +169,25 @@ if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() > 1) + if (ssel.size() > 1) { return; + } Object obj = ssel.getFirstElement(); if (obj instanceof IResource) { IContainer container; - if (obj instanceof IContainer) + if (obj instanceof IContainer) { container = (IContainer) obj; - else + } else { container = ((IResource) obj).getParent(); + } containerText.setText(container.getFullPath().toString()); moduleText.setText(container.getProject().getName()); } } fileText.setText("ivy.xml"); statusText.select(0); - try { - orgText.setText(IvyPlugin.getDefault().getPreferenceStore().getString( - PreferenceConstants.ORGANISATION)); - } catch (Exception ex) { - } + orgText.setText(IvyPlugin.getDefault().getPreferenceStore().getString( + PreferenceConstants.ORGANISATION)); } /**