Skip to content

Commit 742db4e

Browse files
valfirstSrinivasanTarget
authored andcommitted
JDK9 compatibility: replace DatatypeConverter with Base64 (#999)
1 parent e23046a commit 742db4e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/io/appium/java_client/InteractsWithFiles.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
import org.openqa.selenium.remote.Response;
2525

26-
import javax.xml.bind.DatatypeConverter;
26+
import java.nio.charset.StandardCharsets;
27+
import java.util.Base64;
2728

2829
public interface InteractsWithFiles extends ExecutesMethod {
2930

@@ -50,7 +51,7 @@ default byte[] pullFile(String remotePath) {
5051
Response response = execute(PULL_FILE, ImmutableMap.of("path", remotePath));
5152
String base64String = response.getValue().toString();
5253

53-
return DatatypeConverter.parseBase64Binary(base64String);
54+
return Base64.getDecoder().decode(base64String.getBytes(StandardCharsets.UTF_8));
5455
}
5556

5657
/**
@@ -76,7 +77,7 @@ default byte[] pullFolder(String remotePath) {
7677
Response response = execute(PULL_FOLDER, ImmutableMap.of("path", remotePath));
7778
String base64String = response.getValue().toString();
7879

79-
return DatatypeConverter.parseBase64Binary(base64String);
80+
return Base64.getDecoder().decode(base64String.getBytes(StandardCharsets.UTF_8));
8081
}
8182

8283
}

0 commit comments

Comments
 (0)