0

Below code showing the NullPointerException after writing the file why it showing this .

OutputStream opStream  = null;
try {
   opStream = new FileOutputStream(wavFilePath);    
   opStream.write(wavData);
   opStream.flush();
   opStream.close();
} finally {
   if (opStream!=null)
        opStream.close();
        opStream = null;        
   }
ΦXocę 웃 Пepeúpa ツ
  • 43,054
  • 16
  • 58
  • 83
  • 2
    Fastest way to an answer is to step through your code line-by-line with a debugger. Have you tried doing that before posting on SO? – Tim Biegeleisen May 30 '17 at 10:06
  • 2
    Stacktrace? I guess `wavFilePath` (or `wavData`) is probably `null` –  May 30 '17 at 10:07
  • Yes tried but some where its going wrong i am setting value for wavFilePath – Muhammed Yaseen May 30 '17 at 10:10
  • I believe the fastest way is to inspect the StackTrace - then, if still necessary, use a debugger... – user85421 May 30 '17 at 11:36
  • Your wavData is null, if java.lang.NullPointerException at java.io.FileOutputStream.write(Unknown Source) – monty May 30 '17 at 12:34
  • your wavFilePath is null if java.lang.NullPointerException at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) – monty May 30 '17 at 12:37

0 Answers0