java - JpcapWriter causes app to crash -


i working on relatively simple packet capture application, , using jpcap library. has been working until added in save feature program.

my write function

public void write() {     try {         writer = jpcapwriter.opendumpfile(captor, filename);     } catch (ioexception e) {e.printstacktrace();}     (packet packet : this.packets) {         writer.writepacket(packet);     }     writer.close(); } 

it correctly gets captor , filepath, loops through packets successfully, when tries write @ end of code block, jvm crashes.

my question is, why application crash when trying close jpcapwriter?

update: weird thing discovered, is writing file. crashes after write. added print statement after close, , never reaches it.

i found several other people same issue me. i'm not sure why removing call close writer fixed problem. file writes correctly, , has no issues. now, content working, may come issue @ later date.

update: turns out the file closes when call made stop capture. when capture thread closed closes captor, in turn closes writer me. essence, trying tell close writer, writer closing, caused jvm crash.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -