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 50013 Details for
Bug 154471
WST code assumes IResource.getLocation() returns a non-null value
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Example patch of some mods I made to WST sse/xml code to eliminate NPE's
patch.txt (text/plain), 8.03 KB, created by
John O'Shea
on 2006-09-13 04:32:03 EDT
(
hide
)
Description:
Example patch of some mods I made to WST sse/xml code to eliminate NPE's
Filename:
MIME Type:
Creator:
John O'Shea
Created:
2006-09-13 04:32:03 EDT
Size:
8.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.core >Index: src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/xml/plugins/org.eclipse.wst.xml.core/src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java,v >retrieving revision 1.4 >diff -u -r1.4 AbstractNestedValidator.java >--- src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java 14 Apr 2006 00:53:54 -0000 1.4 >+++ src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java 13 Sep 2006 08:20:04 -0000 >@@ -21,7 +21,6 @@ > import org.eclipse.core.resources.IMarker; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.ISchedulingRule; >@@ -47,8 +46,6 @@ > private static final String REFERENCED_FILE_ERROR_OPEN = "referencedFileError("; //$NON-NLS-1$ > private static final String REFERENCED_FILE_ERROR_CLOSE = ")"; //$NON-NLS-1$ > private static final String REFERENCED_FILE_ERROR = "referencedFileError"; //$NON-NLS-1$ >- private static final String FILE_PROTOCOL_NO_SLASH = "file:"; //$NON-NLS-1$ >- private static final String FILE_PROTOCOL = "file:///"; //$NON-NLS-1$ > private static final String GROUP_NAME = "groupName"; //$NON-NLS-1$ > private final String GET_FILE = "getFile"; //$NON-NLS-1$ > private final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$ >@@ -235,8 +232,7 @@ > Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, NLS.bind(getValidatorName(), new String[]{file.getFullPath().toString()})); > reporter.displaySubtask(this, message); > >- IPath path = file.getLocation(); >- String uri = createURIForFilePath(path.toString()); >+ String uri = file.getLocationURI().toString(); > > clearMarkers(file, this, reporter); > ValidationReport valreport = validate(uri, inputstream, context); >@@ -310,29 +306,7 @@ > return false; > } > >- /** >- * Format a file name into a correct URI. >- * This is a convenience method for subclasses. >- * >- * @param filename >- * The file name to format. >- * @return >- * >- * The formatted URI. >- */ >- private String createURIForFilePath(String filename) >- { >- if(!filename.startsWith(FILE_PROTOCOL_NO_SLASH)) >- { >- while(filename.startsWith("/")) //$NON-NLS-1$ >- { >- filename = filename.substring(1); >- } >- filename = FILE_PROTOCOL + filename; >- } >- return filename; >- } >- >+ > /** > * Create markers for the valiation messages generated from the validation. > * >#P org.eclipse.wst.sse.core >Index: src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/sse/plugins/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java,v >retrieving revision 1.33 >diff -u -r1.33 FileBufferModelManager.java >--- src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java 6 Apr 2006 04:36:21 -0000 1.33 >+++ src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java 13 Sep 2006 08:20:05 -0000 >@@ -18,6 +18,7 @@ > import java.io.IOException; > import java.io.InputStream; > import java.net.MalformedURLException; >+import java.net.URI; > import java.net.URL; > import java.util.Hashtable; > import java.util.Map; >@@ -149,12 +150,12 @@ > * resolver > */ > class CommonURIResolver implements URIResolver { >- IPath fLocation; >+ URI fLocation; > IPath fPath; > final static String SEPARATOR = "/"; //$NON-NLS-1$ >- final static String FILE_PREFIX = "file://"; //$NON-NLS-1$ >+ //final static String FILE_PREFIX = "file://"; //$NON-NLS-1$ > >- CommonURIResolver(IPath path, IPath location) { >+ CommonURIResolver(IPath path, URI location) { > fLocation = location; > fPath = path; > } >@@ -175,22 +176,8 @@ > return getLocationByURI(uri, baseReference, false); > } > >- public String getLocationByURI(String uri, String baseReference, boolean resolveCrossProjectLinks) { >- boolean baseHasPrefix = baseReference != null && baseReference.startsWith(FILE_PREFIX); >- String reference = null; >- if (baseHasPrefix) { >- reference = baseReference; >- } >- else { >- reference = FILE_PREFIX + baseReference; >- } >- String result = URIResolverPlugin.createResolver().resolve(reference, null, uri); >- // Logger.log(Logger.INFO_DEBUG, >- // "URIResolverPlugin.createResolver().resolve(" >- // + reference + ", null, " +uri+") = " + result); >- if (!baseHasPrefix && result.startsWith(FILE_PREFIX) && result.length() > FILE_PREFIX.length()) { >- result = result.substring(FILE_PREFIX.length()); >- } >+ public String getLocationByURI(String uri, String baseReference, boolean resolveCrossProjectLinks) { >+ String result = URIResolverPlugin.createResolver().resolve(baseReference, null, uri); > return result; > } > >@@ -199,7 +186,7 @@ > } > > public IContainer getRootLocation() { >- String root = URIResolverPlugin.createResolver().resolve(FILE_PREFIX + getFileBaseLocation(), null, SEPARATOR); >+ String root = URIResolverPlugin.createResolver().resolve(getFileBaseLocation(), null, SEPARATOR); > IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(root)); > for (int i = 0; i < files.length; i++) { > if ((files[i].getType() & IResource.FOLDER) == IResource.FOLDER) { >@@ -406,9 +393,8 @@ > IProject project = workspaceFile.getProject(); > resolver = (URIResolver) project.getAdapter(URIResolver.class); > if (resolver == null) { >- resolver = new CommonURIResolver(workspaceFile.getFullPath(), workspaceFile.getLocation()); >- } >- resolver.setFileBaseLocation(workspaceFile.getLocation().toString()); >+ resolver = new CommonURIResolver(workspaceFile.getFullPath(), workspaceFile.getLocationURI()); >+ } > } > else { > resolver = new ExternalURIResolver(location); >Index: src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/sse/plugins/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java,v >retrieving revision 1.21 >diff -u -r1.21 ModelManagerImpl.java >--- src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java 20 Apr 2006 20:38:27 -0000 1.21 >+++ src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java 13 Sep 2006 08:20:06 -0000 >@@ -483,7 +483,7 @@ > URIResolver resolver = (URIResolver) project.getAdapter(URIResolver.class); > if (resolver == null) > resolver = new ProjectResolver(project); >- resolver.setFileBaseLocation(file.getLocation().toString()); >+ resolver.setFileBaseLocation(file.getLocationURI().toString()); > return resolver; > } > >#P org.eclipse.wst.xml.ui >Index: src/org/eclipse/wst/xml/ui/internal/hyperlink/XMLHyperlinkDetector.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/xml/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/hyperlink/XMLHyperlinkDetector.java,v >retrieving revision 1.17 >diff -u -r1.17 XMLHyperlinkDetector.java >--- src/org/eclipse/wst/xml/ui/internal/hyperlink/XMLHyperlinkDetector.java 10 May 2006 07:21:34 -0000 1.17 >+++ src/org/eclipse/wst/xml/ui/internal/hyperlink/XMLHyperlinkDetector.java 13 Sep 2006 08:20:08 -0000 >@@ -155,7 +155,7 @@ > } > else { > if (location.segmentCount() > 1) >- baseLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(location).getLocation().toString(); >+ baseLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(location).getLocationURI().toString(); > else > baseLoc = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(location).toString(); > }
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 154471
:
49941
|
49943
|
49944
|
49945
|
49946
| 50013