Symbian
Symbian OS Library

FAQ-1289 Why does my untrusted MIDlet throw a SecurityException when I try to open a SocketConnection?

[Index][spacer] [Previous] [Next]



 

Classification: Java Category: J2ME MIDP 2.0
Created: 07/18/2005 Modified: 07/19/2005
Number: FAQ-1289
Platform: Not Applicable

Question:
Why does my untrusted MIDlet throw a SecurityException when I try to open a SocketConnection?

Answer:

Under the JSR 185, Java Technology for the Wireless Industry (JTWI) specification, the implementation of SocketConnection must throw
a java.lang.SecurityException when an untrusted MIDlet suite attempts to open a connection on ports 80 and 8080 (http) and 443 (https). Untrusted MIDlets can open SocketConnections to any other port with explicit User permission. All but the earliest Symbian MIDP 2.0 phones are JTWI compliant.

If you need to open a SocketConnection to one of the restricted ports then your MIDlet suite must be signed. Alternatively use a Http(s)Connection instead, since untrusted MIDlets can open a HttpConnection to ports 80 and 8080, likewise a HttpsConnection can be opened to 443, provided permission is granted by the User.