jOOQ / jOOX

jOOX - The Power of jQuery Applied to W3C DOM Like JDBC, DOM is a powerful, yet very verbose low-level API to manipulate XML. The HTML DOM an be manipulated with the popular jQuery product, in JavaScript. Why don't we have jQuery in Java? jOOX is jQuery's XML parts, applied to Java.

Home Page:http://www.jooq.org/products

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a Match with ampersand in content causes printing to error out

PascalSchumacher opened this issue · comments

Expected behavior and actual behavior:

When a Match with an ampersand in content is created a message like [Fatal Error] :1:11: The entity name must immediately follow the '&' in the entity reference. is printed to error out.

Functionally is not affected. The document is created and is well formed.

A simplified test to reproduce the problem:

public void testContentContainsAmpersand() {
    $("company", "a & b");
}

Versions:

  • jOOX: 1.6.1
  • Java: 11.0.2

Looks like this was caused by the changes for #150 / #152 in https://github.com/jOOQ/jOOX/blob/master/jOOX/src/main/java/org/joox/Util.java#L103 This change cause a SaxException to be thrown for content containing an ampersand. The exception is swallowed in https://github.com/jOOQ/jOOX/blob/master/jOOX/src/main/java/org/joox/Util.java#L143 but the com.sun.org.apache.xerces.internal.util.DefaultErrorHandler writes to error out.

The error output can be suppressed by setting the error handler of the DocumentBuilder used by jOOX to null, but avoiding the exception somehow would be a better.

Any ideas/hints how to fix this?

Thanks in advance,
Pascal

Thank you very much for your report. Unfortunately, I cannot reproduce this:

When a Match with an ampersand in content is created a message like [Fatal Error] :1:11: The entity name must immediately follow the '&' in the entity reference. is printed to error out.

Running your test doesn't yield any error messages on my machine. How can this be reproduced?

My mistake - I had checked this with version 1.2.0

Thanks again for your report. This is fixed for jOOX 1.7.0. Currently, there haven't been enough changes to justify a release.

Moving to 1.6.2 as we're getting more reports (e.g. #163), which might make a timely release more probable

Version 1.6.2 has been released including a fix for this issue. It will be available from Maven Central shortly.

Thanks!

Sadly is not on maven central yet and https://github.com/jOOQ/jOOX/releases also does not display it.

For some reason I was looking for 1.6.3. My mistake.

Sorry and thanks!