exception

Socket not disconnecting when connectivity changes

My chat application connects to a server and information is sent/received by the user. When the connection changes, such as 3g->wifi, wifi->3g, losing a data connection, etc, the socket sometimes stays connected for ages before disconnecting. During this time, it's impossible to tell if the connection is still active, it seems as if mess...

Cryptic error from Core Data: NSInvalidArgumentException, reason: referenceData64 only defined for abstract class

Hi all, I'm doing an iPhone app that reads data from XML file, turn them into Core Data Managed Objects and save them. The application is working fine, mostly, on smaller data set/XML that contains ~150 objects. I said mostly because 10% of the time, I'd get the following exception from CoreData while trying to save the context: * Te...

What's a good approach to writing error handling?

I hate writing error condition code. I guess I don't have a good approach to doing it: Do you write all of your 'functional' code first then go back in and add error handling or vice versa? How stupid do you assume your users are? How granular do you make your exception throws? Does anyone have sage advice to pass on to make this ea...

how to catch devenv exception

Hello, How can I catch an error in devenv? If an error occures (the build fails..) I need to print it out. How can I do that? Thanks! ...

how to handle a exception in java

So I am using HtmlUnit, and the method's signature looks like: public HtmlAnchor getAnchorByText(String text) throws ElementNotFoundException So this means, the call to this method won't just return null, but it will throw an exception. (I find this a pain!!, in c# methods usually just return a null if not ...

What's the correct way to try a method again after a exception has been handled?

I am new to exceptions, haven't covered them in college yet so still learning about them. I tried this and it seems to work, but doesn't seem "right". What's the correct way to try a method again after a exception has been handled? public static void openCSV(String file) { FileInputStream fis; try { fis = new FileInputS...

NHibernate exception collection [..User.Groups] was not processed by flush()

All of my NH entities derive from a type called BusinessEntity, it has the most basic values ID, Created, CreatedBy, Updated, UpdatedBy. CreatedBy / UpdatedBy takes a User I have a IPreUpdateEventListener and IPreInsertEventListener that fire to get the current DateTime for the audit values. Also in here I have my logic to get the curr...

C++ Exception Handling In Critical Section (pthreads)

[Edit: (copied from a comment) As it turns out, the problem was elsewhere, but thank you all for your input.] I have a shared container class which uses a single mutex to lock the push() and pop() functions, since I don't want to simultaneously modify the head and tail. Here's the code: int Queue::push( WorkUnit unit ) { pthread_mu...

Caught exception while loading file struts-default.xml

I'm not that new to Java. I've done plenty of stuff with it before. But I'm migrating from PHP to Java Servlet/JSP (which I am new to) and I can't figure out this error to save my life. I installed Tomcat6 using Ubuntu 9.04's Synaptic Package Manager and it works like a charm. But when I put struts in my WEB-INF/lib directory and try to ...

Side effects of throwing an exception inside a synchronized clause?

Are there any unclear side effects to throwing an exception from within a synchronized clause? What happens to the lock? private void doSomething() throws Exception {...} synchronized (lock) { doSomething(); } ...

GoogleAppEngine urlfetch timeout exception

Has anyone got any experience with the following exception when using GAE urlfetch? DownloadError: ApplicationError: 2 timed out I'm trying to send a HTTP POST request. Like so: result = urlfetch.fetch('http://api.nathan.com:8080/Obj/', method='POST', payload=pos...

dealing with complex results in objects -- exceptions?

What is the general way of handling complex results from functions with an object? A simple method might return true or false, and that would be all I need to know. A more complex method might return true or false, but there might be more information I would want to get out of the class, such as why it failed ( there might be several rea...

Trying to get HTTP code. Can someone try this code for me in their Python interpretor and see why it doesn't work?

import httplib def httpCode(theurl): if theurl.startswith("http://"): theurl = theurl[7:] head = theurl[:theurl.find('/')] tail = theurl[theurl.find('/'):] response_code = 0 conn = httplib.HTTPConnection(head) conn.request("HEAD",tail) res = conn.getresponse() response_code = int(res.status) return res...

Blackberry http connection using WiFi when not entering event dispatcher

My application can run in 2 modes first one instantiates itself after going into main() enters event dispatcher then works as normal. MyApp theApp = new MyApp(); theApp.enterEventDispatcher(); In another (used to update some background stuff) it does not enter into event dispatcher just runs an http request and does some extra stuff. ...

check what files are open in Python

I'm getting an error in a program that is supposed to run for a long time that too many files are open. Is there any way I can keep track of which files are open so I can print that list out occasionally and see where the problem is? ...

C# Collection was modified; enumeration operation may not execute.

Hi there. I'm trying to remove a item from a ArrayList and I get this Exception: Collection was modified; enumeration operation may not execute. Any ideas? thanks for the help ...

Unhandled exception returns junk characters instead of error

In my ASP.NET (3.5) application, I don't have global exception handling, and if an unhandled exception is thrown, instead of getting the standard yellow ASP.NET error, I'm getting a bunch of junk characters (fairly long, and different each time) - stuff like: y6����h����H'��:���ղ�>�Ey�裟��Y��>:�O���b�>ZV�"+壦�A�(?��Ӫ��G�2��=�%�w�@} Obvio...

How do I test my socket exception handling code?

I have the following code: try { mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, serverPort); mainSocket.Bind(ipEndPoint); mainSocket.Listen(MAX_CONNECTIONS); mainSocket.BeginAccept(new AsyncCallback(serverEndAccept), mainSocke...

How to listen for Exceptions in Android?

Some of the analytics packages (for instance, Flurry) will listen for Exceptions and log them w/o actually catching them. How are they doing this? ...

How can I know what exceptions can be thrown from a method?

How can I know what exceptions might be thrown from a method call? ...