NullPointerException in quoteReplacement #725
Comments
Thanks for the report. Could you post the 020 migration causing trouble? It's hard to pin point the exact cause without it. |
Sure, this is the contents of the file V020__data_feed_source_locations.sql (I just replaced the real domain name with "someUrl"): INSERT INTO If I copy and paste these SQL statements into console mysql client, it works perfectly: mysql> INSERT INTO mysql> INSERT INTO After the mvn flyway:migrate is executed, there's no need to do mvn flyway:repair since no record is written into schema_version table. Kind regards, |
Fixed it. One of your placeholders must have had no value. This caused Maven this pass null instead of blank, causing the NPE. |
You're right: if useLocal tag is empty, I get NPE. If it's not empty, the migration works. Thank you for the quick fix :) Kind regards, |
Hi,
We were using flyway-maven-plugin 2.2 and we just upgraded to 2.3. We're doing the database migration with mvn flyway:migrate.
Until some point in time the migrations worked perfectly. But we started to get some errors and we can't get it to migrate with mvn flyway:migration anymore.
Prior the upgrade (using version 2.2) we got the same error as described here: #575.
There's no error with our SQL files. If I copy & paste the SQL file contents into the mysql client, the statements are successfully executed.
After the upgrade (now using version 2.3) we indeed get an error. Find the stacktrace below.
As I understand there's some error replacing the placeholders.
This is our pom definition for flyway plugin:
Any help would be appreciated.
Kind regards,
Lidija
Java stacktrace:
[INFO] Current version of schema
najdi_news_dev
: 019[INFO] Migrating schema
najdi_news_dev
to version 020[DEBUG] Rolling back transaction...
[DEBUG] Transaction rolled back
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.017s
[INFO] Finished at: Mon Apr 14 13:28:13 CEST 2014
[INFO] Final Memory: 15M/981M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.googlecode.flyway:flyway-maven-plugin:2.3:migrate (default-cli) on project najdi-persistence: java.lang.NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.googlecode.flyway:flyway-maven-plugin:2.3:migrate (default-cli) on project najdi-persistence: java.lang.NullPointerException
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: java.lang.NullPointerException
at com.googlecode.flyway.maven.AbstractFlywayMojo.execute(AbstractFlywayMojo.java:536)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.NullPointerException
at java.util.regex.Matcher.quoteReplacement(Matcher.java:598)
at com.googlecode.flyway.core.util.StringUtils.replaceAll(StringUtils.java:132)
at com.googlecode.flyway.core.util.PlaceholderReplacer.replacePlaceholders(PlaceholderReplacer.java:75)
at com.googlecode.flyway.core.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:70)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:243)
at com.googlecode.flyway.core.command.DbMigrate$2.doInTransaction(DbMigrate.java:241)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at com.googlecode.flyway.core.command.DbMigrate.applyMigration(DbMigrate.java:241)
at com.googlecode.flyway.core.command.DbMigrate.access$700(DbMigrate.java:44)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:186)
at com.googlecode.flyway.core.command.DbMigrate$1.doInTransaction(DbMigrate.java:135)
at com.googlecode.flyway.core.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
at com.googlecode.flyway.core.command.DbMigrate.migrate(DbMigrate.java:135)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:872)
at com.googlecode.flyway.core.Flyway$1.execute(Flyway.java:819)
at com.googlecode.flyway.core.Flyway.execute(Flyway.java:1200)
at com.googlecode.flyway.core.Flyway.migrate(Flyway.java:819)
at com.googlecode.flyway.maven.MigrateMojo.doExecute(MigrateMojo.java:38)
at com.googlecode.flyway.maven.AbstractFlywayMojo.execute(AbstractFlywayMojo.java:534)
... 21 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The text was updated successfully, but these errors were encountered: