validation fixes

This commit is contained in:
Bruce Eckel 2015-05-30 19:07:15 -07:00
parent 11d5437864
commit 316783cdcd
16 changed files with 23 additions and 20 deletions

View File

@ -17,11 +17,12 @@ public class AtomicIntegerTest implements Runnable {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
System.err.println("Aborting");
System.out.println("Aborting");
System.exit(0);
}
}, 5000); // Terminate after 5 seconds
ExecutorService exec = Executors.newCachedThreadPool();
ExecutorService exec =
Executors.newCachedThreadPool();
AtomicIntegerTest ait = new AtomicIntegerTest();
exec.execute(ait);
while(true) {

View File

@ -1,6 +1,6 @@
//: concurrency/ExceptionThread.java
// ©2015 MindView LLC: see Copyright.txt
// {RunByHand}
// {ValidateByHand}
// {ThrowsException}
import java.util.concurrent.*;

View File

@ -1,7 +1,8 @@
//: concurrency/ExplicitCriticalSection.java
// ©2015 MindView LLC: see Copyright.txt
// {ThrowsException} on a multiprocessor machine
// Using explicit Lock objects to create critical sections.
// Using explicit Lock objects to create
// critical sections.
package concurrency;
import java.util.concurrent.locks.*;
@ -40,7 +41,8 @@ class ExplicitPairManager2 extends PairManager {
}
public class ExplicitCriticalSection {
public static void main(String[] args) throws Exception {
public static void
main(String[] args) throws Exception {
PairManager
pman1 = new ExplicitPairManager1(),
pman2 = new ExplicitPairManager2();

View File

@ -44,6 +44,7 @@
<jrun cls="MoreBasicThreads" />
<jrun cls="MultiLock" />
<jrun cls="MutexEvenGenerator" failOnError='false' timeOut='4000' msg='* Timeout for Testing *' />
<jrun cls="NaiveExceptionHandling" failOnError='false' msg='* Exception was Expected *' />
<jrun cls="NIOInterruption" />
<jrun cls="NotifyVsNotifyAll" />
<jrun cls="OrnamentalGarden" />

View File

@ -1,6 +1,5 @@
//: exceptions/DynamicFields.java
// ©2015 MindView LLC: see Copyright.txt
// {ThrowsException}
// A Class that dynamically adds fields to itself.
// Demonstrates exception chaining.
import static net.mindview.util.Print.*;
@ -94,7 +93,7 @@ public class DynamicFields {
print("df: " + df);
print("df.getField(\"d\") : " + df.getField("d"));
Object field = df.setField("d", null); // Exception
} catch(NoSuchFieldException |
} catch(NoSuchFieldException |
DynamicFieldsException e) {
e.printStackTrace(System.out);
}

View File

@ -10,7 +10,7 @@
<jrun cls="AlwaysFinally" />
<jrun cls="Cleanup" />
<jrun cls="CleanupIdiom" />
<jrun cls="DynamicFields" failOnError='false' msg='* Exception was Expected *' />
<jrun cls="DynamicFields" />
<jrun cls="ExceptionMethods" />
<jrun cls="ExceptionSilencer" />
<jrun cls="ExtraFeatures" />

View File

@ -13,7 +13,7 @@ public class FormattedMemoryInput {
while(true)
System.out.write((char)in.readByte());
} catch(EOFException e) {
System.err.println("End of stream");
System.out.println("End of stream");
}
}
} /* (Execute to see output) *///:~

View File

@ -38,7 +38,7 @@ public class ChatterServer {
System.err.println("Can't open socket");
System.exit(1);
} catch(IOException e) {
System.err.println("Communication error");
System.out.println("Communication error");
e.printStackTrace();
}
}

View File

@ -3,7 +3,7 @@
// Very simple client that just sends
// lines to the server and reads lines
// that the server sends.
// {RunByHand}
// {ValidateByHand}
import java.net.*;
import java.io.*;

View File

@ -66,7 +66,7 @@ public class CheckCloneable {
x= (Ordinary)((IsCloneable)ord).clone();
System.out.println("Cloned " + id);
} catch(CloneNotSupportedException e) {
System.err.println(
System.out.println(
"Could not clone " + id);
}
} else {

View File

@ -1,7 +1,7 @@
//: remote/ptime/DisplayPerfectTime.java
// ©2015 MindView LLC: see Copyright.txt
// Uses remote object PerfectTime
// {RunByHand}
// {ValidateByHand}
package remote.ptime;
import java.net.MalformedURLException;
import java.rmi.*;

View File

@ -2,7 +2,7 @@
// ©2015 MindView LLC: see Copyright.txt
// The implementation of the PerfectTime
// remote object.
// {RunByHand}
// {ValidateByHand}
package remote.ptime;
import java.rmi.*;
import java.rmi.server.*;

View File

@ -1,2 +1,3 @@
python ..\Validate.py -p
powershell .\runall.ps1
python ..\Validate.py -e

View File

@ -31,13 +31,13 @@ class Communicate {
spkr.getMethod("talk", (Class[])null);
talk.invoke(speaker, new Object[]{});
} catch(NoSuchMethodException e) {
System.err.println(
System.out.println(
speaker + " cannot talk");
} catch(IllegalAccessException e) {
System.err.println(
System.out.println(
speaker + " IllegalAccessException");
} catch(InvocationTargetException e) {
System.err.println(
System.out.println(
speaker + " InvocationTargetException");
}
}

View File

@ -1,7 +1,7 @@
//: strings/TestRegularExpression.java
// ©2015 MindView LLC: see Copyright.txt
// Easily try out regular expressions.
// {Args: abcabcabcdefabc 'abc+' '(abc)+' '(abc){2,}' }
// {Args: abcabcabcdefabc "abc+" "(abc)+" "(abc){2,}" }
import java.util.regex.*;
import static net.mindview.util.Print.*;

View File

@ -15,7 +15,6 @@
<jrun cls="Finding" />
<jrun cls="Groups" />
<jrun cls="Immutable" />
<jrun cls="InfiniteRecursion" failOnError='false' msg='* Exception was Expected *' />
<jrun cls="IntegerMatch" />
<jrun cls="JGrep" arguments="JGrep.java '\\b[Ssct]\\w+'" />
<jrun cls="Receipt" />
@ -30,7 +29,7 @@
<jrun cls="SplitDemo" />
<jrun cls="Splitting" />
<jrun cls="StartEnd" />
<jrun cls="TestRegularExpression" arguments="abcabcabcdefabc 'abc+' '(abc)+' '(abc){2,}' " />
<jrun cls="TestRegularExpression" arguments='abcabcabcdefabc "abc+" "(abc)+" "(abc){2,}" ' />
<jrun cls="TheReplacements" />
<jrun cls="ThreatAnalyzer" />
<jrun cls="Turtle" />