Skip to content

Commit 283cdc3

Browse files
committed
Updated sources
1 parent 270752c commit 283cdc3

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repositories {
2525
...
2626
dependencies {
2727
...
28-
implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.8'
28+
implementation 'com.groupdocs:groupdocs-viewer-cloud-android:21.10'
2929
}
3030
```
3131

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>groupdocs-viewer-cloud-android</artifactId>
66
<packaging>jar</packaging>
77
<name>groupdocs-viewer-cloud-android</name>
8-
<version>21.8</version>
8+
<version>21.10</version>
99
<url>https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-android</url>
1010
<description>Java library for communicating with the GroupDocs.Viewer Cloud API</description>
1111
<scm>

src/main/java/com/groupdocs/cloud/viewer/client/ApiClient.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public ApiClient(Configuration configuration) {
9797
this.json = new JSON();
9898

9999
// Set default User-Agent.
100-
setUserAgent("java-sdk/21.8");
100+
setUserAgent("java-sdk/21.10");
101101

102102
// Set connection timeout
103103
setConnectTimeout(configuration.getTimeout());
@@ -876,7 +876,17 @@ public <T> T handleResponse(Response response, Type returnType) throws ApiExcept
876876
}
877877
if(apiError != null && apiError.getCode() != null) {
878878
throw new ApiException(apiError.getMessage(), response.code());
879-
}
879+
}
880+
881+
com.groupdocs.cloud.viewer.model.ApiError apiError1 = null;
882+
try {
883+
apiError1 = json.deserialize(respBody, com.groupdocs.cloud.viewer.model.ApiError.class);
884+
} catch (Exception e) {
885+
//NOTE: ignore
886+
}
887+
if(apiError1 != null && apiError1.getError() != null && apiError1.getError().getMessage() != null) {
888+
throw new ApiException(apiError1.getError().getMessage(), response.code());
889+
}
880890

881891
AuthError authError = null;
882892
try {

src/test/java/com/groupdocs/cloud/viewer/api/ViewerGetInfoApiTests.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ public void TestGetInfoReturnsFileNotFound()
7373
}
7474
}
7575

76+
@Test
77+
public void TestGetInfoPasswordProtected()
78+
{
79+
// Arrange
80+
ViewOptions viewOptions = new ViewOptions();
81+
viewOptions.setFileInfo(TestFiles.PasswordProtectedDocx.ToFileInfo());
82+
viewOptions.getFileInfo().setPassword(null);
83+
GetInfoRequest request = new GetInfoRequest(viewOptions);
84+
85+
// Act & Assert
86+
try {
87+
infoApi.getInfo(request);
88+
fail("Expected ApiException was not thrown.");
89+
} catch (ApiException ex) {
90+
assertEquals("Please specify password to load the document.", ex.getMessage());
91+
}
92+
}
93+
7694
@Test
7795
public void TestGetInfoWithMinimalViewOptions() throws ApiException
7896
{

0 commit comments

Comments
 (0)