#369 Clearcase trigger causes ArrayIndexOutOfBoundsException

2.x
open
None
5
2015-01-24
2013-11-04
No

Triggers are not handled correctly. We've got a trigger that prevents users from adding files

ERROR[0203]:  It is not allowed to create elements in a Dumbo!

Please add the elements as private files.
Be aware that private files in views are NOT back-upped!
So create a copy in your home drive to use these later in the final project.

This policy is enforced to avoid evil-twins when creating files in the regular archive.

cleartool: Warning: Trigger "TR_LNNAME_PREOP" has refused to let lnname proceed.
cleartool: Error: Unable to create element "test_file".

When performing the action, it does not show this custom message but rather shows the following:
'Adding resources to ClearCase' has encountered a problem.

An internal error occurred during: "Adding resources to ClearCase".
0

The Error Log shows the following information:
An internal error occurred during: "Adding resources to ClearCase".

java.lang.ArrayIndexOutOfBoundsException: 0
at net.sourceforge.clearcase.ClearCaseCLIImpl.add(ClearCaseCLIImpl.java:465)
at     net.sourceforge.eclipseccase.ClearCaseProvider.makeFileElement(ClearCaseProvider.java:1408)
at net.sourceforge.eclipseccase.ClearCaseProvider.access$1(ClearCaseProvider.java:1403)
at     net.sourceforge.eclipseccase.ClearCaseProvider$AddOperation.visit(ClearCaseProvider.java:1284)
at net.sourceforge.eclipseccase.ClearCaseProvider.execute(ClearCaseProvider.java:2119)
at net.sourceforge.eclipseccase.ClearCaseProvider.execute(ClearCaseProvider.java:2061)
at net.sourceforge.eclipseccase.ClearCaseProvider.add(ClearCaseProvider.java:314)
at     net.sourceforge.eclipseccase.ui.actions.AddToClearCaseAction$1.run(AddToClearCaseAction.java:60)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at net.sourceforge.eclipseccase.ui.ClearCaseOperation.run(ClearCaseOperation.java:106)
at     org.eclipse.team.internal.ui.actions.JobRunnableContext.run(JobRunnableContext.java:144)
at     org.eclipse.team.internal.ui.actions.JobRunnableContext$ResourceJob.runInWorkspace(JobRunnableContext.java:72)
at     org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



net.sourceforge.clearcase.commandline.output.ClearCaseElementState.check returns null if no patternmatch is found, which causes net.sourceforge.clearcase.ClearCaseCLIImpl.add (which returns result[0]) to go out of bounds if there was output (output != null).

Eclipse Juno 3.8.1
eclipse-ccase.sourceforge.net ClearCase Java API, Integration Core, and Integration UI all version: 2.2.34.201310031511.

Discussion

  • Mikael Petterson

    Yes this is true. Trigger output is not handled. As a user you need to be able to specify patterns for each trigger output and then apply them to the output and show the message to user. I will have a look at it asap.

    //mike

     
  • Mikael Petterson

    Maybe we need a file with different regexp pattern matches that we need to ignore and just send as a message to the user of the plugin. So If we add another page in Preferences that is called clearcase triggers. It can have something like a Trigger object with a name (uniqe and regexp pattern that matches the text from the trigger). We can add and remove these trigger filters and we create a matcher that uses a predefined trigger messages and when these are found we have a macth and we show message to user. I will check and see what classes I need to add and change.

    //mike

     
  • Ruud Goossens

    Ruud Goossens - 2013-11-29

    I do not know much about clearcase triggers but I understand these can be defined by the VOB owner. So this means we cannot add a general solution to this but need a customizable solution?

    In that case your idea seems like a good solution. If this would be implemented in the Eclipse preferences dialog, we can use the Workspace Mechanic (which we already use) to set these preferences for all our users automatically.

    I'm wondering however if it would be possible to also read the output on stdout/stderr so we can display (in a dialog) the message generated by the perl script, which was executed by the trigger.

    On a side note, you can retrieve all triggers in a VOB using:

    cleartool lstype -kind trtype -invob /vobs/my_vob
    

    And get more info an a specific trigger with e.g.:

    cleartool describe trtype:cq_co_trigger@vob:/vobs/my_vob
    

    Not sure if this would be of any use. In our case the descriptions are more explanatory than in the example of IBM.

    Also see:
    https://pic.dhe.ibm.com/infocenter/cchelp/v7r1m0/index.jsp?topic=/com.ibm.rational.clearcase.cc_proj.doc/t_bcccq_lsttrggrs.htm

     
  • Mikael Petterson

    Hi,

    Yes since there are different triggers in clearcase you need some kind of customizable solution.

    I think we should try to match the text and then use it as a message in some kind of pop-up dialog.

    Thanks for links!

    br,

    //mike

    Ps. I will not have access to clearcase ( after 2013/12/30) so it will be impossible to develop plugin if I cannot get a solution on this.

     
  • Mikael Petterson

    I will soon present a gui to get feedback...

    //mike

     
  • Mikael Petterson

    Here is an example of what the gui might look like.

    Merry X-mas.

    //mike

     
  • Mikael Petterson

    • status: closed-rejected --> open
     
  • Ruud Goossens

    Ruud Goossens - 2014-04-10

    Hi Mike, I did not have much time to check up on this. It seems that the priority is not that high from our user's point of view as I have not heard any other issues regarding this. The GUI looks fine, but I understand you have no longer access to clearcase and cannot continue to develop the plug-in.

    Thanks for the support in the past, really appreciate it.

     
  • Mikael Petterson

    I think I will be able to solve it wo cc access. So I will work on it from time to time when I have some spare time.

    //mike

     
  • Mikael Petterson

    Refactoring java clearcase api and add a CleartoolOutputParser.

    public String [] clearcaseOperation() {
    checkInterface();

        String[] output = buildAndExecuteCommand(command, options, elements,
                operationListener);
        if (null != operationListener) {
            operationListener.finishedOperation();
        }
    return output;
    

    }

    public ClearCaseElementState[] parseCommandOutput(String [] output){
    List<ClearCaseElementState> states = new ArrayList<ClearCaseElementState>();
    if (output != null) {
    if (debugLevel > 0) {
    for (int i = 0; i < output.length; i++) {
    System.out.println("<<< " + output[i]);
    }
    }
    List<ClearCaseElementState> states = new ArrayList<ClearCaseElementState>();
    //TODO:Change to foreach loop.
    for (int i = 0; i < result.length; i++) {
    ClearCaseElementState state = matchComposite.check(result[i]);
    if (state != null) {
    states.add(state);
    }
    }
    } else {
    states = new ClearCaseElementState[0];
    }
    return states.toArray(new ClearCaseElementState[states.size()]);

    }

    public ClearCaseElementState parseCommandOutput(String [] output){
    ClearCaseElementState state = null;
    ClearCaseElementState[] states = parseCommandOutput(result);
    // Just one state for whole merge operation
    if (states.length != 0 && states != null) {
    state = state[0];
    }
    return state;
    }

     

Log in to post a comment.