Buggy code:
public class SwiftNativeFileSystemStore { private static final Pattern URI_PATTERN = Pattern . compile ( "\"\\S+?\"" ) ; private static final String PATTERN = "EEE,<seq2seq4repair_space>d<seq2seq4repair_space>MMM<seq2seq4repair_space>yyyy<seq2seq4repair_space>hh:mm:ss<seq2seq4repair_space>zzz" ; private static final Log LOG = LogFactory . getLog ( SwiftNativeFileSystemStore . class ) ; private URI uri ; private SwiftRestClient swiftRestClient ; private DNSToSwitchMapping dnsToSwitchMapping ; public void initialize ( URI fsURI , Configuration configuration ) throws IOException { } @ Override public String toString ( ) { } public long getBlocksize ( ) { } public long getPartsizeKB ( ) { } public int getBufferSizeKB ( ) { } public int getThrottleDelay ( ) { } public void uploadFile ( Path path , InputStream inputStream , long length ) throws IOException { } public void uploadFilePart ( Path path , int partNumber , InputStream inputStream , long length ) throws IOException { <START_BUG> String stringPath = path . toUri ( ) . toString ( ) ; <END_BUG> String partitionFilename = SwiftUtils . partitionFilenameFromNumber ( partNumber ) ; if ( stringPath . endsWith ( "//" ) ) { stringPath = stringPath . concat ( partitionFilename ) ; } else { stringPath = stringPath . concat ( "//" ) . concat ( partitionFilename ) ; } swiftRestClient . upload ( new SwiftObjectPath ( toDirPath ( path ) . getContainer ( ) , stringPath ) , inputStream , length ) ; } public void createManifestForPartUpload ( Path path ) throws IOException { } public SwiftFileStatus getObjectMetadata ( Path path ) throws IOException { } public Header [ ] getObjectHeaders ( Path path , boolean newest ) throws FileNotFoundException , IOException { } public SwiftFileStatus getObjectMetadata ( Path path , boolean newest ) throws FileNotFoundException , IOException { } private Header [ ] stat ( SwiftObjectPath objectPath , boolean newest ) throws IOException { } private boolean existsPseudoDirectory ( SwiftObjectPath path ) { } public HttpBodyContent getObject ( Path path ) throws IOException { } private List < String > getDataLocalEndpoints ( Path path ) throws IOException { } private int getSimilarity ( String rack1 , String rack2 ) { } private String getHostRack ( ) throws SwiftException { } private String getRack ( String url ) { } public HttpBodyContent getObject ( Path path , long byteRangeStart , long length ) throws IOException { } private List < FileStatus > listDirectory ( SwiftObjectPath path , boolean listDeep , boolean newest , boolean addTrailingSlash ) throws IOException { } public FileStatus [ ] listSubPaths ( Path path , boolean recursive , boolean newest ) throws IOException { } public void createDirectory ( Path path ) throws IOException { } private void innerCreateDirectory ( SwiftObjectPath swiftObjectPath ) throws IOException { } private SwiftObjectPath toDirPath ( Path path ) throws SwiftConfigurationException { } private SwiftObjectPath toObjectPath ( Path path ) throws SwiftConfigurationException { } public List < URI > getObjectLocation ( Path path ) throws IOException { } public boolean deleteObject ( FileStatus status ) throws IOException { } public boolean objectExists ( Path path ) throws IOException { } public boolean objectExists ( SwiftObjectPath path ) throws IOException { } public void rename ( Path src , Path dst ) throws FileNotFoundException , IOException , SwiftOperationFailedException { } private void logDirectory ( String message , SwiftObjectPath objectPath , Iterable < FileStatus > statuses ) { } public void copy ( Path srcKey , Path dstKey ) throws IOException { } private void copyThenDeleteObject ( SwiftObjectPath srcObject , SwiftObjectPath destObject ) throws IOException { } private void copyObject ( SwiftObjectPath srcObject , SwiftObjectPath destObject ) throws IOException { } public Path getCorrectSwiftPath ( Path path ) throws SwiftException { } private Path getCorrectSwiftPath ( SwiftObjectPath path ) throws SwiftException { } public static List < URI > extractUris ( String json , Path path ) throws SwiftOperationFailedException { } public void throttle ( ) throws InterruptedIOException { } public List < DurationStats > getOperationStatistics ( ) { } public boolean delete ( Path absolutePath , boolean recursive ) throws IOException { } public FileStatus [ ] listSegments ( SwiftFileStatus file , boolean newest ) throws IOException { } }

Fix:
String stringPath = path . toUri ( ) . getPath ( ) ;