We recently migrated our application to JDK 8 from JDK 7. After the change, we ran into a problem with the following snippet of code.
String output = new Str
From the pointers provided by @Holger, It was clear that we had to write a custom CharsetDecoder.
I copied over OpenJDK's version of sun.nio.cs.UTF_8 class, renamed it to CustomUTF_8 and used it to construct a string like so
String output = new String(bytes, new CustomUTF_8());
I plan to run extensive tests cross verifying the outputs generated on Java 7 and Java 8. This is an interim solution while I am trying to fix the actual problem of passing output from hmac directly to String without Base64 encoding it first to.
String output = new String(Base64.Encoder.encode(bytes), Charset.forname("UTF-8"));