java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • GitHub comment 7720#245400347
    via GitHub by glennsarti
    ,
  • FULL PRODUCT VERSION : java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux xxx 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : java.lang.NullPointerException at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77) at sun.nio.fs.UnixPath.(UnixPath.java:71) at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281) at java.nio.file.Paths.get(Paths.java:84) when using Path p = Paths.get(null); There is no javadoc indicating the NullPointerException, and according to the javadoc it should throw "InvalidPathException - if the path string cannot be converted to a Path" STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Just use Paths.get(null); on an unix system (which will use UnixPath) I just tested other things on windows : Paths.get(null) leads to : Exception in thread "main" java.lang.NullPointerException at java.nio.file.Paths.get(Paths.java:132) at atest.test.main(test.java:15) and Paths.get((String)null); leads to : Exception in thread "main" java.lang.NullPointerException at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at atest.test.main(test.java:16) EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - I expect some javadocs comments or correct exceptions to be thrown (IllegalArgumentException ?) ACTUAL - Multiple different errors depending on the platform and the signature of Paths.get used. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public static void main(String[] args) { try { Paths.get(null); } catch (Exception e) { System.out.println("Path.get(URI) with null arg error"); e.printStackTrace(); } try { Paths.get((String) null); } catch (Exception e) { System.out.println("Path.get(String...varargs) with null arg error"); e.printStackTrace(); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Null check before using Paths.get() with "if"
    via by Webbug Group,
  • FULL PRODUCT VERSION : java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) ADDITIONAL OS VERSION INFORMATION : Linux xxx 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u1 x86_64 GNU/Linux A DESCRIPTION OF THE PROBLEM : java.lang.NullPointerException at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77) at sun.nio.fs.UnixPath.(UnixPath.java:71) at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281) at java.nio.file.Paths.get(Paths.java:84) when using Path p = Paths.get(null); There is no javadoc indicating the NullPointerException, and according to the javadoc it should throw "InvalidPathException - if the path string cannot be converted to a Path" STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Just use Paths.get(null); on an unix system (which will use UnixPath) I just tested other things on windows : Paths.get(null) leads to : Exception in thread "main" java.lang.NullPointerException at java.nio.file.Paths.get(Paths.java:132) at atest.test.main(test.java:15) and Paths.get((String)null); leads to : Exception in thread "main" java.lang.NullPointerException at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at atest.test.main(test.java:16) EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - I expect some javadocs comments or correct exceptions to be thrown (IllegalArgumentException ?) ACTUAL - Multiple different errors depending on the platform and the signature of Paths.get used. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- public static void main(String[] args) { try { Paths.get(null); } catch (Exception e) { System.out.println("Path.get(URI) with null arg error"); e.printStackTrace(); } try { Paths.get((String) null); } catch (Exception e) { System.out.println("Path.get(String...varargs) with null arg error"); e.printStackTrace(); } } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Null check before using Paths.get() with "if"
    via by Webbug Group,
  • GitHub comment 20#69728183
    via GitHub by LarsWH
    ,
  • GitHub comment 89#57074744
    via GitHub by foonix
    ,
  • NPE on Toshiba Laptop
    via by chris.good,
  • FTP Extension: using a ftp config without the working directly field throws NPE. It should default to server default for that user. *Steps to reproduce FTP (works fine):* * create app with ftp config without workdir. * Send a http request http://localhost:9090/read-write-like-copy-remote-local-to-server-sftp: {code:xml} <httpn:listener-config name="http-listener-config"> <httpn:listener-connection host="localhost" port="9090" protocol="HTTP"/> </httpn:listener-config> <ftp:config name="ftp-config-remote-ftp-server" > <ftp:connection username="demo" password="demo" host="ftp-server.demo.solarwinds.com"/> </ftp:config> <ftp:config name="sftp-remote-without-workdir" > <sftp:sftp-connection username="demo" password="demo" host="ftp-server.demo.solarwinds.com" /> </ftp:config> <flow name="cant-obtain-write-path"> <httpn:listener responseStreamingMode="AUTO" path="/cant-obtain-write-path" parseRequest="false" config-ref="http-listener-config"/> <set-payload value="hello_world!!" /> <ftp:write config-ref="sftp-remote-without-workdir" path="Upload/text.out" mode="OVERWRITE"/> </flow> <flow name="read-write-as-copy-config-remote-server-to-local"> <httpn:listener responseStreamingMode="AUTO" path="/read-write-like-copy-remote-server-to-local" parseRequest="false" config-ref="http-listener-config"/> <ftp:read config-ref="ftp-config-remote-ftp-server" path="Photos/Logos/RS-Logo-Text-HighRes_563x109_WhiteBG.png" /> <!-- <ftp:write config-ref="ftp-config-without-working-dir" path="output/photo.png" mode="OVERWRITE"/> --> </flow> {code} ---- *Steps to reproduce SFTP:* * Send a http request http://localhost:9090/cant-obtain-write-path * This exception will appear: {quote} ******************************************************************************** Message : Found exception trying to obtain path /Upload/text.out. Payload : org.mule.extension.ftp.internal.ftp.ClassicFtpInputStream@9bdf14a Element : /read-write-as-copy-config-remote-local-to-server-sftp/processors/1 @ a0907800-7c4c-11e6-b531-985aebc8e9b5 -------------------------------------------------------------------------------- Root Exception stack trace: 2: No such file. at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2846) at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2198) at com.jcraft.jsch.ChannelSftp._stat(ChannelSftp.java:2215) at com.jcraft.jsch.ChannelSftp.stat(ChannelSftp.java:2172) at org.mule.extension.ftp.internal.sftp.connection.SftpClient.getAttributes(SftpClient.java:114) at org.mule.extension.ftp.internal.sftp.command.SftpCommand.getFile(SftpCommand.java:48) at org.mule.extension.ftp.internal.ftp.command.FtpCommand.getFile(FtpCommand.java:66) at org.mule.extension.ftp.internal.sftp.command.SftpWriteCommand.write(SftpWriteCommand.java:52) at org.mule.extension.file.common.api.AbstractFileSystem.write(AbstractFileSystem.java:116) at org.mule.extension.file.common.api.StandardFileSystemOperations.write(StandardFileSystemOperations.java:171) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) {quote} ---- *Steps to reproduce SFTP:* * Using the same config but changing the SFTP connection: {code:xml} ... <ftp:config name="sftp-remote-without-workdir" > <ftp:sftp-connection username="demo" password="demo" host="ftp-server.demo.solarwinds.com" /> </ftp:config> ... {code} * Send a http request http://localhost:9090/read-write-like-copy-remote-local-to-server-sftp * This exception will appear: {quote} 2016-08-29 20:03:18,834 [[bacdc740-6e3c-11e6-973e-985aebc8e9b5].read-write-as-copy-config-remote-local-to-server-sftp.worker.01] ERROR org.mule.runtime.core.exception.DefaultMessagingExceptionStrategy - ******************************************************************************** Message : Exception occurred while trying to change working directory to null. Element : /read-write-as-copy-config-remote-local-to-server-sftp/processors/1 @ bacdc740-6e3c-11e6-973e-985aebc8e9b5 -------------------------------------------------------------------------------- Exception stack is: Exception occurred while trying to change working directory to null. (org.mule.runtime.core.api.MessagingException) com.jcraft.jsch.ChannelSftp.remoteAbsolutePath(ChannelSftp.java:2916) com.jcraft.jsch.ChannelSftp.cd(ChannelSftp.java:339) org.mule.extension.ftp.internal.sftp.connection.SftpClient.changeWorkingDirectory(SftpClient.java:100) org.mule.extension.ftp.internal.sftp.connection.SftpFileSystem.changeToBaseDir(SftpFileSystem.java:98) org.mule.runtime.module.extension.file.api.StandardFileSystemOperations.write(StandardFileSystemOperations.java:165) {quote} +*In the case of the FTP create directory*+ {quote} 2016-09-03 02:35:48,074 [[41723430-7198-11e6-93b2-0a0027000000].flow-copy-prepare-environment.worker.01] ERROR org.mule.runtime.core.exception.DefaultMessagingExceptionStrategy - ******************************************************************************** Message : null. Payload : null Payload Type : null Element : /flow-copy-prepare-environment/processors/0 @ 41723430-7198-11e6-93b2-0a0027000000 -------------------------------------------------------------------------------- Root Exception stack trace: java.lang.NullPointerException at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77) at sun.nio.fs.UnixPath.<init>(UnixPath.java:71) at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281) at java.nio.file.Paths.get(Paths.java:84) at org.mule.extension.ftp.internal.ftp.command.FtpCommand.createDirectory(FtpCommand.java:167) at org.mule.extension.ftp.internal.ftp.command.FtpCreateDirectoryCommand.createDirectory(FtpCreateDirectoryCommand.java:34) at org.mule.runtime.module.extension.file.api.AbstractFileSystem.createDirectory(AbstractFileSystem.java:152) at org.mule.runtime.module.extension.file.api.StandardFileSystemOperations.createDirectory(StandardFileSystemOperations.java:325) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) {quote}
    via by Alejandro Nosenzo,
  • GitHub comment 2#249087001
    via GitHub by aplatypus
    ,
  • Search and replce a string in 10000 files
    via Stack Overflow by Suman Verma
    ,
    • java.lang.NullPointerException at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:98) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at org.neo4j.commandline.admin.AdminTool.main(AdminTool.java:34)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    iferca
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    1 more bugmates