@Test public void testConvertToStringNull() { InPlaceMsAdObjectSidValueEditor editor = new InPlaceMsAdObjectSidValueEditor(); byte[] bytes = null; String displayValue = editor.convertToString( bytes ); assertEquals( Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ), displayValue ); }
protected String convertToString( byte[] bytes ) { if ( ( bytes == null ) || ( bytes.length < 8 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( 'S' ); int revision = Integer.parseInt( new String( hex, 0, 2 ), 16 ); sb.append( '-' ); sb.append( revision ); int count = Integer.parseInt( new String( hex, 2, 2 ), 16 ); if ( bytes.length != ( 8 + count * 4 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } long authority = Long.parseLong( new String( hex, 4, 12 ), 16 ); sb.append( '-' ); sb.append( authority ); for ( int i = 0; i < count; i++ ) { StringBuffer rid = new StringBuffer(); for ( int k = 3; k >= 0; k-- ) { rid.append( hex[16 + ( i * 8 ) + ( k * 2 )] ); rid.append( hex[16 + ( i * 8 ) + ( k * 2 ) + 1] ); } long subAuthority = Long.parseLong( rid.toString(), 16 ); sb.append( '-' ); sb.append( subAuthority ); } return sb.toString(); }
InPlaceMsAdObjectSidValueEditor extends HexValueEditor { protected String convertToString( byte[] bytes ) { if ( ( bytes == null ) || ( bytes.length < 8 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( 'S' ); int revision = Integer.parseInt( new String( hex, 0, 2 ), 16 ); sb.append( '-' ); sb.append( revision ); int count = Integer.parseInt( new String( hex, 2, 2 ), 16 ); if ( bytes.length != ( 8 + count * 4 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } long authority = Long.parseLong( new String( hex, 4, 12 ), 16 ); sb.append( '-' ); sb.append( authority ); for ( int i = 0; i < count; i++ ) { StringBuffer rid = new StringBuffer(); for ( int k = 3; k >= 0; k-- ) { rid.append( hex[16 + ( i * 8 ) + ( k * 2 )] ); rid.append( hex[16 + ( i * 8 ) + ( k * 2 ) + 1] ); } long subAuthority = Long.parseLong( rid.toString(), 16 ); sb.append( '-' ); sb.append( subAuthority ); } return sb.toString(); } }
InPlaceMsAdObjectSidValueEditor extends HexValueEditor { protected String convertToString( byte[] bytes ) { if ( ( bytes == null ) || ( bytes.length < 8 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( 'S' ); int revision = Integer.parseInt( new String( hex, 0, 2 ), 16 ); sb.append( '-' ); sb.append( revision ); int count = Integer.parseInt( new String( hex, 2, 2 ), 16 ); if ( bytes.length != ( 8 + count * 4 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } long authority = Long.parseLong( new String( hex, 4, 12 ), 16 ); sb.append( '-' ); sb.append( authority ); for ( int i = 0; i < count; i++ ) { StringBuffer rid = new StringBuffer(); for ( int k = 3; k >= 0; k-- ) { rid.append( hex[16 + ( i * 8 ) + ( k * 2 )] ); rid.append( hex[16 + ( i * 8 ) + ( k * 2 ) + 1] ); } long subAuthority = Long.parseLong( rid.toString(), 16 ); sb.append( '-' ); sb.append( subAuthority ); } return sb.toString(); }  }
InPlaceMsAdObjectSidValueEditor extends HexValueEditor { protected String convertToString( byte[] bytes ) { if ( ( bytes == null ) || ( bytes.length < 8 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( 'S' ); int revision = Integer.parseInt( new String( hex, 0, 2 ), 16 ); sb.append( '-' ); sb.append( revision ); int count = Integer.parseInt( new String( hex, 2, 2 ), 16 ); if ( bytes.length != ( 8 + count * 4 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } long authority = Long.parseLong( new String( hex, 4, 12 ), 16 ); sb.append( '-' ); sb.append( authority ); for ( int i = 0; i < count; i++ ) { StringBuffer rid = new StringBuffer(); for ( int k = 3; k >= 0; k-- ) { rid.append( hex[16 + ( i * 8 ) + ( k * 2 )] ); rid.append( hex[16 + ( i * 8 ) + ( k * 2 ) + 1] ); } long subAuthority = Long.parseLong( rid.toString(), 16 ); sb.append( '-' ); sb.append( subAuthority ); } return sb.toString(); }  String getDisplayValue( IValue value ); }
InPlaceMsAdObjectSidValueEditor extends HexValueEditor { protected String convertToString( byte[] bytes ) { if ( ( bytes == null ) || ( bytes.length < 8 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } char[] hex = Hex.encodeHex( bytes ); StringBuffer sb = new StringBuffer(); sb.append( 'S' ); int revision = Integer.parseInt( new String( hex, 0, 2 ), 16 ); sb.append( '-' ); sb.append( revision ); int count = Integer.parseInt( new String( hex, 2, 2 ), 16 ); if ( bytes.length != ( 8 + count * 4 ) ) { return Messages.getString( "InPlaceMsAdObjectSidValueEditor.InvalidSid" ); } long authority = Long.parseLong( new String( hex, 4, 12 ), 16 ); sb.append( '-' ); sb.append( authority ); for ( int i = 0; i < count; i++ ) { StringBuffer rid = new StringBuffer(); for ( int k = 3; k >= 0; k-- ) { rid.append( hex[16 + ( i * 8 ) + ( k * 2 )] ); rid.append( hex[16 + ( i * 8 ) + ( k * 2 ) + 1] ); } long subAuthority = Long.parseLong( rid.toString(), 16 ); sb.append( '-' ); sb.append( subAuthority ); } return sb.toString(); }  String getDisplayValue( IValue value );  }