Skip to content

Commit

Permalink
Adding implicit dependency, using constant instead of hardcoded string
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjonesgoogle committed Nov 4, 2015
1 parent 56ad099 commit 02058b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions gcloud-java-gax/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<artifactId>auto-value</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
Expand Down Expand Up @@ -766,15 +767,15 @@ private static ImmutableList<Segment> parseTemplate(String template) {

private static String encodeUrl(String text) {
try {
return URLEncoder.encode(text, "UTF-8");
return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new ValidationException("UTF-8 encoding is not supported on this platform");
}
}

private static String decodeUrl(String url) {
try {
return URLDecoder.decode(url, "UTF-8");
return URLDecoder.decode(url, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new ValidationException("UTF-8 encoding is not supported on this platform");
}
Expand Down

0 comments on commit 02058b3

Please sign in to comment.