Description

The thing is: archiva accepts that this kind of artifact version be deployed, but then it doesn't allow you to download it...
In fact, when trying to download, say, the artifactId-2.1.0.beta-2.20080613.125403-1.jar artifact, archiva throws the following exception:

org.apache.maven.archiva.repository.layout.LayoutException: Invalid path to Artifact: filename format is invalid,expected timestamp format in filename.
at java.lang.Throwable.(Throwable.java:57)
at java.lang.Throwable.(Throwable.java:68)
at org.apache.maven.archiva.common.ArchivaException.(ArchivaException.java:38)
at org.apache.maven.archiva.repository.layout.LayoutException.(LayoutException.java:39)
at org.apache.maven.archiva.repository.content.DefaultPathParser.toArtifactReference(DefaultPathParser.java:134)
at org.apache.maven.archiva.repository.content.RepositoryRequest.toArtifactReference(RepositoryRequest.java:121)
at org.apache.maven.archiva.repository.content.RepositoryRequest.toNativePath(RepositoryRequest.java:271)
at org.apache.maven.archiva.web.repository.ProxiedDavServer.process(ProxiedDavServer.java:163)
at org.codehaus.plexus.webdav.servlet.multiplexed.MultiplexedWebDavServlet.service(MultiplexedWebDavServlet.java:119)
at org.apache.maven.archiva.web.repository.RepositoryServlet.service(RepositoryServlet.java:167)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:189)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)
at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
at org.mortbay.http.HttpServer.service(HttpServer.java:909)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

I guess the versioning we used there is quite wrong (in a release process, I think we should not suffix SNAPSHOT after a qualifier...), but the thing is: IMO, archiva should be coherent:
if this naming scheme is incorrect, then archiva should reject the artifact when trying to deploy it (we use the archiva webdav interface when doing mvn deploy).
In fact, it's quite puzzling to having successfully deployed an artifact, but being unable to download it.

Baptiste MATHUS
added a comment - 14/Jun/08 08:07 The server is the one at work. I'll try to find some time next week to see if it fixes/improves the current behaviour. I'll comment (or close) this bug when done.
Thanks for the answer.

After some verifications, I found a workaround. Seems like archiva does not like the "." between version and the SNAPSHOT suffix. Replacing this . with a - makes it downloadable by archiva without problem.
As a reminder, here are the tested pattern:

2.1.0.beta-2.SNAPSHOT CANNOT be downloaded

2.1.0.beta-2-SNAPSHOT is OK

2.1.0.beta2-SNAPSHOT is OK

I guess there's something to do about it. As I said above: either forbid the upload into archiva, else archiva should be fixed to allow download.
In the meantime, we'll now use hyphen instead of dot.

Baptiste MATHUS
added a comment - 16/Jun/08 08:37 After some verifications, I found a workaround. Seems like archiva does not like the "." between version and the SNAPSHOT suffix. Replacing this . with a - makes it downloadable by archiva without problem.
As a reminder, here are the tested pattern:
2.1.0.beta-2.SNAPSHOT CANNOT be downloaded
2.1.0.beta-2-SNAPSHOT is OK
2.1.0.beta2-SNAPSHOT is OK
I guess there's something to do about it. As I said above: either forbid the upload into archiva, else archiva should be fixed to allow download.
In the meantime, we'll now use hyphen instead of dot.
Cheers.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.apache.maven.archiva.repository.content.FilenameParser.expect(FilenameParser.java:107)
at org.apache.maven.archiva.repository.content.DefaultPathParser.toArtifactReference(DefaultPathParser.java:119)
at org.apache.maven.archiva.repository.content.RepositoryRequest.toArtifactReference(RepositoryRequest.java:79)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.fetchContentFromProxies(ArchivaDavResourceFactory.java:529)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.doGet(ArchivaDavResourceFactory.java:439)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.createResource(ArchivaDavResourceFactory.java:256)
at org.apache.maven.archiva.webdav.RepositoryServlet.service(RepositoryServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:189)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)

Mirko Jahn
added a comment - 02/Oct/08 20:07 I have a very similar problem. I get an error 500 when I specify a version with "SNAPSHOT". However, as soon as I use the common pattern "1.0.0.SNAPSHOT", everything is fine.
Here is the stacktrace:
HTTP ERROR: 500
String index out of range: -1
RequestURI=/archiva/repository/sectest/com/xxx/xzy/SNAPSHOT/xzy-20081002.165542-1.pom
Caused by:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.apache.maven.archiva.repository.content.FilenameParser.expect(FilenameParser.java:107)
at org.apache.maven.archiva.repository.content.DefaultPathParser.toArtifactReference(DefaultPathParser.java:119)
at org.apache.maven.archiva.repository.content.RepositoryRequest.toArtifactReference(RepositoryRequest.java:79)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.fetchContentFromProxies(ArchivaDavResourceFactory.java:529)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.doGet(ArchivaDavResourceFactory.java:439)
at org.apache.maven.archiva.webdav.ArchivaDavResourceFactory.createResource(ArchivaDavResourceFactory.java:256)
at org.apache.maven.archiva.webdav.RepositoryServlet.service(RepositoryServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:189)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at com.opensymphony.webwork.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:88)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:722)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:404)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)

Totally agree with you Brett. .SNAPSHOT isn't maven-compliant, and btw we don't use this naming anymore. But as you point out, I guess it should work. At least, I think archiva should be able to serve any content. Particularly, it should be able to serve content that was deployed by the standard maven way.

Baptiste MATHUS
added a comment - 23/Feb/10 07:05 Totally agree with you Brett. .SNAPSHOT isn't maven-compliant, and btw we don't use this naming anymore. But as you point out, I guess it should work. At least, I think archiva should be able to serve any content. Particularly, it should be able to serve content that was deployed by the standard maven way.
Cheers

Brett Porter
added a comment - 31/Dec/10 21:42 On trunk the error is:
Timestamped snapshots must contain the main version, filename was 'MRM-837-20100223.110535-1.jar'
This will need to be checked in both locations.