Re: [jclouds/jclouds] [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException. (c34935d)

2018-07-10 Thread Jesse Glick
#1228 FTR

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/commit/c34935dcd3476db7397e7433de6243ec81a09ccf#commitcomment-29663823

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Ignasi Barrera
nacx approved this pull request.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#pullrequestreview-136029939

[jira] [Resolved] (JCLOUDS-1433) IllegalArgumentException from Strings2.replaceTokens

2018-07-10 Thread Ignasi Barrera (JIRA)


 [ 
https://issues.apache.org/jira/browse/JCLOUDS-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ignasi Barrera resolved JCLOUDS-1433.
-
   Resolution: Fixed
Fix Version/s: 2.1.1
   2.2.0

> IllegalArgumentException from Strings2.replaceTokens
> 
>
> Key: JCLOUDS-1433
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1433
> Project: jclouds
>  Issue Type: Bug
>  Components: jclouds-core
>Affects Versions: 2.2.0
>Reporter: Jesse Glick
>Priority: Major
> Fix For: 2.2.0, 2.1.1
>
>
> While testing scenarios related to JCLOUDS-1401, I noticed that some 
> operations on blobs with funny filename characters resulted in exceptions 
> like:
> {code:none}
> 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)
> {code}
> This seems to be due to a failure to notice that {{Matcher.replaceAll}} 
> interprets some metacharacters in its argument.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Jesse Glick
There are some tests that fail even without my patch:

```
org.jclouds.aws.AWSResponseException: request PUT 
https://s3.amazonaws.com/jglick-blobstore-TestBucket HTTP/1.1 failed with code 
400, error: AWSError{requestId='…', requestToken='…', code='InvalidBucketName', 
message='The specified bucket is not valid.', 
context='{BucketName=jglick-blobstore-TestBucket, HostId=…}'}
at 
org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:75)
at 
org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:65)
at 
org.jclouds.http.internal.BaseHttpCommandExecutorService.shouldContinue(BaseHttpCommandExecutorService.java:138)
at 
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:107)
at 
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
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.$Proxy48.putBucketInRegion(Unknown Source)
at 
org.jclouds.s3.blobstore.S3BlobStore.createContainerInLocation(S3BlobStore.java:456)
at 
org.jclouds.aws.s3.blobstore.AWSS3BlobStore.createContainerInLocation(AWSS3BlobStore.java:105)
at 
org.jclouds.s3.blobstore.S3BlobStore.createContainerInLocation(S3BlobStore.java:146)
at 
org.jclouds.aws.s3.AWSS3ClientLiveTest.testUseBucketWithUpperCaseName(AWSS3ClientLiveTest.java:109)

org.jclouds.http.HttpResponseException: Server rejected operation connecting to 
PUT 
https://jglick-blobstore11eu.s3-eu-central-1.amazonaws.com/test-blob?X-Amz-Security-Token=…=…=…/eu-central-1/s3/aws4_request=…=…=host=…
 HTTP/1.1
at 
sun.net.www.protocol.http.HttpURLConnection.expect100Continue(HttpURLConnection.java:1269)
at 
sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1348)
at 
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
at 
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:259)
at 
org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.writePayloadToConnection(JavaUrlHttpCommandExecutorService.java:295)
at 
org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:171)
at 
org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:65)
at 
org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:97)
at 
org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:91)
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.$Proxy49.invoke(Unknown Source)
at 
org.jclouds.aws.s3.AWSS3ClientLiveTest.testV4SignatureOps(AWSS3ClientLiveTest.java:192)
```

These seem to be related to the region, perhaps? And:

```
java.lang.NullPointerException: null
at java.net.URI$Parser.parse(URI.java:3042)
at java.net.URI.(URI.java:588)
at java.net.URI.create(URI.java:850)
at 
org.jclouds.s3.S3ClientLiveTest.getObjectURL(S3ClientLiveTest.java:139)
at 
org.jclouds.s3.S3ClientLiveTest.testCopyCannedAccessPolicyPublic(S3ClientLiveTest.java:176)

java.lang.NullPointerException: null
at java.net.URI$Parser.parse(URI.java:3042)
at java.net.URI.(URI.java:588)
at java.net.URI.create(URI.java:850)
at 
org.jclouds.s3.S3ClientLiveTest.getObjectURL(S3ClientLiveTest.java:139)
at 
org.jclouds.s3.S3ClientLiveTest.testPutCannedAccessPolicyPublic(S3ClientLiveTest.java:155)
```

which seem to be caused by an undefined `endpoint`, though I am not sure why 
since `providers/aws-s3/pom.xml` does seem to default it. Anyway, I will ignore 
these for now.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1226#issuecomment-403980911

Re: [jclouds/jclouds] [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException (#1228)

2018-07-10 Thread Ignasi Barrera
Pushed to 
[master](http://git-wip-us.apache.org/repos/asf/jclouds/commit/c34935dc) and 
[2.1.x](http://git-wip-us.apache.org/repos/asf/jclouds/commit/9f999617). Thanks 
@jglick!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1228#issuecomment-403980533

Re: [jclouds/jclouds] [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException (#1228)

2018-07-10 Thread Ignasi Barrera
Closed #1228.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1228#event-1726643033

[jira] [Commented] (JCLOUDS-1433) IllegalArgumentException from Strings2.replaceTokens

2018-07-10 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539277#comment-16539277
 ] 

ASF subversion and git services commented on JCLOUDS-1433:
--

Commit 9f999617cebd26ebb79c95549314f6ea4f2e1551 in jclouds's branch 
refs/heads/2.1.x from [~jesse.gl...@netbeans.com]
[ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=9f99961 ]

[JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, 
Multimap) could result in IllegalArgumentException.


> IllegalArgumentException from Strings2.replaceTokens
> 
>
> Key: JCLOUDS-1433
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1433
> Project: jclouds
>  Issue Type: Bug
>  Components: jclouds-core
>Affects Versions: 2.2.0
>Reporter: Jesse Glick
>Priority: Major
>
> While testing scenarios related to JCLOUDS-1401, I noticed that some 
> operations on blobs with funny filename characters resulted in exceptions 
> like:
> {code:none}
> 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)
> {code}
> This seems to be due to a failure to notice that {{Matcher.replaceAll}} 
> interprets some metacharacters in its argument.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (JCLOUDS-1433) IllegalArgumentException from Strings2.replaceTokens

2018-07-10 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539275#comment-16539275
 ] 

ASF subversion and git services commented on JCLOUDS-1433:
--

Commit c34935dcd3476db7397e7433de6243ec81a09ccf in jclouds's branch 
refs/heads/master from [~jesse.gl...@netbeans.com]
[ https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=c34935d ]

[JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, 
Multimap) could result in IllegalArgumentException.


> IllegalArgumentException from Strings2.replaceTokens
> 
>
> Key: JCLOUDS-1433
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1433
> Project: jclouds
>  Issue Type: Bug
>  Components: jclouds-core
>Affects Versions: 2.2.0
>Reporter: Jesse Glick
>Priority: Major
>
> While testing scenarios related to JCLOUDS-1401, I noticed that some 
> operations on blobs with funny filename characters resulted in exceptions 
> like:
> {code:none}
> 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)
> {code}
> This seems to be due to a failure to notice that {{Matcher.replaceAll}} 
> interprets some metacharacters in its argument.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Jesse Glick
@jglick pushed 1 commit.

069e109  Allow S3ClientLiveTest (and AWSS3ClientLiveTest) to use a session 
token.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds/pull/1226/files/8022473e25654dbb4d6ab12587efd90027657840..069e1097bb9cc9247a2a0b736ba17a50aa08d0d2


Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Jesse Glick
I think I figured out that the existing tests just do not support session 
credentials (and I cannot access my account without them), so I need to patch 
the tests.

> since you are now using the aws-s3 provider there is no need to provide the 
> endpoint, as the AWS provider does already know where it needs to connect.

This is not true—the inherited `testCopyCannedAccessPolicyPublic` and 
`testPutCannedAccessPolicyPublic` fail with an NPE when it is omitted.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1226#issuecomment-403972004

Re: [jclouds/jclouds-labs] JCLOUDS-1386 1&1 Baremetal servers (#431)

2018-07-10 Thread Ali Bazlamit
@alibazlamit pushed 1 commit.

861321b  Merge branch 'master' of https://github.com/jclouds/jclouds-labs into 
oneandone-baremetal-update


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/431/files/6b289e8cc80ce0e8e1740953ecb250bebd321633..861321bcc2ff80d6ebb61c408145a0fc1879db5b


Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
Removed previous solution and added the optional/nullable resourcegroup 
parameter as solution! 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#issuecomment-403970005

Re: [jclouds/jclouds-labs] JCLOUDS-1386 1&1 Baremetal servers (#431)

2018-07-10 Thread Ali Bazlamit
@andreaturli Can you please take a look at this PR and let me know when can we 
move on with it?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/431#issuecomment-403967229

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> @SelectJson("value")
@GET
@Fallback(EmptyListOnNotFoundOr404.class)
List list();
 
+   @Named("networkinterfacecard:list_all")
+   @Path("/providers/Microsoft.Network/networkInterfaces")
+   @SelectJson("value")
+   @GET
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List listAll();

The Nullable solution seems the less intrusive solution for this case, i guess. 
Will do

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201480750

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Ignasi Barrera
nacx commented on this pull request.



> @SelectJson("value")
@GET
@Fallback(EmptyListOnNotFoundOr404.class)
List list();
 
+   @Named("networkinterfacecard:list_all")
+   @Path("/providers/Microsoft.Network/networkInterfaces")
+   @SelectJson("value")
+   @GET
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List listAll();

You can declare it nullable and pass a null value there. I'd say that's a 
better option (for one method that was not needed until now, so we can assume 
there is no big impact in that low-usage path).
Otherwise, let's go for the global APIs instead of changing the existing APIs 
that much. The azure provider is no longer in labs and we must keep backward 
compatibility. If you want to go that path, then you need to `@Deprecate` the 
methods first till the next release, leave one release for deprecation with a 
clear upgrade path, then finally remove it in the next one.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201473420

Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Jesse Glick
I did try running `AWSS3ClientLiveTest` with the arguments you mention, and it 
did not work, as noted in the PR description. Of course the failure messages 
were pretty opaque for security reasons. Noting that these parameters are 
identical to that used by `ContextBuilder` is not particularly helpful to me 
since our tests do not require such keys to be passed in explicitly—the code 
picks up `~/.aws/credentials` automatically and calls `credentialsSupplier` on 
a `SessionCredentials` ultimately using the AWS SDK, and that works fine, and 
there is no apparent system property corresponding to the `sessionToken`. So I 
will guess I will have to find a colleague with better understanding of AWS 
authentication to assist me.

It is good to at least have confirmation that `identity` is an “access key” 
while `credential` is an “access secret” in AWS terminology—this is what would 
be useful to clarify in a `README.md`.

I am less confident in the value of a unit test or mock test since it is not 
self-evident what the actual designed signature would be. The fix is just that 
which produces a signature that Amazon in fact accepts.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1226#issuecomment-403940474

Re: [jclouds/jclouds] [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException (#1228)

2018-07-10 Thread Jesse Glick
jglick commented on this pull request.



>  
 @Test(groups = "unit")
 public class Strings2Test {
 
public void testReplaceTokens() {
   assertEquals(Strings2.replaceTokens("hello {where}", 
ImmutableMap.of("where", "world")), "hello world");
+  assertEquals(Strings2.replaceTokens("hello {where}", 
ImmutableMap.of("where", "$1,000,000 \\o/!")), "hello $1,000,000 \\o/!");

This already passed…

>  
 @Test(groups = "unit")
 public class Strings2Test {
 
public void testReplaceTokens() {
   assertEquals(Strings2.replaceTokens("hello {where}", 
ImmutableMap.of("where", "world")), "hello world");
+  assertEquals(Strings2.replaceTokens("hello {where}", 
ImmutableMap.of("where", "$1,000,000 \\o/!")), "hello $1,000,000 \\o/!");
+  assertEquals(Strings2.replaceTokens("hello {where}", 
ImmutableMultimap.of("where", "$1,000,000 \\o/!")), "hello $1,000,000 \\o/!");

…but this threw an exception.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1228#pullrequestreview-135972918

[jclouds/jclouds] [JCLOUDS-1433] $ and \ in tokenValues passed to Strings2.replaceTokens(String, Multimap) could result in IllegalArgumentException (#1228)

2018-07-10 Thread Jesse Glick
[JCLOUDS-1433](https://jira.apache.org/jira/browse/JCLOUDS-1433), a little fix 
noticed while testing #1226. @kuisathaverat @carlossg
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/1228

-- Commit Summary --

  * [JCLOUDS-1433] $ and \ in tokenValues passed to 
Strings2.replaceTokens(String, Multimap) could result in 
IllegalArgumentException.

-- File Changes --

M core/src/main/java/org/jclouds/util/Strings2.java (2)
M core/src/test/java/org/jclouds/util/Strings2Test.java (3)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/1228.patch
https://github.com/jclouds/jclouds/pull/1228.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1228


[jira] [Commented] (JCLOUDS-1433) IllegalArgumentException from Strings2.replaceTokens

2018-07-10 Thread Jesse Glick (JIRA)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16539130#comment-16539130
 ] 

Jesse Glick commented on JCLOUDS-1433:
--

Filed PR 1228 with a fix.

> IllegalArgumentException from Strings2.replaceTokens
> 
>
> Key: JCLOUDS-1433
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1433
> Project: jclouds
>  Issue Type: Bug
>  Components: jclouds-core
>Affects Versions: 2.2.0
>Reporter: Jesse Glick
>Priority: Major
>
> While testing scenarios related to JCLOUDS-1401, I noticed that some 
> operations on blobs with funny filename characters resulted in exceptions 
> like:
> {code:none}
> 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)
> {code}
> This seems to be due to a failure to notice that {{Matcher.replaceAll}} 
> interprets some metacharacters in its argument.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> @SelectJson("value")
@GET
@Fallback(EmptyListOnNotFoundOr404.class)
List list();
 
+   @Named("networkinterfacecard:list_all")
+   @Path("/providers/Microsoft.Network/networkInterfaces")
+   @SelectJson("value")
+   @GET
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List listAll();

But in that 3rd option, the user is forced to pass a resource group he doesn't 
know anything about (it could even not exist) and that's very confusing

I added 2 commits with the changes to those APIs but i guess that breaks 
compatibility with clients and won't be accepted, right? I believe, however, 
it's the best way to go

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201461297

[jira] [Created] (JCLOUDS-1433) IllegalArgumentException from Strings2.replaceTokens

2018-07-10 Thread Jesse Glick (JIRA)
Jesse Glick created JCLOUDS-1433:


 Summary: IllegalArgumentException from Strings2.replaceTokens
 Key: JCLOUDS-1433
 URL: https://issues.apache.org/jira/browse/JCLOUDS-1433
 Project: jclouds
  Issue Type: Bug
  Components: jclouds-core
Affects Versions: 2.2.0
Reporter: Jesse Glick


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

{code:none}
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)
{code}

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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Ignasi Barrera
Thanks, @jglick!

I'd say before running live tests you could add a small unit test that just 
verifies the `createStringToSign` method so we don't break it accidentally in 
the future.

You can also add a mock unit test to the 
[S3ClientMockTest](https://github.com/jclouds/jclouds/blob/master/apis/s3/src/test/java/org/jclouds/s3/S3ClientMockTest.java)
 class. Mock tests just mock HTTP requests and provide a convenient way to do 
assertions on the generated requests. You could write one test that verifies 
the signature that has been sent for a request.

For the live tests, we don't mention explicitly the S3 parameters in the wiki 
because they are the same for all providers. You can invoke the live tests as 
follows (note this follows the generic format explained in the testing page):

```bash
mvn clean install -Plive -pl :s3 -Dtest=S3ClientLiveTest \
   -Dtest.s3.identity= \
   -Dtest.s3.credential= \
   -Dtest.s3.endpoint=https://s3.amazonaws.com
```

Since S3 is a [generic API](https://jclouds.apache.org/start/concepts/) (if you 
read this quick page you'll get the difference between the S3 *api* and the 
AWS-S3 *provider*) that can be implemented by many providers, we need to set 
the endpoint parameter indicating where to run the live tests against.

Since you are already using AWS, you could run the `aws-s3` provider live tests 
too, as follows:

```bash
mvn clean install -Plive -pl :aws-s3 -Dtest=AWSS3ClientLiveTest \
   -Dtest.aws-s3.identity= \
   -Dtest.aws-s3.credential=
```

Note that since you are now using the `aws-s3` provider there is no need to 
provide the endpoint, as the AWS provider does already know where it needs to 
connect.

The credentials you need to pass in the identity and credential property are 
the same ones you pass to the jclouds `ContextBuilder` when creating the 
context, and in general, the additional properties you have to pass to the 
tests in the command line, are those extra properties you configure when 
creating the context.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1226#issuecomment-403902292

[jclouds/jclouds] Adds ConcurrentModificationException to the list of propagable types (#1227)

2018-07-10 Thread Ignasi Barrera
Depends on https://github.com/jclouds/jclouds/pull/1224
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/1227

-- Commit Summary --

  * Adds ConcurrentModificationException to the list of propagatable types

-- File Changes --

M core/src/main/java/org/jclouds/util/Throwables2.java (2)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/1227.patch
https://github.com/jclouds/jclouds/pull/1227.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1227


Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Ignasi Barrera
nacx commented on this pull request.



> @SelectJson("value")
@GET
@Fallback(EmptyListOnNotFoundOr404.class)
List list();
 
+   @Named("networkinterfacecard:list_all")
+   @Path("/providers/Microsoft.Network/networkInterfaces")
+   @SelectJson("value")
+   @GET
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List listAll();

Yes, that was my point. To get the API you have to pass the resource group, 
then the method name is confusing.

I see three options:

* Create another api, say `GlobalNetworkApi` with an accessor that does not 
require the resource group, and put there the method to list all. The con is 
that you need one specific API for every *listAll*  method you want to expose.
* Create a `SubscriptionApi` and put there all methods that access 
subscription-wide resources.
* Since it is just one method that causes confusion, it is not a big deal to 
rename it to make it clear what it does.

As per my comment, I'd go for the third option, as users already know that all 
network operations are exposed in the network API, and for me it makes more 
sense, even though that resource group is not going to be used by this concrete 
method.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201408746

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
@danielestevez pushed 3 commits.

ebf4a1c  Addresses comments on tests
4ce685a  Removes resourceGroup parameter from NetworkInterfaceCardApi
ca677c6  Removes resourceGroup parameter from PublicIPAddressApi


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds/pull/1225/files/cb31ce999e3fc6ba20bff90e4b27c17a88aff5da..ca677c6844ded096d17908f6f8ec1493f51068ed


Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> @SelectJson("value")
@GET
@Fallback(EmptyListOnNotFoundOr404.class)
List list();
 
+   @Named("networkinterfacecard:list_all")
+   @Path("/providers/Microsoft.Network/networkInterfaces")
+   @SelectJson("value")
+   @GET
+   @Fallback(EmptyListOnNotFoundOr404.class)
+   List listAll();

Been thinking about this one... i like *listAll* since the path already has the 
subscription and requires no resourcegroup, so *listAll* is (obviously?) 
retrieving all the IPs in subscription.
However this led me to notice a bigger problem: to retrieve all Ips in 
subscription you're now required to provide a resourcegroupname just to get the 
reference this API and this makes no sense
 
https://github.com/danielestevez/jclouds/blob/00b6697d096b54a1f4dc6cbb6a308f91cb0728fc/providers/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/AzureComputeApi.java#L118

I think we should remove the required *@PathParam("resourcegroup") String 
resourcegroup* in this case, but it looks like a big change... see any problem 
with this?

Same applies to the publicIpAddressApi

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201356587

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> @@ -119,6 +119,16 @@ public void listPublicIPAddresses() {
   assertTrue(ipList.size() > 0);
}
 
+   @Test(groups = "live", dependsOnMethods = "createPublicIPAddress")
+   public void listAllPublicIPAddresses() {

same :)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201353593

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> @@ -105,6 +105,12 @@ public void listNetworkInterfaceCards() {
   assertTrue(nicList.contains(api().get(nicName)));
}
 
+   @Test(dependsOnMethods = "createNetworkInterfaceCard")
+   public void listAllNetworkInterfaceCards() {

Good catch, that test could definitely fail.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201353467

Re: [jclouds/jclouds] Adds listall methods to NetworkInterfaceCardApi and PublicIPAddressApi (#1225)

2018-07-10 Thread Daniel Estévez
danielestevez commented on this pull request.



> +  String path = String
+
.format("/subscriptions/%s/providers/Microsoft.Network/networkInterfaces?%s", 
subscriptionid, apiVersion);
+
+  assertSent(server, "GET", path);
+  assertTrue(nicList.size() == 3);
+  assertTrue(nicList.get(0).properties().ipConfigurations().size() > 0);
+  
assertEquals(nicList.get(0).properties().ipConfigurations().get(0).properties().privateIPAllocationMethod(),
+"Dynamic");
+  assertTrue(nicList.get(1).properties().ipConfigurations().size() > 0);
+  
assertEquals(nicList.get(1).properties().ipConfigurations().get(0).properties().privateIPAllocationMethod(),
+"Static");
+  assertTrue(nicList.get(2).properties().ipConfigurations().size() > 0);
+  assertNotEquals(IdReference.extractResourceGroup(nicList.get(2).id()), 
resourcegroup);
+  
assertEquals(nicList.get(2).properties().ipConfigurations().get(0).properties().privateIPAllocationMethod(),
+"Static");
+   }

Forgot that one, sorry

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1225#discussion_r201353514

Re: [jclouds/jclouds] Configure Java 7 language level (#1224)

2018-07-10 Thread Andrea Turli
lgtm

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1224#issuecomment-403791422

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
Closed #437.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#event-1725278705

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
merged at 
[master](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/4a9536b8) 

thanks @alibazlamit 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403790894

[jira] [Commented] (JCLOUDS-1425) 1&1 Block Storage and SSH keys API

2018-07-10 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/JCLOUDS-1425?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16538428#comment-16538428
 ] 

ASF subversion and git services commented on JCLOUDS-1425:
--

Commit 4a9536b8c8ca28e56471ea1e1b108f1766fa260b in jclouds-labs's branch 
refs/heads/master from [~alibazlamit]
[ https://git-wip-us.apache.org/repos/asf?p=jclouds-labs.git;h=4a9536b ]

–JCLOUDS-1425 1&1 Block Storage and SSH keys API


> 1&1 Block Storage and SSH keys API 
> ---
>
> Key: JCLOUDS-1425
> URL: https://issues.apache.org/jira/browse/JCLOUDS-1425
> Project: jclouds
>  Issue Type: New Feature
>  Components: jclouds-labs
>Reporter: Ali Bazlamit
>Priority: Minor
>
> This PR adds two new API features from 1&1.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
ok merging now

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403787472

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Ali Bazlamit
Done

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403784731

Re: [jclouds/jclouds] [JCLOUDS-1401] Properly URL-encode the CanonicalQueryString when it contains funny characters (#1226)

2018-07-10 Thread Ivan Fernandez Calvo
kuisathaverat approved this pull request.





-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1226#pullrequestreview-135736156

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
@alibazlamit I was talking about `master` in jclouds-labs yet. 

Can you please squash the commits into 1? thanks

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403755157

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Ali Bazlamit
Yes, though i am not sure what are the required steps to move out from 
jclouds-labs to jclouds. We have been in the labs for a long time and would 
like to move forward.

What about the other PR for 1&1. Could you please give it a look and let me 
know if it is good too?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403753017

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
andreaturli approved this pull request.

lgtm, thanks @alibazlamit 



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#pullrequestreview-135706726

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
@alibazlamit I assume this will be only merged onto `master` yes?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#issuecomment-403731563

Re: [jclouds/jclouds-labs] JCLOUDS-1425 1&1 Block Storage and SSH keys API (#437)

2018-07-10 Thread Andrea Turli
andreaturli commented on this pull request.



> +
+@Path("/block_storages")
+@Produces("application/json")
+@Consumes("application/json")
+@RequestFilters(AuthenticateRequest.class)
+public interface BlockStorageApi extends Closeable {
+
+   @Named("blockstorages:list")
+   @GET
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List list();
+
+   @Named("blockstorages:list")
+   @GET
+   @Fallback(Fallbacks.EmptyListOnNotFoundOr404.class)
+   List list(GenericQueryOptions options);

agreed

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/437#discussion_r201244892