Buggy code:
public final class GenMapAndTopicListModule extends AbstractPipelineModuleImpl { public static final String ELEMENT_STUB = "stub" ; private final Set < URI > ditaSet ; private final Set < URI > fullTopicSet ; private final Set < URI > fullMapSet ; private final Set < URI > hrefTopicSet ; private final Set < URI > hrefWithIDSet ; private final Set < URI > chunkTopicSet ; private final Set < URI > hrefMapSet ; private final Set < URI > conrefSet ; private final Set < URI > coderefSet ; private final Set < URI > imageSet ; private final Set < URI > flagImageSet ; private final Set < URI > htmlSet ; private final Set < URI > hrefTargetSet ; private Set < URI > conrefTargetSet ; private Set < URI > copytoSourceSet ; private final Set < URI > nonConrefCopytoTargetSet ; private final Set < URI > ignoredCopytoSourceSet ; private final Set < URI > subsidiarySet ; private final Set < URI > relFlagImagesSet ; private Map < URI , URI > copytoMap ; private final Queue < URI > waitList ; private final List < URI > doneList ; private final Set < URI > outDitaFilesSet ; private final Set < URI > conrefpushSet ; private final Set < URI > keyrefSet ; private final Set < URI > resourceOnlySet ; private final Map < String , KeyDef > keysDefMap ; private File baseInputDir ; private File ditaDir ; private boolean profilingEnabled ; private File ditavalFile ; private int uplevels = 0 ; private XMLReader reader ; private GenListModuleReader listFilter ; private KeydefFilter keydefFilter ; private ExportAnchorsFilter exportAnchorsFilter ; private boolean xmlValidate = true ; private ContentHandler nullHandler ; private FilterUtils filterUtils ; private GenMapAndTopicListModule . TempFileNameScheme tempFileNameScheme ; private URI rootFile ; private URI currentFile ; private Map < String , KeyDef > schemekeydefMap ; private final Set < URI > schemeSet ; private final Map < URI , Set < URI > > schemeDictionary ; private String transtype ; private boolean gramcache = true ; private boolean setSystemid = true ; public GenMapAndTopicListModule ( ) throws ParserConfigurationException , SAXException { } @ Override public AbstractPipelineOutput execute ( final AbstractPipelineInput input ) throws DITAOTException { } private void initFilters ( ) { } private void initXMLReader ( final File ditaDir , final boolean validate ) throws SAXException { } private void parseInputParameters ( final AbstractPipelineInput input ) throws IOException { } private void processWaitList ( ) throws DITAOTException { } private List < XMLFilter > getProcessingPipe ( final URI fileToParse ) { } private void processFile ( final URI currentFile ) throws DITAOTException { } private void processParseResult ( final URI currentFile ) { } private void categorizeCurrentFile ( final URI currentFile ) { } private void categorizeReferenceFile ( final Reference file ) { } private void updateUplevels ( final URI file ) { assert file . isAbsolute ( ) ; final URI f = ( file . toString ( ) . contains ( STICK ) ) ? toURI ( file . toString ( ) . substring ( 0 , file . toString ( ) . indexOf ( STICK ) ) ) : file ; final URI relative = getRelativePath ( rootFile , f ) . normalize ( ) ; <START_BUG> final int lastIndex = relative . getPath ( ) . lastIndexOf ( ( ".." + ( File . separator ) ) ) ; <END_BUG> if ( lastIndex != ( - 1 ) ) { final int newUplevels = ( lastIndex // 3 ) + 1 ; uplevels = Math . max ( newUplevels , uplevels ) ; } } private void addToWaitList ( final URI file ) { } private void updateBaseDirectory ( ) { } private String getLevelsPath ( final URI rootTemp ) { } private static String escapeRegExp ( final String value ) { } private FilterUtils parseFilterFile ( ) { } private void refactoringResult ( ) { } private void handleCopyto ( ) { } private void handleConref ( ) { } private void outputResult ( ) throws DITAOTException { } private void writeListFile ( final File inputfile , final String relativeRootFile ) { } private String getPrefix ( final File relativeRootFile ) { } private FileInfo getOrCreateFileInfo ( final Map < URI , FileInfo > fileinfos , final URI file ) { } private void writeExportAnchors ( ) throws DITAOTException { } private List < String > sort ( final Set < String > set ) { } private Map < URI , Set < URI > > addMapFilePrefix ( final Map < URI , Set < URI > > map ) { } private Map < URI , URI > addFilePrefix ( final Map < URI , URI > set ) { } private Collection < KeyDef > addFilePrefix ( final Collection < KeyDef > keydefs ) { } private void addKeyDefSetToProperties ( final Job . Job prop , final Map < String , KeyDef > keydefs ) { } private void addFlagImagesSetToProperties ( final Job . Job prop , final Set < URI > set ) { } public static interface TempFileNameScheme { public URI generateTempFileName ( final URI src ) { } } public static class DefaultTempFileScheme implements GenMapAndTopicListModule . TempFileNameScheme { final URI b ; public DefaultTempFileScheme ( final URI b ) { } public URI generateTempFileName ( final URI src ) { } } No newline ; at end ; of file ; }

Fix:
final int lastIndex = relative . getPath ( ) . lastIndexOf ( ( ".." + ( URI_SEPARATOR ) ) ) ;