Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] P2 touchpoint parsing/writing problem

Sorry. You had already. -- https://bugs.eclipse.org/bugs/show_bug.cgi?id=238697 

Inactive hide details for Simon Kaegi---06/27/2008 10:51:15 AM---Please open a bug. We should not be merging instructions.Simon Kaegi---06/27/2008 10:51:15 AM---Please open a bug. We should not be merging instructions.


From:

Simon Kaegi/Ottawa/IBM@IBMCA

To:

Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

Date:

06/27/2008 10:51 AM

Subject:

Re: [equinox-dev] P2 touchpoint parsing/writing problem




Please open a bug. We should not be merging instructions.

Inactive hide details for Henrik Lindberg ---06/26/2008 09:41:03 PM---Hi, I encountered a problem with reading and writing IU tHenrik Lindberg ---06/26/2008 09:41:03 PM---Hi, I encountered a problem with reading and writing IU touchpoints. The IU supports multiple touchpoints - the getTouchpointD

From:

Henrik Lindberg <henrik.lindberg@xxxxxxxxxxxxxx>

To:

Equinox development mailing list <equinox-dev@xxxxxxxxxxx>

Date:

06/26/2008 09:41 PM

Subject:

[equinox-dev] P2 touchpoint parsing/writing problem




Hi,
I encountered a problem with reading and writing IU touchpoints. The IU supports multiple touchpoints - the getTouchpointData() method returns an array of TouchpointData, and it is possible to add mulitple touchpoint data.


When writing the IU as XML however, all the touchpoint data gets merged. When reading this back in again, the result is a map where instructions are overwritten.


This is what touchpoint writer does:


protected
void writeTouchpointData(TouchpointData[] touchpointData) {
if
(touchpointData != null && touchpointData.length > 0) {
start(
TOUCHPOINT_DATA_ELEMENT);
attribute(
COLLECTION_SIZE_ATTRIBUTE, touchpointData.length);
for
(int i = 0; i < touchpointData.length; i++) {
TouchpointData nextData = touchpointData[i];
Map instructions = nextData.getInstructions();

if
(instructions.size() > 0) {
start(
TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
attribute(
COLLECTION_SIZE_ATTRIBUTE, instructions.size());
for
(Iterator iter = instructions.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
start(
TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
attribute(
TOUCHPOINT_DATA_INSTRUCTION_KEY_ATTRIBUTE, entry.getKey());
cdata((String) entry.getValue(),
true);
end(
TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
}
}
}
end(
TOUCHPOINT_DATA_ELEMENT);
}
}


For an IU with two touchpoints, with one install instruction each - the output is:


<touchpointData size='2'>
<instructions size='1'>
<instruction key='install'>
doSomething(target:some target value, source:some source value);
</instruction>
<instructions size='1'>
<instruction key='install'>
doSomethingElse(source:some source value, target:some target value);
</instruction>
</instructions>
</instructions>
</touchpointData>


When the parser reads this back in - it gets the hint that there are two touchpoint data, but there is just one instructions element. The parser seems to be able to handle multiple instructions elements. So I think the writer is to blame, and that there should be an end(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT) after looping over the instructions. Like this:

protected
void writeTouchpointData(TouchpointData[] touchpointData) {
if
(touchpointData != null && touchpointData.length > 0) {
start(TOUCHPOINT_DATA_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, touchpointData.length);
for
(int i = 0; i < touchpointData.length; i++) {
TouchpointData nextData = touchpointData[i];
Map instructions = nextData.getInstructions();
if
(instructions.size() > 0) {
start(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, instructions.size());
for
(Iterator iter = instructions.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
start(TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
attribute(TOUCHPOINT_DATA_INSTRUCTION_KEY_ATTRIBUTE, entry.getKey());
cdata((String) entry.getValue(), true);
end(TOUCHPOINT_DATA_INSTRUCTION_ELEMENT);
}
// ! ! ! ! ! ! ! ! !
// MISSING END OF INSTRUCTIONS
end(TOUCHPOINT_DATA_INSTRUCTIONS_ELEMENT);
}
}
end(TOUCHPOINT_DATA_ELEMENT);
}
}

This is from version 1.14 of MetadataWriter - which I think is the latest - or is this something that has been fixed?

Regards.

Henrik Lindberg
henrik.lindberg@xxxxxxxxxxxxxx
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/equinox-dev

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev

GIF image

GIF image

GIF image

GIF image


Back to the top