Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 207806

Summary: Eventformatter does not correctly serialize the any properties.
Product: z_Archived Reporter: Paul Slauenwhite <paulslau>
Component: TPTPAssignee: Rohit Shetty <rohit.shetty>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: apnan, jkubasta, paulslau, rohit.shetty
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch for the problem
none
Test case patch and updated testsuite files
none
updated patch
rohit.shetty: review?
Tests - updated
none
Bugzilla_207806_Test.java none

Description Paul Slauenwhite CLA 2007-10-29 12:37:45 EDT
Eventformatter does not correctly serizalize the any properties.

The any properties of the CommonBaseEvent and OtherSituration is not correctly serialized when it contains invalid XML (e.g. plain text with XML markup characters).  The content should be wrapped as a CDATA section (<![CDATA[any]]>) or normalized.  For example:

EventFactoryHome eventFactoryHome = EventFactoryContext.getInstance().getEventFactoryHome("RuntimeEventXMLFileEventFactoryHomeImpl");

EventFactory eventFactory = eventFactoryHome.getAnonymousEventFactory();

CommonBaseEvent commonBaseEvent = eventFactory.createCommonBaseEvent();
commonBaseEvent.setCreationTimeAsLong(System.currentTimeMillis());
commonBaseEvent.setSeverity(((short) (60)));
commonBaseEvent.setMsg("Hello World!");
			
Situation situation = eventFactory.createSituation();
situation.setOtherSituation("INTERNAL","<hello>world</hello>");
			
commonBaseEvent.setSituation(situation);
			
CommonBaseEvent deserializedCommonBaseEvent = EventFormatter.eventFromCanonicalXML(EventFormatter.toCanonicalXMLString(commonBaseEvent));
			
System.out.println(EventFormatter.toCanonicalXMLString(deserializedCommonBaseEvent));
Comment 1 Paul Slauenwhite CLA 2007-10-29 12:38:18 EDT
Since i1 development is closed, targeting to i2.
Comment 2 Paul Slauenwhite CLA 2007-11-06 08:24:34 EST
Reassign to Project Lead for triage.
Comment 3 Paul Slauenwhite CLA 2007-11-07 18:31:22 EST
Correcting target.
Comment 4 Alex Nan CLA 2007-11-17 17:49:28 EST
Rohit can you please provide an input to this issue by end of Monday Nov 19, 2007.
Comment 5 Rohit Shetty CLA 2007-11-20 22:55:45 EST
Created attachment 83388 [details]
Patch for the problem

Patch for the problem.
Comment 6 Rohit Shetty CLA 2007-11-20 23:00:47 EST
Created attachment 83389 [details]
Test case patch and updated testsuite files
Comment 7 Rohit Shetty CLA 2007-11-24 10:40:55 EST
Created attachment 83693 [details]
updated patch
Comment 8 Rohit Shetty CLA 2007-11-24 10:41:57 EST
Created attachment 83694 [details]
Tests - updated
Comment 9 Rohit Shetty CLA 2007-11-24 10:42:59 EST
Alex,
Can you please review the patch and tests. 
Comment 10 Alex Nan CLA 2007-12-10 11:30:45 EST
Changing target to 4.5 i5 since it was not approved in 4.4.1. The code will be checked into the 4.5 stream in i5 since this defect is not neccessarily needed in M4.
Comment 11 Alex Nan CLA 2008-01-09 16:19:32 EST
Checked in the fix as part of the consolidated patch for bug 207763.
Comment 12 Paul Slauenwhite CLA 2008-02-12 09:23:40 EST
Did this fix make it into I5?  The enclosed test class is still not normalizing or enclosing the content in a CDATA section (<![CDATA[any]]>).
Comment 13 Paul Slauenwhite CLA 2008-02-12 09:24:10 EST
Created attachment 89501 [details]
Bugzilla_207806_Test.java
Comment 14 Alex Nan CLA 2008-02-12 09:59:32 EST
It looks like I forgot to check in the patch.
Comment 15 Alex Nan CLA 2008-02-12 17:37:49 EST
Patch checked in.
Comment 16 Paul Slauenwhite CLA 2008-06-10 10:50:05 EDT
Verified in TPTP-4.5.0-200806070100.  Closing.