Skip to content

Commit a539939

Browse files
committed
Updated sources
1 parent 3c15d96 commit a539939

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Add following repository and dependency to your project's POM
2424
<dependency>
2525
<groupId>com.groupdocs</groupId>
2626
<artifactId>groupdocs-viewer-cloud</artifactId>
27-
<version>21.8</version>
27+
<version>21.10</version>
2828
<scope>compile</scope>
2929
</dependency>
3030
```
@@ -43,7 +43,7 @@ repositories {
4343
...
4444
dependencies {
4545
...
46-
implementation 'com.groupdocs:groupdocs-viewer-cloud:21.8'
46+
implementation 'com.groupdocs:groupdocs-viewer-cloud:21.10'
4747
}
4848
```
4949

@@ -100,7 +100,7 @@ mvn package -D maven.test.skip=true
100100

101101
Then manually install the following JARs:
102102

103-
* target/groupdocs-viewer-cloud-21.8.jar
103+
* target/groupdocs-viewer-cloud-21.10.jar
104104
* target/lib/*.jar
105105

106106
## Licensing

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</artifactId>
66
<packaging>jar</packaging>
77
<name>groupdocs-viewer-cloud</name>
8-
<version>21.8</version>
8+
<version>21.10</version>
99
<url>https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-java</url>
1010
<description>Java library for communicating with the GroupDocs.Viewer Cloud API</description>
1111
<scm>

simplified-pom.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.groupdocs</groupId>
77
<artifactId>groupdocs-viewer-cloud</artifactId>
8-
<version>{VERSION}</version>
8+
<version>21.10</version>
99
<packaging>jar</packaging>
1010

1111
<name>groupdocs-viewer-cloud</name>

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)