[Fb-contrib-commit] SF.net SVN: fb-contrib:[1426] trunk/fb-contrib/samples/MDM_Sample.java
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-01-04 04:20:12
|
Revision: 1426
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1426&view=rev
Author: dbrosius
Date: 2010-01-04 04:20:06 +0000 (Mon, 04 Jan 2010)
Log Message:
-----------
Sample bug file for MDM detector by Chris Peterson
Added Paths:
-----------
trunk/fb-contrib/samples/MDM_Sample.java
Added: trunk/fb-contrib/samples/MDM_Sample.java
===================================================================
--- trunk/fb-contrib/samples/MDM_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/MDM_Sample.java 2010-01-04 04:20:06 UTC (rev 1426)
@@ -0,0 +1,97 @@
+import java.math.BigDecimal;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.security.SecureRandom;
+import java.util.Locale;
+import java.util.Random;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLServerSocketFactory;
+
+
+public class MDM_Sample implements Runnable
+{
+ public MDM_Sample() throws Exception
+ {
+ boolean b;
+
+ { // Halt tests
+ Runtime r = Runtime.getRuntime();
+ r.exit(0); // WARNING
+ r.halt(0); // WARNING
+ r.runFinalization(); // WARNING
+ System.runFinalization(); // WARNING
+ }
+
+ { // equals() tests
+ BigDecimal bd1 = new BigDecimal(0);
+ BigDecimal bd2 = new BigDecimal(0);
+ b = bd1.equals(bd2); // WARNING
+ }
+
+ { // Socket tests
+ InetAddress localhost = InetAddress.getLocalHost(); // WARNING
+ ServerSocket ss = new ServerSocket(0); touch(ss); // WARNING
+ ss = new ServerSocket(0,0); touch(ss); // WARNING
+ ServerSocketFactory ssf = SSLServerSocketFactory.getDefault();
+ ss = ssf.createServerSocket(0); touch(ss); // WARNING
+ ss = ssf.createServerSocket(0,0); touch(ss); // WARNING
+ }
+
+ { // RNG tests
+ Random r = new Random(); touch(r); // WARNING
+ byte[] seed = SecureRandom.getSeed(1); // WARNING
+ r = new SecureRandom(seed); touch(r); // WARNING
+ }
+
+ { // Thread tests
+ Thread t = new Thread(this);
+ int priority = t.getPriority(); // WARNING
+ t.setPriority(priority); // WARNING
+ t.join(); // WARNING
+
+ Thread.sleep(0); // WARNING
+ Thread.sleep(0,0); // WARNING
+ Thread.yield(); // WARNING
+ }
+
+ { // Timeout tests
+ ReentrantLock rl = new ReentrantLock();
+ rl.lock(); // WARNING
+ rl.lockInterruptibly(); // WARNING
+ b = rl.isHeldByCurrentThread(); // WARNING
+ b = rl.isLocked(); // WARNING
+
+ Object o = new Object();
+ do {
+ b = rl.tryLock(); // WARNING
+ o.wait(); // WARNING
+ } while (b);
+
+ Lock l = rl;
+ l.lock(); // WARNING
+ b = l.tryLock(); touch(b); // WARNING
+ l.lockInterruptibly(); // WARNING
+
+ Condition c = l.newCondition();
+ c.signal(); // WARNING
+ c.await(); // WARNING
+ }
+
+ { // String tests
+ byte[] bytes = "".getBytes(); // WARNING
+ String s = new String(bytes); // WARNING
+
+ Locale.setDefault(Locale.ENGLISH); // WARNING
+ }
+ }
+
+ public void run() {}
+ private static void touch(Object o) {}
+}
+
+
+
\ No newline at end of file
Property changes on: trunk/fb-contrib/samples/MDM_Sample.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|