-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b07
-
x86
-
windows_xp
FULL PRODUCT VERSION :
C:\jdk1.5.0_04\bin>.\java -version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Java 5 transformer does not honor the indenting request:
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
REGRESSION. Last worked in version jwsdp-1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the supplied sources under
java 1.4.1_02 and java 1.5.0_04.
Java 4 will indent, java 5 will not.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<three>Am I indented?</three>
</two>
</one>
ACTUAL -
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<three>Am I indented?</three>
</two>
</one>
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class IndentTest
{
public static void printXML(String xmlStr_in)
{
try
{
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
StringReader strRdr = new StringReader(xmlStr_in);
InputSource in = new InputSource(strRdr);
Document doc = builder.parse(in);
Transformer tf = TransformerFactory.newInstance().newTransformer();
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
tf.transform(new DOMSource(doc), new StreamResult(System.out));
}
catch (Exception e)
{
e.printStackTrace();
}
}
// java 1.4.1_02: output is indented
//<?xml version="1.0" encoding="UTF-8"?>
//<one>
// <two>
// <three>Am I indented?</three>
// </two>
//</one>
// java 1.5.0_04: output is not indented:
//<?xml version="1.0" encoding="UTF-8"?>
//<one>
//<two>
//<three>Am I indented?</three>
//</two>
//</one>
public static void main(String[] args_in)
{
printXML("<one><two><three>Am I indented?</three></two></one>");
System.exit(0);
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-07-13 18:10:18 GMT
C:\jdk1.5.0_04\bin>.\java -version
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Java 5 transformer does not honor the indenting request:
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
REGRESSION. Last worked in version jwsdp-1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the supplied sources under
java 1.4.1_02 and java 1.5.0_04.
Java 4 will indent, java 5 will not.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<three>Am I indented?</three>
</two>
</one>
ACTUAL -
<?xml version="1.0" encoding="UTF-8"?>
<one>
<two>
<three>Am I indented?</three>
</two>
</one>
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class IndentTest
{
public static void printXML(String xmlStr_in)
{
try
{
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
StringReader strRdr = new StringReader(xmlStr_in);
InputSource in = new InputSource(strRdr);
Document doc = builder.parse(in);
Transformer tf = TransformerFactory.newInstance().newTransformer();
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
tf.transform(new DOMSource(doc), new StreamResult(System.out));
}
catch (Exception e)
{
e.printStackTrace();
}
}
// java 1.4.1_02: output is indented
//<?xml version="1.0" encoding="UTF-8"?>
//<one>
// <two>
// <three>Am I indented?</three>
// </two>
//</one>
// java 1.5.0_04: output is not indented:
//<?xml version="1.0" encoding="UTF-8"?>
//<one>
//<two>
//<three>Am I indented?</three>
//</two>
//</one>
public static void main(String[] args_in)
{
printXML("<one><two><three>Am I indented?</three></two></one>");
System.exit(0);
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
###@###.### 2005-07-13 18:10:18 GMT