[
https://issues.apache.org/jira/browse/TINKERPOP-1041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15065591#comment-15065591
]
Martin Häusler commented on TINKERPOP-1041:
-------------------------------------------
Hello again,
I just wanted to add another piece of information. Since I've upgraded to the
latest 3.1.1-SNAPSHOT version of the gremlin test suite, the exception in the
ticket description has changed. It is no longer an IOException, but the
following:
{code}
java.lang.NullPointerException
at
org.apache.tinkerpop.gremlin.TestHelper.computePath(TestHelper.java:106)
at
org.apache.tinkerpop.gremlin.TestHelper.getRootOfBuildDirectory(TestHelper.java:98)
at
org.apache.tinkerpop.gremlin.TestHelper.makeTestDataPath(TestHelper.java:63)
at
org.apache.tinkerpop.gremlin.TestHelper.generateTempFile(TestHelper.java:115)
at
org.apache.tinkerpop.gremlin.structure.io.IoGraphTest.shouldReadWriteModernToFileWithHelpers(IoGraphTest.java:164)
{code}
The error occurs in the {{computePath}} method:
{code}
private static String computePath(final Class clazz) {
final String clsUri = clazz.getName().replace('.', SEP.charAt(0)) +
".class";
final URL url = clazz.getClassLoader().getResource(clsUri);
final String clsPath = url.getPath();
return clsPath.substring(0, clsPath.length() - clsUri.length());
}
{code}
In the case for the {{IoGraphTest}}, the variables take the following values:
{code}
clazz = org.apache.tinkerpop.gremlin.structure.io.IoGraphTest
clsUri = "org\apache\tinkerpop\gremlin\structure\io\IoGraphTest.class"
url = NULL
{code}
I am not entirely sure what the {{clazz.getClassLoader().getResource(clsUri)}}
expects to produce as a result when passing this strange kind-of-class-name
notation.
General question: why do all of these calculations and not simply use
{{System.getProperty("java.io.tmpdir")}} for temporary file storage in
JUnit-Tests?
> StructureStandardTestSuite has file I/O issues on Windows
> ---------------------------------------------------------
>
> Key: TINKERPOP-1041
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1041
> Project: TinkerPop
> Issue Type: Bug
> Components: test-suite
> Affects Versions: 3.0.2-incubating
> Environment: Windows 10, Java 8, TinkerPop version "3.0.2-incubating"
> Reporter: Martin Häusler
> Fix For: 3.1.1-incubating
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Most of the tests in StructureStandardTestSuite/IoGraphTest cause an
> unexpected java.io.IOException. The stack trace looks like this:
> {panel:title=Stack Trace}
> java.io.IOException: The the file name, directory name or volume label syntax
> is incorrect.
> at java.io.WinNTFileSystem.createFileExclusively(Native Method)
> at java.io.File.createTempFile(Unknown Source)
> at
> org.apache.tinkerpop.gremlin.TestHelper.generateTempFile(TestHelper.java:74)
> at
> org.apache.tinkerpop.gremlin.structure.io.IoGraphTest.shouldReadWriteModernToFileWithHelpers(IoGraphTest.java:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> {panel}
> I'm running the test suite from Eclipse under Java 8, on a Windows 10 x64
> machine. The dependencies in my project are managed with gradle.
> Investigating the offinsive line
> (org.apache.tinkerpop.gremlin.TestHelper.java@74) in the debugger reveals the
> following parameters of "File.createTempFile(...)":
> {noformat}
> fileName = "shouldReadWriteModernToFileWithHelpers[graphml]"
> fileNameSuffix = ".xml"
> path =
> "file:\D:\guh\caches\modules-2\files-2.1\org.apache.tinkerpop\gremlin-test\3.0.2-incubating\345ec87b74923b76374111f2e4040d4d105f256\temp"
> {noformat}
> The offensive part is the "path" variable, because it contains the prefix
> "file:\". I tried the same thing in a dedicated JUnit test without the prefix
> and it works fine.
> I would be very happy to see this issue fixed, as this considerably reduces
> the amount of tests in the suite that I can run against my graph
> implementation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)