1507 Commits

Author SHA1 Message Date
Timur Alperovich
a0b95ea7a3 JCLOUDS-217: Fix encoding handling in S3.
When constructing the query path, S3 does not properly handle encoded
paths. For example, if a blob named %20 is to be placed into the blob
store, S3 would end up placing blob named " " (what %20 represents).
This occurs because the S3 provider examines the URI's path portion
(which is presented in a decoded fasion to the caller). After
examining the path, it is not encoded again. Instead, we should call
getRawPath() to avoid this issue.

There are two issues on the decoding path:
1. Given a blob named " ", S3 API will throw a RuntimeException due to
a NULL check -- the key that it uses is NULL to represent the XML
content " " corresponding to the blob name.
2. Given a blob named "%20 ", S3 API will generate a URI for a blob
named "%20%20", which is also incorrect. The correct URI would be
"%2520%20" (escaping the first "%" and " " characters).

The first issue is due to the currentOrNull() helper, which calls
trim() on the string and then compares the string to an empty string.
This means that a blob named " " will be parsed as "" and then
converted to NULL as the result of that method. Passing "null" as the
key then fails in a number of places (notably, appendPath()).

The second issue is due to the appendPath() method in the jclouds Uris
class. The issue here is that appendPath() calls urlDecode() and
passes the result to path(). The path() method, in turn, also calls
urlDecode(). After these transformations, a properly encoded blob of
the form %2520%20 turns into "%20 " and then "  " (two spaces). After
these transformations the path is encoded again, resulting in "%20%20"
(which is wrong).
2015-09-08 15:19:02 -07:00
Timur Alperovich
aaa164179c JCLOUDS-217: Percent encoding changes.
jclouds should not check if the string is encoded, but rather expect
that all strings would be encoded prior to transmission. As part of
that change, we must make sure that no code relies on such behavior
within jclouds. This commit adds a blobstore test to check encoding
pattern for blobs. It also removes the encoding check in the Strings2
class and the related test.
2015-09-08 15:12:14 -07:00
Oliver Gondža
edde721937 JCLOUDS-962: Make all @Provider methods final 2015-09-02 23:54:44 +02:00
Oliver Gondža
6cd716f1ea JCLOUDS-962: Do not override provider methods 2015-09-02 23:54:44 +02:00
Andrew Gaul
62f088cf14 JCLOUDS-974: Upgrade to GSON 2.3.1
This may resolve issues with older versions of Maven.  Release notes:

https://sites.google.com/site/gson/gson-roadmap
2015-08-04 11:09:28 -07:00
Andrew Gaul
86f47394bf Correct FindBugs violations 2015-07-31 14:53:58 -07:00
Arvind Nadendla
ba55ab4b12 Fix bug where password information is printed in logs in case of exceptions 2015-07-30 12:16:16 -05:00
Andrea Turli
7480d6e363 replace ExpectTests with MockWebServerTests
refactor AccountApiExpectedTest to AccountApiMockTest
refactor DatacenterApiExpectTest to DatacenterApiMockTest
refactor SoftwareDescriptionApiExpectTest to SoftwareDescriptionApiMockTest
refactor VirtualGuestApiExpectTest to VirtualGuestApiMockTest
refactor VirtualGuestBlockDeviceTemplateGroupApiExpectTest to VirtualGuestBlockDeviceTemplateGroupApiMockTest
2015-06-25 00:03:47 +02:00
Ka-Hing Cheung
140fb7ea7b fix multipart put of a blob with content md5
previously the parts will carry the content md5 of the entire
object, because unsetting the md5 of a ContentMetadata actually
didn't do anything
2015-06-09 22:59:30 -07:00
Andrew Gaul
c22afc5a55 Revert "tighten the isUrlEncoded check"
This reverts commit 82ab88d5896a6628f3fbb42a3c4bce39ce843fa1.
2015-05-27 17:46:24 -07:00
Ka-Hing Cheung
82ab88d589 tighten the isUrlEncoded check
ideally we shouldn't need this function and instead never double
encode strings, but auditing for that is beyond what I have time
for. currently, putBlob(" ") and putBlob("%20") behave the same
way which is arguably incorrect
2015-05-27 16:48:30 -07:00
Andrew Gaul
ff1f2c01ef JCLOUDS-912: Implement RandomInputStream.close
Prevent reading closed RandomInputStream.
2015-05-25 22:26:09 -07:00
Zack Shoylev
6fa59ca22d Upgrade to autovalue 1.1; Adds autovalue/gson builders tests 2015-05-21 16:26:11 -05:00
Ignasi Barrera
7053a7870d JCLOUDS-897: Remove the Rocoto dependency 2015-05-21 00:26:57 +02:00
Svetoslav Neykov
d4fa1159ac Don't retry unsafe HTTP methods in case of an IOException
If an IOException is thrown during the execution of an HttpCommand retry only if the HTTP method is idempotent (i.e. GET, DELETE, PUT). Otherwise the retry could cause unwanted side effects (i.e. creating and leaking multiple new nodes).
2015-05-13 22:01:00 +02:00
Andrew Gaul
6a7a52642a Convert Windows to Unix line endings
Converted with:

mvn checkstyle:checkstyle --quiet -Dcheckstyle.output.file=/dev/stdout -Dcheckstyle.output.format=plain | grep warn | cut -f1 -d: | uniq | xargs -n 1 dos2unix
2015-03-31 18:25:54 -07:00
Andrew Gaul
77d846c5ff Remove unused import 2015-03-30 20:57:59 -07:00
Andrew Gaul
4f566d3b6e Address and suppress FindBugs warnings 2015-03-30 20:40:10 -07:00
Andrew Gaul
db5acb8588 Fix error-prone DepAnn 2015-03-30 19:06:48 -07:00
Ignasi Barrera
f469cf8b51 Next development version 2.0.0-SNAPSHOT 2015-03-24 10:52:01 +01:00
Ignasi Barrera
bb41ed4341 Apache jclouds 1.9.0 release 2015-03-24 10:35:42 +01:00
Ignasi Barrera
4db2b75add Fixes OpenStack extension namespace configuration
* Improves extension namespace configuration to use Guice multibindings
  so each provider can cleanly provide their own namespaces.
* Fixes the HPCloud Compute volume attachment namespace and adds the
  corresponding live tests.
* Fixes the Rackspace CloudServers UK volume attachment namespace.
2015-03-23 22:40:43 +01:00
Zack Shoylev
8217248571 Adds a rackspace-specific test and a fix for the volume-attach extension problem. 2015-03-20 11:41:24 -05:00
Ignasi Barrera
ec63b55a04 JCLOUDS-532: Properly close HTTP streams 2015-03-10 21:28:14 +01:00
Zack Shoylev
fb1f3b9dfd Adds additional details to the jclouds log error message. 2015-02-26 15:01:24 -06:00
Ignasi Barrera
acd06b3024 JCLOUDS-462: Fix AWSEC2TemplateBuilderLiveTest 2015-02-04 11:04:18 +01:00
Aled Sage
55f7e48d89 Fix/improve retry-predicate:
- If get timeout of 0 (or negative), then still try once.
- Remove (unlikely) race in retry’s apply(T) where context-switching
  delays could cause `before(end)` to return false the first time, even
  though the timeout was positive.
- Ensure retries at end of the timeout (e.g. if timeout is 30 secs
  and last sleep takes us up to the 30 secs mark, then test again
  rather than returning immediately after the sleep!)
- Use `long` for time, rather than `java.util.Date`, for internal
  calculations. Deprecates old protected methods that use Date.
2015-01-30 11:07:25 +01:00
Zack Shoylev
46f4a4e454 More robust line-ending detection for Bundles 2015-01-22 12:45:54 -06:00
Zack Shoylev
f5523c9412 Fixes the exponential backoff for small delay values 2015-01-21 16:50:01 -06:00
Andrew Gaul
e183d9e651 Add ByteSourcePayloadIterator to BasePayloadSlicer
ByteSourcePayloadIterator avoids buffering the entire slice like
InputStreamPayloadIterator does.  Also rename PayloadIterator to
better reflect its intent and reduce its visibility.
2015-01-09 22:19:24 -08:00
Jeremy Daggett
d3c1e2eab4 Use AutoService to generate service loader metadata 2015-01-09 11:22:12 -08:00
Andrew Gaul
d5fadb598e Implement read(byte[]) with read() for consistency
Previously multiple calls to read() returned different results than a
single call to read(byte[]).
2014-12-30 17:37:26 -08:00
Ignasi Barrera
958d09ecbd JCLOUDS-753: Make ConnectionSpec configurable in the OkHttp driver 2014-12-02 18:17:17 +01:00
Ignasi Barrera
902f1b4105 JCLOUDS-744: Upgrade to OkHttp 2.1.0 and use its native API 2014-11-27 18:44:08 +01:00
Adrian Cole
a449b24e7d JCLOUDS-480 support version 4 signatures for aws-ec2. 2014-11-22 08:08:37 -08:00
Adrian Cole
6f974f34b5 JCLOUDS-780 Remove vcloud. 2014-11-17 08:18:39 -08:00
Adrian Cole
d8cb6958f0 JCLOUDS-774 cleanup derived location suppliers and backfill test for inconsistent region and zone mappings. 2014-11-16 13:38:48 -08:00
Adrian Cole
90a6bb19f4 Finished partial fix in 91f405c9fedf24822015172e9e3c50acbd855d28. 2014-11-16 10:37:31 -08:00
Zack Shoylev
91f405c9fe Small cleanup of how RegionToEndpoint checks arguments. 2014-11-13 04:37:07 -06:00
Adrian Cole
4b3fa75a68 Implicitly create a json response parser when using @Transform. 2014-11-10 06:57:45 -08:00
Adrian Cole
d8d7b130a3 fixed javadoc typo. 2014-11-02 08:14:45 -08:00
Adrian Cole
45fd59f4b7 JCLOUDS-750 Revert 5b6f1e929ef4b6438facc06df0f081ddef8c9cf6 in favor of tighter contract on @SerializedNames. 2014-11-01 10:56:04 -07:00
Adrian Cole
1e35c0fe19 Use type adapter factory to hard-set serialization of Credentials. 2014-10-30 10:02:27 -07:00
Adrian Cole
e21cbd09cb JCLOUDS-750 support serializing auto-value types without custom type adapters. 2014-10-30 07:19:01 -07:00
Adrian Cole
0012e6f950 JCLOUDS-534 Avoid runtime incompatibility introduced by Guava's closeQuietly. 2014-10-29 17:01:26 -07:00
Adrian Cole
02801321a2 JCLOUDS-410 note that ByteArrayPayload needs to handle offsets. 2014-10-29 10:20:39 -07:00
Adrian Cole
177fd6d37f Do not require Guava ByteSource in order to create a payload. 2014-10-29 10:20:39 -07:00
Adrian Cole
035d9d1ed7 Revert "Remove ByteArrayPayload"
This reverts commit ac2238364840915597b860e395973859b3f447ab.
2014-10-29 10:20:39 -07:00
Adrian Cole
1702bddffa Revert "Replace uses of ByteArrayPayload"
This reverts commit bd5b6853ee4d2397f49e27d68818b01123fa7bd2.
2014-10-29 10:20:38 -07:00
Andrew Phillips
ae8b7636df Moving Guava version config into <dependencyManagement>
- Follow-up to c426e7e: allows overriding of the Guava version
  in modules that inherit from core
- Also consolidating dependency versions
2014-10-28 23:16:19 -04:00