Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-8622

Incorrect OSGi configuration ID leads to StringIndexOutOfBoundException

    XMLWordPrintableJSON

    Details

      Description

      TheĀ ConfigUpdateHandler class and mostly 2 methods inside seems to be not safe enough and they lead to runtime exception like this:

      Runtime Exception
      Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 43
      	at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:47)
      	at java.base/java.lang.String.charAt(String.java:693)
      	at com.adobe.empty.Main.getFactoryPidAndPid(Main.java:34)
      	at com.adobe.empty.Main.run(Main.java:64)
      	at com.adobe.empty.Main.main(Main.java:59)
      

      which prevents Installer to be working correctly. The exception on a faulty input can be reproduced using the simple main class as a POC: BugRunner.java

      Actual behavior

      The whole update handler is aborted due to one faulty name of the OSGi config and the update and installer thread is stopped

      Expected behavior

      The wrong configuration name should be either skipped or converted if possible to the correct name not leading to stop in update thread.

        Attachments

        1. BugRunner.java
          3 kB
          Arek Kita

          Activity

            People

            • Assignee:
              cziegeler Carsten Ziegeler
              Reporter:
              kitarek Arek Kita
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: