sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1785298 - /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
Date Fri, 03 Mar 2017 13:42:27 GMT
Author: desruisseaux
Date: Fri Mar  3 13:42:27 2017
New Revision: 1785298

URL: http://svn.apache.org/viewvc?rev=1785298&view=rev
Log:
Fix a NullPointerException when creating the metadata schema on a PostgreSQL database.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java?rev=1785298&r1=1785297&r2=1785298&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
[UTF-8] Fri Mar  3 13:42:27 2017
@@ -242,6 +242,7 @@ public class ScriptRunner implements Aut
     /**
      * The regular expression to use for building {@link #statementsToSkip}.
      * At most one of {@code regexOfStmtToSkip} and {@code statementsToSkip} shall be non-null.
+     * Both fields may be null if there is no statement to skip.
      */
     private StringBuilder regexOfStmtToSkip;
 
@@ -658,13 +659,15 @@ parseLine:  while (pos < length) {
      * @return whether the given SQL statement is supported by the database engine.
      */
     protected boolean isSupported(final CharSequence sql) {
-        if (regexOfStmtToSkip == null) {
+        if (statementsToSkip != null) {
             return !statementsToSkip.reset(sql).matches();
-        } else {
+        } else if (regexOfStmtToSkip != null) {
             // We do not use Pattern.CASE_INSENTITIVE for performance reasons.
             statementsToSkip = Pattern.compile(regexOfStmtToSkip.toString(), Pattern.DOTALL).matcher(sql);
             regexOfStmtToSkip = null;
             return !statementsToSkip.matches();
+        } else {
+            return true;
         }
     }
 



Mime
View raw message