@@ -268,11 +268,11 @@ public String toString() {
268268 */
269269 @ Override
270270 public int getSizeMessageData () {
271- short size = 8 ; // Header size
271+ short hdrSize = 8 ; // Header size
272272 for (CompoundMemberDatatype member : members ) {
273- size += member .getSizeMessageData ();
273+ hdrSize += member .getSizeMessageData ();
274274 }
275- return size ;
275+ return hdrSize ;
276276 }
277277
278278 /**
@@ -353,7 +353,7 @@ public <T> T toPOJO(Class<T> clazz, byte[] bytes) {
353353 }
354354 return instance ;
355355 } catch (Exception e ) {
356- throw new RuntimeException ("Failed to create instance of " + clazz .getName (), e );
356+ throw new IllegalStateException ("Failed to create instance of " + clazz .getName (), e );
357357 }
358358 }
359359
@@ -372,8 +372,7 @@ private Map<String, CompoundMemberDatatype> getCachedMemberMap() {
372372
373373 // Extracted record creation logic with caching
374374 private <T > T createRecordInstance (Class <T > clazz , byte [] bytes ,
375- Map <String , CompoundMemberDatatype > nameToMemberMap )
376- throws Exception {
375+ Map <String , CompoundMemberDatatype > nameToMemberMap ) throws InvocationTargetException , InstantiationException , IllegalAccessException {
377376
378377 // Cache record components
379378 RecordComponent [] components = CLASS_RECORD_COMPONENTS_CACHE .computeIfAbsent (clazz ,
@@ -391,7 +390,7 @@ private <T> T createRecordInstance(Class<T> clazz, byte[] bytes,
391390 ctor .setAccessible (true );
392391 return ctor ;
393392 } catch (NoSuchMethodException e ) {
394- throw new RuntimeException ("No canonical constructor found for record: " + clazz .getName (), e );
393+ throw new IllegalStateException ("No canonical constructor found for record: " + clazz .getName (), e );
395394 }
396395 });
397396
@@ -417,8 +416,7 @@ private <T> T createRecordInstance(Class<T> clazz, byte[] bytes,
417416 // Extracted class creation logic with caching
418417 private <T > T createClassInstance (Class <T > clazz , byte [] bytes ,
419418 Map <String , Field > nameToFieldMap ,
420- Map <String , CompoundMemberDatatype > nameToMemberMap )
421- throws Exception {
419+ Map <String , CompoundMemberDatatype > nameToMemberMap ) throws InvocationTargetException , InstantiationException , IllegalAccessException {
422420
423421 // Cache no-arg constructor
424422 @ SuppressWarnings ("unchecked" )
@@ -433,7 +431,7 @@ private <T> T createClassInstance(Class<T> clazz, byte[] bytes,
433431 Constructor <?> fallback = Arrays .stream (constructors )
434432 .filter (ct -> ct .getParameterCount () <= nameToMemberMap .size ())
435433 .findFirst ()
436- .orElseThrow (() -> new RuntimeException ("No suitable constructor for " + clazz .getName ()));
434+ .orElseThrow (() -> new IllegalStateException ("No suitable constructor for " + clazz .getName ()));
437435 fallback .setAccessible (true );
438436 return fallback ;
439437 }
0 commit comments