Skip to content

Commit fc196f4

Browse files
committed
Java 1.5 compatibility corrected
1 parent f66a956 commit fc196f4

File tree

3 files changed

+22
-34
lines changed

3 files changed

+22
-34
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ target
2626
.gradle
2727
build
2828

29-
.settings
3029
.classpath
3130
.project
3231

@@ -35,4 +34,6 @@ build
3534

3635
# BlueJ files
3736
*.ctxt
38-
.vscode
37+
38+
.vscode
39+
.idea

pom.xml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<dependency>
176176
<groupId>org.apache.commons</groupId>
177177
<artifactId>commons-lang3</artifactId>
178-
<version>3.3.2</version>
178+
<version>3.10</version>
179179
</dependency>
180180
<dependency>
181181
<groupId>com.fasterxml.jackson.core</groupId>
@@ -206,24 +206,14 @@
206206
<dependency>
207207
<groupId>commons-io</groupId>
208208
<artifactId>commons-io</artifactId>
209-
<version>2.4</version>
209+
<version>2.6</version>
210210
</dependency>
211211
<!-- Base64 encoding that works in both JVM and Android -->
212212
<dependency>
213213
<groupId>com.brsanthu</groupId>
214214
<artifactId>migbase64</artifactId>
215215
<version>2.2</version>
216216
</dependency>
217-
<dependency>
218-
<groupId>org.apache.commons</groupId>
219-
<artifactId>commons-lang3</artifactId>
220-
<version>${commons_lang3_version}</version>
221-
</dependency>
222-
<dependency>
223-
<groupId>commons-io</groupId>
224-
<artifactId>commons-io</artifactId>
225-
<version>${commons_io_version}</version>
226-
</dependency>
227217
<dependency>
228218
<groupId>com.google.code.gson</groupId>
229219
<artifactId>gson</artifactId>
@@ -243,8 +233,6 @@
243233
</dependencies>
244234
<properties>
245235
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
246-
<commons_io_version>2.5</commons_io_version>
247-
<commons_lang3_version>3.6</commons_lang3_version>
248236
<jackson-version>2.10.1</jackson-version>
249237
<maven-plugin-version>1.0.0</maven-plugin-version>
250238
</properties>

src/test/java/com/aspose/email/cloud/sdk/api/EmailApiTests.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.aspose.email.cloud.sdk.api;
22

33
import java.io.IOException;
4-
import java.nio.charset.StandardCharsets;
4+
import java.io.UnsupportedEncodingException;
55
import java.text.DateFormat;
66
import java.text.ParseException;
77
import java.text.SimpleDateFormat;
@@ -74,10 +74,10 @@ public void dateTest() throws ApiException, ParseException {
7474
}
7575

7676
@Test(groups = { "pipeline" })
77-
public void fileTest() throws ApiException {
77+
public void fileTest() throws ApiException, UnsupportedEncodingException {
7878
String file = createCalendar();
7979
byte[] fileBytes = api.downloadFile(new DownloadFileRequestData(folder + "/" + file, storage, null));
80-
String calendarContent = new String(fileBytes, StandardCharsets.UTF_8);
80+
String calendarContent = new String(fileBytes, "UTF-8");
8181
assert calendarContent.contains("organizer@am.ru");
8282
String uploadedName = UUID.randomUUID().toString() + ".ics";
8383
String path = folder + "/" + uploadedName;
@@ -188,7 +188,7 @@ public void aiBcrParseStorageTest() throws ApiException, IOException {
188188
ListResponseOfStorageFileLocation result = api.aiBcrParseStorage(new AiBcrParseStorageRequestData(
189189
new AiBcrParseStorageRq(
190190
null,
191-
Arrays.asList(new AiBcrImageStorageFile(true, new StorageFileLocation(storage, folder, fileName))),
191+
Collections.singletonList(new AiBcrImageStorageFile(true, new StorageFileLocation(storage, folder, fileName))),
192192
new StorageFolderLocation(storage, outFolderPath))));
193193
// Check that only one file produced
194194
assert result.getValue().size() == 1;
@@ -199,7 +199,7 @@ public void aiBcrParseStorageTest() throws ApiException, IOException {
199199
contactFile.getFolderPath() + "/" + contactFile.getFileName(),
200200
contactFile.getStorage(),
201201
null));
202-
String contactFileContent = new String(contactBytes, StandardCharsets.UTF_8);
202+
String contactFileContent = new String(contactBytes, "UTF-8");
203203
assert contactFileContent.contains("Thomas");
204204
// 5) Get VCard object properties list, check that there are 3 properties or more
205205
HierarchicalObject contactProperties = api.getContactProperties(new GetContactPropertiesRequestData(
@@ -219,7 +219,7 @@ public void aiBcrParseTest() throws ApiException, IOException {
219219
this.getClass().getResourceAsStream("test_single_0001.png"));
220220
String fileBase64 = Base64.encodeToString(fileBytes, false);
221221
ListResponseOfHierarchicalObject result = api.aiBcrParse(new AiBcrParseRequestData(
222-
new AiBcrBase64Rq(null, Arrays.asList(new AiBcrBase64Image(true, fileBase64)))));
222+
new AiBcrBase64Rq(null, Collections.singletonList(new AiBcrBase64Image(true, fileBase64)))));
223223
assert result.getValue().size() == 1;
224224
PrimitiveObject displayName = null;
225225
for(BaseObject property: result.getValue().get(0).getInternalProperties()) {
@@ -233,7 +233,7 @@ public void aiBcrParseTest() throws ApiException, IOException {
233233
}
234234

235235
@Test(groups = { "pipeline" })
236-
public void createCalendarEmailTest() throws ApiException {
236+
public void createCalendarEmailTest() throws ApiException, UnsupportedEncodingException {
237237
Calendar startDate = Calendar.getInstance();
238238
Calendar endDate = (Calendar) startDate.clone();
239239
endDate.set(Calendar.HOUR_OF_DAY, endDate.get(Calendar.HOUR_OF_DAY) + 1);
@@ -272,7 +272,7 @@ public void createCalendarEmailTest() throws ApiException {
272272

273273
byte[] downloaded = api.downloadFile(
274274
new DownloadFileRequestData(folder + "/" + emailFile, storage, null));
275-
String calendarContent = new String(downloaded, StandardCharsets.UTF_8);
275+
String calendarContent = new String(downloaded, "UTF-8");
276276
assert calendarContent.contains("Some subject");
277277
}
278278

@@ -304,7 +304,7 @@ public void aiBcrParseModelTest() throws ApiException, IOException {
304304
this.getClass().getResourceAsStream("test_single_0001.png"));
305305
String fileBase64 = Base64.encodeToString(fileBytes, false);
306306
ListResponseOfContactDto result = api.aiBcrParseModel(new AiBcrParseModelRequestData(
307-
new AiBcrBase64Rq(null, Arrays.asList(new AiBcrBase64Image(true, fileBase64)))));
307+
new AiBcrBase64Rq(null, Collections.singletonList(new AiBcrBase64Image(true, fileBase64)))));
308308
assert result.getValue().size() == 1;
309309
ContactDto firstVCard = result.getValue().get(0);
310310
assert firstVCard.getDisplayName().contains("Thomas");
@@ -316,8 +316,7 @@ public void discoverEmailConfigTest() throws ApiException {
316316
new DiscoverEmailConfigRequestData("example@gmail.com", true));
317317
assert configList.getValue().size() >= 2;
318318
for (EmailAccountConfig config : configList.getValue()) {
319-
if (config.getProtocolType().equals("SMTP"))
320-
assert "smtp.gmail.com".equals(config.getHost());
319+
assert !config.getProtocolType().equals("SMTP") || "smtp.gmail.com".equals(config.getHost());
321320
}
322321
}
323322

@@ -395,7 +394,7 @@ public void emailClientAccountTest() throws ApiException {
395394
@Test(groups = { "pipeline" })
396395
public void emailClientMultiAccountTest() throws ApiException {
397396
EmailClientMultiAccount multiAccount = new EmailClientMultiAccount(
398-
Arrays.<EmailClientAccount>asList(
397+
Arrays.asList(
399398
new EmailClientAccount("imap.gmail.com", 993, "SSLAuto", "IMAP",
400399
new EmailClientAccountPasswordCredentials("example@gmail.com", null, "password"), null),
401400
new EmailClientAccount("exchange.outlook.com", 443, "SSLAuto", "EWS",
@@ -425,18 +424,18 @@ private String createCalendar(Calendar startDate) throws ApiException {
425424
Calendar endDate =(Calendar) startDate.clone();
426425
endDate.set(Calendar.HOUR_OF_DAY, endDate.get(Calendar.HOUR_OF_DAY) + 1);
427426
api.createCalendar(new CreateCalendarRequestData(fileName, new HierarchicalObjectRequest(
428-
new HierarchicalObject("CALENDAR", null, Arrays.<BaseObject>asList(
427+
new HierarchicalObject("CALENDAR", null, Arrays.asList(
429428
new PrimitiveObject("LOCATION", null, "location"),
430429
new PrimitiveObject("STARTDATE", null, dateFormat.format(startDate.getTime())),
431430
new PrimitiveObject("ENDDATE", null, dateFormat.format(endDate.getTime())),
432431
new HierarchicalObject("ORGANIZER", null, Arrays.<BaseObject>asList(
433432
new PrimitiveObject("ADDRESS", null, "organizer@am.ru"),
434433
new PrimitiveObject("DISPLAYNAME", null, "Organizer Name"))),
435-
new HierarchicalObject("ATTENDEES", null, Arrays.<BaseObject>asList(
436-
new IndexedHierarchicalObject(
437-
"ATTENDEE", null, 0, Arrays.<BaseObject>asList(
438-
new PrimitiveObject("ADDRESS", null, "attendee@am.ru"),
439-
new PrimitiveObject("DISPLAYNAME", null, "Attendee Name"))))))),
434+
new HierarchicalObject("ATTENDEES", null, Collections.<BaseObject>singletonList(
435+
new IndexedHierarchicalObject(
436+
"ATTENDEE", null, 0, Arrays.<BaseObject>asList(
437+
new PrimitiveObject("ADDRESS", null, "attendee@am.ru"),
438+
new PrimitiveObject("DISPLAYNAME", null, "Attendee Name"))))))),
440439
new StorageFolderLocation(storage, folder))));
441440
return fileName;
442441
}

0 commit comments

Comments
 (0)