wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

CalendarResource should output correct XML #51

Closed michaelwechner closed 10 years ago

michaelwechner commented 11 years ago

When requesting

http://127.0.0.1:8080/yanel/my-realm/calendar.ics?yanel.resource.viewid=xml

then a well-formed XML will be dumped (named calendar.xml) beside calendar.ics inside the realm repository, but the browser does not receive the complete XML, but rather complains about not closed tokens. Please note that 'my-realm' is just an example.

An existing sample can be accessed

http://127.0.0.1:8080/yanel/test/use-cases/calendar.ics?yanel.resource.viewid=xml

assuming that you have the default source version of Yanel installed.

michaelwechner commented 11 years ago

I cannot reproduce this issue when using the sample at

http://127.0.0.1:8080/yanel/test/use-cases/calendar.ics

but I can reproduce the problem, that when adding special characters like for example ü,ä, ü that the XML won't be well-formed anymore.

I think the problem is that

src/resources/calendar/src/java/org/wyona/yanel/impl/resources/calendar/CalendarEvent.java#toXML() is using StringBuffer instead the org.w3c.dom classes!

michaelwechner commented 10 years ago

The problem was that the method

src/resources/calendar/src/java/org/wyona/yanel/impl/resources/calendar/CalendarResource.java#getSize()

was not implemented correctly. When requesting the XML view, then the size of calendar.ics was returned anyway, but which of course did not fit, and hence the InputStream was often closed to early

michaelwechner commented 10 years ago

We should still improve the StringBuffer issue

src/resources/calendar/src/java/org/wyona/yanel/impl/resources/calendar/CalendarEvent.java#toXML() is using StringBuffer

michaelwechner commented 10 years ago

StringBuffer has now been replaced by DOM