|
From: Michael R. <mr...@us...> - 2004-08-12 12:54:32
|
Update of /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6600/OpenORB/src/main/org/openorb/orb/util Modified Files: Trace.java Log Message: Various improvements, see WHATSNEW for details Index: Trace.java =================================================================== RCS file: /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/util/Trace.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Trace.java 16 Feb 2004 09:41:59 -0000 1.8 +++ Trace.java 12 Aug 2004 12:54:24 -0000 1.9 @@ -518,6 +518,34 @@ } /** + * This method performs a sanity check of a GIOP header at the + * specified offset. It prints a stack trace and the corrupted buffer + * to stderr. + * + * @param buf The message buffer. + * @param off The offset at which to check for the GIOP header. + * @return True when the header is OK, false otherwise. + */ + public static boolean isGIOPHeaderOK( byte[] buf, int off ) + { + boolean result = true; + if ( buf[ off + 0 ] != 'G' || buf[ off + 1 ] != 'I' + || buf[ off + 2 ] != 'O' || buf[ off + 3 ] != 'P' + || buf[ off + 4 ] != 1 || buf[ off + 5 ] > 2 ) + { + System.err.println( "###############################################" ); + System.err.println( "!!Trying to send/receive corrupt GIOP message!!" ); + System.err.println( "###############################################" ); + Thread.dumpStack(); + System.err.println( "###############################################" ); + System.err.println( bufferToString( "The corrupted buffer (off=" + off + ")", buf ) ); + System.err.println( "###############################################" ); + result = false; + } + return result; + } + + /** * Helper method for signalIllegalCondition. * Returns the default assertion logger. * |