question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FileAlreadyExistsException when report is generated

See original GitHub issue

TestNG Version

7.6.0 7.5 is ok

Expected behavior

Generate test reports without errors in console.

Actual behavior

> Task :libs:xxx:test
Jun 01, 2022 9:01:16 AM org.testng.log4testng.Logger error
SEVERE: D:\...\build\reports\tests\test\jquery-3.6.0.min.js
java.nio.file.FileAlreadyExistsException: D:\...\build\reports\tests\test\jquery-3.6.0.min.js
	at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:87)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
	at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
	at java.base/sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:236)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
	at java.base/java.nio.file.Files.copy(Files.java:3160)
	at org.testng.reporters.jq.Main.generateReport(Main.java:93)
	at org.testng.TestNG.generateReports(TestNG.java:1134)
	at org.testng.TestNG.run(TestNG.java:1072)
	at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.runTests(TestNGTestClassProcessor.java:141)
	at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:90)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy1/jdk.proxy1.$Proxy2.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

Is the issue reproducible on runner?

  • Shell
  • Maven
  • [x ] Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

useTestNG() { useDefaultListeners = true }

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:7
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
mellowarecommented, Nov 5, 2022

Ok I will submit a PR.

2reactions
mellowarecommented, Nov 5, 2022

Ok I will do. One thing to note I have a feeling this is Windows bug are you running your example in Windows or some other Os?

If you look in the stack trace is definitely mentions WindowsFileSystem which has different locking than Linux.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FileAlreadyExistsException (Java SE 17 & JDK 17)
Checked exception thrown when an attempt is made to create a file or directory and a file of that name already exists. Since:...
Read more >
Files.createDirectory() : FileAlreadyExistsException
Unlike the createDirectory method, an exception is not thrown if the directory could not be created because it already exists.".
Read more >
java.nio.file.FileAlreadyExistsException - ProgramCreek.com
NO_OVERWRITE) { throw new FileAlreadyExistsException("File already exists: ... log.info("Scenario identities to generate report: {}", identities.size()); ...
Read more >
How to fix java.nio.file.FileAlreadyExistsException: /Users/app ...
How to generate Simple Timeout Exception in Java? Java 11 and How to fix java.lang. TypeNotPresentException: Type javax.xml.bind.JAXBContext ...
Read more >
FileAlreadyExistsException - Android Developers
Checked exception thrown when an attempt is made to create a file or ... public FileAlreadyExistsException (String file, String other, String reason).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found