Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-32046

Jboss-eap-installation-manager String formatting error when displaying repository URLs containing percent-encoded characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 8.1.0.GA
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • Workaround Exists
    • Hide

      Do not use path with spaces for maven repository

      Show
      Do not use path with spaces for maven repository

      When jboss eap installation manager (Prospero) encounters a missing channel metadata error and attempts to display the list of attempted repositories, it crashes with a MissingFormatArgumentException if any repository URL contains percent-encoded characters (e.g., %20 for space).

      This bug is not a regression AFAICT.

      Reproducer:

      prospero.sh \                                                                                                        
          update \                                                                                                                                                                                                                   
          perform \                                               
          --dir=/tmp/server \
          --repositories=file:/home/user/eap%20artifacts/testsuite-maven-repository/local-maven-repository/
      

      Expected: Error message about missing metadata
      Actual: java.util.MissingFormatArgumentException: Format specifier '%20a'

      Root Cause

      The CliConsole.error(String message, String... args) method at line 267 calls String.format(message, args):

      public void error(String message, String... args)

      { getErrOut().println(String.format(message, (Object[]) args)); }

      When ExecutionExceptionHandler.printRepositories() (line 204) passes repository URLs containing percent characters to console.error(), Java's String.format() interprets sequences like %20a as format specifiers. Since no corresponding argument exists, it throws MissingFormatArgumentException.

      Affected code path:

        ExecutionExceptionHandler.printRepositories() (line 204)
          → console.error("  *" + repo + ...)  // repo contains URL with %20
            → CliConsole.error() (line 267)
              → String.format(message, args)  // %20a interpreted as format specifier
                → MissingFormatArgumentException
      

      User Impact:

      • Users cannot see which repositories were attempted when resolution fails
      • Error messages are obscured by secondary exceptions
      • Any repository URL containing % followed by certain characters will trigger this bug
      • Common scenarios: Windows paths with spaces (C:\Program Files), URLs with encoded characters

      Workaround:
      Do not use repositories with a space in path

      Proposed Solution
      Escape percent characters in repository URLs before passing to console.error():

        String escapedRepo = repo.replace("%", "%%");
        console.error("  *" + escapedRepo + ...);
      

              rhn-support-pesilva Pedro Silva
              rhn-support-vsalbaba Vojtěch Šalbaba
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: