Skip to content

Commit

Permalink
added necessary charset arguments for guava hashing interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiberg committed Feb 1, 2015
1 parent 2020c92 commit 9c528ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

package edu.cmu.lti.oaqa.ecd.phase;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -120,9 +120,9 @@ public static ExperimentUUID getCurrentExperiment(JCas jcas) {
public static String getExecutionIdHash(String experimentId, Trace trace, String sequenceId) {
HashFunction hf = Hashing.md5();
Hasher hasher = hf.newHasher();
hasher.putString(experimentId);
hasher.putString(trace.getTrace());
hasher.putString(String.valueOf(sequenceId));
hasher.putString(experimentId,StandardCharsets.UTF_8);
hasher.putString(trace.getTrace(),StandardCharsets.UTF_8);
hasher.putString(String.valueOf(sequenceId),StandardCharsets.UTF_8);
HashCode hash = hasher.hash();
final String traceHash = hash.toString();
return traceHash;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/edu/cmu/lti/oaqa/ecd/phase/Trace.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;

import java.nio.charset.StandardCharsets;
public final class Trace {

private static final HashFunction hf = Hashing.sha256();
Expand All @@ -29,7 +29,7 @@ public final class Trace {

public Trace(String trace) {
this.trace = trace;
this.traceId = hf.hashString(trace).toString();
this.traceId = hf.hashString(trace,StandardCharsets.UTF_8).toString();
}

public int hashCode() {
Expand Down

0 comments on commit 9c528ee

Please sign in to comment.