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

Bug 291960

Summary: XMLViewer makes (apparently) invalid assumptions about TransformerFactory
Product: [WebTools] WTP ServerTools Reporter: Angel Vera <arvera>
Component: wst.serverAssignee: Angel Vera <arvera>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: ccc, krzysztof.daniel, thatnitind
Version: 3.0.5   
Target Milestone: 3.0.5 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 289573    
Bug Blocks:    
Attachments:
Description Flags
v1
none
v1.1 none

Description Angel Vera CLA 2009-10-09 17:19:03 EDT
+++ This bug was initially created as a clone of Bug #289573 +++

TransformerFactory comes with Java SDK, and it results in different output xml
on different platforms.

XMLViewer#createDocument adds <?xml version="1.0" encoding="UTF-8"?> to the
content if it is missing. Then the content is transformed, and following
outputs were observed:
(A)
<?xml version="1.0" encoding="UTF-8"?><content ... />
(B)
<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<content ... />
(C)
<?xml version="1.0" encoding="UTF-8"?>
<content ... />

The problem is that if the missing xml tag was added, XMLViewer#setContent in
line 90 will try to match <?xml version="1.0" encoding="UTF-8"?> and once it
succeeds it will remove first line.

Therefore valid content will be presented only in case (C).
In case of (A) the whole first line will be eaten, and in the case of (B) xml
instruction will be presented in the view.

Following things should be fixed:
(1) standalone flag should be explicitly set to "no"
(2) after successful  match <?xml version="1.0" encoding="UTF-8"?> should be
removed, and then line separator if present.
Comment 1 Angel Vera CLA 2009-10-09 17:22:11 EDT
An adopter has requested for this bug to be committed into the 3.0.5 P stream.
Comment 2 Angel Vera CLA 2009-10-09 17:25:32 EDT
Created attachment 149281 [details]
v1

This plugin hasn't been branched for 3.0.5 P, thus some care will have to be taken for the version of the plugin and the features that depend on this plugin
Comment 3 Angel Vera CLA 2009-10-09 17:31:29 EDT
Created attachment 149282 [details]
v1.1

Forgot to update the Copyrights, this new attachment should have the copyrights update.
Comment 4 Carl Anderson CLA 2009-10-22 12:27:47 EDT
Committed to R3_0_5_patches
Comment 5 Angel Vera CLA 2010-01-23 11:46:02 EST
Verified that changes are committed into 31M.
Comment 6 Angel Vera CLA 2010-01-23 21:01:08 EST
Released changes into 31M
Comment 7 Angel Vera CLA 2010-03-08 09:15:26 EST
Changes checked-in into 32(HEAD) as part of a forward fed from other streams
Comment 8 Angel Vera CLA 2010-03-08 13:14:16 EST
Changes released to 32 stream, which is currently HEAD