Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 43570 Details for
Bug 115716
XML formatter produces wrong output, and hang up on huge files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.wst.xml.core.tests.patch
org.eclipse.wst.xml.core.tests.patch (text/plain), 7.91 KB, created by
Amy Wu
on 2006-06-06 03:18:05 EDT
(
hide
)
Description:
org.eclipse.wst.xml.core.tests.patch
Filename:
MIME Type:
Creator:
Amy Wu
Created:
2006-06-06 03:18:05 EDT
Size:
7.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xml.core.tests >Index: src/org/eclipse/wst/xml/core/tests/format/TestFormatProcessorXML.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/xml/tests/org.eclipse.wst.xml.core.tests/src/org/eclipse/wst/xml/core/tests/format/TestFormatProcessorXML.java,v >retrieving revision 1.2 >diff -u -r1.2 TestFormatProcessorXML.java >--- src/org/eclipse/wst/xml/core/tests/format/TestFormatProcessorXML.java 27 Feb 2006 09:15:54 -0000 1.2 >+++ src/org/eclipse/wst/xml/core/tests/format/TestFormatProcessorXML.java 6 Jun 2006 07:08:36 -0000 >@@ -61,18 +61,15 @@ > > IStructuredModel model = null; > try { >- IModelManager modelManager = StructuredModelManager >- .getModelManager(); >+ IModelManager modelManager = StructuredModelManager.getModelManager(); > InputStream inStream = getClass().getResourceAsStream(filename); > if (inStream == null) >- throw new FileNotFoundException("Can't file resource stream " >- + filename); >+ throw new FileNotFoundException("Can't file resource stream " + filename); > final String baseFile = getClass().getResource(filename).toString(); >- model = modelManager.getModelForEdit(baseFile, inStream, >- new URIResolver() { >+ model = modelManager.getModelForEdit(baseFile, inStream, new URIResolver() { >+ >+ String fBase = baseFile; > >- String fBase = baseFile ; >- > public String getFileBaseLocation() { > return fBase; > } >@@ -88,12 +85,12 @@ > public String getLocationByURI(String uri, String baseReference) { > int lastSlash = baseReference.lastIndexOf("/"); > if (lastSlash > 0) >- return baseReference.substring(0, lastSlash+1) + uri; >+ return baseReference.substring(0, lastSlash + 1) + uri; > return baseReference; > } > > public String getLocationByURI(String uri, String baseReference, boolean resolveCrossProjectLinks) { >- return getLocationByURI(uri, baseReference); >+ return getLocationByURI(uri, baseReference); > } > > public IProject getProject() { >@@ -105,7 +102,7 @@ > } > > public InputStream getURIStream(String uri) { >- return getClass().getResourceAsStream(getLocationByURI(uri)); >+ return getClass().getResourceAsStream(getLocationByURI(uri)); > } > > public void setFileBaseLocation(String newLocation) { >@@ -113,8 +110,10 @@ > } > > public void setProject(IProject newProject) { >- }}); >- } catch (IOException ex) { >+ } >+ }); >+ } >+ catch (IOException ex) { > ex.printStackTrace(); > } > return model; >@@ -129,44 +128,36 @@ > return true; > } > >- protected void formatAndAssertEquals(String beforePath, String afterPath) >- throws UnsupportedEncodingException, IOException, CoreException { >+ protected void formatAndAssertEquals(String beforePath, String afterPath) throws UnsupportedEncodingException, IOException, CoreException { > IStructuredModel beforeModel = null, afterModel = null; > try { > beforeModel = getModelForEdit(beforePath); >- assertNotNull("could not retrieve structured model for : " >- + beforePath, beforeModel); >+ assertNotNull("could not retrieve structured model for : " + beforePath, beforeModel); > > afterModel = getModelForEdit(afterPath); >- assertNotNull("could not retrieve structured model for : " >- + afterPath, afterModel); >+ assertNotNull("could not retrieve structured model for : " + afterPath, afterModel); > >- IStructuredFormatPreferences formatPreferences = formatProcessor >- .getFormatPreferences(); >+ IStructuredFormatPreferences formatPreferences = formatProcessor.getFormatPreferences(); > formatPreferences.setLineWidth(MAX_LINE_WIDTH); > formatPreferences.setClearAllBlankLines(CLEAR_ALL_BLANK_LINES); > formatPreferences.setIndent(INDENT); >- ((IStructuredFormatPreferencesXML) formatPreferences) >- .setSplitMultiAttrs(SPLIT_MULTI_ATTRS); >+ ((IStructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(SPLIT_MULTI_ATTRS); > > formatProcessor.formatModel(beforeModel); > > ByteArrayOutputStream formattedBytes = new ByteArrayOutputStream(); > beforeModel.save(formattedBytes); // "beforeModel" should now be >- // after the formatter >+ // after the formatter > > ByteArrayOutputStream afterBytes = new ByteArrayOutputStream(); > afterModel.save(afterBytes); > >- assertEquals("Formatted document differs from the expected", >- new String(afterBytes.toByteArray(), UTF_8), new String( >- formattedBytes.toByteArray(), UTF_8)); >+ assertEquals("Formatted document differs from the expected", new String(afterBytes.toByteArray(), UTF_8), new String(formattedBytes.toByteArray(), UTF_8)); > > // Do the same check in binary for kicks >- assertTrue("Formatted document differs fromto the expected", >- isByteArrayIdentical(formattedBytes.toByteArray(), >- afterBytes.toByteArray())); >- } finally { >+ assertTrue("Formatted document differs fromto the expected", isByteArrayIdentical(formattedBytes.toByteArray(), afterBytes.toByteArray())); >+ } >+ finally { > if (beforeModel != null) > beforeModel.releaseFromEdit(); > if (afterModel != null) >@@ -174,22 +165,21 @@ > } > } > >- public void testSimpleXml() throws UnsupportedEncodingException, >- IOException, CoreException { >- formatAndAssertEquals("testfiles/xml/simple-standalone.xml", >- "testfiles/xml/simple-standalone-fmt.xml"); >- } >- >- public void testPreserveFormat() throws UnsupportedEncodingException, >- IOException, CoreException { >- formatAndAssertEquals("testfiles/xml/xml-space-preserve-standalone.xml", >- "testfiles/xml/xml-space-preserve-standalone-fmt.xml"); >- } >- >- public void testPreserveFormatDTD() throws UnsupportedEncodingException, >- IOException, CoreException { >- formatAndAssertEquals("testfiles/xml/xml-space-preserve-dtd.xml", >- "testfiles/xml/xml-space-preserve-dtd-fmt.xml"); >+ public void testSimpleXml() throws UnsupportedEncodingException, IOException, CoreException { >+ formatAndAssertEquals("testfiles/xml/simple-standalone.xml", "testfiles/xml/simple-standalone-fmt.xml"); >+ } >+ >+ public void testPreserveFormat() throws UnsupportedEncodingException, IOException, CoreException { >+ formatAndAssertEquals("testfiles/xml/xml-space-preserve-standalone.xml", "testfiles/xml/xml-space-preserve-standalone-fmt.xml"); >+ } >+ >+ public void testPreserveFormatDTD() throws UnsupportedEncodingException, IOException, CoreException { >+ formatAndAssertEquals("testfiles/xml/xml-space-preserve-dtd.xml", "testfiles/xml/xml-space-preserve-dtd-fmt.xml"); >+ } >+ >+ public void testOneLineFormat() throws UnsupportedEncodingException, IOException, CoreException { >+ // BUG115716 >+ formatAndAssertEquals("testfiles/xml/oneline.xml", "testfiles/xml/oneline-fmt.xml"); > } > > } >Index: src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline.xml >=================================================================== >RCS file: src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline.xml >diff -N src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,1 @@ >+<?xml version="1.0" encoding="UTF-8"?><one><two></two><three><four></four></three></one> >Index: src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline-fmt.xml >=================================================================== >RCS file: src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline-fmt.xml >diff -N src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline-fmt.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/core/tests/format/testfiles/xml/oneline-fmt.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<one> >+ <two></two> >+ <three> >+ <four></four> >+ </three> >+</one>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 115716
:
29650
|
43550
|
43569
| 43570