Editing in web-interface has problems with double qoute

99 views
Skip to first unread message

Duvel

unread,
Jun 25, 2012, 8:31:23 AM6/25/12
to h2-da...@googlegroups.com
Hello,

I noticed a problem when editing XML as a value in a column in the web-interface, see screenshot. My guess is that the escaping of the double quotes in the column value is the problem.

Simple test-script:

create table xmledittest (id serial, xmltext varchar)
insert into xmledittest ( xmltext ) values (select xmlstartdoc() || XMLNODE('a', XMLATTR('href', 'http://h2database.com')));

clear input and run

@edit SELECT * FROM XMLEDITTEST

Try to edit the xml.

With kind regards,

Remco Schoen
Capture.PNG

Noel Grandin

unread,
Jun 25, 2012, 9:42:21 AM6/25/12
to h2-da...@googlegroups.com, Duvel
Thanks, this will be fixed in the next version.

(It's still not perfect, I didn't try to handle line breaks, but it
works better than now.)

Thomas Mueller

unread,
Jun 26, 2012, 2:55:48 PM6/26/12
to h2-da...@googlegroups.com
Hi,

Thanks a lot for fixing this issue! I have now added support for
editing multi-line values / documents.

Regards,
Thomas
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>

Duvel

unread,
Jun 29, 2012, 5:49:03 PM6/29/12
to h2-da...@googlegroups.com
Thx for the fixes!

Duvel

unread,
Jul 4, 2012, 10:26:19 AM7/4/12
to h2-da...@googlegroups.com
I tried it in the h2-latest.jar downloaded today (http://h2database.com/html/build.html#automated), but I'm getting this error when I save a record:

IO Exception: "java.io.IOException: org.h2.message.DbException: IO Exception: ""java.io.IOException: org.h2.jdbc.JdbcSQLException: IO Exception: """"Missing lob: 1"""" [90028-167]"" [90028-167]"; "lob: null table: 25 id: 1" [90031-167]

IO Exception: "java.io.IOException: org.h2.message.DbException: IO Exception: ""java.io.IOException: org.h2.jdbc.JdbcSQLException: IO Exception: """"Missing lob: 1"""" [90028-167]"" [90028-167]"; "lob: null table: 25 id: 1" [90031-167] 90031/90031 (Help)

I'm still working on a reproduction without sending the customer database. But maybe you will have an idea, how to force it to use the seperate lob-storage instead of in record, which would be my guess is related to this problem.

Duvel

unread,
Jul 4, 2012, 10:32:57 AM7/4/12
to h2-da...@googlegroups.com
I also noticed that editing and saving a record can remove line-breaks.

Here a small reproduction:

SELECT * FROM XMLEDITTEST ;
ID      XMLTEXT 
1    <?xml version="1.0"?>
<a href="http://h2database.com"/>
(1 rij, 0 ms)

SELECT length(xmltext) FROM XMLEDITTEST;
LENGTH(XMLTEXT) 
56
(1 rij, 0 ms)

@edit SELECT * FROM XMLEDITTEST;
Edit and save the record in the interface.

SELECT * FROM XMLEDITTEST ;
ID      XMLTEXT 
1    <?xml version="1.0"?><a href="http://h2database.com"/>
(1 rij, 0 ms)

SELECT length(xmltext) FROM XMLEDITTEST;
LENGTH(XMLTEXT) 
54
(1 rij, 0 ms)

Duvel

unread,
Jul 4, 2012, 12:46:52 PM7/4/12
to h2-da...@googlegroups.com
Hello,

Managed to reproduce it now. The first error was hiding the "real" cause because of connecting in server mode. In embedded mode I'm getting the error (NPE) below. It occurs with xmltext changed to the data type clob. A reproduction is below.

create table xmledittest (id serial, xmltext clob);

insert into xmledittest ( xmltext ) values (select xmlstartdoc() || XMLNODE('a', XMLATTR('href', 'http://h2database.com')));
@loop 50 update xmledittest set xmltext = xmltext || XMLNODE('a', XMLATTR('href', 'http://h2database.com'));

Greetings,

Remco

07-04 18:41:49 jdbc[2]: exception
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-167]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
    at org.h2.message.DbException.get(DbException.java:158)
    at org.h2.message.DbException.convert(DbException.java:281)
    at org.h2.message.DbException.toSQLException(DbException.java:254)
    at org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
    at org.h2.jdbc.JdbcResultSet.updateRow(JdbcResultSet.java:2782)
    at org.h2.server.web.WebApp.editResult(WebApp.java:1024)
    at org.h2.server.web.WebApp.process(WebApp.java:221)
    at org.h2.server.web.WebApp.processRequest(WebApp.java:164)
    at org.h2.server.web.WebThread.process(WebThread.java:137)
    at org.h2.server.web.WebThread.run(WebThread.java:93)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at org.h2.value.ValueLobDb.getInputStream(ValueLobDb.java:290)
    at org.h2.value.ValueLobDb.getReader(ValueLobDb.java:276)
    at org.h2.value.ValueLobDb.getString(ValueLobDb.java:197)
    at org.h2.value.ValueLobDb.compareSecure(ValueLobDb.java:262)
    at org.h2.value.Value.compareTo(Value.java:895)
    at org.h2.jdbc.JdbcResultSet.patchCurrentRow(JdbcResultSet.java:3476)
    at org.h2.jdbc.JdbcResultSet.updateRow(JdbcResultSet.java:2778)
    ... 6 more

Thomas Mueller

unread,
Oct 29, 2012, 3:07:11 PM10/29/12
to h2-da...@googlegroups.com
Hi,

I'm unable to reproduce the NullPointerException with the latest version. Maybe the problem is fixed now? Or possibly it was only occurring with a broken database?

Regards,
Thomas



--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/KIwriNKbPowJ.
Reply all
Reply to author
Forward
0 new messages