exception

Cant "get" streams from server

Hi guys, I am trying to make a simple Client-Server application but when I execute the code I get an exception that the client cannot get the socket's input stream.Please, take a look to my code and try to help.Thanks:) P.S:Sorry for the messy code.Execute it as two different applications. import java.io.IOException; import java.io.Ob...

How do I add state information without writing repetitive code when catching multiple Java exceptions?

I've read a few other posts like this one about avoiding repetition in Java catch blocks. Apparently, what I really want is "multi-catch", but seeing as Java 7 isn't here yet, is there a good pattern to let me add state to my exceptions, then re-throw them, without catching the kitchen sink? Specifically, I have some code that makes li...

how to solve these in c#

Possible Duplicate: How to show a error message if the data is already inserted in the database in c# protected void Button2_Click(object sender, EventArgs e) { try { SqlConnection conn = new SqlConnection("Data Source=KING;Initial Catalog=semasinter;Integrated Security=True"); SqlCommand command = new ...

Ada file operation: instantiation and exception

Hi, I'm learning Ada and I need some clarifications on file operations. I have just one type: float and I have to create 2 files that will store float values (with append operation). So I'm instantiating a package for the type float and I then declare 2 file variables X_File and Y_File. Then I put exceptions in case the files don't al...

Using global exception handling with "setUncaughtExceptionHandler" and "Toast"

Hi everyone, I am trying to create a simple exception handler which will help me debug the application. Right now, when I have an exception I am forced to connect with Eclipse debugger merely to see the exception details. To avoid that I've used setUncaughtExceptionHandler to handle any unhandled exception and display a Toast on the ex...

C++ return value versus exception performance

hi. Somewhere I have read that modern Intel processors have low-level hardware for implementing exceptions and most compilers take advantage of it, to the effect that exceptions become faster than returning results state using variables. Is it true? are exceptions faster than variables as far as returning state/responding to state? re...

Intercepting exceptions

I'd like to use to a custom exception to have a user-friendly message come up when an exception of any sort takes place. What's a good straightforward way of doing this? Are there any extra precautions I should take to avoid interfering with Swing's EDT? ...

Catching Reflection Exception When Parent Class Not Found

Scenario: I have a class that extends another class, yet the parent class is undefined (for whatever reason). I am trying to get a ReflectionClass of the child class. When I do this, I get a Class Not Found exception on the parent class. However, I cannot catch this exception. What am I doing wrong? For example... <?php class Foo ...

Where do I catch this simple bug?

Here's the relevant code: Public class User.cs: public void FindByID(int id) { Parser parser = new Parser(id); ID = parser.FindID(); Name = parser.FindName(); Rating = parser.FindRating(); Photo = parser.FindPhoto(); Reputation = parser.FindReputation(); ...

How do appDomain provide Isolation.

In my window forms application, I create a Appdomain say sandBox. In this sandbox i excute some code Say TestMethod from TestAppdomain Class. This class is in Test.dll which is not loaded in the current appdomain (Default appdomain). Now while executing TestMethod some exception occurs, then I want the sandbox domain to be unloaded and ...

Under what circumstances are C++ destructors not going to be called?

I know that my destructors are called on normal unwind of stack and when exceptions are thrown, but not when exit() is called. Are there any other cases where my destructors are not going to get called? What about signals such as SIGINT or SIGSEGV? I presume that for SIGSEGV, they are not called, but for SIGNINT they are, how do I kno...

Java - When is it a compiler error and when is it a runtime exception?

Hello all, I am currently studying for the SCJP certification using the Sierra and Bates Study Guide and in many of the self tests (mock exam questions) I keep running into the same problem - I can't tell whether a particular error will be at runtime (an exception) or at compile (compile error). I know this is a bit of a vague question ...

Why are C++ STL iostreams not "exception friendly"?

I'm used to the Delphi VCL Framework, where TStreams throw exceptions on errors (e.g file not found, disk full). I'm porting some code to use C++ STL instead, and have been caught out by iostreams NOT throwing exceptions by default, but setting badbit/failbit flags instead. Two questions... a: Why is this - It seems an odd design decis...

Dynamic memory and constructor exceptions

Early today I discovered function try-catch blocks (from here in fact) and then went on a bit of a research spree - apparently they're main use is it catch exceptions throw in by a constructor initialiser list. Anyway, this sent me thinking about failing constructors and I've got to a stage where I just need a little clarification. This...

Drawback to catch-all exception (at highest program level, followed by re-raising, just to log before exiting?)

Hello-- I have a long-running program on a remote machine and want to be sure that (1) I have a record of any exception that causes it to terminate and (2) someone is notified if it terminates. Does anyone see drawbacks to the method I am using? (or have recommendations for a better one?) I've read the Python docs and many exception-re...

DLL Problems Causing Casting Exception

I've been breaking apart a large VS C# project into smaller projects, and while everything worked fine when it was all one project, I'm getting an error now that I've split it apart. There is an exception being thrown when I try a cast, though I haven't changed any of the code. The exception is as follows: InvalidCastException [A...

Boost thread_interrupted exception terminate()s with MinGW gcc 4.4.0, OK with 3.4.5

I've been "playing around with" boost threads today as a learning exercise, and I've got a working example I built quite a few months ago (before I was interrupted and had to drop multi-threading for a while) that's showing unusual behaviour. When I initially wrote it I was using MingW gcc 3.4.5, and it worked. Now I'm using 4.4.0 and i...

ASP.NET catch referenced script file exceptions

How to catch exceptions raised by a referenced javascript file in an aspx page?? ...

Design pattern for shared error handling code

I'm looking for some thoughts/opinions on architecture for a layer of code that invokes methods in an API. In my case, the calling code is C#/.NET and the API is part of an unmanaged legacy DLL. But the same question could apply in many different languages/environments. I'm basically writing a managed wrapper around an unmanaged API. ...

Zend Framwork: Problem with links (like a href)

Hi, I've got a problem with Zend Framework, when calling an action. This action is called "uploadvideo" inside a controller called "UploadInterfaceController". Therefor the view is called "uploadvideo.phtml". Now all this is wrapped in a module called "Upload". The problem is, that I cannot call a link inside the uploadvideo.phtml. I ...