[Jukebox-cvs] CVS update: J4/src/java/gnu/j4/examples Base64Example.java
Brought to you by:
vtt
From: CVS B. <vt...@fr...> - 2000-10-25 06:54:48
|
User: vt Date: 00/10/24 23:54:52 Modified: src/java/gnu/j4/examples Base64Example.java Log: Made the check return the error code to the system if the check is not successful. Revision Changes Path 1.3 +16 -3 J4/src/java/gnu/j4/examples/Base64Example.java CVSWEB Options: ------------------- CVSWeb: Annotate this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java?annotate=1.3&cvsroot=jukebox4 CVSWeb: View this file: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java?rev=1.3&content-type=text/x-cvsweb-markup&cvsroot=jukebox4 CVSWeb: Diff to previous version: http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/J4/src/java/gnu/j4/examples/Base64Example.java.diff?r1=1.3&r2=1.2&cvsroot=jukebox4 ----------------------------------- Index: Base64Example.java =================================================================== RCS file: /usr/local/cvs/J4/src/java/gnu/j4/examples/Base64Example.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Base64Example.java 2000/08/04 23:21:07 1.2 +++ Base64Example.java 2000/10/25 06:54:52 1.3 @@ -15,7 +15,7 @@ * MIME Base64 encoding/decoding example. * * @author Copyright © <a href="mailto:vt...@fr...">Vadim Tkachenko</a> 1995-1998 - * @version $Id: Base64Example.java,v 1.2 2000/08/04 23:21:07 vt Exp $ + * @version $Id: Base64Example.java,v 1.3 2000/10/25 06:54:52 vt Exp $ */ public class Base64Example extends ActiveService { @@ -56,9 +56,16 @@ sources.add("Padding1234"); sources.add("Padding12345"); + boolean OK = true; + for ( Enumeration e = sources.elements(); e.hasMoreElements(); ) { + + OK = process((String)e.nextElement())?OK:false; + } - process((String)e.nextElement()); + if ( !OK ) { + + throw new Error("FAILED"); } } @@ -72,8 +79,10 @@ LOG_NOTICE,CH_BASE64,"shutdown: cleaning up" ); } - private void process(String source) throws Throwable { + private boolean process(String source) throws Throwable { + boolean OK = true; + complain(LOG_NOTICE, CH_BASE64, "Source: '" + source + "'"); ByteArrayInputStream in = new ByteArrayInputStream(source.getBytes()); @@ -128,6 +137,7 @@ if ( !encodedReliable.equals(encoded) ) { complain(LOG_ERR, CH_BASE64, "FAILED: '" + encodedReliable + "', length " + encodedReliable.length()); + OK = false; } in = new ByteArrayInputStream(encoded.getBytes()); @@ -159,7 +169,10 @@ if ( !source.equals(decoded) ) { complain(LOG_ERR, CH_BASE64, "FAILED: '" + source + "', length " + source.length()); + OK = false; } + + return OK; } } |