Hello,
Your modem is using verbose error reporting
CMS Error 321 is used by some modems to say "no messages available"
You issue is solved by adding
if (line.length() <= 0 || line.matches("\\+CM[ES]\\sERROR:\\s\\d+")) break;
REGARDS
Wim stevens
On Wed, Dec 4, 2013 at 7:00 AM, 马勇 via SMSLib Discussion Group <
smslib+noreply-apn2wqe2qmucv6_tgnbyfejncfsfd3zbi5vk0ixomiyzqr...@googlegroups.com
> wrote:
> 2013-12-04 13:39:51 788 [DEBUG] smslib [350] GTW: xfzjsms: BUFFER: +CMS
> ERROR: 321
>
> 2013-12-04 13:39:51 788 [DEBUG] smslib [390] GTW: xfzjsms: RECV :+CMS
> ERROR: 321(cr)
> 2013-12-04 13:39:51 789 [ERROR] smslib [119] Error!
> java.lang.StringIndexOutOfBoundsException: String index out of range: -12
> at java.lang.String.substring(String.java:1938)
> at org.smslib.modem.ModemGateway.readMessagesPDU(ModemGateway.java:552)
> at org.smslib.modem.ModemGateway.readMessages(ModemGateway.java:213)
> at
> org.smslib.modem.AModemDriver$CNMIEmulatorProcessor.process(AModemDriver.java:935)
> at org.smslib.threading.AServiceThread.run(AServiceThread.java:105)
> 2013-12-04 13:39:51 789 [DEBUG] smslib [104] Running...
>
>
> ModemGateway.java at line 552
> if (line.length() <= 0 || line.equalsIgnoreCase("OK")) break;
> if (line.length() <= 0 || line.equalsIgnoreCase("ERROR")) break;
> i = line.indexOf(':');
> j = line.indexOf(',');
> memIndex = 0;
> try
> {
> memIndex = Integer.parseInt(line.substring(i + 1, j).trim());
> }
> if GTW return +CMS ERROR:321 not have ','
> so j = -1 throw java.lang.StringIndexOutOfBoundsException: String index
> out of range: -12
>
> --
> You received this message because you are subscribed to the Google Groups
> "SMSLib Discussion Group" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/smslib/619fda0d-f901-4f98-95e5-1d4987455b15%40googlegroups.com
> .
>
--
Vriendelijke groeten,
Wim Stevens
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/CAN1seG0fZNNiD94hRaQzNOYBGx6JH_Ba9fxf1Z2u_qzuGCGscA%40mail.gmail.com.