Handled http connection exceptions works fine on emualtor but bot on phone?

I have written some code to do a currency conversion.
The code works fine when a proper url is entered:
http://finance.yahoo.com/currency/convert?amt=1150& from=GBP& to=JPY& submit=Convert
I wanted to see how the error handling worket so i entered a dummy url. In the emulator this works fine, once i catch the IOexception i display an alert " Could not connect to server etc" . But when i run it on my K700i it does`nt show the error alert it goes to the display reults and shows an empty conversion result?
Does anyone know what this issue is?? I have tried everything.
Please HELP!
Code is below
* Get the returned html from the conversion page
public void run(){
try{
getData(url);
catch (IOException e){
//Show An Error Alert Page
MIDlet.showResult(false, null);
System.err.println(" Error in Run: " + e.getMessage();
* Open connection and return the html conversion
* results
* @throws IOException*/
private void getData(String url) throws IOException{
HttpConnection c = null;
InputStream is = null;
StringBuffer str = new StringBuffer();
String data = " " ;
//Open the url connection
c = (HttpConnection)Connector.open(url);
// Getting the InputStream will open the connection
// and read the HTTP headers
is = c.openInputStream();
try
// Getting the InputStream will open the connection
// and read the HTTP headers
int len = (int)c.getLength();
int ch;
while ((ch = is.read()) != -1) {
str.append((char)ch);
//Convert the data to a string
data = str.toString();
//Show The Results with the data
MIDlet.showResult(false, null);
//Close any open connections
...........

It turned out to be the firewall settings on our router. Her machine was sending traffic that our router interpreted as a DoS attack and blacklisted her Airport's MAC address. That's why it would work fine if she switched to Ethernet.

Similar Messages

  • My ipad2 was working fine last night, but this morning is unable to connect to ANY wifi networks (though it can detect them).  All typical solutions fail.  What can i do?

    My ipad2 was working fine last night, but this morning when I woke it up... it no longer was connected to my network.  While it can detect networks, it cannot connect to any (have tried at home and at work).  I have tried: resetting router, resetting ipad, forgetting network, renewing lease on network, ensuring airplane mode is off, resetting network settings, turning wifi on/off.  None of the typical solutions I can find online seem to work.  HELP!

    You've gone through all of the basics. You might look at this document regarding potential issues with wi-fi environments. 
    http://support.apple.com/kb/HT4199
    If none of that works, and if a device restore doesn't work, it's time for a trip to the Genius Bar. 

  • TS3367 Facetime worked fine on Sunday but nit yesterday nor today. Message is 'connection lost'. Help please

    Facetime worked fine on Sunday but not yesterday nor today. It just never connects. Message is 'connection lost'. Help please

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • HI my network connections is working fine but it doesnt allow me to update software or access apple store. Any suggestions?

    HI my network connections is working fine but it doesnt allow me to update software or access apple store. Any suggestions?

    Then it simply was NOT Brand New. Doesn't matter what the box looked like when you got it or if you went through the setup pages when you first turned it on. If it is registered to some other Apple ID then someone else had originally registered it and locked it to there ID.
    Type in the serial number of the system into this page.
    https://selfsolve.apple.com/agreementWarrantyDynamic.do
    And see when it was originally registered.
    Then send it back to Amazon as Used.
    LordRavenWolfe wrote:
    So I bought a brand new macbook from Amazon, and it came factory sealed (Not my first time buying a macbook, last one I bought was from Apple directly) but after I got this, I put in my apple I.D. and it told me there were updates available. I told it to go ahead and update, and it updated about half of the list, but the essential stuff (pages, notes, etc) it says "This software was installed using another Apple I.D. Please logon with that I.D. to install the software."  I'm a bit baffled by this as it is a brand new mac and so I don't know why anyone else's I.D. would be logged into this mac.  I'm not really worried about it though, as I don't really need to update my pages, etc, as I like what I have, but I'd love for this stupid "updates availble" popup to stop popping up every freaking day!!!
    Anyone have any suggestions on finding out how to either gain access to update, or get rid of that "other" i.d. that is somehow associated with my brand new macbook?
    I'm running OSX 10.9 if that is of any consequence.

  • My  2012 Mini OS 10.7.5 cannot see the Ethernet connection to my Actiontec GT701 WG.  The Network Preferences says "cable unplugged".  The WiFi connection is working fine.  Please Thank You

    My  2012 Mini OS 10.7.5 cannot see the Ethernet connection to my Actiontec GT701 WG.  The Network Preferences says "cable unplugged".  The WiFi connection is working fine.  Please Thank You

    Never mind, problem solved.  When I retunred to the Network tab the message had changed to "connected, no IP address" so I got that from the WiFi tab and configured the Ethernet manually.  Have a nice day @:-)#

  • Why cant itunes download songs from itunestore to my pc,windows seven,error msg says problem with connectivity,however the internet connection is working fine?

    why cant itunes download songs from the itunestore,the download fails and thr error msg says check your connectivity,however the internet is connected and working fine.I did reinstall itunes

    I have the same issue...I called Adobe and they said that Acrobat 8 is not compatible with Windows 7 ...so I tried installing the suite again without Acrobat and still the same issue....does anyone know if this issue is resolved by getting the new CS5 suite??? That is my only option it seems like...no one knows what's going on with the internet issue....even Adobe
    HELP

  • I try to open Acrobat I get a message that I need to register the product. I click on register and after about a minute, I'm told that I don't have an internet connection. My internet connection is working fine. In fact I registered Acrobat Pro XI using m

    I try to open Acrobat I get a message that I need to register the product. I click on register and after about a minute, I'm told that I don't have an internet connection. My internet connection is working fine. In fact I registered Acrobat Pro XI using my account, but the program itself will not recognize it or allow me to use the software. What do I do?

    If you already registered, then there is no point to trying to do so again. Simply dismiss the dialog.
    Mylenium

  • Trying to download CC Desktop. Loading bar freezes... how long does it take to download or is there another problem I'm not aware? Interne connection is working fine.

    .. how long does it take to download or is there another problem I'm not aware? Interne connection is working fine.
    Thanks for any help in advance!

    Are you using Windows computer or Mac?
    Also specify the version.

  • I have an ipad 2 the itunes program worked fine at first but now it will not connect to the store. it says 'secure link to itune store failed' i have uninstalled it and reinstalled it. what do i do

    i have an ipad 2 the itunes program worked fine at first but now it will not connect to the store. it says 'secure link to itune store failed' i have uninstalled it and reinstalled it. what do i do?

    Doublechecking before proceeding. Is iTunes endlessly saying "Accessing iTunes Store"? Or is something a bit different going on?

  • Safari is not connecting to internet on my iPad.  Says "could not open the page becuase the server stopped responding."  Everything else that updates over wireless connection is working fine.  Get same response on any site I try to visit.  Need Help!

    Safari is not connecting to internet on my iPad.  Says "could not open the page becuase the server stopped responding."  Everything else that updates over wireless connection is working fine.  Get same response on any site I try to visit.  Need Help!

    I am having identical problem on my iPhone 4 running iOS6.  Did NOT experience this issue prior to upgrade.

  • Http connection not working on phone

    Hi i am trying to connect to a http server using the new nokia n95 phone with T-mobile web and walk(Unlimited 3g internet access)
    on the emulaor and on the phones wifi connection, it works. But when i try connecting to the server using gprs/3g it doesnt. The response code never equals to OK . here is my code below:
    I know it is not working because has soon as the program makes an attempted to connect, the root.notifyDestroy() closes the application as i expect it too
    server = (HttpConnection) Connector.open(url);
                server.setRequestMethod(HttpConnection.POST);
                int rc = server.getResponseCode();
                if (rc == HttpConnection.HTTP_OK)
                   is = server.openInputStream();
                else
                    root.notifyDestroyed();
                     Alert alert = new Alert ("Error");
                    alert.setString("Error, server is down");
                    alert.setTimeout (5000);
                    Display.getDisplay(root).setCurrent(alert);
                    throw new IOException("HTTP response code: " + rc);
                }

    I had all sorts of strange problems getting http connect to work from phones. Most of my problems were resolved by adding every single header I could find that tells the carrier's gateway to leave it alone. Try adding these headers to the connection from the phone, and the response from the server:
                        connection.setRequestProperty( "User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0");
                        connection.setRequestProperty( "Content-Type", "application/octet-stream");
                        connection.setRequestProperty( "Content-Length", ""+(allContentToSend.length));
                        connection.setRequestProperty( "Cache-Control","no-store");
                        connection.setRequestProperty( "Cache-Control", "no-cache");
              connection.setRequestProperty( "Pragma","no-cache");
              connection.setRequestProperty( "Cache-Control", "no-transform");
              connection.setRequestProperty( "Connection", "Keep-Alive");
              connection.setRequestProperty( "Proxy-Connection", "Keep-Alive");          
    The content-type will depend on what you are sending. octet-stream is for binary data. If you are just encoding parameters in your POST you may need something else like "application/x-www-form-urlencoded".
    The content-length is obviously dependant on what you are sending. The rest of the properties simply tell whoever is transporting the request to leave it alone.
    TEMP_MOVED sounds like a redirect or some odd thing. Maybe the carrier is caching the response, and you are actually getting something unnexpected.
    Hope this helps.

  • Cannot connect to iTune store... even after the internet connection is working fine... plz help...

    cannot connect to iTune store... even after the internet connection is working fine... plz help...

    Same here, also cannot access the App Store. Internet connection is good. Iam on a Mac

  • I am trying to download and install itunes on windows 7.  The download works fine and it appears that the install works fine as well but when it finishes itunes is nowhere to be found. I am in Mexico. Please help.  Thanks

    I am trying to download and install itunes on windows 7.  The download works fine and it appears that the install works fine as well but when it finishes itunes is nowhere to be found. I am in Mexico. Please help.  Thanks

    You can try using this tool to first remove all traces of Reader from your computer:
    http://labs.adobe.com/downloads/acrobatcleaner.html
    Then, you can download the full offline Reader installer from
    http://get.adobe.com/reader/enterprise/
    After downloading, restart your computer and run the installer before doing anything else.

  • I'm having an intermittent problem with my midi controllers triggering Mainstage 3. I'm using a PreSonus Firebox audio interface. It's been working fine for months, but now when I first turn on the computer in the morning , I'm not able to trigger Ma

    I’m having an intermittent problem with my midi controllers triggering Mainstage 3.
    I’m using a PreSonus Firebox audio interface.
    It’s been working fine for months, but now when I first turn on the computer in the morning , I’m not able to trigger MainStage from the keyboard.  I tried different midi controllers, different keyboards, different midi cords, and check midi preferences.  The audio interface is working fine and is recogonized, but the midi doesn’twork.  I re-started the computer several times and then finally it miraculously starts working again.
      I’ve been having to this every day now.  Any help or ideas is very much appreciated.

    I Had the same problem with a FireStudio. Try unplugging the FireWire plug and the power plug. Wait for a few seconds, then plug both back in. The light on my FireStudio was flashing blue/red which means "not connecting." I did what I just described, and everything works again. Hope it works for you.

  • ITunes/Apple Mobile Device works fine w/iPod but not iPad

    Hi. I'm getting stuck on this and would like some help to solving this problem. Basically I'm trying to sync my iPad; however, whenever I connect it, this meesage pops up: "this iPad cannot be used because the Apple Mobile Device is not started." The problem is that when I try to plug in an iPod using the same wire, it works fine, no problem, but the iPad just won't connect. I have since uninstall and reinstall all Apple components (iTunes, AMD, QuickTime, etc) and it's still the same thing...iTunes connects fine w/ the iPod, but not the iPad. What to do? Thnx in advance.
    EDIT:
    Btw, I've tried to connect the iPad while the iPod is connected, and the "Apple Mobile Device is not started" error message pops up too, which is weird, because the iPod is connected and syncing at that time...which means the Apple Mobile Device thing IS started. >.>

    The iOS devices use Apple Mobile Device Service, while older iPods use the iPod Service.
    Checkout this Apple document -> How to restart the Apple Mobile Device Service (AMDS) on Windows
    Are you able to restart the service after following the steps in that article?

Maybe you are looking for