2

I've upgraded my application from ojdbc7-12.1.0.2.0 to ojdbc8-12.2.0.1 and a code which worked fine before started to get the next exception:

java.lang.NullPointerException
at java.lang.System.arraycopy(Native Method)
at oracle.jdbc.driver.DynamicByteArray.get(DynamicByteArray.java:538)
at oracle.jdbc.driver.ByteArray.get(ByteArray.java:330)
at oracle.jdbc.driver.Accessor.getBytesInternal(Accessor.java:865)
at oracle.jdbc.driver.TypeAccessor.pickledBytes(TypeAccessor.java:49)
at oracle.jdbc.driver.NamedTypeAccessor.getOracleObject(NamedTypeAccessor.java:215)
at oracle.jdbc.driver.NamedTypeAccessor.getARRAY(NamedTypeAccessor.java:279)
at oracle.jdbc.driver.OracleCallableStatement.getArray(OracleCallableStatement.java:2075)
at oracle.jdbc.driver.OracleCallableStatementWrapper.getArray(OracleCallableStatementWrapper.java:543)
at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:114)
at com.sun.proxy.$Proxy5.getArray(Unknown Source)

The code calls Oracle stored procedure which has array of struct as output parameter:

statement.registerOutParameter(2, OracleTypes.ARRAY, "START_OF_TIMES");

The next code reads data from output array:

    Object[] data = (Object[]) statement.getArray(2).getArray();
    for (Object tmp : data) {
        Struct row = (Struct) tmp;
        Object[] attributes = row.getAttributes();

        final BigDecimal id = (BigDecimal)attributes[0];
        final BigDecimal time = (BigDecimal)attributes[1];
        final String name = String.valueOf(attributes[2]);

Most likely there was no any data in the mentioned array, but this is not the reason for ojdbc to fail with NPE...

Any ideas how to solve this are very welcome!

Mark Vilkel
  • 55
  • 1
  • 5
  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – azro Aug 24 '17 at 12:46
  • This question is very similar in the stack trace https://stackoverflow.com/questions/33381256/has-anyone-seen-this-npe-in-oracle-jdbc-driver – jontro Aug 24 '17 at 13:06

0 Answers0