Skip to content

Commit

Permalink
Do not depend on default charset when hashing
Browse files Browse the repository at this point in the history
+review REVIEW-6495
  • Loading branch information
lptr committed Apr 3, 2017
1 parent fe6f5b1 commit b762622
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -16,6 +16,7 @@

package org.gradle.api.internal.changedetection.state;

import com.google.common.base.Charsets;
import com.google.common.hash.Funnels;
import com.google.common.hash.Hasher;
import com.google.common.io.ByteStreams;
Expand All @@ -31,7 +32,7 @@ public void appendContent(String name, InputStream inputStream, Hasher hasher) {
// TODO: Sort entries in META-INF/ignore some entries
// TODO: Sort entries in .properties/ignore some entries
try {
hasher.putBytes(name.getBytes());
hasher.putString(name, Charsets.UTF_8);
ByteStreams.copy(inputStream, Funnels.asOutputStream(hasher));
} catch (IOException e) {
throw new UncheckedIOException(String.format("Failed to hash file '%s' found on classpath", name), e);
Expand Down

0 comments on commit b762622

Please sign in to comment.