exception

NoElementException but I print the element and get the expected result

What I am trying to do is save a Move objects into a Vector called topMoves. There will be many Move objects which is why I create the object within the loop. The pastPriceMap stores prices for stocks at some past time (in this case one minute ago). The currPriceMap stores price for stocks some time within the last second. I get the fo...

Unhandled Exceptions with Global.asax

I am emailing unhandled exception details from global.asax. How can I get the path and/or filename of the aspx file or assembly file where an exception was not handled. This info was showing up in the exception's stack trace when I was developing & testing. When I deployed the global.asax to production, this info is no longer showing up...

When is it appropriate to use C++ exceptions?

I'm trying to design a class that needs to dynamically allocate some memory.. I had planned to allocate the memory it needs during construction, but how do I handle failed memory allocations? Should I throw an exception? I read somewhere that exceptions should only be used for "exceptional" cases, and running out of memory doesn't seem ...

Should NullRefs ever be caught?

I recently made the statement to a colleague that: NullReferenceExceptions should never be explicitly caught I used the word never.... hmmm. I've never seen a appropriate use case myself for catching them but I wanted to check if anyone else has? Never is such a strong word after all..... ...

What's causing my java.net.SocketException: Connection reset?

We are seeing frequent java.net.SocketException: Connection reset errors in our logs for a component that calls a third party Web service that sends SMS messages. Our application is written in Java and is sat on top of Tomcat 5.5. It was written by contractors who are no longer with us. The current team has no real Java expertise, and w...

Stop bash script if unchecked Java Exception is thrown

I am running a java program from within a Bash script. If the java program throws an unchecked exception, I want to stop the bash script rather than the script continuing execution of the next command. How to do this? My script looks something like the following: #!/bin/bash javac *.java java -ea HelloWorld > HelloWorld.txt mv Hell...

Catching exceptions as an expression while debugging Java in Eclipse IDE

An everyday debugging situation for Java developers is that in which an Exception is thrown and then you need to dig into the debugger to find out what threw it. Usually you would try to set up some breakpoints before the exception is thrown and hope that you are able to determine the situation that leads up to that exception. In Eclips...

Is there an unhandled exception handler in Java?

If i remember correctly in .NET one can register "global" handlers for unhandled exceptions. I am wondering if there is something similar for Java. ...

.NET Exception Explorer

Hello, Does anyone know of a program or plug-in or anything that I can find out what are all the exceptions any method may throw? I think JAVA has this build in if I'm not mistaken. Where the compiler tells you what exceptions this method will throw. Does the same exist for .NET? Thanks Edit: After searching around more, I wish the...

Java AWT - BufferedImage problems when using J2ME and J9

Hey, I'm trying to use the BufferedImage class in AWT. I'm using J2ME on IBM's J9 virtual machine. When I try and call the BufferedImge.getRastor() method I get the following exception: Exception in thread "main" java.lang.NoSuchMethodError: java/awt/image/BufferedImage.getRastor()Ljava/awt/image/WritableRaster; Now, from what I kn...

What causes the System.Web.HttpException with error code 0x80070057 on Page.Flush while debugging in VS2005?

Here is the complete error message: An exception of type 'System.Web.HttpException' occurred in System.Web.dll but was not handled in user code Additional information: The remote host closed the connection. The error code is 0x80070057. and the offending code: char[] buffer = oPage.HTML.HTML.ToCharArray(); Page.Re...

What are the pros and cons for different methods of checking a Collection for a null before adding to a Set?

This is a follow up question to "Is there a basic Java Set implementation that does not permit nulls?". (thank you to all of those who helped with the answer) It seems that the way to do this, since Sun didn't provide something simple like this OOTB, is with a wrapper / proxy. This seems nearly straight forward. What I am wondering is ...

Help me make this code exception-safe.

So I have this library code, see... class Thing { public: class Obj { public: static const int len = 16; explicit Obj(char *str) { strncpy(str_, str, len); } virtual void operator()() = 0; private: char str_[len]; }; explicit Thing(vector<Obj*> &o...

onerror handling with VS2008

function testFun() { onerror = function() { log("caught the error"); return true; }; setTimeout(function() { throw "bad bad bad"; }, 300); }; This is sample, code, but it demonstrates a problem. If I run this in FF, or IE7, it prints the sensible "caught the error" message (assume a reasonable 'log' function). However if I deb...

Is a finally block without a catch block a java anti-pattern?

I just had a pretty painful troubleshooting experience in troubleshooting some code that looked like this: try { doSomeStuff() doMore() } finally { doSomeOtherStuff() } The problem was difficult to troubleshoot because doSomeStuff() threw an exception, which in turn caused doSomeOtherStuff() to also throw an exception. The s...

Why does execution jump to the end of a proc after an exception?

When an unhandled exception happens while debugging some code in any procedure/function/method, the debugger stops there and shows the message. If I now continue debugging step by step, the execution jumps directly from the line that created the exception to the end of the current procedure (if there is no finally block). Woulnd't it ...

Why doesn't C# have support for first pass exception filtering?

Note: this is not a duplicate of Jeff's question. That question asked "Is an equivalent?" I know there isn't, and I want to know why! The reason I ask is that I've only just become clear on how important it is, and the conclusion seems very strange to me. The Exception Handling block of Microsoft's Enterprise Library advises us to use...

Visual Studio.NET 2008 doesn't give me english exception-messages.

In previous versions of VS.NET or the .NET framework, you got english exception messages by default. If you installed a 'language pack', you received exception messages in the language of that language pack. Now, I'm working with an English VS.NET 2008 (no language packs have been installed) on a dutch Windows Vista. When I'm developin...

ThreadAbortException vs graceful event handle exit in C#.

When aborting the execution of a thread I'm always doubting between a graceful exit with an event handler like this: int result = WaitHandle.WaitAny(handles); if (result = WAIT_FINALIZE) FinalizeAndExit(); and using the event to signal the thread it must terminate or just handling the ThreadAbortException to finalize the thread... ...

.Net System.MissingMethodException - 3.5 SP1 versioning hell

Hello, After deploying an ASP.net webservice to my production server i got this exception: System.MissingMethodException Method not found: 'Boolean System.Threading.WaitHandle.WaitOne(Int32)' The MSDN documentation states: Version Information .NET Framework Supported in: 3.5 SP1, 3.0 SP2, 2.0 SP2 so the reason of...