/usr/share/doc/libjcifs-java/examples/InterruptTest.java is in libjcifs-java-doc 1.3.19-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | import java.io.InterruptedIOException;
import jcifs.util.transport.TransportException;
import jcifs.smb.*;
public class InterruptTest extends Thread {
String url;
public InterruptTest(String url) {
this.url = url;
}
public void run() {
for (int i = 0; i < 100; i++) {
try {
SmbFileInputStream in = new SmbFileInputStream(url);
byte[] b = new byte[10];
while(in.read( b ) > 0) {
;
}
in.close();
} catch(InterruptedIOException iioe) {
System.out.println("InterruptedIOException");
continue;
} catch(SmbException se) {
Throwable t = se.getRootCause();
if (t instanceof TransportException) {
TransportException te = (TransportException)t;
t = te.getRootCause();
if (t instanceof InterruptedException) {
System.out.println("InterruptedException in constructor");
continue;
}
}
se.printStackTrace();
try { Thread.sleep(500); } catch(InterruptedException ie) {}
} catch(Exception e) {
e.printStackTrace();
break;
}
}
}
public static void main( String argv[] ) throws Exception {
InterruptTest it = new InterruptTest(argv[0]);
it.start();
for (int i = 0; i < 20; i++) {
Thread.sleep(200);
it.interrupt();
}
}
}
|