@@ -47,6 +47,7 @@ public class StdKeyDeserializer extends KeyDeserializer
4747 public final static int TYPE_URL = 14 ;
4848 public final static int TYPE_CLASS = 15 ;
4949 public final static int TYPE_CURRENCY = 16 ;
50+ public final static int TYPE_BYTE_ARRAY = 17 ;
5051
5152 final protected int _kind ;
5253 final protected Class <?> _keyClass ;
@@ -108,6 +109,8 @@ public static StdKeyDeserializer forType(Class<?> raw)
108109 } else if (raw == Currency .class ) {
109110 FromStringDeserializer <?> deser = FromStringDeserializer .findDeserializer (Currency .class );
110111 return new StdKeyDeserializer (TYPE_CURRENCY , raw , deser );
112+ } else if (raw == byte [].class ) {
113+ kind = TYPE_BYTE_ARRAY ;
111114 } else {
112115 return null ;
113116 }
@@ -204,26 +207,32 @@ protected Object _parse(String key, DeserializationContext ctxt) throws Exceptio
204207 try {
205208 return UUID .fromString (key );
206209 } catch (Exception e ) {
207- return ctxt . handleWeirdKey ( _keyClass , key , "problem: %s" , e . getMessage () );
210+ return _weirdKey ( ctxt , key , e );
208211 }
209212 case TYPE_URI :
210213 try {
211214 return URI .create (key );
212215 } catch (Exception e ) {
213- return ctxt . handleWeirdKey ( _keyClass , key , "problem: %s" , e . getMessage () );
216+ return _weirdKey ( ctxt , key , e );
214217 }
215218 case TYPE_URL :
216219 try {
217220 return new URL (key );
218221 } catch (MalformedURLException e ) {
219- return ctxt . handleWeirdKey ( _keyClass , key , "problem: %s" , e . getMessage () );
222+ return _weirdKey ( ctxt , key , e );
220223 }
221224 case TYPE_CLASS :
222225 try {
223226 return ctxt .findClass (key );
224227 } catch (Exception e ) {
225228 return ctxt .handleWeirdKey (_keyClass , key , "unable to parse key as Class" );
226229 }
230+ case TYPE_BYTE_ARRAY :
231+ try {
232+ return ctxt .getConfig ().getBase64Variant ().decode (key );
233+ } catch (Exception e ) {
234+ return _weirdKey (ctxt , key , e );
235+ }
227236 default :
228237 throw new IllegalStateException ("Internal error: unknown key type " +_keyClass );
229238 }
@@ -247,6 +256,11 @@ protected double _parseDouble(String key) throws IllegalArgumentException {
247256 return NumberInput .parseDouble (key );
248257 }
249258
259+ // @since 2.9
260+ protected Object _weirdKey (DeserializationContext ctxt , String key , Exception e ) throws IOException {
261+ return ctxt .handleWeirdKey (_keyClass , key , "problem: %s" , e .getMessage ());
262+ }
263+
250264 /*
251265 /**********************************************************
252266 /* First: the standard "String as String" deserializer
0 commit comments