private String correctPlusSign ( String origin , String stringToCorrect ) { if ( origin . contains ( "+" ) ) { LOG . debug ( "Adapt plus sign in {} to avoid SDK bug on {}" , origin , stringToCorrect ) ; StringBuilder tmpStringToCorrect = new StringBuilder ( stringToCorrect ) ; boolean hasSign = true ; int fromIndex = 0 ; while ( hasSign ) { int plusLocation = origin . indexOf ( "+" , fromIndex ) ; if ( plusLocation < 0 ) { hasSign = false ; break ; } if ( tmpStringToCorrect . charAt ( plusLocation ) == ' ' ) { tmpStringToCorrect . setCharAt ( plusLocation , ' ' ) ; } if ( origin . length ( ) <= plusLocation + 1 ) { fromIndex = plusLocation + 1 ; } else { fromIndex = origin . length ( ) ; } } LOG . debug ( "Adapt plus sign {} corrected to {}" , stringToCorrect , tmpStringToCorrect . toString ( ) ) ; return tmpStringToCorrect . toString ( ) ; } return stringToCorrect ; }
Due to SDK bug list operations may return strings that has spaces instead of + This method will try to fix names for known patterns