exception

JSF Float Conversion

I'm using JSF 1.2 with IceFaces 1.8 in a project here. I have a page which is basically a big edit grid for a whole bunch of floating-point number fields. This is implemented with inputText fields on the page pointing at a value object with primitive float types Now, as a new requirement sees some of the fields be nullable, I wanted to...

Throwing non-const temporaries by reference

Is there any problem with throwing an object constructed on the stack in a try-block by non-const reference, catching it and modifying it, then throwing it by reference to another catch block? Below is a short example of what I'm refering to. struct EC { EC(string msg) { what = msg; } string where; string what; void ap...

Unit Test Adapter threw exception: ... is not marked as serializable..

this error is driving me nuts: Unit Test Adapter threw exception: Type 'com.imagehawk.ZDRCreator.Config.ZDRCreatorConfigException' in assembly 'ZDRCreator, Version=1.0.5.1, Culture=neutral, PublicKeyToken=null' is not marked as serializable.. it's an exception, the only places it's used is like this throw new ZDRCreatorConfigException(...

.NET DataGridView: Correct way of dealing with parsing errors while handling the CellParsing event?

I am currently developing an application for an angle measurement device (goniometer). A DataGridView component is used for configuring nominal values (and tolerances) for the measured angles. The user shall be able to enter the angles in various ways, such as 2° (for degrees) or 120' (for minutes of arc) or 7200" (for arcseconds). For t...

How to force Java to throw arithmetic exception?

How to force Java to throw arithmetic exception on dividing by 0.0 or extracting root from negative double? Code follows: double a = 1; // or a = 0 to test division by 0 double b = 2; double c = 100; double d = b*b - 4*a*c; double x1 = (-b - Math.sqrt(d)) / 2 / a; double x2 = (-b + Math.sqrt(d)) / 2 / a; ...

C# exception when calling callback function

I've made this to call unmanaged function from C code. pCallback is a function pointer so on the managed side is a delegate. [DllImport("MyDLL.dll")] public static extern Result SetCallback( IntPtr handle, Delegate pCallback, CallbackType Type); Now I am setting private delegate void pfnCallback(u...

How is this Dictionary<TKey, TValue> exception possible?

Given the following stack trace: MESSAGE: Value cannot be null.Parameter name: key SOURCE: mscorlib TARGETSITE: Void ThrowArgumentNullException(System.ExceptionArgument) STACKTRACE:    at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)    at System.Collections.Generic.Dictionary'2.FindEntry(TKey key)    at Syst...

Singleton and Exception

Hi Guys, Whats the best way to design a singleton class that could throw an exception? Here I have a Singleton (using Bill Pugh's method, documented in Wiki for Singleton). private static class SingletonObjectFactoryHolder{ //1 private static final ObjectFactory INSTANCE = new ObjectFactory(); } private Obje...

Try/catch blocks inside constructors

Hi, Is it a bad programming practice to have try/catch blocks inside constructors? Or does it make no difference as long as our programs handle typeinitializer exceptions gracefully. In C# if there are any exceptions inside a constructor the framework always throws typeinitilizer exceptions. Thanks, Shamika ...

Creating exception classes for lot different error codes.

I am writing a custom .Net SDK for the mapping program MapInfo Pro, mapinfo only exposes two methods to use over COM void Do(string cmd) and string Eval(string cmd). When you use one of these methods and you do something invaild, it returns a a COMException with a error message and I get the error code from MapInfo. So for example an er...

What does it mean in .Net: try-catch block without any Exception as parameter for catch?

Hi What does it mean in .Net: try-catch block without any Exception as parameter for catch? ...

What happens if I use "throw;" without an exception to throw?

Here's the setup. I have a C++ program which calls several functions, all of which potentially throw the same exception set, and I want the same behaviour for the exceptions in each function (e.g. print error message & reset all the data to the default for exceptionA; simply print for exceptionB; shut-down cleanly for all other exceptio...

uncatchable exception from unreachable code

I run into a very strange problem in my C# 2.0 WinForms app and I'm not even sure if its worth asking SO, because the problem occurs in a strange setup and I don't think that you could reproduce it without my sources, but I'm totally out of ideas. I have a Form with a TreeView on the left and an ListView on the right. The TreeView shows...

How can keep the debugger from breaking on NotImplementedException exception?

I've tried this, but it doesn't seem to work: Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler...

Can't determine what is throwing a NullPointer exception.

I have a method that looks like this: try { doStuff(); } catch (Exception ex) { logger.error(ex); } (I don't really use method names like doStuff - this is just to make things easy) In doStuff I do a variety of things, among them is call a data access method (so, another method within doStuff) that ends with the following: } cat...

try- catch. Handling multiple exceptions the same way (or with a fall through)

There has already been a question posted here which is very similar. Mine is extending that question a bit more. Say you want to catch multiple types of exception but want to handle it the same way, is there a way to do something like switch case ? switch (case) { case 1: case 2: DoSomething(); break; case 3: DoSomethingEls...

Invalid Cast Exception while using LINQ

Hello =) I'm a classic newbie... i can compile my program, but get an invalidcast excpetion when running the programm what's wrong with my code. i don't not what to seach for :( This is my code (.net 3.5) class Element{ private int i; public int I { get { return i; } set { i = value; } } private string s; public st...

Who is throwing (and catching) this MySQL Exception?

i'm using Python with MySQL and Django. I keep seeing this error and I can't figure out where the exception is being thrown: Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in > ignored I have many "try" and "exception" blocks in my code--if the exception occurred within...

Exception in thread "AWT-EventQueue-0" java.util.

How do I fix this code? i don't know what this error means... I heard that it comes from having elements of a list removed during a for each loop, but I don't see anything tha I'm removing... public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; for(Layer e : layerList) e.drawLayer(...

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException

SEVERE: Exception loading sessions from persistent storage java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: bean.ProjectAreaBean at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1333) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at java.util.Ar...