Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 111385 Details for
Bug 245830
ClasspathEntry illegally instantiates AssertionFailedException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
245830.txt (text/plain), 15.61 KB, created by
Jerome Lanneluc
on 2008-09-01 04:52:56 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-09-01 04:52:56 EDT
Size:
15.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaProject.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v >retrieving revision 1.410 >diff -u -r1.410 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 27 Jun 2008 16:03:51 -0000 1.410 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 1 Sep 2008 08:50:32 -0000 >@@ -34,7 +34,6 @@ > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ProjectScope; > import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.AssertionFailedException; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -844,7 +843,7 @@ > /* > * Reads and decode an XML classpath string > */ >- public IClasspathEntry[] decodeClasspath(String xmlClasspath, Map unknownElements) throws IOException, AssertionFailedException { >+ public IClasspathEntry[] decodeClasspath(String xmlClasspath, Map unknownElements) throws IOException, ClasspathEntry.AssertionFailedException { > > ArrayList paths = new ArrayList(); > IClasspathEntry defaultOutput = null; >@@ -2357,7 +2356,7 @@ > * As a side effect, unknown elements are stored in the given map (if not null) > * Throws exceptions if the file cannot be accessed or is malformed. > */ >- public IClasspathEntry[] readFileEntriesWithException(Map unknownElements) throws CoreException, IOException, AssertionFailedException { >+ public IClasspathEntry[] readFileEntriesWithException(Map unknownElements) throws CoreException, IOException, ClasspathEntry.AssertionFailedException { > String xmlClasspath; > IFile rscFile = this.project.getFile(JavaProject.CLASSPATH_FILENAME); > if (rscFile.exists()) { >@@ -2412,7 +2411,7 @@ > } catch (IOException e) { > Util.log(e, "Exception while reading " + getPath().append(JavaProject.CLASSPATH_FILENAME)); //$NON-NLS-1$ > return JavaProject.INVALID_CLASSPATH; >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > Util.log(e, "Exception while reading " + getPath().append(JavaProject.CLASSPATH_FILENAME)); //$NON-NLS-1$ > return JavaProject.INVALID_CLASSPATH; > } >@@ -2500,7 +2499,7 @@ > IClasspathEntry resolvedEntry = null; > try { > resolvedEntry = JavaCore.getResolvedClasspathEntry(rawEntry); >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > // Catch the assertion failure > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992 > break; >@@ -2585,7 +2584,7 @@ > IClasspathEntry resolvedEntry = null; > try { > resolvedEntry = manager.getResolvedClasspathEntry(rawEntry, usePreviousSession); >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > // Catch the assertion failure and set status instead > // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=55992 > unresolvedEntryStatus = new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage()); >Index: model/org/eclipse/jdt/internal/core/ClasspathEntry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java,v >retrieving revision 1.102 >diff -u -r1.102 ClasspathEntry.java >--- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 19 Aug 2008 12:53:19 -0000 1.102 >+++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 1 Sep 2008 08:50:31 -0000 >@@ -24,7 +24,6 @@ > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.AssertionFailedException; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; >@@ -58,6 +57,15 @@ > * @see IClasspathEntry > */ > public class ClasspathEntry implements IClasspathEntry { >+ >+ public static class AssertionFailedException extends RuntimeException { >+ >+ private static final long serialVersionUID = -171699380721189572L; >+ >+ public AssertionFailedException(String message) { >+ super(message); >+ } >+ } > > public static final String TAG_CLASSPATH = "classpath"; //$NON-NLS-1$ > public static final String TAG_CLASSPATHENTRY = "classpathentry"; //$NON-NLS-1$ >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.407 >diff -u -r1.407 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 29 Aug 2008 11:19:57 -0000 1.407 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 1 Sep 2008 08:50:32 -0000 >@@ -1134,7 +1134,7 @@ > new JavaModelStatus( > IJavaModelStatusConstants.INVALID_CLASSPATH_FILE_FORMAT, > Messages.bind(Messages.classpath_cannotReadClasspathFile, javaProject.getElementName())); >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > classpath = JavaProject.INVALID_CLASSPATH; > status = > new JavaModelStatus( >Index: model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java,v >retrieving revision 1.31 >diff -u -r1.31 CopyPackageFragmentRootOperation.java >--- model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java 27 Jun 2008 16:03:51 -0000 1.31 >+++ model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java 1 Sep 2008 08:50:31 -0000 >@@ -11,7 +11,6 @@ > package org.eclipse.jdt.internal.core; > > import org.eclipse.core.resources.*; >-import org.eclipse.core.runtime.AssertionFailedException; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.jdt.core.*; >@@ -188,7 +187,7 @@ > case IClasspathEntry.CPE_LIBRARY: > try { > return JavaCore.newLibraryEntry(this.destination, entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported()); >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > IJavaModelStatus status = new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage()); > throw new JavaModelException(status); > } >@@ -199,7 +198,7 @@ > case IClasspathEntry.CPE_VARIABLE: > try { > return JavaCore.newVariableEntry(entry.getPath(), entry.getSourceAttachmentPath(), entry.getSourceAttachmentRootPath(), entry.getAccessRules(), entry.getExtraAttributes(), entry.isExported()); >- } catch (AssertionFailedException e) { >+ } catch (ClasspathEntry.AssertionFailedException e) { > IJavaModelStatus status = new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, e.getMessage()); > throw new JavaModelException(status); > } >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.623 >diff -u -r1.623 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 26 Aug 2008 11:52:52 -0000 1.623 >+++ model/org/eclipse/jdt/core/JavaCore.java 1 Sep 2008 08:50:31 -0000 >@@ -103,7 +103,6 @@ > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.IWorkspaceRunnable; > import org.eclipse.core.resources.ResourcesPlugin; >-import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; > import org.eclipse.core.runtime.IExtension; >@@ -3765,11 +3764,9 @@ > boolean isExported) { > > if (containerPath == null) { >- Assert.isTrue(false, "Container path cannot be null"); //$NON-NLS-1$ >+ throw new ClasspathEntry.AssertionFailedException("Container path cannot be null"); //$NON-NLS-1$ > } else if (containerPath.segmentCount() < 1) { >- Assert.isTrue( >- false, >- "Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ >+ throw new ClasspathEntry.AssertionFailedException("Illegal classpath container path: \'" + containerPath.makeRelative().toString() + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$//$NON-NLS-2$ > } > return new ClasspathEntry( > IPackageFragmentRoot.K_SOURCE, >@@ -3952,13 +3949,13 @@ > IClasspathAttribute[] extraAttributes, > boolean isExported) { > >- if (path == null) Assert.isTrue(false, "Library path cannot be null"); //$NON-NLS-1$ >- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute: " + path); //$NON-NLS-1$ >+ if (path == null) throw new ClasspathEntry.AssertionFailedException("Library path cannot be null"); //$NON-NLS-1$ >+ if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute: " + path); //$NON-NLS-1$ > if (sourceAttachmentPath != null) { > if (sourceAttachmentPath.isEmpty()) { > sourceAttachmentPath = null; // treat empty path as none > } else if (!sourceAttachmentPath.isAbsolute()) { >- Assert.isTrue(false, "Source attachment path '" //$NON-NLS-1$ >+ throw new ClasspathEntry.AssertionFailedException("Source attachment path '" //$NON-NLS-1$ > + sourceAttachmentPath > + "' for IClasspathEntry must be absolute"); //$NON-NLS-1$ > } >@@ -4007,7 +4004,7 @@ > */ > public static IClasspathEntry newProjectEntry(IPath path, boolean isExported) { > >- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ >+ if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ > > return newProjectEntry( > path, >@@ -4072,7 +4069,7 @@ > IClasspathAttribute[] extraAttributes, > boolean isExported) { > >- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ >+ if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ > > return new ClasspathEntry( > IPackageFragmentRoot.K_SOURCE, >@@ -4274,10 +4271,10 @@ > */ > public static IClasspathEntry newSourceEntry(IPath path, IPath[] inclusionPatterns, IPath[] exclusionPatterns, IPath specificOutputLocation, IClasspathAttribute[] extraAttributes) { > >- if (path == null) Assert.isTrue(false, "Source path cannot be null"); //$NON-NLS-1$ >- if (!path.isAbsolute()) Assert.isTrue(false, "Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ >- if (exclusionPatterns == null) Assert.isTrue(false, "Exclusion pattern set cannot be null"); //$NON-NLS-1$ >- if (inclusionPatterns == null) Assert.isTrue(false, "Inclusion pattern set cannot be null"); //$NON-NLS-1$ >+ if (path == null) throw new ClasspathEntry.AssertionFailedException("Source path cannot be null"); //$NON-NLS-1$ >+ if (!path.isAbsolute()) throw new ClasspathEntry.AssertionFailedException("Path for IClasspathEntry must be absolute"); //$NON-NLS-1$ >+ if (exclusionPatterns == null) throw new ClasspathEntry.AssertionFailedException("Exclusion pattern set cannot be null"); //$NON-NLS-1$ >+ if (inclusionPatterns == null) throw new ClasspathEntry.AssertionFailedException("Inclusion pattern set cannot be null"); //$NON-NLS-1$ > > return new ClasspathEntry( > IPackageFragmentRoot.K_SOURCE, >@@ -4418,11 +4415,9 @@ > IClasspathAttribute[] extraAttributes, > boolean isExported) { > >- if (variablePath == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ >+ if (variablePath == null) throw new ClasspathEntry.AssertionFailedException("Variable path cannot be null"); //$NON-NLS-1$ > if (variablePath.segmentCount() < 1) { >- Assert.isTrue( >- false, >- "Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ >+ throw new ClasspathEntry.AssertionFailedException("Illegal classpath variable path: \'" + variablePath.makeRelative().toString() + "\', must have at least one segment"); //$NON-NLS-1$//$NON-NLS-2$ > } > > return new ClasspathEntry( >@@ -4641,7 +4636,7 @@ > */ > public static void setClasspathContainer(IPath containerPath, IJavaProject[] affectedProjects, IClasspathContainer[] respectiveContainers, IProgressMonitor monitor) throws JavaModelException { > if (affectedProjects.length != respectiveContainers.length) >- Assert.isTrue(false, "Projects and containers collections should have the same size"); //$NON-NLS-1$ >+ throw new ClasspathEntry.AssertionFailedException("Projects and containers collections should have the same size"); //$NON-NLS-1$ > SetContainerOperation operation = new SetContainerOperation(containerPath, affectedProjects, respectiveContainers); > operation.runOperation(monitor); > } >@@ -4692,7 +4687,7 @@ > IProgressMonitor monitor) > throws JavaModelException { > >- if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$ >+ if (path == null) throw new ClasspathEntry.AssertionFailedException("Variable path cannot be null"); //$NON-NLS-1$ > setClasspathVariables(new String[]{variableName}, new IPath[]{ path }, monitor); > } > >@@ -4727,7 +4722,7 @@ > IProgressMonitor monitor) > throws JavaModelException { > >- if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$ >+ if (variableNames.length != paths.length) throw new ClasspathEntry.AssertionFailedException("Variable names and paths collections should have the same size"); //$NON-NLS-1$ > SetVariablesOperation operation = new SetVariablesOperation(variableNames, paths, true/*update preferences*/); > operation.runOperation(monitor); > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.180 >diff -u -r1.180 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 29 Aug 2008 11:20:28 -0000 1.180 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 1 Sep 2008 08:50:34 -0000 >@@ -4579,7 +4579,7 @@ > ClasspathEntry.NO_EXTRA_ATTRIBUTES); > IJavaModelStatus status = JavaConventions.validateClasspathEntry(proj, cp, false); > assertEquals( >- "assertion failed: Source attachment path \'jclMin.zip\' for IClasspathEntry must be absolute", >+ "Source attachment path \'jclMin.zip\' for IClasspathEntry must be absolute", > status.getMessage()); > } finally { > this.deleteProject("P"); >@@ -4607,7 +4607,7 @@ > ); > assertMarkers( > "Unexpected markers", >- "assertion failed: Source attachment path \'tmp.zip\' for IClasspathEntry must be absolute", >+ "Source attachment path \'tmp.zip\' for IClasspathEntry must be absolute", > javaProject); > } finally { > this.deleteProject("P");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 245830
: 111385