notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2049 - in development/main/transit/core/handler/src: main/net/dpml/transit/artifact test/net/dpml/transit/artifact
- From: niclas AT hedhman.org
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2049 - in development/main/transit/core/handler/src: main/net/dpml/transit/artifact test/net/dpml/transit/artifact
- Date: Sat, 12 Mar 2005 18:01:28 -0500
Author: niclas AT hedhman.org
Date: Sat Mar 12 18:01:27 2005
New Revision: 2049
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Artifact.java
development/main/transit/core/handler/src/test/net/dpml/transit/artifact/ArtifactTestCase.java
Log:
A OutOfMemoryError happened if the version was placed before the internal
reference identifier.
Modified:
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Artifact.java
==============================================================================
---
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Artifact.java
(original)
+++
development/main/transit/core/handler/src/main/net/dpml/transit/artifact/Artifact.java
Sat Mar 12 18:01:27 2005
@@ -46,17 +46,27 @@
//
------------------------------------------------------------------------
/**
- * Creation of a new artifact instance using a supplied uri
specification. An
- * artifact uri contains the protocol identifier, an optional type, a
group
+ * Creation of a new artifact instance using a supplied uri
specification.
+ * An artifact uri contains the protocol identifier, a type, a group
* designator, a name, and an optional version identifier.
* <p>The following represent valid artifact uri examples:</p>
*
* <ul>
- * <li>artifact:jar:metro/cache/dpml-cache-main#1.0.0</li>
- * <li>artifact:metro/cache/dpml-cache-main#1.0.0</li>
- * <li>artifact:metro/cache/dpml-cache-main</li>
+ * <li>artifact:jar:dpml/transit/dpml-transit-main#1.0.0</li>
+ * <li>artifact:jar:dpml/transit/dpml-transit-main</li>
* </ul>
*
+ * <p>
+ * If there is a internal reference identifier which is marked by the
+ * exclamation mark followed by slash (!/) it will be stripped. The
+ * version part can be either before or after such identifier. Example;
+ * <pre>
+ * artifact:war:jmx-html/jmx-html#1.3!/images/abc.png
+ * artifact:war:jmx-html/jmx-html!/images/abc.png#1.3
+ * </pre>
+ * The above uris will both be referencing
+ * <code>artifact:war:jmx-html/jmx-html#1.3</code>
+ * </p>
* @param uri the artifact uri
* @return the new artifact
* @exception java.net.URISyntaxException if the supplied uri is not
valid.
@@ -81,7 +91,7 @@
{
String path = uri.substring( 0, asterix );
int versionPos = uri.indexOf( "#" );
- if( versionPos == -1 )
+ if( versionPos < asterix )
{
return createArtifact( path );
}
Modified:
development/main/transit/core/handler/src/test/net/dpml/transit/artifact/ArtifactTestCase.java
==============================================================================
---
development/main/transit/core/handler/src/test/net/dpml/transit/artifact/ArtifactTestCase.java
(original)
+++
development/main/transit/core/handler/src/test/net/dpml/transit/artifact/ArtifactTestCase.java
Sat Mar 12 18:01:27 2005
@@ -187,11 +187,27 @@
assertEquals( artifact.toString(), spec );
}
+ public void testInternalReference1() throws Exception
+ {
+ final String spec = "artifact:jar:group/sub-group/name#version";
+ final String url = spec + "!/some/resource.abc";
+ Artifact artifact = Artifact.createArtifact( url );
+ assertEquals( spec, artifact.toString() );
+ }
+
+ public void testInternalReference2() throws Exception
+ {
+ final String spec = "artifact:jar:group/sub-group/name#version";
+ final String url =
"artifact:jar:group/sub-group/name!/some/resource.abc#version";
+ Artifact artifact = Artifact.createArtifact( url );
+ assertEquals( spec, artifact.toString() );
+ }
+
public void testExternalFormWithNonDefaultType() throws Exception
{
final String spec = "artifact:block:group/sub-group/name#version";
Artifact artifact = Artifact.createArtifact( spec );
- assertEquals( artifact.toString(), spec );
+ assertEquals( spec, spec, artifact.toString() );
}
public void testEquality() throws Exception
@@ -199,7 +215,7 @@
final String spec = "artifact:jar:group/sub-group/name#version";
Artifact artifact1 = Artifact.createArtifact( spec );
Artifact artifact2 = Artifact.createArtifact( spec );
- assertTrue( artifact1.equals( artifact2 ) );
+ assertTrue( spec, artifact1.equals( artifact2 ) );
}
public void testInequality() throws Exception
- svn commit: r2049 - in development/main/transit/core/handler/src: main/net/dpml/transit/artifact test/net/dpml/transit/artifact, niclas, 03/12/2005
Archive powered by MHonArc 2.6.24.