Skip to content

Commit 9743374

Browse files
committed
minor corrections: replace -1 with symbolic value ERA_NOT_DEFINED.
1 parent 11365ea commit 9743374

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/net/sharksystem/asap/protocol/ASAP_Modem_Impl.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@ public void offer(CharSequence peer, CharSequence format, CharSequence channel,
3232

3333
@Override
3434
public void interest(CharSequence peer, CharSequence sourcePeer, CharSequence format,
35-
CharSequence channel, int eraFrom, int eraTo, OutputStream os, boolean signed)
35+
CharSequence channel, int eraFrom, int eraTo, OutputStream os, boolean signed)
3636
throws IOException, ASAPException {
3737

38-
// TODO - should throw an exception!
39-
//if(eraFrom < 0 || eraTo < 0) throw new ASAPException("era must be a non-negative value: from|to): " + eraFrom + "|" + eraTo);
4038
InterestPDU_Impl.sendPDU(peer, sourcePeer, format, channel, eraFrom, eraTo, os, signed);
4139
}
4240

4341
@Override
4442
public void interest(CharSequence peer, CharSequence sourcePeer, CharSequence format,
4543
CharSequence channel, OutputStream os, boolean signed) throws IOException, ASAPException {
4644

47-
this.interest(peer, sourcePeer, format, channel, -1, -1, os, signed);
45+
this.interest(peer, sourcePeer, format, channel, ERA_NOT_DEFINED, ERA_NOT_DEFINED, os, signed);
4846
}
4947

5048
@Override

src/net/sharksystem/asap/protocol/PDU_Impl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import static net.sharksystem.asap.protocol.ASAP_1_0.ERA_NOT_DEFINED;
1111

12-
abstract class PDU_Impl implements ASAP_PDU_1_0{
12+
abstract class PDU_Impl implements ASAP_PDU_1_0 {
1313
public static final int PEER_BIT_POSITION = 0;
1414
public static final int CHANNEL_BIT_POSITION = 1;
1515
public static final int ERA_BIT_POSITION = 2;
@@ -300,6 +300,7 @@ static void checkValidFormat(CharSequence format) throws ASAPException {
300300
static void checkValidEra(int era) throws ASAPException {
301301
if(era < -1) throw new ASAPException("era cannot be smaller than -1");
302302
int maxEra = Integer.MAX_VALUE;
303+
// that's impossible but ... never change a running system...
303304
if(era > maxEra) throw new ASAPException("era exceeded max limit of " + Integer.MAX_VALUE);
304305
}
305306

0 commit comments

Comments
 (0)