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.
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
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
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:
And get more info an a specific trigger with e.g.:
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
Or simply all-in-one:
List all mkelem triggers in all vobs of one path_
Last edit: Thomas Bark 2020-12-06
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.
I will soon present a gui to get feedback...
//mike
Here is an example of what the gui might look like.
Merry X-mas.
//mike
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.
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
http://blog.eclipse-tips.com/2009/08/remember-state.html
Refactoring java clearcase api and add a CleartoolOutputParser.
public String [] clearcaseOperation() {
checkInterface();
}
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;
}
@tommy333 if this is still an issue I can work on it. Let me know!
@eraonel I didn't found a "add to source control" trigger in our vobs, and don't have admin right to create one. I try to ask the admin to temporarely add one.
Hello Mikael, Thomas.
I will continue this discussion for Ruud. Our client still has this issue and we handled it by patching the net.sourceforge.clearcase plugin from eclipse-java repo. I will provide our solution for this, but seems that your intention to fix this ( in branch bug_369_trigger_causes_array_outof) by adding a Preference page (Triggers) from where to provide custom patterns is much more complicated. I tried to test it, but the implementation is not working yet.
Could you please take a look and solve this ?
I don't know much about triggers. In case the old suggestion will be finalized, what pattern we should provide for the sample in this bug?
Thank you
Lidia
I have pushed few old commits related to this topic and would like to request merge into 'clearcase-java' .
If you will not have time or possibility to fix this with original suggested design , you can take a look into our solution. It handles java.lang.ArrayIndexOutOfBoundsException: 0
and prints the clearcase error message to eclipse dialog.
Beside provided commits, we are also using a System property to provide a custom list of Env and in each command line execute we provide our custom list of String[] env instead of inherited one from eclipse. It makes possible to show more user friendly, clearcase related, error message dialog. I could provide this commit as well in case it makes any sense for general usage.
My cloned repo and branch with suggested commits:
https://sourceforge.net/u/lidochca/clearcase-java/ci/bug_369_trigger_causes_array_outof/tree/
Thank you
Lidia
Last edit: Lidia Popescu 2020-11-27
Bună ziua Lidia!
Thanks for the commits, I will check if I can simply merge them, or if they interfere with Mike's bugfix.
Still in search for an "add to CC"-trigger in the vobs I have access to :-(
Weekend plăcut,
Thomas
Thank you Thomas, That would be great.
We also have some other custom changes, and bug fixes that we will review and if it makes sense for open source, we would like to merge them. I will provide details later.
Have a nice weekend
Lidia
Last edit: Lidia Popescu 2020-11-27
Hi Lidia,
when testing with your clone, I got 2 failing tests.
* MoveOutputScenarioTest.testSuccessfulMove() line: 37
One Element is expected, but there are 2 strings in cess:
1. cleartool: Warning: Moved element with checkouts to "src/cm_add.c"; CHECKED_IN CHECKED_OUT CHECKED_OUT_BY_DIFFERENT_USER CHECKED_OUT_IN_DIFFERENT_BRANCH CHECKED_OUT_IN_DIFFERENT_VIEW HIJACKED MISSING OUTSIDE_VOB RESERVED UNRESERVED VIEW_PRIVATE DERIVED_OBJECT LINK ALREADY_CHECKED_OUT MOVED,
2. cm_add.c MOVED
There are 3 strings in cces:
cleartool: Warning: Object "test1.txt" no longer referenced.
CHECKED_IN CHECKED_OUT CHECKED_OUT_BY_DIFFERENT_USER CHECKED_OUT_IN_DIFFERENT_BRANCH CHECKED_OUT_IN_DIFFERENT_VIEW HIJACKED MISSING OUTSIDE_VOB RESERVED UNRESERVED VIEW_PRIVATE DERIVED_OBJECT LINK ALREADY_CHECKED_OUT MOVED,
cleartool: Warning: Moving object to vob lost+found directory as "test1.txt.5b5628b05b0611dc9b46001321f229d1".
CHECKED_IN CHECKED_OUT CHECKED_OUT_BY_DIFFERENT_USER CHECKED_OUT_IN_DIFFERENT_BRANCH CHECKED_OUT_IN_DIFFERENT_VIEW HIJACKED MISSING OUTSIDE_VOB RESERVED UNRESERVED VIEW_PRIVATE DERIVED_OBJECT LINK ALREADY_CHECKED_OUT MOVED,
test1.txt
A problem of the code? Or the test should be adapted?
I'm not sure about this. (the tweaking of the test is easy, but I should first know what's behind).
CU, Thomas
My CC admin created a mkelem preop trigger for me. When I tried to add a file, with the solution on 369 branch I neither get any dialog nor any exception.
The text of the trigger, which refused mkelem , is simply printed in the console:
Last edit: Thomas Bark 2020-12-07
when I adapt the String in ForbiddenToCreateElementInDumbo.java to the output of my trigger, then I get the dialog in the attachment.
Hi Mike,
In the commit [7c9eff] (in the develop branch of CC for Java) I did a more generic solution, based on Lidia's commit.
Also the tests run successfully without any changes.
My prososal is to make a 2.2.42, and then I continue (don't have much time) with replacing some deprecated functions, and/or solving other bugs.
What is your opinion.
br, tom
Solved in 2.2.42.
Please close ticket.