Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyway breaks when JDBC driver returns null URL #1909

Closed
fabianbergmark opened this issue Jan 26, 2018 · 10 comments
Closed

Flyway breaks when JDBC driver returns null URL #1909

fabianbergmark opened this issue Jan 26, 2018 · 10 comments

Comments

@fabianbergmark
Copy link

What version of Flyway are you using?

5.0.6

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)

Java API

What database are you using (type & version)?

Android Sqlite

What operating system are you using?

Android

What did you do?

(Please include the content causing the issue, any relevant configuration settings, and the command you ran)

Flyway migrate

What did you expect to see?
What did you see instead?

SQLDroidDatabaseMetaData.getURL() is implemented

System.err.println(" ********************* not implemented @ "
+ DebugPrinter.getFileName() + " line "
+ DebugPrinter.getLineNumber());
return null;

resulting in

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.indexOf(java.lang.String)' on a null object reference
at org.flywaydb.core.internal.database.DatabaseFactory.filterUrl(DatabaseFactory.java:204)
at org.flywaydb.core.internal.database.DatabaseFactory.getJdbcUrl(DatabaseFactory.java:191
at org.flywaydb.core.internal.database.DatabaseFactory.createDatabase(DatabaseFactory.java:72)
at org.flywaydb.core.Flyway.execute(Flyway.java:1629)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1168)

@axelfontaine
Copy link
Contributor

This is actually implemented by SQLDroid: https://github.com/SQLDroid/SQLDroid/blob/master/src/main/java/org/sqldroid/SQLDroidDatabaseMetaData.java#L1002

So you are most likely running an outdated version.

Either way, not a Flyway issue.

@fabianbergmark
Copy link
Author

If you checkout the github readme it states that the lastest version is 1.0.3. I think the whole project seems abandoned, and I don't think you should mention in (https://flywaydb.org/blog/flyway-3.0-android.html). I'll try to use the master branch but maybe you should create your own Android support?

@axelfontaine
Copy link
Contributor

We have no plans to maintain the SQLDroid project. However consider talking to @jhannes as he has an active interest in this as well and has contributed various fixes to SQLDroid. Maybe the two of you could create and release an official fork. From our end, we'll happily recommend our users to use it instead of the now (seemingly) abandoned main SQLDroid repo.

@victorroeder
Copy link

Had the same issue and am now using Flyway version 4.0.2 (I remembered this version from one (older?) documentation) instead of 5.0.3 in my Android project, and now it's working. I did not dig deeper into the problem and but maybe a workaround for you...

I'll try to use the master branch but maybe you should create your own Android support?

Did that help, by the way?

@axelfontaine & team: Anyway, many many thanks for Flyway 👍

Bye,
Victor

@fabianbergmark
Copy link
Author

@victorroeder I downloaded the master branch and modified the code to make it work. I'm looking into using xerials jdbc library instead

@jhannes
Copy link

jhannes commented Jan 31, 2018

It's correct that the code is implemented now. However, I have not been able to convince the person with access to the Maven repository to release a new version of SQLDroid since then. :-/

@FilenkovMaxim
Copy link

FilenkovMaxim commented Aug 10, 2018

I'm sorry, but I don't think that it is not a Flyway issue. You know getUrl() can return null, why you don't check it? Especially considering that you only need it for logging.

@lyubomyr-shaydariv
Copy link

@axelfontaine
@FilenkovMaxim is right: the getURL() may return a null and it's said in the JavaDoc:

Returns:
the URL for this DBMS or null if it cannot be generated

What if there's a driver other than SQLDroid that returns a null?

@axelfontaine
Copy link
Contributor

@lyubomyr-shaydariv Excellent point. We will support drivers returning null from 5.2 onwards.

@axelfontaine axelfontaine reopened this Aug 23, 2018
@axelfontaine axelfontaine changed the title Flyway on Android Flyway breaks when JDBC driver returns null URL Aug 23, 2018
@axelfontaine axelfontaine added this to the Flyway 5.2.0 milestone Aug 23, 2018
@lyubomyr-shaydariv
Copy link

@axelfontaine
Awesome news! Thank you very much!

axelfontaine pushed a commit to flyway/flywaydb.org that referenced this issue Aug 24, 2018
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants