db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4903) Plan exporter tool produces broken output if query contains less-than operator
Date Thu, 25 Nov 2010 15:19:13 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12935775#action_12935775
] 

Knut Anders Hatlen commented on DERBY-4903:
-------------------------------------------

Hi Nirmal,

Thanks for writing up the challenges with such a rewrite. Some more
comments below...

> Few negative/tricky points on doing this:
> 1) This way XML document becomes hard to read: It was a requirement,
> so that the user can go through a generated XML file and build up
> his own Style sheet.

I think the Transformer can be tuned to pretty print the document. For
example, this code makes it output XML that looks more or less
identical to the manually formatted XML generated by the exporter:

    trans.setOutputProperty(OutputKeys.INDENT, "yes");
    trans.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");

(I'm not sure exactly how portable the above code is, but I'm sure we
can work out something that'll do the trick.)

I've also noticed that, no matter how badly formatted the XML document
is, it looks nice and tidy when I open it in Firefox. I assume other
XML tools will behave similarly.

> 2) This need some re-factoring of the design approach:

I agree. It will be a chunk of work that someone must volunteer to do.

> 3) Given the time constraint at that time, I was unable to find any
> other approach of creating the HTML file. Since creating the HTML
> file involves parsing the style sheet as well. I think we need some
> extra classes when creating the XML document. So, I am not quite
> sure about the presence of those extra classes in all JREs.

I'm assuming the JREs in question are the Java ME ones. Those JREs
don't even have the classes used in the generation of HTML files, so
they'd need the Xalan jars on the classpath to be able to run the plan
exporter in any case. I believe the Xalan jars contain all the classes
and interfaces needed, also to generate the XML file, but I may be
mistaken.

> 4) Element.setTextContent() method is not there in J2SE 1.4.2, and
> it gave rubbish when I used setNodeValue().

Right, to make it work in 1.4.2, I think we need to replace
setTextContent(text) with appendChild(doc.createTextNode(text)).

> After considering all these facts I think it's better to keep XML
> generation in this way and just handle those special character
> occurrences.

Well, I lean towards the opposite conclusion... :)

If we had used the XML libraries to generate the XML, we wouldn't have
had this bug or DERBY-4902, and perhaps other bugs that we haven't
discovered yet.

But I think the current patch would be a good incremental
improvement. I'll check it in and back-port it to the 10.7 branch so
that it makes it into the next release candidate. If we want to change
how the XML is generated, we can file a new JIRA issue to track that
work.

> Plan exporter tool produces broken output if query contains less-than operator
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-4903
>                 URL: https://issues.apache.org/jira/browse/DERBY-4903
>             Project: Derby
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 10.7.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: C.S. Nirmal J. Fernando
>         Attachments: derby-4903-a.diff
>
>
> The plan exporter tool fails to produce well-formed output for the following query:
> ij> select * from sysibm.sysdummy1 where ibmreqd < 'Z';
> The generation of XML doesn't fail, but when I open the file in Firefox, I see this message:
> XML Parsing Error: not well-formed
> Location: file:///tmp/plan.xml
> Line Number 9, Column 11:
> Operator: <
> ----------^
> HTML generation prints the following error, and produces an empty file:
> ERROR:  'The value of attribute "scan_qualifiers" associated with an element type "null"
must not contain the '<' character.'

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message