Codec Hex operations throws Exception

Bug #521674 reported by Oded Peer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Medium
Nicolas Leroux
1.1
Fix Committed
Medium
Nicolas Leroux

Bug Description

Codec.hexStringToByte(String hexString) throws an exception for a valid String.

The following test case
  String s = "test";
  byte[] s1bytes = Codec.hexStringToByte( Codec.byteToHexString( s.getBytes() ) );
  String s1 = new String( s1bytes );
  assertEquals( s, s1 );
fails with
java.lang.StringIndexOutOfBoundsException: String index out of range: 10
 at java.lang.String.substring(String.java:1934)
 at play.libs.Codec.hexStringToByte(Codec.java:115)

I am using version 1.0.1.
Since you already have commons codec and bouncycastle in the 3rd party libraries I suggest using one of them for these operations.

Tags: codec crypto
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.