claeis / ili2db

interlis import/export to relational databases
30 stars 30 forks source link

ili2pg validate fails if external connection is used #514

Closed edigonzales closed 1 year ago

edigonzales commented 1 year ago

Funktioniert nicht:

        settings.setJdbcConnection(conn);

        if (function == Config.FC_VALIDATE) {
            run(function, settings);
        }

Funktioniert:

        settings.setJdbcConnection(conn);

        if (function == Config.FC_VALIDATE) {
            settings.setDburl(database.getDbUri());
            settings.setDbusr(database.getDbUser());
            settings.setDbpwd(database.getDbPassword());
            run(function, settings);
        }

Fehlermeldung:

    failed to run ili2pg
    java.lang.NullPointerException
        at ch.ehi.ili2db.base.Ili2db$1.compare(Ili2db.java:911)
        at ch.ehi.ili2db.base.Ili2db$1.compare(Ili2db.java:908)
        at ch.ehi.ili2db.base.Ili2db.logStatistics(Ili2db.java:908)
        at ch.ehi.ili2db.base.Ili2db.runExport(Ili2db.java:1837)
        at ch.ehi.ili2db.base.Ili2db.run(Ili2db.java:213)
        at ch.so.agi.gretl.tasks.impl.Ili2pgAbstractTask.run(Ili2pgAbstractTask.java:206)

Ich glaube settings.getDburl könnte null sein und das führ zu Problemen, z.B. https://github.com/claeis/ili2db/blob/8592c5decac9c5bd739ffbdc0badb06896fbbe6b/src/ch/ehi/ili2db/base/Ili2db.java#L3049

claeis commented 1 year ago

if(config.getDburl()==null)url=conn.getMetaData().getURL();