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() { new Timer().schedule(new TimerTask() {
@Override @Override
public void run() { public void run() {
System.err.println("Aborting"); System.out.println("Aborting");
System.exit(0); System.exit(0);
} }
}, 5000); // Terminate after 5 seconds }, 5000); // Terminate after 5 seconds
ExecutorService exec = Executors.newCachedThreadPool(); ExecutorService exec =
Executors.newCachedThreadPool();
AtomicIntegerTest ait = new AtomicIntegerTest(); AtomicIntegerTest ait = new AtomicIntegerTest();
exec.execute(ait); exec.execute(ait);
while(true) { while(true) {

View File

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

View File

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

View File

@ -44,6 +44,7 @@
<jrun cls="MoreBasicThreads" /> <jrun cls="MoreBasicThreads" />
<jrun cls="MultiLock" /> <jrun cls="MultiLock" />
<jrun cls="MutexEvenGenerator" failOnError='false' timeOut='4000' msg='* Timeout for Testing *' /> <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="NIOInterruption" />
<jrun cls="NotifyVsNotifyAll" /> <jrun cls="NotifyVsNotifyAll" />
<jrun cls="OrnamentalGarden" /> <jrun cls="OrnamentalGarden" />

View File

@ -1,6 +1,5 @@
//: exceptions/DynamicFields.java //: exceptions/DynamicFields.java
// ©2015 MindView LLC: see Copyright.txt // ©2015 MindView LLC: see Copyright.txt
// {ThrowsException}
// A Class that dynamically adds fields to itself. // A Class that dynamically adds fields to itself.
// Demonstrates exception chaining. // Demonstrates exception chaining.
import static net.mindview.util.Print.*; import static net.mindview.util.Print.*;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,6 @@
<jrun cls="Finding" /> <jrun cls="Finding" />
<jrun cls="Groups" /> <jrun cls="Groups" />
<jrun cls="Immutable" /> <jrun cls="Immutable" />
<jrun cls="InfiniteRecursion" failOnError='false' msg='* Exception was Expected *' />
<jrun cls="IntegerMatch" /> <jrun cls="IntegerMatch" />
<jrun cls="JGrep" arguments="JGrep.java '\\b[Ssct]\\w+'" /> <jrun cls="JGrep" arguments="JGrep.java '\\b[Ssct]\\w+'" />
<jrun cls="Receipt" /> <jrun cls="Receipt" />
@ -30,7 +29,7 @@
<jrun cls="SplitDemo" /> <jrun cls="SplitDemo" />
<jrun cls="Splitting" /> <jrun cls="Splitting" />
<jrun cls="StartEnd" /> <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="TheReplacements" />
<jrun cls="ThreatAnalyzer" /> <jrun cls="ThreatAnalyzer" />
<jrun cls="Turtle" /> <jrun cls="Turtle" />