Skip to content

Commit b60d045

Browse files
authored
Merge pull request #93 from oracle/release_2018-12-13
Releasing version 1.3.3
2 parents 2e9982f + 89c69dc commit b60d045

File tree

193 files changed

+8884
-4962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+8884
-4962
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
1313
### Added
1414
- N/A
1515

16+
## 1.3.3 - 2018-12-13
17+
### Added
18+
- Support for Data Guard for VM shapes in the Database service
19+
- Support for sparse disk groups for Exadata shapes in the Database service
20+
- Support for a new field, isLatestForMajorVersion, when listing DB versions in the Database service
21+
- Support for in-transit encryption for paravirtualized boot volume and data volume attachments in the Block Storage service
22+
- Support for tagging DNS Zones in the DNS service
23+
- Support for resetting credentials for SCIM clients associated with an Identity provider and updating user capabilities in the Identity service
24+
25+
### Fixed
26+
- If the response body is an InputStream and the Content-Length header is available, the OCI Java SDK now throws an IOException if the data provided by the InputStream has a different size
27+
1628
## 1.3.2 - 2018-11-29
1729
### Added
1830
- Support for getting bucket statistics in the Object Storage service

bmc-addons/bmc-apache-connector-provider/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk-addons</artifactId>
8-
<version>1.3.2</version>
8+
<version>1.3.3</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>com.oracle.oci.sdk</groupId>
3939
<artifactId>oci-java-sdk-common</artifactId>
40-
<version>1.3.2</version>
40+
<version>1.3.3</version>
4141
</dependency>
4242
</dependencies>
4343
</project>

bmc-addons/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.3.2</version>
8+
<version>1.3.3</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

bmc-audit/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.3.2</version>
8+
<version>1.3.3</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

@@ -19,7 +19,7 @@
1919
<dependency>
2020
<groupId>com.oracle.oci.sdk</groupId>
2121
<artifactId>oci-java-sdk-common</artifactId>
22-
<version>1.3.2</version>
22+
<version>1.3.3</version>
2323
</dependency>
2424
</dependencies>
2525

bmc-bom/pom.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.3.2</version>
8+
<version>1.3.3</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<artifactId>oci-java-sdk-bom</artifactId>
@@ -19,86 +19,86 @@
1919
<dependency>
2020
<groupId>com.oracle.oci.sdk</groupId>
2121
<artifactId>oci-java-sdk-common</artifactId>
22-
<version>1.3.2</version>
22+
<version>1.3.3</version>
2323
<optional>false</optional>
2424
</dependency>
2525
<!-- Service modules, alpha sorted -->
2626
<dependency>
2727
<groupId>com.oracle.oci.sdk</groupId>
2828
<artifactId>oci-java-sdk-audit</artifactId>
29-
<version>1.3.2</version>
29+
<version>1.3.3</version>
3030
<optional>false</optional>
3131
</dependency>
3232
<dependency>
3333
<groupId>com.oracle.oci.sdk</groupId>
3434
<artifactId>oci-java-sdk-containerengine</artifactId>
35-
<version>1.3.2</version>
35+
<version>1.3.3</version>
3636
<optional>false</optional>
3737
</dependency>
3838
<dependency>
3939
<groupId>com.oracle.oci.sdk</groupId>
4040
<artifactId>oci-java-sdk-core</artifactId>
41-
<version>1.3.2</version>
41+
<version>1.3.3</version>
4242
<optional>false</optional>
4343
</dependency>
4444
<dependency>
4545
<groupId>com.oracle.oci.sdk</groupId>
4646
<artifactId>oci-java-sdk-database</artifactId>
47-
<version>1.3.2</version>
47+
<version>1.3.3</version>
4848
<optional>false</optional>
4949
</dependency>
5050
<dependency>
5151
<groupId>com.oracle.oci.sdk</groupId>
5252
<artifactId>oci-java-sdk-dns</artifactId>
53-
<version>1.3.2</version>
53+
<version>1.3.3</version>
5454
<optional>false</optional>
5555
</dependency>
5656
<dependency>
5757
<groupId>com.oracle.oci.sdk</groupId>
5858
<artifactId>oci-java-sdk-email</artifactId>
59-
<version>1.3.2</version>
59+
<version>1.3.3</version>
6060
<optional>false</optional>
6161
</dependency>
6262
<dependency>
6363
<groupId>com.oracle.oci.sdk</groupId>
6464
<artifactId>oci-java-sdk-filestorage</artifactId>
65-
<version>1.3.2</version>
65+
<version>1.3.3</version>
6666
<optional>false</optional>
6767
</dependency>
6868
<dependency>
6969
<groupId>com.oracle.oci.sdk</groupId>
7070
<artifactId>oci-java-sdk-identity</artifactId>
71-
<version>1.3.2</version>
71+
<version>1.3.3</version>
7272
<optional>false</optional>
7373
</dependency>
7474
<dependency>
7575
<groupId>com.oracle.oci.sdk</groupId>
7676
<artifactId>oci-java-sdk-loadbalancer</artifactId>
77-
<version>1.3.2</version>
77+
<version>1.3.3</version>
7878
<optional>false</optional>
7979
</dependency>
8080
<dependency>
8181
<groupId>com.oracle.oci.sdk</groupId>
8282
<artifactId>oci-java-sdk-objectstorage</artifactId>
83-
<version>1.3.2</version>
83+
<version>1.3.3</version>
8484
<optional>false</optional>
8585
</dependency>
8686
<dependency>
8787
<groupId>com.oracle.oci.sdk</groupId>
8888
<artifactId>oci-java-sdk-resourcesearch</artifactId>
8989
<optional>false</optional>
90-
<version>1.3.2</version>
90+
<version>1.3.3</version>
9191
</dependency>
9292
<dependency>
9393
<groupId>com.oracle.oci.sdk</groupId>
9494
<optional>false</optional>
9595
<artifactId>oci-java-sdk-addons-apache</artifactId>
96-
<version>1.3.2</version>
96+
<version>1.3.3</version>
9797
</dependency>
9898
<dependency>
9999
<groupId>com.oracle.oci.sdk</groupId>
100100
<artifactId>oci-java-sdk-keymanagement</artifactId>
101-
<version>1.3.2</version>
101+
<version>1.3.3</version>
102102
<optional>false</optional>
103103
</dependency>
104104
</dependencies>

bmc-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.3.2</version>
8+
<version>1.3.3</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

bmc-common/src/main/java/com/oracle/bmc/http/internal/ResponseHelper.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
*/
44
package com.oracle.bmc.http.internal;
55

6-
import java.io.ByteArrayInputStream;
76
import java.io.InputStream;
87
import java.util.HashMap;
98
import java.util.List;
@@ -18,6 +17,8 @@
1817

1918
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2019
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
20+
import com.google.common.base.Optional;
21+
import com.oracle.bmc.io.internal.ContentLengthVerifyingInputStream;
2122
import com.oracle.bmc.model.BmcException;
2223

2324
import lombok.Builder;
@@ -188,7 +189,25 @@ public static <T> T readEntity(@NonNull final Response response, Class<T> entity
188189
contentType);
189190
try {
190191
// NOTE: do not buffer InputStreams (namely object storage) as those might be very large
191-
return response.readEntity(entityType);
192+
final InputStream rawInputStream = response.readEntity(InputStream.class);
193+
InputStream inputStream = rawInputStream;
194+
195+
Optional<List<String>> contentLengthHeader =
196+
HeaderUtils.get(
197+
response.getStringHeaders(), HttpHeaders.CONTENT_LENGTH);
198+
// If the Content-Length header is present, verify that the length of the input stream matches it
199+
if (contentLengthHeader.isPresent()) {
200+
long contentLength =
201+
HeaderUtils.toValue(
202+
HttpHeaders.CONTENT_LENGTH,
203+
contentLengthHeader.get().get(0),
204+
Long.class);
205+
206+
inputStream =
207+
new ContentLengthVerifyingInputStream(
208+
rawInputStream, contentLength);
209+
}
210+
return (T) inputStream;
192211
} finally {
193212
response.getHeaders().addAll(HttpHeaders.CONTENT_TYPE, contentType);
194213
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/**
2+
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
3+
*/
4+
package com.oracle.bmc.io.internal;
5+
6+
import lombok.RequiredArgsConstructor;
7+
import lombok.extern.slf4j.Slf4j;
8+
9+
import java.io.IOException;
10+
import java.io.InputStream;
11+
12+
/**
13+
* A wrapper over an {@link java.io.InputStream} whose length is known, which verifies that
14+
* the length of the wrapped stream matches its known length.
15+
*
16+
* NOTE: This implementation of content length verification does not support {@link InputStream#reset()}
17+
* and the verification is disabled upon invocation of {@link InputStream#reset()}.
18+
*/
19+
@Slf4j
20+
@RequiredArgsConstructor
21+
public class ContentLengthVerifyingInputStream extends InputStream {
22+
private final InputStream delegate;
23+
private final long contentLength;
24+
25+
private long totalBytesProcessed = 0L;
26+
private boolean isVerificationEnabled = true;
27+
28+
@Override
29+
public int read() throws IOException {
30+
final int byteRead = delegate.read();
31+
// Either one byte read or eof
32+
final int bytesRead = byteRead != -1 ? 1 : -1;
33+
processBytesRead(bytesRead);
34+
return byteRead;
35+
}
36+
37+
@Override
38+
public int read(byte b[]) throws IOException {
39+
final int bytesRead = delegate.read(b);
40+
processBytesRead(bytesRead);
41+
return bytesRead;
42+
}
43+
44+
@Override
45+
public int read(byte b[], int off, int len) throws IOException {
46+
final int bytesRead = delegate.read(b, off, len);
47+
processBytesRead(bytesRead);
48+
return bytesRead;
49+
}
50+
51+
@Override
52+
public long skip(long n) throws IOException {
53+
final long bytesSkipped = delegate.skip(n);
54+
totalBytesProcessed += bytesSkipped;
55+
return bytesSkipped;
56+
}
57+
58+
@Override
59+
public synchronized void mark(int readlimit) {
60+
delegate.mark(readlimit);
61+
}
62+
63+
@Override
64+
public synchronized void reset() throws IOException {
65+
isVerificationEnabled = false;
66+
LOG.info("Content length verification disabled");
67+
delegate.reset();
68+
}
69+
70+
@Override
71+
public int available() throws IOException {
72+
return delegate.available();
73+
}
74+
75+
@Override
76+
public void close() throws IOException {
77+
delegate.close();
78+
}
79+
80+
@Override
81+
public boolean markSupported() {
82+
return delegate.markSupported();
83+
}
84+
85+
private void processBytesRead(final int bytesRead) throws IOException {
86+
if (!isVerificationEnabled) {
87+
return;
88+
}
89+
90+
if (bytesRead == -1) {
91+
if (totalBytesProcessed != contentLength) {
92+
throw new IOException(
93+
String.format(
94+
"Total bytes processed (%d) does not match content-length (%d)",
95+
totalBytesProcessed,
96+
contentLength));
97+
}
98+
} else {
99+
totalBytesProcessed += bytesRead;
100+
}
101+
}
102+
}

bmc-common/src/test/java/com/oracle/bmc/http/internal/ResponseHelperTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public void testReadEntity_streamWithConentType() {
105105
verify(response).readEntity(entityType);
106106
verify(headers).addAll(HttpHeaders.CONTENT_TYPE, contentType);
107107
verify(response, never()).bufferEntity();
108+
verify(response).getStringHeaders();
108109
verifyNoMoreInteractions(response, statusInfo, headers, mockStream);
109110
}
110111

0 commit comments

Comments
 (0)