Warren Racz commented on Bug JENKINS-12272

I too am faced with an issue where I need to be able to use -host -hpath -gpath in the mkview options. I am not a committer of the code, but I'll contribute by attempting to suggest a possible resolution...

I believe the problem could be rectified in
https://svn.jenkins-ci.org/trunk/hudson/plugins/clearcase-ucm-baseline/src/main/java/com/michelin/cio/hudson/plugins/clearcaseucmbaseline/ClearToolUcmBaseline.java

// HUDSON-6409
        if(StringUtils.isNotBlank(mkviewOptionalParam)) {
            cmd.addTokenized(Util.replaceMacro(mkviewOptionalParam, variableResolver));
        }

        // HUDSON-8168
        // cleartool mkview ...
        // { –stg/loc { view-stgloc-name | –aut/o }
        //   | [ –hos/t hostname –hpa/th host-storage-pname –gpa/th global-storage-pname ] dynamic-view-storage-pname }
        if(!StringUtils.contains(mkviewOptionalParam, "-stg")) {
            cmd.add(viewName);
        }

If it's safe to assume that you only append the view name when there are no optional arguments passed in then I'd suggest this fix:

// HUDSON-6409, HUDSON-8168, JENKINS-12272
        if(StringUtils.isNotBlank(mkviewOptionalParam)) {
            cmd.addTokenized(Util.replaceMacro(mkviewOptionalParam, variableResolver));
        } else {
            cmd.add(viewName);
        }

Otherwise I think something like this should resolve it:

// HUDSON-6409
        if(StringUtils.isNotBlank(mkviewOptionalParam)) {
            cmd.addTokenized(Util.replaceMacro(mkviewOptionalParam, variableResolver));
        }

        // HUDSON-8168, JENKINS-122272
        // cleartool mkview ...
        // { –stg/loc { view-stgloc-name | –aut/o }
        //   | [ –hos/t hostname –hpa/th host-storage-pname –gpa/th global-storage-pname ] dynamic-view-storage-pname }
        if (!StringUtils.contains(mkviewOptionalParam, "-stg") && !StringUtils.contains(mkviewOptionalParam, "-host") && !StringUtils.contains(mkviewOptionalParam, "-hpath") && !StringUtils.contains(mkviewOptionalParam, "-gpath")) {
            cmd.add(viewName);
        }
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to