5

I am running into problems on my (Linux) Jenkins server when using the Java Files API.

An integration test is failing, which uses a JUnit TemporaryFolder. The test executes the following code:

Path expectedPath = tmpFolder.getRoot().toPath().resolve("folder1/folder2");

// create files

assertTrue(Files.exists(expectedPath.resolve("newFile1.txt")));

The test passes locally, and I see in the logs for the Jenkins run that expectedPath is being created successfully, but what confuses me is the "path" to my new file:

/tmp/junit0219318729037123/folder1\/folder2/newFile1.txt

Why has \/ been introduced? Is this some quirk of Files on Linux, or a problem with my tmpFolder?

4
  • Can you show us how you create the new file ? It looks like newFile1.txt is in a folder named folder1/folder2 and not in the folder2 (which is in folder1)
    – NiziL
    May 26, 2015 at 12:45
  • When creating the file, I use Files.createDirectories to create folder1 and folder2, I then use Files.write(myFilePath, someBytes, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE.
    – Rossiar
    May 26, 2015 at 12:49
  • Obviously a problem is with programmatic file or folder creation. Could you provide us a full piece of code where you create file. May 26, 2015 at 15:17
  • Please note that the code to write files / create directories is generic and is used successfully by several other integration tests, all of which pass.
    – Rossiar
    May 26, 2015 at 15:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.