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 125426 Details for
Bug 264111
NPE in SimpleArtifactRepositoryFactory
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]
Fix + tests v01
patch.txt (text/plain), 9.59 KB, created by
John Arthorne
on 2009-02-11 13:40:15 EST
(
hide
)
Description:
Fix + tests v01
Filename:
MIME Type:
Creator:
John Arthorne
Created:
2009-02-11 13:40:15 EST
Size:
9.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.p2.tests >Index: src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java,v >retrieving revision 1.17 >diff -u -r1.17 SimpleArtifactRepositoryTest.java >--- src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java 30 Dec 2008 15:58:14 -0000 1.17 >+++ src/org/eclipse/equinox/p2/tests/artifact/repository/SimpleArtifactRepositoryTest.java 11 Feb 2009 18:39:11 -0000 >@@ -45,32 +45,32 @@ > } > } > >- public void testGetActualLocation1() throws URISyntaxException { >+ public void testGetActualLocation1() throws Exception { > URI base = new URI("http://localhost/artifactRepository"); > assertEquals(new URI(base + "/artifacts.xml"), SimpleArtifactRepository.getActualLocation(base, false)); > } > >- public void testGetActualLocation2() throws URISyntaxException { >+ public void testGetActualLocation2() throws Exception { > URI base = new URI("http://localhost/artifactRepository/"); > assertEquals(new URI(base + "artifacts.xml"), SimpleArtifactRepository.getActualLocation(base, false)); > } > >- public void testGetActualLocation3() throws URISyntaxException { >+ public void testGetActualLocation3() throws Exception { > URI base = new URI("http://localhost/artifactRepository/artifacts.xml"); > assertEquals(base, SimpleArtifactRepository.getActualLocation(base, false)); > } > >- public void testGetActualLocationCompressed1() throws URISyntaxException { >+ public void testGetActualLocationCompressed1() throws Exception { > URI base = new URI("http://localhost/artifactRepository"); > assertEquals(new URI(base + "/artifacts.jar"), SimpleArtifactRepository.getActualLocation(base, true)); > } > >- public void testGetActualLocationCompressed2() throws URISyntaxException { >+ public void testGetActualLocationCompressed2() throws Exception { > URI base = new URI("http://localhost/artifactRepository/"); > assertEquals(new URI(base + "artifacts.jar"), SimpleArtifactRepository.getActualLocation(base, true)); > } > >- public void testGetActualLocationCompressed3() throws URISyntaxException { >+ public void testGetActualLocationCompressed3() throws Exception { > URI base = new URI("http://localhost/artifactRepository/artifacts.jar"); > assertEquals(base, SimpleArtifactRepository.getActualLocation(base, true)); > } >@@ -141,6 +141,16 @@ > fail("Repository should create artifact.xml"); > } > >+ public void testLoadInvalidLocation() { >+ try { >+ getArtifactRepositoryManager().loadRepository(new URI("file:d:/foo"), getMonitor()); >+ } catch (ProvisionException e) { >+ //expected >+ } catch (URISyntaxException e) { >+ fail("4.99", e); >+ } >+ } >+ > public void test_248772() { > SimpleArtifactRepositoryFactory factory = new SimpleArtifactRepositoryFactory(); > URI location = null; >#P org.eclipse.equinox.p2.artifact.repository >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java,v >retrieving revision 1.3 >diff -u -r1.3 CompositeArtifactRepositoryFactory.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java 8 Jan 2009 22:27:33 -0000 1.3 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java 11 Feb 2009 18:39:13 -0000 >@@ -43,9 +43,9 @@ > boolean compress = true; > if (PROTOCOL_FILE.equals(location.getScheme())) { > local = true; >- localFile = new File(CompositeArtifactRepository.getActualLocation(location, true).getPath()); >+ localFile = URIUtil.toFile(CompositeArtifactRepository.getActualLocation(location, true)); > if (!localFile.exists()) { >- localFile = new File(CompositeArtifactRepository.getActualLocation(location, false).getPath()); >+ localFile = URIUtil.toFile(CompositeArtifactRepository.getActualLocation(location, false)); > compress = false; > } > } else { >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties,v >retrieving revision 1.22 >diff -u -r1.22 messages.properties >--- src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties 9 Jan 2009 20:34:25 -0000 1.22 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/messages.properties 11 Feb 2009 18:39:13 -0000 >@@ -19,6 +19,7 @@ > ecf_configuration_error=Transport initialization error. > io_incompatibleVersion=\ > Simple artifact repository has incompatible version {0}; expected {1}. >+io_invalidLocation=Invalid repository location: {0} > mirroring=Mirroring: > > repoFailedWrite=Unable to write to repository: {0}. >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java,v >retrieving revision 1.18 >diff -u -r1.18 Messages.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java 9 Jan 2009 20:34:26 -0000 1.18 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/Messages.java 11 Feb 2009 18:39:13 -0000 >@@ -22,6 +22,7 @@ > public static String io_failedRead; > public static String ecf_configuration_error; > public static String io_incompatibleVersion; >+ public static String io_invalidLocation; > public static String SignatureVerification_failedRead; > public static String SignatureVerification_invalidContent; > public static String SignatureVerification_invalidFileContent; >Index: src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java,v >retrieving revision 1.71 >diff -u -r1.71 SimpleArtifactRepository.java >--- src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 7 Nov 2008 22:48:06 -0000 1.71 >+++ src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java 11 Feb 2009 18:39:13 -0000 >@@ -20,7 +20,8 @@ > import org.eclipse.equinox.internal.p2.artifact.processors.md5.MD5Verifier; > import org.eclipse.equinox.internal.p2.artifact.repository.*; > import org.eclipse.equinox.internal.p2.artifact.repository.Messages; >-import org.eclipse.equinox.internal.p2.core.helpers.*; >+import org.eclipse.equinox.internal.p2.core.helpers.FileUtils; >+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*; > import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.*; > import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; >@@ -217,11 +218,11 @@ > } > } > >- public static URI getActualLocation(URI base, boolean compress) { >+ public static URI getActualLocation(URI base, boolean compress) throws IOException { > return getActualLocation(base, compress ? JAR_EXTENSION : XML_EXTENSION); > } > >- private static URI getActualLocation(URI base, String extension) { >+ private static URI getActualLocation(URI base, String extension) throws IOException { > final String name = CONTENT_FILENAME + extension; > String spec = base.toString(); > if (spec.endsWith(name)) >@@ -233,7 +234,7 @@ > try { > return new URI(spec); > } catch (URISyntaxException e) { >- return null; >+ throw new IOException(NLS.bind(Messages.io_invalidLocation, spec)); > } > } > >Index: src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java,v >retrieving revision 1.6 >diff -u -r1.6 SimpleArtifactRepositoryFactory.java >--- src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java 14 Nov 2008 22:00:16 -0000 1.6 >+++ src/org/eclipse/equinox/internal/provisional/spi/p2/artifact/repository/SimpleArtifactRepositoryFactory.java 11 Feb 2009 18:39:13 -0000 >@@ -43,9 +43,9 @@ > boolean compress = true; > if (PROTOCOL_FILE.equals(location.getScheme())) { > local = true; >- localFile = new File(SimpleArtifactRepository.getActualLocation(location, true).getPath()); >+ localFile = URIUtil.toFile(SimpleArtifactRepository.getActualLocation(location, true)); > if (!localFile.exists()) { >- localFile = new File(SimpleArtifactRepository.getActualLocation(location, false).getPath()); >+ localFile = URIUtil.toFile(SimpleArtifactRepository.getActualLocation(location, false)); > compress = false; > } > } else {
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 264111
: 125426