Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Fix Base64 Error: ArrayIndexOutOfBoundsException #942

Merged
merged 4 commits into from May 20, 2018

Conversation

huadong
Copy link
Contributor

@huadong huadong commented Dec 3, 2017

Fix issue #940 , replace base64 lib with apache's base64 lib.

@huadong
Copy link
Contributor Author

huadong commented Dec 3, 2017

All checks have failed?

take a look in ,

org.glassfish.jersey.internal.util.Base64

public static String decodeAsString(final String text) {
        return decodeAsString(text.getBytes());
}

@mattnworb
Copy link
Member

Thanks for the PR. The build fails because of Findbug warnings in the use of String.getBytes():

[INFO] --- findbugs-maven-plugin:3.0.1:check (default) @ docker-client ---
[INFO] BugInstance size is 2
[INFO] Error size is 0
[INFO] Total bugs: 2
[INFO] Found reliance on default encoding in com.spotify.docker.client.DefaultDockerClient.authHeader(RegistryAuth): String.getBytes() [com.spotify.docker.client.DefaultDockerClient] At DefaultDockerClient.java:[line 2726]
[INFO] Found reliance on default encoding in com.spotify.docker.client.DefaultDockerClient.authRegistryHeader(RegistryConfigs): String.getBytes() [com.spotify.docker.client.DefaultDockerClient] At DefaultDockerClient.java:[line 2754]
[INFO] 

You could fix this by using ObjectMapper.writeValueAsBytes(..) or using String.getBytes(Charsets.UTF_8).

@codecov-io
Copy link

codecov-io commented Dec 12, 2017

Codecov Report

Merging #942 into master will not change coverage.
The diff coverage is 50%.

@@           Coverage Diff            @@
##             master    #942   +/-   ##
========================================
  Coverage      67.5%   67.5%           
  Complexity      748     748           
========================================
  Files           170     170           
  Lines          3111    3111           
  Branches        348     348           
========================================
  Hits           2100    2100           
  Misses          860     860           
  Partials        151     151

@davidxia
Copy link
Contributor

@huadong Just curious, what's the difference between the two methods? Could you write a unit test that fails before your patch and passes afterwards?

Copy link
Contributor

@davidxia davidxia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we shouldn't be using a class that's in org.glassfish.jersey.internal anyways.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants