It's all about the answers!

Ask a question

How to set value to a custom attribute of type Small String?

Luiz Almeida (23014874) | asked Oct 30 '14, 10:20 a.m.
edited Oct 30 '14, 11:41 a.m.
Hi all,

I am trying set value to a custom attribute of type Small String by Java API. Here is my code:

IAttribute iQtdeUstAjustada = wiCommon.findAttribute(newWorkItem.getProjectArea(), "vlr_ust_ajustada", monitor);

BigDecimal ustAjustada = getQtdeUstFinal();
String vlrAjustada = ustAjustadas.setScale(2, BigDecimal.ROUND_UNNECESSARY).toPlainString();

workingCopy.setValue(iQtdeUstAjustada, vlrAjustada);

The setValue method is raising the following exception:

2014-10-30 12:05:54,398 [WebContainer : 4 @@ 12:05 lcesar /ccm/service/] ERROR                         - assertion failed:
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
        at org.eclipse.core.runtime.Assert.isTrue(
        at org.eclipse.core.runtime.Assert.isTrue(

How to set value to a Small String attribute? Can't I use String?
Important: this code works well when I am testing in Eclipse with Jetty server. The exception is raised only on the production environment (WAS and DB2).

One answer

permanent link
Ralph Schoon (60.7k33643) | answered Oct 30 '14, 8:05 p.m.
It is absolutely unobvious in which context you ask this question. There is no hint about the RTC version. This seems to be Java API, but, who knows. If you can't provide a useful description, no one can answer this question.

Luiz Almeida commented Nov 19 '14, 12:04 p.m. | edited Nov 19 '14, 12:07 p.m.

Sorry, Ralph....
I am developing a participant extension. RTC version is 4.0.7.
As you can see, in my code I am creating a BigDecimal variable and later I created a String variable with the bigdecimal value.

BigDecimal ustAjustada = getQtdeUstFinal(); // this method returns a BigDecimal value.
String vlrAjustada = ustAjustadas.setScale(2,BigDecimal.ROUND_UNNECESSARY).toPlainString();

Well, when I set the String variable to workitemcopy to save it, occurs the error that I described above.

workingCopy.setValue(iQtdeUstAjustada, vlrAjustada); // error occurs here.

iQtdeUstAjustada is an attribute of type Small String.

I do not know if I can explain...I hope so.

Your answer

Register or to post your answer.