From 0577674fe364c8e2a18076da4f5aede890b7260b Mon Sep 17 00:00:00 2001 From: Catalina Wei Date: Thu, 3 Apr 2008 05:52:38 +0000 Subject: [PATCH] OPENJPA-555 MappingTool got NullPointerException in DB2Dictionary.isDB2ZOSV8xOrLater() git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@644177 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/jdbc/sql/DB2Dictionary.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java index 732f4d068..8ec05469d 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java @@ -359,7 +359,8 @@ public class DB2Dictionary public boolean isDB2UDBV82OrLater() { boolean match = false; - if ((databaseProductVersion.indexOf("SQL") != -1 + if (databaseProductName != null && + (databaseProductVersion.indexOf("SQL") != -1 || databaseProductName.indexOf("DB2/") != -1) && ((maj == 8 && min >= 2) || (maj >= 9))) match = true; @@ -368,7 +369,8 @@ public class DB2Dictionary public boolean isDB2ZOSV8xOrLater() { boolean match = false; - if ((databaseProductVersion.indexOf("DSN") != -1 + if (databaseProductName != null && + (databaseProductVersion.indexOf("DSN") != -1 || databaseProductName.indexOf("DB2/") == -1) && maj >= 8) match = true; @@ -377,7 +379,8 @@ public class DB2Dictionary public boolean isDB2ISeriesV5R3OrEarlier() { boolean match = false; - if (databaseProductName.indexOf("AS") != -1 + if (databaseProductName != null && + databaseProductName.indexOf("AS") != -1 && ((maj == 5 && min <=3) || maj < 5)) match = true; return match; @@ -385,7 +388,8 @@ public class DB2Dictionary public boolean isDB2ISeriesV5R4OrLater() { boolean match = false; - if (databaseProductName.indexOf("AS") != -1 + if (databaseProductName != null && + databaseProductName.indexOf("AS") != -1 && (maj >=6 || (maj == 5 && min >=4))) match = true; return match; @@ -393,9 +397,10 @@ public class DB2Dictionary public boolean isDB2UDBV81OrEarlier() { boolean match = false; - if ((databaseProductVersion.indexOf("SQL") != -1 - || databaseProductName.indexOf("DB2/") != -1) && - ((maj == 8 && min <= 1) || maj < 8)) + if (databaseProductName != null && + (databaseProductVersion.indexOf("SQL") != -1 + || databaseProductName.indexOf("DB2/") != -1) && + ((maj == 8 && min <= 1) || maj < 8)) match = true; return match; }