Buggy code:
public class GM2KML { private enum Mode { STATIC , ALL_MOVEMENTS , ALL_MOVEMENTS_BINNED , STAND_PATHS , STAND_PATHS_BINNED , VISITS_PER_STAND , MOVEMENTS_PER_EDGE , AVERAGE_SPEED_PER_EDGE , AVERAGE_SPEED_PER_EDGE_BINNED ; } private static final String DETAIL_SEPARATOR = "\t" ; public static void main ( String [ ] args ) { } public static void printUsage ( ) { } private static Map < String , List < GM2KML . Movement > > getAircraftRoutes ( GroundMovementWriter gmw , TaxiGen at , boolean keyByStand ) { } private static Map < String , Map < String , List < GM2KML . Movement > > > getAircraftRoutesInTimeBins ( GroundMovementWriter gmw , TaxiGen at , boolean keyByStand , GM2KML . TimeBinManager timeBinManager ) { } @ SuppressWarnings ( "unchecked" ) private static void graphNodesAndEdgesToKML ( String filename , PrintStream outDetail , Collection < TaxiNode > nodes , Collection < TaxiEdge > edges , Object flightpaths , Map < String , Map < TaxiEdge , List < Double > > > speeds , GM2KML . Mode mode ) { <START_BUG> String filePrefix = filename . substring ( 0 , filename . lastIndexOf ( '.' ) ) ; <END_BUG> boolean addingFlightTracks = false ; boolean addingFlightTracksToStands = false ; boolean hidingTaxiways = false ; boolean omitNonStandNodes = false ; boolean flightTracksBinned = false ; boolean edgeSpeeds = false ; @ SuppressWarnings ( "unused" ) boolean speedsBinned = false ; boolean taxiwaysThin = false ; switch ( mode ) { case STAND_PATHS : omitNonStandNodes = true ; addingFlightTracksToStands = flightpaths != null ; hidingTaxiways = addingFlightTracksToStands ; break ; case STAND_PATHS_BINNED : omitNonStandNodes = true ; addingFlightTracksToStands = flightpaths != null ; hidingTaxiways = addingFlightTracksToStands ; flightTracksBinned = true ; break ; case ALL_MOVEMENTS : omitNonStandNodes = true ; addingFlightTracks = flightpaths != null ; break ; case ALL_MOVEMENTS_BINNED : omitNonStandNodes = true ; flightTracksBinned = true ; addingFlightTracks = flightpaths != null ; break ; case AVERAGE_SPEED_PER_EDGE : omitNonStandNodes = true ; flightTracksBinned = true ; addingFlightTracks = flightpaths != null ; taxiwaysThin = true ; edgeSpeeds = true ; break ; case AVERAGE_SPEED_PER_EDGE_BINNED : omitNonStandNodes = true ; flightTracksBinned = true ; addingFlightTracks = flightpaths != null ; taxiwaysThin = true ; edgeSpeeds = true ; speedsBinned = true ; hidingTaxiways = true ; break ; default : break ; } final Kml kml = KmlFactory . createKml ( ) ; final Document document = kml . createAndSetDocument ( ) . withName ( filePrefix ) . withOpen ( true ) ; final Document documentTaxiwaysE = document . createAndAddDocument ( ) . withName ( ( filePrefix + "TaxiwaysEdges" ) ) . withOpen ( ( ! addingFlightTracksToStands ) ) . withVisibility ( ( ! addingFlightTracksToStands ) ) ; final Document documentTaxiwaysN = document . createAndAddDocument ( ) . withName ( ( filePrefix + "TaxiwaysNodes" ) ) . withOpen ( true ) ; final Style styleOSM = documentTaxiwaysN . createAndAddStyle ( ) . withId ( "placemarkStyleGates" ) ; styleOSM . createAndSetIconStyle ( ) . withIcon ( new Icon ( ) . withHref ( "http:////www.google.com//mapfiles//marker.png" ) ) . withColor ( "ffff7777" ) . withScale ( 1 ) ; final Style styleTaxiway = documentTaxiwaysE . createAndAddStyle ( ) . withId ( "linestyleTaxiway" ) ; if ( taxiwaysThin ) { styleTaxiway . createAndSetLineStyle ( ) . withColor ( "ffffffff" ) . withWidth ( 1.0 ) ; } else { styleTaxiway . createAndSetLineStyle ( ) . withColor ( "550000ff" ) . withWidth ( 4.0 ) ; } final Style styleTaxiwayToGate = documentTaxiwaysE . createAndAddStyle ( ) . withId ( "linestyleTaxiwayToGate" ) ; styleTaxiwayToGate . createAndSetLineStyle ( ) . withColor ( "55ff0000" ) . withWidth ( 4.0 ) ; final Style styleRunway = documentTaxiwaysE . createAndAddStyle ( ) . withId ( "linestyleRunway" ) ; styleRunway . createAndSetLineStyle ( ) . withColor ( "5500ff00" ) . withWidth ( 4.0 ) ; final Style styleOriginalFP = document . createAndAddStyle ( ) . withId ( "linestyleFlightpath" ) ; styleOriginalFP . createAndSetLineStyle ( ) . withColor ( "2255ee00" ) . withWidth ( 4.0 ) ; int numberOfStandSizes = 10 ; int maxNumberAtOneStand = 0 ; if ( mode == ( GM2KML . Mode . VISITS_PER_STAND ) ) { for ( int i = 0 ; i < numberOfStandSizes ; i ++ ) { final Style styleOSMSized = documentTaxiwaysN . createAndAddStyle ( ) . withId ( ( "placemarkStyleGates-" + i ) ) ; styleOSMSized . createAndSetIconStyle ( ) . withIcon ( new Icon ( ) . withHref ( "http:////maps.google.com//mapfiles//kml//shapes//placemark_circle.png" ) ) . withColor ( "ffff7777" ) . withScale ( ( ( i + 1 ) // 2.0 ) ) ; } if ( flightpaths != null ) { for ( List < GM2KML . Movement > l : ( ( Map < String , List < GM2KML . Movement > > ) ( flightpaths ) ) . values ( ) ) { maxNumberAtOneStand = Math . max ( maxNumberAtOneStand , l . size ( ) ) ; } } } int numberOfEdgeGroups = 10 ; double maxSpeed = 0 ; int maxTraffic = 0 ; if ( edgeSpeeds ) { for ( int i = 0 ; i < numberOfEdgeGroups ; i ++ ) { String s = Integer . toHexString ( ( ( int ) ( ( i * 255.0 ) // ( numberOfEdgeGroups - 1 ) ) ) ) ; if ( ( s . length ( ) ) < 2 ) { s = "0" + s ; } final String colour = ( ( "ff" + s ) + s ) + "ff" ; final Style styleTaxiwaySpeed = documentTaxiwaysE . createAndAddStyle ( ) . withId ( ( "linestyleTaxiway-" + i ) ) ; styleTaxiwaySpeed . createAndSetLineStyle ( ) . withColor ( colour ) . withWidth ( 4.0 ) ; }

Fix:
String filePrefix = ( filename . contains ( "." ) ) ? filename . substring ( 0 , filename . lastIndexOf ( '.' ) ) : filename ;