Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2690

Update OSGi Import-Package to support Oracle CLOB/BLOB

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.2
    • Fix Version/s: 2.4.3, 3.0.0
    • Component/s: None
    • Labels:
      None

      Description

      When openjpa is running in an OSGi environment (Karaf 2.4.0) and all packages not being imported properly may result in the oracleClob_empty_lob_Method being set to null, a NPE will occur when trying to persist an entity with a NULL CLOB column.

      getEmptyClob() (and probably getEmtpyBlob as well) should detect for oracleClob_empty_lob_Method being set to NULL before attempting to invoke the method, or just return the EMPTY_CLOB constant.

       private Clob getEmptyClob()
              throws SQLException {
              if (EMPTY_CLOB != null)
                  return EMPTY_CLOB;
              try {
                  return EMPTY_CLOB = (Clob) oracleClob_empty_lob_Method.invoke(null, new Object[0]);
              } catch (Exception e) {
                  throw new SQLException(e.getMessage());
              }
          }
      

      Reference:

      During constructor of OracleDictionary.. this may return null:

      private Method getMethodByReflection(String className, String methodName, Class<?>... paramTypes) {
              try {
                  return Class.forName(className,true,
                          AccessController.doPrivileged(J2DoPrivHelper
                                  .getContextClassLoaderAction())).
                          getMethod(methodName, paramTypes);
              }
              catch (Exception e) {
                  // all fine
              }
      
              return null;
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                chris@die-schneider.net Christian Schneider
                Reporter:
                mattrpav Matt Pavlovich
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: