You Are Here:

Community: Wiki

This page was last modified on 12 June 2009, at 08:11.

KIJ001371 - Wrong exception thrown when sending SMS messages that are too long

From Forum Nokia Wiki



ID KIJ001371 Creation date June 12, 2009
Platform S60 3rd Edition, FP2, S60 5th Edition Devices Nokia N79, Nokia N96, Nokia 5730 XpressMusic, Nokia 5800 XpressMusic
Category Java ME Subcategory Messaging, SMS


Keywords (APIs, classes, methods, functions): java.lang.IllegalArgumentException, java.io.InterruptedIOException


Description

When sending an SMS message that is too long, java.io.InterruptedIOException will be thrown instead of java.lang.IllegalArgumentException.

How to reproduce

1. Implement the following test MIDlet:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.Connector;
import javax.wireless.messaging.*;
 
public class SMSSendTest extends MIDlet
implements CommandListener
{
 
Display d;
Form f;
TextField phoneNumber;
TextField smsInfo;
 
Command exitCmd;
Command sendCmd;
String mese;
 
public SMSSendTest()
{
d = Display.getDisplay(this);
exitCmd = new Command("Exit", 1, Command.EXIT);
sendCmd = new Command("Send SMS", 1, Command.OK);
f = new Form("SMS Test");
 
phoneNumber = new TextField("Enter SMS receiver phone number", "+3581234567", 20, TextField.PHONENUMBER);
mese="VeryLongString";//the string must be approximately 5000-6000 characters
 
smsInfo= new TextField("Text", "Size of the test SMS text: "+mese.length(), 6000, TextField.ANY);
 
f.append(phoneNumber);
f.append(smsInfo);
f.addCommand(sendCmd);
f.addCommand(exitCmd);
f.setCommandListener(this);
d.setCurrent(f);
}
 
public void commandAction(Command c, Displayable d)
{
if(c == exitCmd)
try
{
destroyApp(true);
notifyDestroyed();
}
catch(Exception e)
{
smsInfo.setString(e.getMessage());
}
 
else
if(c == sendCmd)
send();
 
}
 
private void send()
{
Alert smsAlert;
smsAlert = new Alert("SMS Alert", "", null, null);
smsAlert.setTimeout(Alert.FOREVER);
 
try
{
 
String addr = "sms://" + phoneNumber.getString();
 
MessageConnection conn = (MessageConnection)Connector.open(addr);
TextMessage msg = (TextMessage)conn.newMessage("text");
 
msg.setPayloadText(mese);
conn.send(msg);
 
smsAlert.setString("SMS send successful");
d.setCurrent(smsAlert);
}
catch(Exception e)
{
smsAlert.setString("SMS send not successful: \n"+e.toString());
d.setCurrent(smsAlert);
 
}
}
 
 
protected void startApp()
throws MIDletStateChangeException
{
}
 
protected void pauseApp()
{
}
 
protected void destroyApp(boolean bool)
throws MIDletStateChangeException
{
}
 
}

2. Launch the test MIDlet and choose Send SMS from Options. For the affected devices, java.io.InterruptedIOException will be thrown instead of java.lang.IllegalArgumentException.


Solution

This issue is expected to be fixed in future software versions, starting with S60 5th Edition.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fKIJ001371E5fE2dE5fWrongE5feE78ceptionE5fthrownE5fwhenE5fsendingE5ftooE5flargeE5fSMSE5fmessageX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZKnowledgeBaseContentQ qdcZtypeQUqfntypeZKnownIssueQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZmessagingQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZKnowledgeBaseContentQ qfnZtypeQUqfntypeZKnownIssueQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxmessagingX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZKnowledgeBaseContentQ qrdfZtypeQUqfntypeZKnownIssueQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ