0

A customer has lots of following stacktraces appearing in the logs of my application. It runs on WildFly 18 and JDK 11 on Windows Server.

2022-10-14 14:36:19,382 ERROR [io.undertow.request] (default I/O-2) UT005071: Undertow request failed HttpServerExchange{ GET /application/images/gray/qtip/nul}: java.lang.RuntimeException: java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.

    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:65)
    at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.deployment.ServletResource.getLastModified(ServletResource.java:61)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.resource.CachedResource.<init>(CachedResource.java:59)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.resource.CachingResourceManager.getResource(CachingResourceManager.java:119)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.resource.CachingResourceManager.getResource(CachingResourceManager.java:32)
    at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:96)
    at io.undertow.servlet@2.0.27.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:91)
    at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.Host$OptionsHandler.handleRequest(Host.java:399)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
    at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.Host$AcmeResourceHandler.handleRequest(Host.java:421)
    at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.Host$HostRootHandler.handleRequest(Host.java:430)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.NameVirtualHostHandler.handleRequest(NameVirtualHostHandler.java:64)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.error.SimpleErrorPageHandler.handleRequest(SimpleErrorPageHandler.java:78)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
    at org.wildfly.extension.undertow@18.0.1.Final//org.wildfly.extension.undertow.Server$DefaultHostHandler.handleRequest(Server.java:190)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.ChannelUpgradeHandler.handleRequest(ChannelUpgradeHandler.java:211)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.DisallowedMethodsHandler.handleRequest(DisallowedMethodsHandler.java:61)
    at io.undertow.core@2.0.27.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
    at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255)
    at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
    at io.undertow.core@2.0.27.Final//io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
    at org.jboss.xnio@3.7.3.Final//org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
    at org.jboss.xnio@3.7.3.Final//org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
    at io.undertow.core@2.0.27.Final//io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1176)
    at org.jboss.xnio.nio@3.7.3.Final//org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
    at org.jboss.xnio.nio@3.7.3.Final//org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.

    at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
    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.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
    at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
    at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
    at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
    at java.base/java.nio.file.Files.getLastModifiedTime(Files.java:2315)
    at io.undertow.core@2.0.27.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:63)
    ... 36 more

So always the method getLastModifiedTime triggers this issue. Does this mean that there are issues with permissions problems? I guess that my Java program doesn't have the sufficient rights to access these files, but I'm not sure about this.

Can someone help me?

ksclfanatic
  • 122
  • 1
  • 10
  • Can you share the code that calls `.getLastModifiedTime()`? Where does the colon (`:`) in `\nul:` come from? – Ivar Dec 01 '22 at 13:06
  • @Ivar - I guess it's part of the message, not the filename. – access violation Dec 01 '22 at 13:13
  • @accessviolation I don't think so. [This question](https://stackoverflow.com/questions/1208566/typically-what-does-it-mean-when-java-returns-a-the-parameter-is-incorrect) mentions the same error message (where the path doesn't end in a colon) and the answer mentions it is often caused by a colon in the path (the colon for the driver-letter excluded). – Ivar Dec 01 '22 at 13:16
  • After searching for [`images\gray\qtip`](https://www.google.com/search?q=%22images/gray/qtip%22), it looks like something to do with a GXT theme. You somehow ended up with an file called `nul:` in there. Across all those google results, no one else's directory contained anything like that. It should contain 3 or 4 gifs, and that's it – Michael Dec 01 '22 at 13:26
  • I don’t think the colon is part of the filename, only part of the exception message. The problem is that the file’s base name is `nul` which is not allowed in Windows. See https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file. – VGR Dec 01 '22 at 14:54
  • The name 'nul' refers to the null device, regardless of the directory path precediing it (DOS-compatible misfeature). You can't **create** a file named nul. but you can open for reading a file named nul. The trouble is, it's a device file, and does not have a 'last modified time'. @VGR, you should perhaps write this as an answer. – access violation Dec 02 '22 at 00:11

1 Answers1

0

If we look at the underlying exception:

java.nio.file.FileSystemException: C:\PROGRAM\SAUSAGE\wildfly-gui\standalone\tmp\vfs\temp\temp5bd4c0db725d6b53\content-d8575e88ce594507\images\gray\qtip\nul: The parameter is incorrect.

We can see that the file’s final path component is nul. That name is not allowed in Windows at all, which is the reason for the cryptic exception message (which probably came from Windows, not from Java). This is documented at https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file :

Do not use the following reserved names for the name of a file:

CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

Solution: don’t name a file nul.

VGR
  • 40,506
  • 4
  • 48
  • 63