MicroShed / boost

Boost Maven and Gradle plugins for MicroProfile development
Eclipse Public License 1.0
27 stars 13 forks source link

In Liberty, BoosterConfigurator with wrong version leads to NPE #351

Open scottkurz opened 5 years ago

scottkurz commented 5 years ago

By the time we get to: boost.runtimes.openliberty.LibertyRuntime.generateLibertyServerConfig(List<AbstractBoosterConfig>) we're only calling configurator.getFeature() for the select configurators w/ corresponding boosters as dependencies in this project.

So instead of falling through and returning 'null':

public class LibertyJAXRSBoosterConfig extends JAXRSBoosterConfig implements LibertyBoosterI {

    public LibertyJAXRSBoosterConfig(Map<String, String> dependencies, BoostLoggerI logger) throws BoostException {
        super(dependencies, logger);
    }

    @Override
    public String getFeature() {
        if (getVersion().equals(JAXRS_VERSION_20)) {
            return JAXRS_20;
        } else if (getVersion().equals(JAXRS_VERSION_21)) {
            return JAXRS_21;
        }
        return null;
    }

we should probably fail fast with a clear error message.

ajm01 commented 5 years ago

top level failure during a mvn boost package will look like:

[INFO] CWWKM2001I: Invoke command is ["C:\BoostRepo\systemtestToolsRepo\system-test\sample-apps\maven-app\target\liberty\wlp\bin\server.bat", create, BoostServer].
[INFO] Server BoostServer created.
[INFO] CWWKM2129I: Server BoostServer has been created at C:\BoostRepo\systemtestToolsRepo\system-test\sample-apps\maven-app\target\liberty\wlp\usr\servers\BoostServer.
FATAL ERROR:  'java.lang.NullPointerException'
           :null
[INFO] CWWKM2102I: Using installDirectory : C:\BoostRepo\systemtestToolsRepo\system-test\sample-apps\maven-app\target\liberty\wlp.
[INFO] CWWKM2102I: Using serverName : BoostServer.
[INFO] CWWKM2102I: Using serverDirectory : C:\BoostRepo\systemtestToolsRepo\system-test\sample-apps\maven-app\target\liberty\wlp\usr\servers\BoostServer.
Downloading from central: https://repo.maven.apache.org/maven2/io/openliberty/features/install-map/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/io/openliberty/features/install-map/maven-metadata.xml (350 B at 1.4 kB/s)
[Fatal Error] :-1:-1: Premature end of file.
[WARNING] The server file C:\BoostRepo\systemtestToolsRepo\system-test\sample-apps\maven-app\target\liberty\wlp\usr\servers\BoostServer\server.xml cannot be parsed. Skipping its features.