@@ -20,20 +20,23 @@ public class ASAP_Modem_Impl implements ASAP_1_0 {
20
20
public void offer (CharSequence peer , CharSequence format , CharSequence channel , int era ,
21
21
OutputStream os , boolean signed ) throws IOException , ASAPException {
22
22
23
+ if (era < 0 ) throw new ASAPException ("era must be a non-negative value: " + era );
23
24
OfferPDU_Impl .sendPDU (peer , format , channel , era , os , signed );
24
25
}
25
26
26
27
@ Override
27
28
public void offer (CharSequence peer , CharSequence format , CharSequence channel ,
28
29
OutputStream os , boolean signed ) throws IOException , ASAPException {
29
- this .offer (peer , format , channel , - 1 , os , signed );
30
+ this .offer (peer , format , channel , 0 , os , signed );
30
31
}
31
32
32
33
@ Override
33
34
public void interest (CharSequence peer , CharSequence sourcePeer , CharSequence format ,
34
35
CharSequence channel , int eraFrom , int eraTo , OutputStream os , boolean signed )
35
36
throws IOException , ASAPException {
36
37
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);
37
40
InterestPDU_Impl .sendPDU (peer , sourcePeer , format , channel , eraFrom , eraTo , os , signed );
38
41
}
39
42
@@ -58,6 +61,7 @@ public void assimilate(CharSequence peer, CharSequence recipientPeer, CharSequen
58
61
OutputStream os , boolean signed ) throws IOException , ASAPException {
59
62
60
63
if (data == null || data .length == 0 ) throw new ASAPException ("data must not be null" );
64
+ if (era < 0 ) throw new ASAPException ("era must be a non-negative value: " + era );
61
65
62
66
this .assimilate (peer , recipientPeer , format , channel , era , data .length , offsets ,
63
67
new ByteArrayInputStream (data ), os , signed );
0 commit comments