-
Type: Bug
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: QualifiedToSchedule
-
Component/s: Query & PageProvider
When h2 is passed a query like SELECT * FROM Document WHERE ecm:fulltext = "some\"thing" a NPE is thrown:
Caused by: java.lang.NullPointerException at org.nuxeo.runtime.datasource.DatasourceExceptionSorter$Configuration.isFatal(DatasourceExceptionSorter.java:154) at org.nuxeo.runtime.datasource.DatasourceExceptionSorter.isExceptionFatal(DatasourceExceptionSorter.java:225) at org.nuxeo.runtime.datasource.PooledDataSourceFactory$JdbcConnectionFactory$1ManagedJDBCConnection.isFatal(PooledDataSourceFactory.java:341) at org.nuxeo.runtime.datasource.PooledDataSourceFactory$JdbcConnectionFactory$1ManagedJDBCConnection.connectionError(PooledDataSourceFactory.java:317) at org.tranql.connector.jdbc.ConnectionHandle.connectionError(ConnectionHandle.java:112) at org.tranql.connector.jdbc.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:54) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.queryProjection(JDBCMapper.java:816) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.query(JDBCMapper.java:715) at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.doInvoke(JDBCMapperConnector.java:111) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.lambda$doConnectAndInvoke$0(JDBCMapperConnector.java:98) at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:589) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.doConnectAndInvoke(JDBCMapperConnector.java:95) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapperConnector.invoke(JDBCMapperConnector.java:84) at com.sun.proxy.$Proxy65.query(Unknown Source) at org.nuxeo.ecm.core.storage.sql.SoftRefCachingMapper.query(SoftRefCachingMapper.java:104) at org.nuxeo.ecm.core.storage.sql.SessionImpl.query(SessionImpl.java:1290) at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.query(ConnectionImpl.java:334) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.query(SQLSession.java:382) at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1182) at org.nuxeo.ecm.core.api.AbstractSession.query(AbstractSession.java:1159) at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.getCurrentPage(CoreQueryDocumentPageProvider.java:148) at org.nuxeo.ecm.platform.query.api.AbstractPageProvider.getCurrentSelectPage(AbstractPageProvider.java:715) at org.nuxeo.ecm.platform.query.nxql.CoreQueryDocumentPageProvider.getCurrentSelectPage(CoreQueryDocumentPageProvider.java:347)
This is caused by incorrect treatment of a null sqlstate in DatasourceExceptionSorter.Configuration.isFatal.
The exception actually caught at that point is:
org.h2.jdbc.JdbcSQLException: Error while indexing document; SQL statement: SELECT "_C1", _NXSCORE FROM (SELECT "HIERARCHY"."ID" AS "_C1", 1 AS _NXSCORE FROM "HIERARCHY" LEFT JOIN NXFT_SEARCH('PUBLIC_FULLTEXT_default', ?) "_NXFTTBL" ON "_NXFTTBL".KEY = "HIERARCHY"."ID" WHERE (("HIERARCHY"."PRIMARYTYPE" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) AND ("_NXFTTBL".KEY IS NOT NULL)) UNION ALL SELECT "_H"."ID" AS "_C1", 1 AS _NXSCORE FROM "HIERARCHY" "_H" JOIN "PROXIES" ON "_H"."ID" = "PROXIES"."ID" JOIN "HIERARCHY" ON "PROXIES"."TARGETID" = "HIERARCHY"."ID" LEFT JOIN NXFT_SEARCH('PUBLIC_FULLTEXT_default', ?) "_NXFTTBL" ON "_NXFTTBL".KEY = "HIERARCHY"."ID" WHERE (("HIERARCHY"."PRIMARYTYPE" IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)) AND ("_NXFTTBL".KEY IS NOT NULL))) ORDER BY _NXSCORE DESC LIMIT 201 OFFSET 0 [0-177] at org.h2.message.DbException.addSQL(DbException.java:131) at org.h2.command.Command.executeQuery(Command.java:213) at org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:109) at org.tranql.connector.jdbc.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:52) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.queryProjection(JDBCMapper.java:816) at org.nuxeo.ecm.core.storage.sql.jdbc.JDBCMapper.query(JDBCMapper.java:715) ... Caused by: java.sql.SQLException: Error while indexing document at org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.convertException(H2Fulltext.java:515) at org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.convertException(H2Fulltext.java:511) at org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.search(H2Fulltext.java:359) at sun.reflect.GeneratedMethodAccessor376.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.h2.engine.FunctionAlias$JavaMethod.getValue(FunctionAlias.java:481) ... Caused by: org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'some"thing': Lexical error at line 1, column 11. Encountered: <EOF> after : "\"thing" at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:116) at org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.search(H2Fulltext.java:351) ... 415 more Caused by: org.apache.lucene.queryparser.classic.TokenMgrError: Lexical error at line 1, column 11. Encountered: <EOF> after : "\"thing" at org.apache.lucene.queryparser.classic.QueryParserTokenManager.getNextToken(QueryParserTokenManager.java:1119) at org.apache.lucene.queryparser.classic.QueryParser.getToken(QueryParser.java:854) at org.apache.lucene.queryparser.classic.QueryParser.jj_3R_3(QueryParser.java:668) at org.apache.lucene.queryparser.classic.QueryParser.jj_3_1(QueryParser.java:702) at org.apache.lucene.queryparser.classic.QueryParser.jj_2_1(QueryParser.java:646) at org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:225) at org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:215) at org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:111) ... 416 more