It's all about the answers!

Ask a question

IProcessConfiguration.getCharacterData() removes linebreaks?


1
1
Florian Georg (19031918) | asked Sep 24 '11, 9:17 a.m.
I'm using my custom process operation participant, which parses its process config via by com.ibm.team.process.common.IProcessConfigurationElement...

However, it seems that loading text nodes (via element.getCharacterData()) remove the linebreaks at load time.

Here's the code to load the character data:

IProcessConfigurationElement[] children = element.getChildren();

for (int i = 0; i < children.length; i++) {
IProcessConfigurationElement child = children[i];
String elementName = child.getName();
if (elementName.equals(IStateChangeHookDefinitions.TAG_SCRIPT)) {
parsedConfig.fHookCodeScript =child.getCharacterData();
}
}



The process configuration source looks like this:
<action>

<script>for (int i = 0; i < 10: i++) {&#13 ;
&#13 ;
do something else
}&#13 ;
</script>
</action>


Note that there are linebreaks (entity-encoded as &#13 ;)... This gets correctly saved/loaded by the UI part, e.g. IMemento ...
However, loading that config element inside the serverside participant from the config element, results in a single-line String - without linebreaks.

Am I missing something, or is actually not working correctly?
Thanks for any hints...

One answer



permanent link
Thomas Yu (45183) | answered Sep 29 '11, 11:30 p.m.
I'm using my custom process operation participant, which parses its process config via by com.ibm.team.process.common.IProcessConfigurationElement...

However, it seems that loading text nodes (via element.getCharacterData()) remove the linebreaks at load time.

Here's the code to load the character data:

IProcessConfigurationElement[] children = element.getChildren();

for (int i = 0; i < children.length; i++) {
IProcessConfigurationElement child = children[i];
String elementName = child.getName();
if (elementName.equals(IStateChangeHookDefinitions.TAG_SCRIPT)) {
parsedConfig.fHookCodeScript =child.getCharacterData();
}
}



The process configuration source looks like this:
<action>

<script>for (int i = 0; i < 10: i++) {&#13 ;
&#13 ;
do something else
}&#13 ;
</script>
</action>


Note that there are linebreaks (entity-encoded as &#13 ;)... This gets correctly saved/loaded by the UI part, e.g. IMemento ...
However, loading that config element inside the serverside participant from the config element, results in a single-line String - without linebreaks.

Am I missing something, or is actually not working correctly?
Thanks for any hints...


Looks it is a bug here, please file a bug against Process component, thanks.

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.