It's all about the answers!

Ask a question

BF API: Cron.updateBuildEnvEntryValue exception


Ronald Signorino (3154) | asked Nov 18 '10, 4:52 p.m.
I hope someone can help...

When running the following code, the cron.updateBuildEnvEntryValue throws an exception if the second argument is anything but a literal string. The uncommented line of cron.updateBuildEnvEntryValue where the second argument is a String variable, causes the exception to be thrown (below the code snippet). The commented line (with literal "myClusterName") does not cause exception, and I see the correct value when looking at the Schedule in BuildForge.

From the Javadocs, it seems any validly formed String should satisfy the requirement for the second argument, so not sure why a String variable with non-zero length value is not considered a 'valid value'

Cron cron;

BuildEnvironment buildEnv;
...
BuildEnvironmentEntry buildEnvEntry = buildEnv.getEntry("Cluster");

String cluster = "myClusterName";
if (buildEnvEntry != null) {
// cron.updateBuildEnvEntryValue(buildEnvEntry.getUuid(), "myClusterName");
cron.updateBuildEnvEntryValue(buildEnvEntry.getUuid(), cluster);
}

...


com.buildforge.services.common.api.APIException: A valid Value must be specified.
at com.buildforge.services.client.api.APIClientConnection.call(APIClientConnection.java:607)
at com.buildforge.services.client.dbo.Cron.updateBuildEnvEntryValue(Cron.java:221)
at com.buildforge.services.client.dbo.Cron.updateBuildEnvEntryValue(Cron.java:201)
at com.myorg.BFDeploy.setWebSphereEnvVars(BFDeploy.java)
at com.myorg.BFDeploy.doDeploy(BFDeploy.java)
at com.myorg.BFDeploy.main(BFDeploy.java:495)

Any help is greatly appreciated!

Regards,

2 answers



permanent link
Steven Vaughan (22111) | answered Nov 18 '10, 6:12 p.m.
JAZZ DEVELOPER
Is the build env entry in question a pulldown variable (i.e.: an enumerated choice variable)? The code path I can see that would give you that error comes from an attempt to set a variable to a value that is not part of its options. I presume your magic "myClusterName" value IS part of the choice list for that variable, and thus why that value works while others do not.

-steve

I hope someone can help...

When running the following code, the cron.updateBuildEnvEntryValue throws an exception if the second argument is anything but a literal string. The uncommented line of cron.updateBuildEnvEntryValue where the second argument is a String variable, causes the exception to be thrown (below the code snippet). The commented line (with literal "myClusterName") does not cause exception, and I see the correct value when looking at the Schedule in BuildForge.

From the Javadocs, it seems any validly formed String should satisfy the requirement for the second argument, so not sure why a String variable with non-zero length value is not considered a 'valid value'

Cron cron;

BuildEnvironment buildEnv;
...
BuildEnvironmentEntry buildEnvEntry = buildEnv.getEntry("Cluster");

String cluster = "myClusterName";
if (buildEnvEntry != null) {
// cron.updateBuildEnvEntryValue(buildEnvEntry.getUuid(), "myClusterName");
cron.updateBuildEnvEntryValue(buildEnvEntry.getUuid(), cluster);
}

...


com.buildforge.services.common.api.APIException: A valid Value must be specified.
at com.buildforge.services.client.api.APIClientConnection.call(APIClientConnection.java:607)
at com.buildforge.services.client.dbo.Cron.updateBuildEnvEntryValue(Cron.java:221)
at com.buildforge.services.client.dbo.Cron.updateBuildEnvEntryValue(Cron.java:201)
at com.myorg.BFDeploy.setWebSphereEnvVars(BFDeploy.java)
at com.myorg.BFDeploy.doDeploy(BFDeploy.java)
at com.myorg.BFDeploy.main(BFDeploy.java:495)

Any help is greatly appreciated!

Regards,

permanent link
Ronald Signorino (3154) | answered Nov 19 '10, 8:59 a.m.
Is the build env entry in question a pulldown variable (i.e.: an enumerated choice variable)?


Yes, it is a pulldown and was behaving exactly as you described. I have corrected what I was passing as the value, and now I no longer get the Exception.

A million 'thank yous'!

Regards,
Ron

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.