exception

nesting too deep in JSON... should I switch to XML?

I am getting a JSONException complaining about a very deep nesting (more than 30). I know that the value is hardcoded in JSONWriter. what best can I do? use another library without this restriction if such thing exists? switch to XML? UPDATE: I am serializing a labeled tree structure into JSON. So starting with root, each node is nesti...

How to avoid multiple nested IFs

I am currently trying to restructure my program to be more OO and to better implement known patterns etc. I have quite many nested IF-statements and want to get rid of them. How can I go about this? My first approach was to get it done with exceptions, so e.g. public static Boolean MyMethod(String param) { if (param == null) throw n...

Need help fast -- CoreData error

Hello, need help desperately ahead of a demo in a few hours... App was working on my test device fine last night. Added some data (as I always do) this morning and now I get this error during a save operation: Serious application error. Exception was caught during Core Data change processing: *** -[NSCFDictionary setObjec...

Is it better to use exceptions in a "validation" class or return status codes?

Suppose I'm creating a class to validate a number, like "Social Security" in US (just as an example of a country-based id). There are some rules to validate this number that comes from an input in a html form in a website. I thinking about creating a simple class in Python, and a public validate method. This validate returns True or Fal...

Java Exception handling mechanism

Hi, In Java,If I didn't catch the thrown Exception then the Thread execution stops there else if I catch the same then the Thread execution continues after the catch block.Why Java Exception handling designed in this way. Thx ...

Call to GetData fails silently in DragDrop event

Hello, I am building a Winforms application with drag and drop support into a TextBox. The TextBox should allow files and text to be dropped onto it. Its AllowDrop property is set to true. This is the event handler for its DragDrop event: var validFile = e.Data.GetDataPresent(DataFormats.FileDrop); var validText = e.Data.GetDataPrese...

Android - Getting Exception

I am developing one application in which i am getting an exception, and i know this one is the silly or small mistake which i am doing but your help may catch me out and make my day: public class Demo extends Activity { Button btnDemo; Thread t; AlertDialog alertDialog; @Override public void onCreate(Bundle...

C#: ArgumentException - XYZ.DLL does not contain any UserControl types

I have moved my development PC to another location, and without any changes to the source I now get the above exception. What could the be problem? I am using C# in VS2005. ...

Assert vs exception when developing the library

I am developing a library for further usage in other libraries or final products. Let's say a user uses the library in a wrong way - passing an inappropriate value to a public function, calling functions in the wrong order etc. In this case I might throw an exception, but these are usually designed for the final products and must be app...

Invoking constructor throws ArrayTypeMismatchException exception

I generated a hierarchy of classes from a xsd set of files. Say the class, that contains instances of other classes is Place and the place has Address, Categories, Tags and so on. When trying to instantiate a new Tags object in a for loop, I get ArrayTypeMismatchException: Attempted to access an element as a type incompatible w...

Insert problem in oracle database

HRESULT: 0X80040E2F (DB_E_INTEGRITYVIOLATION) Error message: Value violated the integrity constraints for a column or table. Can anybody tell me how to solve this error. ...

How to handle object disposed exception was unhandled Exception in c#?

I am working in c# windows application.I have two windows from name as form1 and form2.i am calling form2 by clicking the button in form1 but i create the object for form2 in constrcutor of form1 .if i click the button first time form2 showed successfully after that i close the form2 by clicking the default close button and again click t...

Is it possible to catch exceptions thrown in a JavaScript async callback?

Is there a way to catch exceptions in JavaScript callbacks? Is it even possible? Uncaught Error: Invalid value for property <address> Here is the jsfiddle: http://jsfiddle.net/kjy112/yQhhy/ try { // this will cause an exception ing google.maps.Geocoder().geocode() // since it expects a string. var zipcode = 30045; v...

Why won't this cast?

public interface IMenuCollection<T> : ICollection<T> public class HTMLMenuCollection: IMenuCollection<HTMLMenu> This is my custom collection definition. I am trying to cast to it from another collection IList. IList<HTMLMenu> htmlMenuList = new List<HTMLMenu>(); ... HTMLMenuCollection tempColl = (HTMLMenuCollection)htmlMenuList; I ...

Exception while reading an empty table

Iam trying to read data from a table. Initially it is empty. If i tried to read at that time it will cause an exception. My code is given Below -(NSMutableArray *) selectDataFrom:(NSString *) tableName { NSString *qsql = [NSString stringWithFormat:@"SELECT * FROM '%@' ",tableName]; sqlite3_stmt *statement; if (sqlite3_p...

access denied even though I specified policy.url in java.security

Hi, I am reading the tutorial on java security by oracle. (http://download.oracle.com/javase/tutorial/security/toolsign/rstep4.html) I duplicate all the files and everything from the tutorial basically. I am able to run the file with security manager using the following approach in unix: java -Djava.security.manager -Djava.security.po...

Implementing Exception class in C++

So, I am try to write a simple base Exception class for C++, based on the Java Exception class. I'm sure there are great libraries out there already, but I am doing this for practice, not production code, and I'm curious and always looking to learn. One of the things the Java's Exception does, which I would like to also implement, is the...

What is the cost of using exceptions in Objective-C?

I mean in the current implementation of clang or the gcc version. C++ and Java guys always tell me that exceptions do not cost any performance unless they are thrown. Is the same true for Objective-C? ...

Custom exceptions with error codes in .NET Web Services to Client

I'm trying to throw custom exception from a web service and trap it on the client side. I'm using JQuery and getting the JSON-serialized exceptions, so that's a good start. However the problems are: Stack trace is sent to the client which i don't want. I need to add an error code in addition to the exception message. I've tried creat...

Is it OK to try/catch something just to check if an exception was thrown or not ?

Hi, Is it a good way to try something useless just to see if a particular exception is thrown by this code ? I want to do something when the exception is thrown, and nothing otherwise. try { new BigDecimal("some string"); // This do nothing because the instance is ignored } catch (NumberFormatException e) { return false; ...