public static String resolveTitle ( final String title , final String reference ) { if ( StringUtils . isBlank ( title ) && ! StringUtils . isBlank ( reference ) ) { // If there is no title, assume the reference is a path and take the last part (the "file name") final String [ ] splitReference = PATH_SEPARATOR_REGEX . split ( reference ) ; final String lastPart = splitReference [ splitReference . length - 1 ] ; return StringUtils . isBlank ( lastPart ) || reference . endsWith ( "/" ) || reference . endsWith ( "\\" ) ? reference : lastPart ; } else { return title ; } }
Determine a title to use for a document given it s title and reference fields .