https://issues.apache.org/bugzilla/show_bug.cgi?id=56890
Bug ID: 56890 Summary: getRealPath returns null Product: Tomcat 8 Version: 8.0.11 Hardware: PC OS: Linux Status: NEW Severity: major Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: f.bant...@axon-e.de There is more than one report for this kind of error. since #55837 and #55345 are marked as fixed I have to add another one for 8.0.11. Calling servletContext.getRealPath( "" ) -> some path servletContext.getRealPath( "." ) -> null servletContext.getRealPath( "./" ) -> null servletContext.getRealPath( "/" ) -> same path s.a. servletContext.getRealPath( "test" ) -> null At least the third one worked under tomcat 7.0.54 as I was using it in order to determine where tomcat had it's webapp directory (this isn't so clear when e.g. running from eclipse) I think most (if not all) of the null results are bugs and the behaviour was perfectly fine under tomcat <8. (Note that this code has worked in Tomcat 5, 6, 7) I would expect that this method to just do translation of the path. As I read the other bug reports it seems that tomcat tries to check if this file exists. But I think this is wrong because the concept of Java File doesn't imply that a File must exist. (It weekly implies that it could exist). So instead File has a method 'createNewFile' which clearly wouldn't be there if the file already existed. Furthermore if I wanted to check if a paricular file existed I would use file.exists(), ...canRead() and so on. Finally the specs state that this method could return under any circumstances. If taken literally this would lead to the question what good it is for anyway if it could just return null no matter what. As I read e.g. https://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html the 'null' result is there to indicate that the path to this (potential) file is not leading into the filesystem and therefor makes no sense at all. Best regards and keep up the great work Scheintod -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org