java.io.IOException: Operation not supported
at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:94)
at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1078)
at java.nio.channels.FileChannel.lock(FileChannel.java:1053)
at org.jacoco.agent.rt.internal_035b120.output.FileOutput.openFile(FileOutput.java:69)
...
I tried submitting a bug report to https://github.com/jacoco/jacoco but I get the following message "An owner of this repository has limited the ability to open an issue from new users." so I will try here. If there is a better place to submit this bug let me know.
Bug / RFEWhen running jacoco on an SMB file share I get the following message:java.io.IOException: Operation not supported
at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:94)
at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1078)
at java.nio.channels.FileChannel.lock(FileChannel.java:1053)
at org.jacoco.agent.rt.internal_035b120.output.FileOutput.openFile(FileOutput.java:69)
...
This seems to be cause by defect JDK-8167023 (lock not supported) and likely fails for most network shares using AFP / SMB from macOS. Note the JDK issue has been open over 3 years now and is unlikely to be fixed anytime soon.I would like to suggest foregoing the lock when an IOException is detected instead of failing completely. Below is the code that is failing (yellow) with suggested changes (green).public class FileOutput implements IAgentOutput {...private OutputStream openFile() throws IOException {final FileOutputStream file = new FileOutputStream(destFile, append);// Avoid concurrent writes from different agents running in parallel:try {file.getChannel().lock();} catch(IOException e) {/* Proceed without lock */}return file;}...}
--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/2940e5b6-bf10-4e58-9a68-79d066e74d43%40googlegroups.com.