private String sortWeakReferenceValues ( String name , String value ) { Set < String > refs = new TreeSet <> ( ) ; DocViewProperty prop = DocViewProperty . parse ( name , value ) ; for ( int i = 0 ; i < prop . values . length ; i ++ ) { refs . add ( prop . values [ i ] ) ; } List < Value > values = new ArrayList <> ( ) ; for ( String ref : refs ) { values . add ( new MockValue ( ref , PropertyType . WEAKREFERENCE ) ) ; } try { String sortedValues = DocViewProperty . format ( new MockProperty ( name , true , values . toArray ( new Value [ values . size ( ) ] ) ) ) ; return sortedValues ; } catch ( RepositoryException ex ) { throw new RuntimeException ( "Unable to format value for " + name , ex ) ; } }
Sort weak reference values alphabetically to ensure consistent ordering .