Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-12355

MavenModels throws an IOException when attempting to parse an empty InputStream

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.3.0
    • Component/s: Maven
    • Labels:
      None
    • Story Points:
      1
    • Sprint:
      Sprint 88

      Description

      The Maven facet attempts to fill in information about a pom using the MavenModels.readModel function. If the supplied input stream is empty, this throws an exception and causes issues upstream when we (for example) attempt to migrate a zero-length pom or deploy one to a hosted repository (see stack trace of resulting HTTP 500 error below).

      The javadoc for the method in question says that it should "return {@code null} if input not parsable". It seems more consistent to return null when the input stream is empty instead of throwing an EOFException, but what would that cause unintended side-effects?

      For reference, NX2 does not reject deployments of empty POMs.

      2017-02-08 19:25:17,516+0100 WARN  [qtp571182704-310] admin org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Service failure
      java.io.EOFException: input contained no data
              at org.codehaus.plexus.util.xml.pull.MXParser.fillBuf(MXParser.java:3037) [na:na]
              at org.codehaus.plexus.util.xml.pull.MXParser.more(MXParser.java:3080) [na:na]
              at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1451) [na:na]
              at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1436) [na:na]
              at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1131) [na:na]
              at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3811) [na:na]
              at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:557) [na:na]
              at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:586) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenModels.readModel(MavenModels.java:132) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.fillInFromModel(MavenFacetImpl.java:367) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putArtifact(MavenFacetImpl.java:325) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPutAssetBlob(MavenFacetImpl.java:295) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.doPut(MavenFacetImpl.java:248) [na:na]
              at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:56) [na:na]
              at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:54) [na:na]
              at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:200) [na:na]
              at org.sonatype.nexus.repository.maven.internal.hosted.HostedHandler.doPut(HostedHandler.java:87) [na:na]
              at org.sonatype.nexus.repository.maven.internal.hosted.HostedHandler.handle(HostedHandler.java:61) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.storage.UnitOfWorkHandler.handle(UnitOfWorkHandler.java:39) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.handlers.ContentHeadersHandler.handle(ContentHeadersHandler.java:44) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler.handle(VersionPolicyHandler.java:60) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.http.PartialFetchHandler.handle(PartialFetchHandler.java:55) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.handlers.ConditionalRequestHandler.handle(ConditionalRequestHandler.java:72) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at com.sonatype.nexus.clm.internal.QuarantineContributedHandler.handle(QuarantineContributedHandler.java:62) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.handlers.HandlerContributor.handle(HandlerContributor.java:67) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.handlers.ExceptionHandler.handle(ExceptionHandler.java:43) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:52) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46) [na:na]
              at org.sonatype.nexus.repository.view.Context.proceed(Context.java:80) [na:na]
              at org.sonatype.nexus.repository.view.Context.start(Context.java:114) [na:na]
              at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:63) [na:na]
              at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:52) [na:na]
              at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:43) [na:na]
              at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.dispatchAndSend(ViewServlet.java:197) [na:na]
              at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.doService(ViewServlet.java:159) [na:na]
              at org.sonatype.nexus.repository.httpbridge.internal.ViewServlet.service(ViewServlet.java:116) [na:na]
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fmilens Frederick Milens
              Reporter:
              ecobb Eric Cobb
              Last Updated By:
              Peter Lynch
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response:

                  tigCommentSecurity.panel-title