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

ClassCastException Long cannot be cast to Date for NuGet v3 registrations index

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.28.1
    • Fix Version/s: 3.29.0
    • Component/s: nuget-v3
    • Labels:

      Description

      NuGet V3 registrations related end points may cause this exception in the nexus.log and fail the inbound request:

      WARN Stack trace from NXRM 3.28.1
      2020-11-09 01:58:43,682-0500 WARN  [qtp705407730-4170]  username org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Failure servicing: GET /repo/repository/example-nuget-group-repo/v3/registration/5/examplenugetpackagename/index.json
      java.lang.ClassCastException: java.lang.Long cannot be cast to java.util.Date
      	at com.sonatype.nexus.repository.nuget.internal.v3.packagemetadata.NugetRegistrationsFacetSupport.createCatalogEntry(NugetRegistrationsFacetSupport.java:137)
      	at com.sonatype.nexus.repository.nuget.internal.v3.packagemetadata.orient.OrientNugetRegistrationsFacet.lambda$3(OrientNugetRegistrationsFacet.java:207)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at com.sonatype.nexus.repository.nuget.internal.v3.packagemetadata.orient.OrientNugetRegistrationsFacet.generatePageLeafs(OrientNugetRegistrationsFacet.java:211)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:49)
      	at com.sonatype.nexus.repository.nuget.internal.v3.packagemetadata.orient.OrientNugetRegistrationsFacet.buildRegistrationIndex(OrientNugetRegistrationsFacet.java:147)
      	at com.sonatype.nexus.repository.nuget.internal.v3.packagemetadata.NugetRegistrationsFacetSupport.getRegistrationIndex(NugetRegistrationsFacetSupport.java:85)
      	at org.sonatype.nexus.transaction.TransactionalWrapper.proceedWithTransaction(TransactionalWrapper.java:57)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.proceedWithTransaction(TransactionInterceptor.java:66)
      	at org.sonatype.nexus.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:55)
      	at com.sonatype.nexus.repository.nuget.internal.v3.NugetRegistrationIndexHandler.handle(NugetRegistrationIndexHandler.java:47)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      	at com.sonatype.nexus.repository.nuget.internal.NugetSimpleHandlers.lambda$0(NugetSimpleHandlers.java:26)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      	at org.sonatype.nexus.repository.storage.UnitOfWorkHandler.handle(UnitOfWorkHandler.java:39)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      	at org.sonatype.nexus.repository.routing.internal.RoutingRuleHandler.handle(RoutingRuleHandler.java:52)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      	at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:51)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      	at com.sonatype.analytics.internal.handler.AnalyticsMeteringHandler.handle(AnalyticsMeteringHandler.java:69)
      	at org.sonatype.nexus.repository.view.Context.proceed(Context.java:86)
      
      

      The actual published date value is a long stored in the database, where as the code expects it to be an object that can be cast to a Date.

      Expected

      Instead of casting the Long into a Date, coerce it into a Date.

        Attachments

          Activity

            People

            Assignee:
            mbucher Michael Bucher
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Joe Tom Joe Tom
            Team:
            NXRM - Groot
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title