Bug 553539 - NPE when using <server> in Maven settings.xml without username or password
Summary: NPE when using <server> in Maven settings.xml without username or password
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Tycho (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-27 08:26 EST by Andreas Sewe CLA
Modified: 2021-04-28 16:53 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Sewe CLA 2019-11-27 08:26:28 EST
When you configure, for your p2 repository a <server> element in your settings.xml that lacks <username> or <password> (see https://maven.apache.org/settings.html#Servers), you get a NPE:

[ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
    at org.eclipse.tycho.p2.remote.P2PasswordUtil.setCredentials (P2PasswordUtil.java:69)
    at org.eclipse.tycho.p2.remote.RemoteRepositoryLoadingHelper.setPasswordForLoading (RemoteRepositoryLoadingHelper.java:125)
    at org.eclipse.tycho.p2.remote.RemoteRepositoryLoadingHelper.getEffectiveLocationAndPrepareLoad (RemoteRepositoryLoadingHelper.java:83)
    at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.translateAndPrepareLoad (RemoteMetadataRepositoryManager.java:47)
    at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:59)
    at org.eclipse.tycho.p2.remote.RemoteMetadataRepositoryManager.loadRepository (RemoteMetadataRepositoryManager.java:53)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolver$LoadedIULocation.loadRepository (TargetDefinitionResolver.java:288)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolver$LoadedIULocation.<init> (TargetDefinitionResolver.java:282)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolver$ResolverRun.addLocation (TargetDefinitionResolver.java:154)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolver.resolveContentWithExceptions (TargetDefinitionResolver.java:121)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolver.resolveContent (TargetDefinitionResolver.java:94)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolverService.resolveFromArguments (TargetDefinitionResolverService.java:70)
    at org.eclipse.tycho.p2.target.TargetDefinitionResolverService.getTargetDefinitionContent (TargetDefinitionResolverService.java:60)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.resolveTargetDefinitions (TargetPlatformFactoryImpl.java:214)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:155)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:128)
    at org.eclipse.tycho.p2.target.TargetPlatformFactoryImpl.createTargetPlatform (TargetPlatformFactoryImpl.java:1)
    at org.eclipse.tycho.p2.manager.ReactorRepositoryManagerImpl.computePreliminaryTargetPlatform (ReactorRepositoryManagerImpl.java:84)
    at org.eclipse.tycho.p2.resolver.P2DependencyResolver.computePreliminaryTargetPlatform (P2DependencyResolver.java:226)
    at org.eclipse.tycho.core.resolver.DefaultTychoResolver.resolveProject (DefaultTychoResolver.java:110)
    at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead (TychoMavenLifecycleParticipant.java:95)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:264)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

FWIW, I accidentally discovered this when I gave

        <servers>
                <server>
                        <id>https://download.eclipse.org/releases/oxygen</id>
                        <configuration>
                                <timeout>120000</timeout>
                        </configuration>
                </server>
        </servers>

a try, hoping that it would give me the same interface to configure timeouts than plain Maven.
Comment 1 Mickael Istria CLA 2021-04-08 18:06:22 EDT
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required.
0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT
  if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done
  if issue is still present when latest release:
* Create a new issue at https://github.com/eclipse/tycho/issues/
  ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience)
  ** In the GitHub description, start with a link to this bugzilla ticket
  ** Optionally add new content to the description if it can helps towards resolution
  ** Submit GitHub issue
* Update bugzilla ticket
  ** Add to "See also" property (up right column) the link to the newly created GitHub issue
  ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>"
  ** Set status as CLOSED MOVED
  ** Submit

All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.