Description of problem:
aether-connector-file throws "number of transferred bytes cannot be negative" Exception just for artifact existence check.
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) Exception in thread "FileRepositoryConnector-1" java.lang.IllegalArgumentException: number of transferred bytes cannot be negative
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) at org.sonatype.aether.util.listener.DefaultTransferEvent.setTransferredBytes(DefaultTransferEvent.java:123)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) at org.sonatype.aether.connector.file.FileRepositoryWorker.run(FileRepositoryWorker.java:299)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:60)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
17:53:38,744 ERROR [stderr] (FileRepositoryConnector-1) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
17:53:38,745 ERROR [stderr] (FileRepositoryConnector-1) at java.lang.Thread.run(Thread.java:744)
Steps to Reproduce:
# This is one artificial procedure to reproduce the issue in BPMS 6.0.2. The bug exists in lower layer (aether-connector-file) so I think there are several scenarios to trigger this issue. BZ1084362 was one scenario in BPMS 6.0.1.
1. Create a maven kjar project which has <dependencyManagement> which loads an artifact from http://maven.repository.redhat.com/techpreview/all (Attached jBPM6Ex18_mvn_number_of_transferred_reproducer.zip)
2. Add http://maven.repository.redhat.com/techpreview/all as a repository in ~/.m2/settings.xml (Attached settings.xml)
3. mvn clean install
4. Comment-out the repository (http://maven.repository.redhat.com/techpreview/all) in ~/.m2/settings.xml
5. Start BPMS
6. Deploy the kjar via [New Deployment Unit] (e.g. groupId=com.sample, artifactId=jbpm-example, version=1.0.0-SNAPSHOT)
java.lang.IllegalArgumentException: number of transferred bytes cannot be negative
and fails to deploy the kjar.
Successfully deploy the kjar. (Because the artifact "org.jboss.ip.component.management:ip-dependency-management-all:1.2-redhat-13" actually exists in local repo)
BZ1018220 also talks about this problem and has been fixed. But this BZ is filed for fixing the root problem.
Created attachment 917072 [details]
Created attachment 917073 [details]
Created attachment 917075 [details]
I have attached a patch to fix this issue for aether-connector-file. You can see why FileRepositoryWorker was causing the "number of transferred bytes cannot be negative".
A big problem is that sonatype-aether (https://github.com/sonatype/sonatype-aether) has been moved to eclipse-aether (http://git.eclipse.org/c/aether/) and the codebase was almost re-written. So I think there is no place to report/fix this issue for sonatype-aether 13.x / 14 version. If droolsjbpm team will maintain sonatype-aether, this patch would help.
As far as I know, Mario planned to fix this issue by upgrading to eclipse aether and Maven 3.1.1. Is this correct?
A workaround could be to clear the local maven repository (the exception is thrown when you have an artifact in your local maven repository and this artifact had been downloaded from different remote repository that you are now looking for (this should be the effect of commenting the repository in settings.xml)).
What Marek wrote is correct. This issue should be resolved migrating kie-ci to eclipse.aether and there is no other possible workaround (except the one he is suggesting) before this migration will be finalized. Actually I pushed that migration on master yesterday, but today I had to revert that commit because we realized it caused an incompatibility problem in guvnor between sisu.guice (used by maven 3.1.x/3.2.x) and guice (used by errai). Michael Anstis is currently working to find a fix for this last problem.