Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-749

Commandline does not thrown CommandLineException when uneven number of quotation marks used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Done
    • maven-shared-utils-3.2.1
    • maven-shared-utils-3.3.3
    • None
    • None

    Description

      The merged fix for MSHARED-416 did not fully fix the issue as the process does not return non-0 on failure (which is what the tests were based on).

      As an example:

       

      @Test
      public void MSHARED_416 () throws Exception {
          Process p = new Commandline("\"Hi\" Friends\"").execute();
          Thread.sleep(1000);
          assertNotEquals(0, p.exitValue());
      }
      
      

      will fail without exception (e.g. return 0):

      java.lang.AssertionError: Values should be different. Actual: 0
      

      Even though the logs state (implying the Exception is being thrown)

      Error translating Commandline.
      

      Suggested fix:

       

      As the Exception is thrown in the constructor, it can be difficult to catch it, so I suggest throwing it up to the process runner (executeCommandLineAsCallable) can handle it appropriately.
      However, I'm unsure of the implications.

      Attachments

        Issue Links

          Activity

            People

              khmarbaise Karl Heinz Marbaise
              KathrynNewbould Kathryn Newbould
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: