exception

Trouble accessing Java classes from Firefox extension's Javascript

I'm going to develop a Firefox extension which uses some Java classes. The extension gets the value of <input type="file"> fields, using Javascript. The Java class I'm going to create is the following: public class Firefox { public static String inFileName; public static void main(String[] args) throws IOException { in...

correctly printstacktrace of servlet exception

so i am using a filter to catch servlet exception (because we are using a mix of jsf/plain servlets) when catching the ServletException and calling printstacktrace most of the information is lost. the "true" root exception seems to be hidden behind the "funny" expression ((ServletException) e.getRootCause().getCause()).getRootCause()...

WPF: Button ControlTemplate + Spacebar = exception?

Hello, I've thrown together a template in Expression Blend for a button, and it works alright - until I tab over to it and press the spacebar. I get the following error: InvalidOperationException '[Unknown]' property does not point to a DependencyObject in path '(0).(1).[0].(2)'. The code is as follows: <ControlTemplate x:Key="E...

C# Time of finally execution

Take this code: using System; namespace OddThrow { class Program { static void Main(string[] args) { try { throw new Exception("Exception!"); } finally { System.Threading.Thread.Sleep(2500); Console.Error....

How to use wait and notify in java?

Hello, I have 2 matrices and I need to multiply them and then print the results of each cell. As soon as one cell is ready I need to print it, but for example I need to print the [0][0] cell before cell [2][0] even if the result of [2][0] is ready first. So I need to print it by order. So my idea is to make the printer thread wait until...

Why doesn't .net provide us with the key when it raises a KeyNotFound Exception (and how can I get it?)

When you try to access a key which isn't in a Dictionary (for example), here's the stack trace you get : at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) .... .... (my own code stack trace) Like most people probably do, I log this errors when they occur, ...

Should I always use TryGetValue to access .net Dictionaries ?

In another SO question, I've seen several people recommend me to always use TryGetValue. While I always use TryGetValue over the Contains?/Access pattern, I avoid this pattern on purpose when I expect the key to always be in the dictionary. I then go for a direct indexer access, so that an exception is raised if the key isn't there, bec...

InteropServices COMException when executing a .net app from a web CGI script on Windows Server 2003

Disclaimer: I'm completely clueless about .net and COM. I have a vendor's application that appears to be written in .net and I'm trying to wrap it with a web form (a cgi-bin Perl script) so I can eventually launch this vendor's app from a separate computer. I'm on a Windows Server 2003 R2 SE SP1 system and I'm using Apache 2.2 for the...

How to handle exceptions raised in other threads when unit testing?

When testing with Visual Studio Team Test unhandled exceptions in tests are caught and reported in the results. So I was kind of surprised to see the test hosting process (VSTestHost.exe) crash and showing the system crash dialog. Upon further investigation this crash was an unhandled exception raised in another thread (more directly, i...

How expensive are exceptions in C#?

It seems like its not incredibly expensive as long as the stack isn't too deep but I've read conflicting reports. Just wondering if there is a definitive report out there that hasn't been rebutted. ...

Excel error HRESULT: 0x800A03EC while trying to get range with cell's name

I am working with Window Service project. that have to write data to a sheet in Excel file in a sequence times. But sometimes, just sometimes, the service throw out the exception "Exception from HRESULT: 0x800A03EC" while it's trying to get range with cell's name. I have put the code of opening excel sheet, and getting cell here. OS:...

Exceptions and memory

When an exception is thrown or encountered: void ThrowException() { try { throw new Exception("Error"); } catch { } } is it & how is it disposed from memory? and how does the above code differ from the below code in respect of the disposal from memory of the Exception object? void ThrowException() { ...

Why does BindingList throw a System.ArgumentException when adding a member

I've got a binding list, that under certain hard to reproduce conditions is throwing the following exception when a value is added to it: System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource. at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object valu...

Strange exception coming out of OdbcConnection.Open()

Bashing our heads against the wall here We are an ISV and have hundreds of companies using our software with no problems. The software is Winforms/C# on .NET 2.0. One of our clients has installed our software and it crashes on startup on all of their machines, apart from on one guy's laptop where it works fine. On calling OdbcConnecti...

(Java) Opinion: Preventing Exceptions vs. Catching Exceptions

I am wondering how in practice other SOers tend to deal with and/or prevent exceptions. In what situations do you prevent exceptions, and how? In what situations do you catch exceptions? I usually prevent 'NullPointerExceptions' (and other similar ones) by, well, essentially saying if(foo!=null) {...} I find that in most situations t...

Exception Logging for WCF Services using ELMAH

We are using the excellent ELMAH to deal with unhandled exceptions in an ASP.NET 3.5 web application. This works extremely well for all of the site apart from WCF services which are being consumed using the REST features. When an exception occurs within the operation methods that is not handled by the application code, WCF handles it in ...

ActiveRecord#exists? or rescue from ActiveRecord::RecordNotFound

What is the recommended way of handling the following type of situations: Supposing I have a model called Cart, that has a 1-1 relationship with the model Person and the same PK (the user's id). In the index method of my cart_controller I want to check if a Cart exists for the current user. If I do Cart.find(the_user_id) and a cart does...

How to supress the creation of an (.net) Exception object?

Hi there, If I do not care about a thrown Exception. Can I code in a way as not to create it? In other words, can an Exception be thrown but no Exception object be created? An example - Simple example using a System.Net.Sockets.Socket Socket acceptingSocket; acceptingSocket.Blocking = false; while(condition) { try { ...

Catching wrong array reference in C++

How do I catch wrong array reference in C++? Why doesn't the following code work: #include <exception> int * problemNum = new int; int (* p [100])() = {problem1, problem2, problem3}; ... try { cout << (*p[*problemNum-1])(); } catch (exception){ cout << "No such problem"; } My compiler...

C# object reference not set to an instance of an object.

I am getting the object reference error in just start of the method. For Ex.: 259: public ActionResult ShowAddress(FormCollection formCollection) 260: { In the above sample i am getting the error Line number 260. Please anyone can suggest me the problem with this. ...