Changeset 4 for protocol/src/main
- Timestamp:
- 09/18/19 10:00:22 (5 years ago)
- Location:
- protocol/src/main/java/geniusweb/protocol
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocol/src/main/java/geniusweb/protocol/ProtocolException.java
r1 r4 13 13 14 14 /** 15 *16 15 * @param message the error message 17 16 * @param party offending party, either the {@link PartyId} or a … … 19 18 */ 20 19 public ProtocolException(String message, String party) { 21 super(party + ":" + message); 22 this.party = party; 20 this(message, party, null); 23 21 } 24 22 25 23 /** 24 * ProtocolException is special, in that it does not auto-fill the 25 * stacktrace. This is needed because usually a ProtocolException is caused 26 * by a party doing a bad action. Creating a stacktrace pointing to the 27 * class reporting the protocol exception (usually, the protocol handler) 28 * makes no sense as the protocol handler is doing the correct job there. 29 * 26 30 * 27 31 * @param message the error message … … 31 35 */ 32 36 public ProtocolException(String message, String party, Throwable e) { 33 super(party + ":" + message, e );37 super(party + ":" + message, e, true, false); 34 38 this.party = party; 35 39 } -
protocol/src/main/java/geniusweb/protocol/session/saop/SAOP.java
r1 r4 2 2 3 3 import java.io.IOException; 4 import java.sql.Date; 5 import java.text.SimpleDateFormat; 4 6 import java.util.List; 5 7 import java.util.Timer; … … 190 192 "BUG. Deadline timer has triggered but state is not final"); 191 193 } 194 log.log(Level.WARNING, 195 "SAOP deadline reached. Terminating session."); 192 196 finish(); 193 197 } … … 196 200 // early 197 201 deadlinetimer.schedule(task, deadline.getDuration() + TIME_MARGIN); 202 log.log(Level.INFO, "SAOP deadline set to " 203 + new SimpleDateFormat("yyyy/MM/dd HH:mm:ss") 204 .format(new Date(System.currentTimeMillis() 205 + deadline.getDuration() + TIME_MARGIN))); 198 206 } 199 207 … … 251 259 final ConnectionWithParty partyconn, final Action action) { 252 260 if (action == null) { 253 handleError("Received null from " + partyconn + ". Closing session", 261 handleError(partyconn 262 + " did null action, breaching the protocol. Closing session", 254 263 partyconn.getParty().getName(), null); 255 264 return; … … 259 268 if (!partyconn.getParty().equals(state.getNextActor())) { 260 269 // party does not have the turn. 261 throw new ProtocolException(" act without having the turn", 270 throw new ProtocolException( 271 "Party acts without having the turn", 262 272 partyconn.getParty().getName()); 263 273 } -
protocol/src/main/java/geniusweb/protocol/session/saop/SAOPState.java
r1 r4 189 189 } 190 190 if (!actor.equals(getNextActor())) { 191 throw new ProtocolException(" actordoes not have the turn ",191 throw new ProtocolException("Party does not have the turn ", 192 192 actor.getName()); 193 193 … … 211 211 if (!bid.equals(((Accept) action).getBid())) { 212 212 throw new ProtocolException( 213 " Accepts a bid that was not offered (last offer =" + bid214 + ", action=" + action + ")",213 "Party accepts a bid differing from the last offer =" 214 + bid + ", action=" + action + ")", 215 215 actor.getName()); 216 216 }
Note:
See TracChangeset
for help on using the changeset viewer.