[jboss-jira] [JBoss JIRA] (WFLY-11722) Internal Server Error (500) when using directory-listing in FileHandler

Chao Wang (Jira) issues at jboss.org
Fri Feb 15 01:15:00 EST 2019


    [ https://issues.jboss.org/browse/WFLY-11722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13695792#comment-13695792 ] 

Chao Wang commented on WFLY-11722:
----------------------------------

{quote}However, no exception is logged in the output on WildFly.{quote}

Following your steps, I see this error on WFLY 15.0.1.Final server side:
{noformat}
14:03:02,054 ERROR [io.undertow.request] (default task-1) UT005071: Undertow request failed HttpServerExchange{ GET /folder/ request {Connection=[keep-alive], Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8], Accept-Language=[en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7], Accept-Encoding=[gzip, deflate, br], User-Agent=[Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36], Upgrade-Insecure-Requests=[1], Host=[127.0.0.1:8080]} response {}}: java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/wangc/software/wildfly/15/wildfly-15.0.1.Final/welcome-content/folder/bad
	at io.undertow.core at 2.0.15.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:62)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:139)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:162)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.handlers.resource.ResourceHandler$1.handleRequest(ResourceHandler.java:233)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
	at org.jboss.threads at 2.3.2.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads at 2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
	at org.jboss.threads at 2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
	at org.jboss.threads at 2.3.2.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1349)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.nio.file.NoSuchFileException: /home/wangc/software/wildfly/15/wildfly-15.0.1.Final/welcome-content/folder/bad
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:145)
	at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
	at java.base/java.nio.file.Files.getLastModifiedTime(Files.java:2314)
	at io.undertow.core at 2.0.15.Final//io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:60)
	... 10 more
{noformat}

The error is clear to me as the NoSuchFileException indicates that it tried to get last modified time from non-existent path.

> Internal Server Error (500) when using directory-listing in FileHandler
> -----------------------------------------------------------------------
>
>                 Key: WFLY-11722
>                 URL: https://issues.jboss.org/browse/WFLY-11722
>             Project: WildFly
>          Issue Type: Bug
>          Components: Web (Undertow)
>    Affects Versions: 15.0.1.Final
>            Reporter: Adam Krajcik
>            Assignee: Flavia Rainone
>            Priority: Major
>
> When I added a bad symlink to the *welcome-content* and allowed *directory-listing* in the file handler of the *welcome-content* server returns Internal Server Error (500) when accessing the folder containing the bad symlink. However, no exception is logged in the output on WildFly.
> I also tried to use simple  example application - _File Serving_ from [Undertow Examples|https://github.com/undertow-io/undertow/tree/master/examples] where I can see the following exception when accessing the directory with the bad symlink:
> {code}
> java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/akrajcik/Pictures/pictures
> 	at io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:62)
> 	at io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:139)
> 	at io.undertow.server.handlers.resource.DirectoryUtils.renderDirectoryListing(DirectoryUtils.java:162)
> 	at io.undertow.server.handlers.resource.ResourceHandler$1.handleRequest(ResourceHandler.java:233)
> 	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
> 	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> 	at java.lang.Thread.run(Thread.java:811)
> Caused by: java.nio.file.NoSuchFileException: /home/akrajcik/Pictures/pictures
> 	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:98)
> 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:114)
> 	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:119)
> 	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:67)
> 	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:156)
> 	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:111)
> 	at java.nio.file.Files.readAttributes(Files.java:1748)
> 	at java.nio.file.Files.getLastModifiedTime(Files.java:2277)
> 	at io.undertow.server.handlers.resource.PathResource.getLastModified(PathResource.java:60)
> 	... 8 more
> {code}



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list