I have a problem that I can not solve myself.
I am a big man in Java
I do not know the solution to this problem but I think that I know when this problem happens when I get this problem. So, I solved this problem in the stir. But I want another solution because there is another problem in my solution. I have to reduce the process time.
string intDir = "C: \\ RNE_IN"; While (true) {file interface directory = new file (intDir); String [] arrayfile = interface directory List (new FBM file filter ()); (String f: arrayfile) {string filename = string.form ("% 1 $ s% 2 $ s% 3 $ s", interior, file separator, f); File file = new file (file name); FileInputStream Stream = Faucet; Println (file.canExecute ()); // true system.out.println (file.canRead ()); // true system.out.println (file.exists ()); // true system.out.println (file.isFile ()); // true system.out.println (file.length ()); // Make the full byte of the file / / I can control the NPE with this thread sleeping time. Thread.Sleep (1); // This is when the stream is created in the following stream = new FileInputStream (file); FBMDeviceOnlyParser onlyparser = new FBMDeviceOnlyParser (); Onlyparser.ParseDeviceNameOnly (stream); String only device = only parsing.gate devnom (); String onlystaysake = pagers only .getStepSeq (); }} In the snippet above, I think there is no problem with the file. The exception of the file status is always true and whether the file.length is a complete byte. But, while the infinite loop, if I copy & amp; Paste the intDir from the second directory, then "NullPointerException" occurs.
Thread.sleep (time) is greater than 1000ms, NPE is not. I want to delete the code "Thread.sleep ()" due to the process time.
If there is an intruder element in the files before the program starts, there is no problem in the program (this is not NPE)
I have the file or file input stream status to be NPE I do not want to see.
Thank you for your concern. It is difficult to understand your question, but I can tell you for a fact that this Impossible : java (main entry. Java: 179) Javascript exception in thread "main". P> Line 179 is the line: stream = new FileInputStream (file); should be one of the following:
- You have given us an imperfect stack trace, or
- You have told us exceptions Wrong place, or
- You are not actually executing that code; Just like you did not make the code properly after changing it.
Comments
Post a Comment