Buggy code:
public final byte getDLMSVersion ( ) { } public final void setDLMSVersion ( byte value ) { } public final int getMaxReceivePDUSize ( ) { } public final void setMaxReceivePDUSize ( int value ) { } public final boolean getUseLogicalNameReferencing ( ) { } public final void setUseLogicalNameReferencing ( boolean value ) { } final byte [ ] [ ] generateMessage ( Object name , byte [ ] data , ObjectType interfaceClass , int AttributeOrdinal , Command cmd ) { if ( ( getLimits ( ) . getMaxInfoRX ( ) ) == null ) { throw new GXDLMSException ( "Invalid<seq2seq4repair_space>arguement." ) ; } boolean asList = false ; ByteBuffer buff ; if ( name instanceof byte [ ] ) { buff = ByteBuffer . wrap ( ( ( byte [ ] ) ( name ) ) ) ; } else { if ( name == null ) { buff = ByteBuffer . wrap ( data ) ; } else if ( getUseLogicalNameReferencing ( ) ) { int len = ( data == null ) ? 0 : data . length ; if ( ( ( cmd == ( Command . GetRequest ) ) || ( cmd == ( Command . SetRequest ) ) ) || ( cmd == ( Command . MethodRequest ) ) ) { if ( name instanceof List ) { asList = true ; List < AbstractMap . SimpleEntry < GXDLMSObject , Integer > > tmp = ( ( List < AbstractMap . SimpleEntry < GXDLMSObject , Integer > > ) ( name ) ) ; buff = ByteBuffer . allocate ( ( ( 20 + len ) + ( ( tmp . size ( ) ) * 10 ) ) ) ; buff . put ( ( ( byte ) ( tmp . size ( ) ) ) ) ; for ( AbstractMap . SimpleEntry < GXDLMSObject , Integer > it : tmp ) { GXCommon . setUInt16 ( ( ( short ) ( it . getKey ( ) . getObjectType ( ) . getValue ( ) ) ) , buff ) ; String [ ] items = it . getKey ( ) . getLogicalName ( ) . split ( "[.]" ) ; if ( ( items . length ) != 6 ) { throw new GXDLMSException ( "Invalid<seq2seq4repair_space>Logical<seq2seq4repair_space>Name." ) ; } for ( String it2 : items ) { buff . put ( Integer . valueOf ( it2 ) . byteValue ( ) ) ; } buff . put ( it . getValue ( ) . byteValue ( ) ) ; buff . put ( ( ( byte ) ( 0 ) ) ) ; } } else { buff = ByteBuffer . allocate ( ( 20 + len ) ) ; buff . putShort ( ( ( short ) ( interfaceClass . getValue ( ) ) ) ) ; String [ ] items = ( ( String ) ( name ) ) . split ( "[.]" , ( - 1 ) ) ; if ( ( items . length ) != 6 ) { throw new GXDLMSException ( "Invalid<seq2seq4repair_space>Logical<seq2seq4repair_space>Name." ) ; } for ( String it : items ) { buff . put ( ( ( byte ) ( ( Short . parseShort ( it ) ) & 255 ) ) ) ; } buff . put ( ( ( byte ) ( AttributeOrdinal ) ) ) ; if ( cmd == ( Command . SetRequest ) ) { buff . put ( ( ( byte ) ( 0 ) ) ) ; if ( ( getUseLogicalNameReferencing ( ) ) && ( ( ( data . length ) + ( buff . position ( ) ) ) >= ( getMaxReceivePDUSize ( ) ) ) ) { byte [ ] tmp = new byte [ buff . position ( ) ] ; buff . position ( 0 ) ; buff . get ( tmp ) ; ByteBuffer tmp2 = ByteBuffer . wrap ( data ) ; tmp2 . position ( data . length ) ; return splitToBlocks ( tmp2 , cmd , false , tmp ) ; } <START_BUG> } <END_BUG> if ( ( data == null ) || ( ( data . length ) == 0 ) ) { buff . put ( ( ( byte ) ( 0 ) ) ) ; } else { buff . put ( ( ( byte ) ( 1 ) ) ) ; } } } else { buff = ByteBuffer . allocate ( ( 20 + len ) ) ; } } else { int len = ( data == null ) ? 0 : data . length ; if ( name instanceof List ) { List < AbstractMap . SimpleEntry < GXDLMSObject , Integer > > tmp = ( ( List < AbstractMap . SimpleEntry < GXDLMSObject , Integer > > ) ( name ) ) ; buff = ByteBuffer . allocate ( ( 10 + ( ( tmp . size ( ) ) * 3 ) ) ) ; buff . put ( ( ( byte ) ( tmp . size ( ) ) ) ) ; for ( AbstractMap . SimpleEntry < GXDLMSObject , Integer > it : tmp ) { buff . put ( ( ( byte ) ( 2 ) ) ) ; int base_address = it . getKey ( ) . getShortName ( ) ; base_address += ( ( it . getValue ( ) ) - 1 ) * 8 ; GXCommon . setUInt16 ( ( ( short ) ( base_address ) ) , buff ) ; } } else { buff = ByteBuffer . allocate ( ( 11 + len ) ) ; buff . put ( ( ( byte ) ( 1 ) ) ) ; if ( ( cmd == ( Command . ReadResponse ) ) || ( cmd == ( Command . WriteResponse ) ) ) { buff . put ( ( ( byte ) ( 0 ) ) ) ; }

Fix:
} else