Uploaded image for project: 'jclouds'
  1. jclouds
  2. JCLOUDS-1433

IllegalArgumentException from Strings2.replaceTokens

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0
    • Fix Version/s: 2.2.0, 2.1.1
    • Component/s: jclouds-core
    • Labels:
      None
    • Flags:
      Patch

      Description

      While testing scenarios related to JCLOUDS-1401, I noticed that some operations on blobs with funny filename characters resulted in exceptions like:

      java.lang.IllegalArgumentException: Illegal group reference
      	at java.util.regex.Matcher.appendReplacement(Matcher.java:857)
      	at java.util.regex.Matcher.replaceAll(Matcher.java:955)
      	at org.jclouds.util.Strings2.replaceTokens(Strings2.java:185)
      	at org.jclouds.rest.internal.RestAnnotationProcessor.addHeader(RestAnnotationProcessor.java:763)
      	at org.jclouds.rest.internal.RestAnnotationProcessor.addHeaderIfAnnotationPresentOnMethod(RestAnnotationProcessor.java:756)
      	at org.jclouds.rest.internal.RestAnnotationProcessor.buildHeaders(RestAnnotationProcessor.java:719)
      	at org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:268)
      	at org.jclouds.rest.internal.RestAnnotationProcessor.apply(RestAnnotationProcessor.java:137)
      	at org.jclouds.rest.internal.InvokeHttpMethod.toCommand(InvokeHttpMethod.java:189)
      	at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:85)
      	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:74)
      	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:45)
      	at org.jclouds.rest.internal.DelegatesToInvocationFunction.handle(DelegatesToInvocationFunction.java:156)
      	at org.jclouds.rest.internal.DelegatesToInvocationFunction.invoke(DelegatesToInvocationFunction.java:123)
      	at com.sun.proxy.$Proxy98.copyObject(Unknown Source)
      	at org.jclouds.s3.blobstore.S3BlobStore.copyBlob(S3BlobStore.java:324)
      

      This seems to be due to a failure to notice that Matcher.replaceAll interprets some metacharacters in its argument.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jglick@netbeans.org Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: