Project

General

Profile

Actions

Bug #26088

open

NPE in archive generation

Added by François ARMAND 22 days ago. Updated 7 days ago.

Status:
Pending release
Priority:
1 (highest)
Category:
Web - Compliance & node report
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
Checked
Regression:
No

Description

2024-12-18 09:59:17+0000 INFO  net.liftweb.http.LiftServlet - Request for /rudder/lift/ajax/F819842088788PLFPXD-20/ failed Cannot invoke "String.endsWith(String)" because the return value of "com.normation.rudder.git.ZipUtils$Zippable.path()" is null
zio.FiberFailure: Cannot invoke "String.endsWith(String)" because the return value of "com.normation.rudder.git.ZipUtils$Zippable.path()" is null
    at com.normation.rudder.git.ZipUtils$.$anonfun$zip$11(ZipUtils.scala:149)
    at zio.ZIO$.$anonfun$foreachDiscard$3(ZIO.scala:3411)
    at com.normation.rudder.git.ZipUtils.zip(ZipUtils.scala:146)
    at com.normation.rudder.git.ZipUtils.zip(ZipUtils.scala:143)
    at com.normation.rudder.git.GitFindUtils.getZip(GitFindUtils.scala:201)
    at com.normation.rudder.git.GitFindUtils.getZip(GitFindUtils.scala:200)
    at com.normation.rudder.rest.lift.SystemApiService11.getZip(SystemApi.scala:847)
    at com.normation.rudder.rest.lift.SystemApiService11.getZip(SystemApi.scala:840)
    at com.normation.rudder.rest.lift.SystemApiService11.getZip(SystemApi.scala:853)
    at com.normation.rudder.rest.lift.SystemApiService11.getZip(SystemApi.scala:854)
    at com.normation.zio.ZioRuntime.unsafeRun(ZioCommons.scala:445)
Caused by: java.lang.NullPointerException: Cannot invoke "String.endsWith(String)" because the return value of "com.normation.rudder.git.ZipUtils$Zippable.path()" is null

Zippable.path can be null, because java. It must be checked for or encapsulated in an IOResult.attempt

      ZIO.foreachDiscard(unique) { x =>
        val name = x.useContent match {
          case None     =>
            if (x.path.endsWith("/")) {
              x.path
            } else {
              x.path + "/" 
            }
          case Some(is) =>
            if (x.path.endsWith("/")) {
              x.path.substring(0, x.path.size - 1)
            } else {
              x.path
            }
        }
        IOResult.attempt(zout.putNextEntry(new ZipEntry(name))) *> (
          x.useContent match {
            case None    => ().succeed
            case Some(x) => x(addToZout)
          }
        )
      }


Files

clipboard-202412181136-ufzl1.png (26.2 KB) clipboard-202412181136-ufzl1.png Elaad FURREEDAN, 2024-12-18 11:36
Actions

Also available in: Atom PDF