Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
1.1.6, 1.1.8
-
None
-
MariaDB 10.0.17
Description
Trying to use mariadb connector/j with Atlassian Confluence. Adding plugins fail due to sql interaction error.
I added this change to code for better error reporting:
diff --git a/src/main/java/org/mariadb/jdbc/MySQLResultSet.java b/src/main/java/org/mariadb/jdbc/MySQLResultSet.java
|
index e612428..ef0d0a1 100644
|
--- a/src/main/java/org/mariadb/jdbc/MySQLResultSet.java
|
+++ b/src/main/java/org/mariadb/jdbc/MySQLResultSet.java
|
@@ -3462,7 +3462,11 @@ public class MySQLResultSet implements ResultSet {
|
}
|
|
public long getLong(int i) throws SQLException {
|
- return getValueObject(i).getLong();
|
+ try {
|
+ return getValueObject(i).getLong();
|
+ } catch(Exception e) {
|
+ throw SQLExceptionMapper.getSQLException("Invalid value in field for getLong('" + this.queryResult.getColumnInformation()[i-1].getName() + "´') = " + getValueObject(i).getString(), "S1009", e);
|
+ }
|
}
|
|
public float getFloat(int i) throws SQLException {
|
And after that I get this in confluence log:
Caused by: java.sql.SQLException: Invalid value in field for getLong('PLUGINDA1_?') = ?l??^S??^_?,l?`????J?]?+?<??S??!?+(?^G^M?<65L?x????Y??*<^E?=?z?9s]?{???d???P??^???^\Kr????3?r^Vm{?Y?"^X?Fa(?5?cq???\??KFsEZ?L?^RdG<.?3^@^Do?E^G????^^?^^???ESC??z??6^?^Xa???Tx??Dx
|
?qd??9?????R7?D?7?TN?fR?4^GX?
|
at org.mariadb.jdbc.internal.SQLExceptionMapper.getSQLException(SQLExceptionMapper.java:158)
|
at org.mariadb.jdbc.MySQLResultSet.getLong(MySQLResultSet.java:3468)
|
at org.mariadb.jdbc.MySQLResultSet.getLong(MySQLResultSet.java:170)
|
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getLong(NewProxyResultSet.java:2625)
|
at net.sf.hibernate.type.LongType.get(LongType.java:21)
|
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:72)
|
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:63)
|
at net.sf.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:431)
|
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:205)
|
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:285)
|
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
|
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
|
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
|
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
|
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1570)
|
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
|
at org.springframework.orm.hibernate.HibernateTemplate$24.doInHibernate(HibernateTemplate.java:875)
|
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
|
... 129 more
|
Caused by: java.lang.NumberFormatException
|
at java.math.BigDecimal.<init>(Unknown Source)
|
at java.math.BigDecimal.<init>(Unknown Source)
|
at org.mariadb.jdbc.internal.common.AbstractValueObject.getLong(AbstractValueObject.java:95)
|
at org.mariadb.jdbc.MySQLResultSet.getLong(MySQLResultSet.java:3466)
|
... 145 more
|
The sql querye I beleave this is from is.
select plugindata0_.PLUGINDATAID as PLUGINDA1_, plugindata0_.PLUGINKEY as PLUGINKEY, plugindata0_.FILENAME as FILENAME, plugindata0_.LASTMODDATE as LASTMODD4_, plugindata0_.DATA as DATA from PLUGINDATA plugindata0_ where (plugindata0_.PLUGINKEY='fi.ayy.it.login' ) |
with
mysql confluence -e "select plugindata0_.PLUGINDATAID as PLUGINDA1_, plugindata0_.PLUGINKEY as PLUGINKEY, plugindata0_.FILENAME as FILENAME, plugindata0_.LASTMODDATE as LASTMODD4_, plugindata0_.DATA as DATA from PLUGINDATA plugindata0_ where (plugindata0_.PLUGINKEY='fi.ayy.it.login' );"
|
I get
|
+------------+-----------------+------------------------------------------+---------------------+------+
|
| PLUGINDA1_ | PLUGINKEY | FILENAME | LASTMODD4_ | DATA |
|
+------------+-----------------+------------------------------------------+---------------------+------+
|
| 20742150 | fi.ayy.it.login | plugin_4465232698427290254_login-0.1.jar | 2015-03-18 12:12:03 | |
|
+------------+-----------------+------------------------------------------+---------------------+------+
|
(Though this seems to be without data, which is the one I manually inserted for testing purposes)
Table schema is
MariaDB [confluence]> describe PLUGINDATA;
|
+--------------+--------------+------+-----+---------+-------+
|
| Field | Type | Null | Key | Default | Extra |
|
+--------------+--------------+------+-----+---------+-------+
|
| PLUGINDATAID | bigint(20) | NO | PRI | NULL | |
|
| PLUGINKEY | varchar(255) | NO | UNI | NULL | |
|
| FILENAME | varchar(255) | NO | UNI | NULL | |
|
| LASTMODDATE | datetime | YES | | NULL | |
|
| DATA | longblob | YES | | NULL | |
|
+--------------+--------------+------+-----+---------+-------+
|