Release prepare causing exit Code 141 in linux with clearcase
-------------------------------------------------------------

                 Key: SCM-466
                 URL: http://jira.codehaus.org/browse/SCM-466
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-provider-clearcase
    Affects Versions: 1.2
         Environment: Linux
            Reporter: Adrien


Hi
We've been struggling for a while with the release prepare in the linux env.
For some kind of reason, it was not executing the release prepare properly.
The error that we were getting was
[INFO] Checking out file: 
/view/agracia_ETS_FEST_COMMON1.0_int/cc/ETS_FEST/FEST_COMMON/pom.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to enable editing on the POM
Provider message:
The cleartool command failed.
Command output:

Surprisingly, all this was working in windows. Even though we use linux for our 
build we had to use windows for the release prepare plugin.

We investigated for a while but gave up.
We decided to give it another chance and we finally found the issue.
during the edit process., the ClearCaseEditConsumer class was throwing a 
IndexOutOfBound exception which was the source of the problem
We are still wondering why this was working in windows and not linux. The only 
guess is the state of either the thread or the output stream is being handled 
differently in both env.

Now the bug:
in the consumeLine method you do
 int beginIndex = line.indexOf( '"' );
then you try to extract the file name

But sometimes there is no filename 
String fileName = line.substring( beginIndex + 1, line.indexOf( '"', beginIndex 
+ 1 ) );

This cause the IOOE
The line that was causing the issue for us was

Attached activity:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1938)
        at 
org.apache.maven.scm.provider.clearcase.command.edit.ClearCaseEditConsumer.consumeLine(ClearCaseEditConsumer.java:64)
        at 
org.codehaus.plexus.util.cli.StreamPumper.consumeLine(StreamPumper.java:195)
        at org.codehaus.plexus.util.cli.StreamPumper.run(StreamPumper.java:144)
  activity:release_prepare.3...@\ets_ccm_project  "release prepare"

We fixed it by adding

if(beginIndex != -1){
                String fileName = line.substring( beginIndex + 1, line.indexOf( 
'"', beginIndex + 1 ) );
                editFiles.add( new ScmFile( fileName, ScmFileStatus.UNKNOWN ) );
}
instead of 
                String fileName = line.substring( beginIndex + 1, line.indexOf( 
'"', beginIndex + 1 ) );
                editFiles.add( new ScmFile( fileName, ScmFileStatus.UNKNOWN ) );


The other consumers have potentially the same issue so we fixed those as well

I hope that you will be able to fix this in the next release.

In the meantime we are using our own version of the module.

thanks 

Adrien

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to