You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2010/06/16 23:17:57 UTC

svn commit: r955394 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Author: dwoods
Date: Wed Jun 16 21:17:57 2010
New Revision: 955394

URL: http://svn.apache.org/viewvc?rev=955394&view=rev
Log:
OPENJPA-1700 FindBugs - Possible null pointer dereference; strName could be set to null.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java?rev=955394&r1=955393&r2=955394&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/PostgresDictionary.java Wed Jun 16 21:17:57 2010
@@ -383,8 +383,8 @@ public class PostgresDictionary
 
         // filter out generated sequences used for bigserial cols, which are
         // of the form <table>_<col>_seq
-        String strName = DBIdentifier.isNull(name) ? null : name.getName();
-        int idx = strName.indexOf('_');
+        String strName = DBIdentifier.isNull(name) ? "" : name.getName();
+        int idx = (strName == null) ? -1 : strName.indexOf('_');
         return idx != -1 && idx != strName.length() - 4
             && strName.toUpperCase().endsWith("_SEQ");
     }