[dom4j-dev] [ dom4j-Bugs-1495925 ] DOM4J 1.6.1 xml file generation Exception

2010-04-06 Thread SourceForge.net
Bugs item #1495925, was opened at 2006-05-27 12:27
Message generated for change (Settings changed) made by filipjirsak
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
>Group: dom4j 1.6.x
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Callebaut Benot (bencal)
Assigned to: Nobody/Anonymous (nobody)
Summary: DOM4J 1.6.1 xml file generation Exception

Initial Comment:
I use DOM4J 1.6.1 to write a custom build domcument to
an XML file.
It fails with a StringIndexOutOfBoundsException.

If I do the same with DOM4J 1.5.1 I have no problem.

My tree contains a lot of empty elements and use
sometimes stange names (characters like +,-,_)

Here is the code I use to write the XML file:
OutputFormat outformat =
OutputFormat.createPrettyPrint();
document.getRootElement().normalize();
try{
   
((VFSXmlFileObject)this.getRoot()).flushChilds();
XMLWriter writer = new
XMLWriter(this.getParentLayer().getContent().getOutputStream(false),
outformat); 
writer.write(this.document);
writer.flush();
writer.close();
document = null;
}catch (Exception e){
e.printStackTrace();
}
Here is the Exception:
java.lang.StringIndexOutOfBoundsException: String index
out of range: 0
[java]  at java.lang.String.charAt(String.java:558)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1098)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.write(XMLWriter.java:344)


--

Comment By: Robert Rackl (doogiemuc)
Date: 2008-03-02 09:35

Message:
Logged In: YES 
user_id=2024793
Originator: NO

I have a simpler code to reproduce this bug. Its still there:


import java.io.FileWriter;
import java.io.IOException;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class Dom4jBug {
public static void main(String[] args) {
try {
Document doc  = DocumentHelper.createDocument();
Element  rootElem = doc.addElement("root");
Element propElem  =
DocumentFactory.getInstance().createElement("property");
propElem.addElement("item");
propElem.setText("");
rootElem.add(propElem);

OutputFormat format = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter(new FileWriter("test.xml"),
format);
writer.write(doc);  // <== throws
StringIndexOutOfBoundsException !!!
writer.close();
} catch (IOException ex) {
ex.printStackTrace();
}

}
}


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune app

[dom4j-dev] [ dom4j-Bugs-1495925 ] DOM4J 1.6.1 xml file generation Exception

2008-03-02 Thread SourceForge.net
Bugs item #1495925, was opened at 2006-05-27 12:27
Message generated for change (Comment added) made by doogiemuc
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Callebaut Beno�t (bencal)
Assigned to: Nobody/Anonymous (nobody)
Summary: DOM4J 1.6.1 xml file generation Exception

Initial Comment:
I use DOM4J 1.6.1 to write a custom build domcument to
an XML file.
It fails with a StringIndexOutOfBoundsException.

If I do the same with DOM4J 1.5.1 I have no problem.

My tree contains a lot of empty elements and use
sometimes stange names (characters like +,-,_)

Here is the code I use to write the XML file:
OutputFormat outformat =
OutputFormat.createPrettyPrint();
document.getRootElement().normalize();
try{
   
((VFSXmlFileObject)this.getRoot()).flushChilds();
XMLWriter writer = new
XMLWriter(this.getParentLayer().getContent().getOutputStream(false),
outformat); 
writer.write(this.document);
writer.flush();
writer.close();
document = null;
}catch (Exception e){
e.printStackTrace();
}
Here is the Exception:
java.lang.StringIndexOutOfBoundsException: String index
out of range: 0
[java]  at java.lang.String.charAt(String.java:558)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1098)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.write(XMLWriter.java:344)


--

Comment By: Robert Rackl (doogiemuc)
Date: 2008-03-02 09:35

Message:
Logged In: YES 
user_id=2024793
Originator: NO

I have a simpler code to reproduce this bug. Its still there:


import java.io.FileWriter;
import java.io.IOException;
import org.dom4j.Document;
import org.dom4j.DocumentFactory;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;

public class Dom4jBug {
public static void main(String[] args) {
try {
Document doc  = DocumentHelper.createDocument();
Element  rootElem = doc.addElement("root");
Element propElem  =
DocumentFactory.getInstance().createElement("property");
propElem.addElement("item");
propElem.setText("");
rootElem.add(propElem);

OutputFormat format = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter(new FileWriter("test.xml"),
format);
writer.write(doc);  // <== throws
StringIndexOutOfBoundsException !!!
writer.close();
} catch (IOException ex) {
ex.printStackTrace();
}

}
}


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/0

[dom4j-dev] [ dom4j-Bugs-1495925 ] DOM4J 1.6.1 xml file generation Exception

2006-05-27 Thread SourceForge.net
Bugs item #1495925, was opened at 2006-05-27 12:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Callebaut Benoît (bencal)
Assigned to: Nobody/Anonymous (nobody)
Summary: DOM4J 1.6.1 xml file generation Exception

Initial Comment:
I use DOM4J 1.6.1 to write a custom build domcument to
an XML file.
It fails with a StringIndexOutOfBoundsException.

If I do the same with DOM4J 1.5.1 I have no problem.

My tree contains a lot of empty elements and use
sometimes stange names (characters like +,-,_)

Here is the code I use to write the XML file:
OutputFormat outformat =
OutputFormat.createPrettyPrint();
document.getRootElement().normalize();
try{
   
((VFSXmlFileObject)this.getRoot()).flushChilds();
XMLWriter writer = new
XMLWriter(this.getParentLayer().getContent().getOutputStream(false),
outformat); 
writer.write(this.document);
writer.flush();
writer.close();
document = null;
}catch (Exception e){
e.printStackTrace();
}
Here is the Exception:
java.lang.StringIndexOutOfBoundsException: String index
out of range: 0
[java]  at java.lang.String.charAt(String.java:558)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1098)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.writeElementContent(XMLWriter.java:1086)
[java]  at
org.dom4j.io.XMLWriter.writeElement(XMLWriter.java:954)
[java]  at
org.dom4j.io.XMLWriter.writeNode(XMLWriter.java:1301)
[java]  at
org.dom4j.io.XMLWriter.write(XMLWriter.java:344)


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=116035&aid=1495925&group_id=16035


---
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
___
dom4j-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev