Skip to content

Commit

Permalink
JDK9 compatibility: replace DatatypeConverter with Base64 (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
valfirst authored and SrinivasanTarget committed Aug 13, 2018
1 parent e23046a commit 742db4e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/io/appium/java_client/InteractsWithFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

import org.openqa.selenium.remote.Response;

import javax.xml.bind.DatatypeConverter;
import java.nio.charset.StandardCharsets;
import java.util.Base64;

public interface InteractsWithFiles extends ExecutesMethod {

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

return DatatypeConverter.parseBase64Binary(base64String);
return Base64.getDecoder().decode(base64String.getBytes(StandardCharsets.UTF_8));
}

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

return DatatypeConverter.parseBase64Binary(base64String);
return Base64.getDecoder().decode(base64String.getBytes(StandardCharsets.UTF_8));
}

}

0 comments on commit 742db4e

Please sign in to comment.