|
Message
From: cvs at opencores.org<cvs@o...>
Date: Tue Dec 18 03:35:17 CET 2007
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/07/12 18:03:35 Modified: jop/java/tools/src/com/sun/tools/jdi PacketWrapper.java Log: Added a method to return if there's an error status. Changed the way the packet is printed, to show the error code, in case of reply packets. Method added: 304: public boolean hasNoError() Method changed: 310: public void printInformation(PrintStream stream) Revision Changes Path 1.3 jop/java/tools/src/com/sun/tools/jdi/PacketWrapper.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/sun/tools/jdi/PacketWrapper.java.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: PacketWrapper.java =================================================================== RCS file: /cvsroot/paulo/jop/java/tools/src/com/sun/tools/jdi/PacketWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- PacketWrapper.java 23 Nov 2007 04:46:45 -0000 1.2 +++ PacketWrapper.java 18 Dec 2007 02:35:16 -0000 1.3 @@ -25,6 +25,7 @@ import java.io.PrintStream; import com.jopdesign.debug.jdwp.constants.CommandConstants; +import com.jopdesign.debug.jdwp.constants.ErrorConstants; import com.jopdesign.debug.jdwp.constants.JDWPConstants; import com.jopdesign.debug.jdwp.util.Util; @@ -291,6 +292,21 @@ this.error = error; } + /** + * Check if this is a reply package which has no error set. + * + * This method can be used only for reply packets. + * It has no meaning for regular request packets: in this + * case, it will always return "false". + * + * @return + */ + public boolean hasNoError() + { + // check if it's a reply packet and also if there's no error set. + return isReply() && (getErrorCode() == ErrorConstants.ERROR_NONE); + } + public String toString() { ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); @@ -328,6 +344,8 @@ stream.print(" Size:"); stream.print(size()); + if(isReply() == false) + { int set = getCmdSet(); stream.print(" Command set: "); stream.print(set); @@ -339,6 +357,20 @@ stream.print(cmd); stream.print(" "); stream.println(CommandConstants.getCommandDescription(set, cmd)); + } + else + { + stream.print(" Error code: "); + if(hasNoError()) + { + stream.println("None"); + } + else + { + int error = getErrorCode(); + stream.println(error); + } + } stream.print(" Data (as String): "); stream.println(data);
|
 |