exception

Using Exception.Data

三世轮回 提交于 2019-12-29 03:33:46
问题 How have you used the Exception.Data property in C# projects that you've worked on? I'd like answers that suggest a pattern, rather than those that are very specific to your app. 回答1: The exception logger I use has been tweaked to write out all the items in the Data collection. Then for every exception we encounter that we cannot diagnose from the exception stack, we add in all the data in that function's scope, send out a new build, and wait for it to reoccur. I guess we're optimists in that

Why aren't exceptions in C++ checked by the compiler?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-29 03:32:27
问题 C++ provides a syntax for checked exceptions, for example: void G() throw(Exception); void f() throw(); However, the Visual C++ compiler doesn't check them; the throw flag is simply ignored. In my opinion, this renders the exception feature unusable. So my question is: is there a way to make the compiler check whether exceptions are correctly caught/rethrown? For example a Visual C++ plugin or a different C++ compiler. PS. I want the compiler to check whether exceptions are correctly caught,

What happens when an exception goes unhandled in a multithreaded C++11 program?

你。 提交于 2019-12-29 02:47:30
问题 If I have a C++11 program running two threads, and one of them throws an unhandled exception, what happens? Will the entire program die a fiery death? Will the thread where the exception is thrown die alone (and if so, can I obtain the exception in this case)? Something else entirely? 回答1: Nothing has really changed. The wording in n3290 is: If no matching handler is found, the function std::terminate() is called The behavior of terminate can be customized with set_terminate , but: Required

Retrieving images using Jquery and servlet produces HTTP Status 500 error

非 Y 不嫁゛ 提交于 2019-12-29 02:05:26
问题 I need to retrieve images from my database. For this I used jquery and servlet to retrieve all images stored in a table. But when i run the code it produces HTTP Status 500 - class oracle.jdbc.driver.OracleBlobInputStream declares multiple JSON fields named maxPosition I'm a newbie in Jquery I don't know how to use JSON for images. My Servlet is: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uname;// = request

Integer.parse(String str) java.lang.NumberFormatException: Errors

喜欢而已 提交于 2019-12-29 01:50:23
问题 I keep getting number format expectations, even though I'm trimming the strings and they don't contain non numerical characters bizarrely it works for some numbers and not others. Below is an example of a string I get number format exception for. Also, any string starting with 0 e.g "0208405223", is returned 208405223, there's no zero anymore is that supposed to happen? String n="3020857508"; Integer a = Integer.parseInt(n.trim()); System.out.println(a); This is the exception: Exception in

Why do I get InvalidCastException when casting a double to decimal

旧城冷巷雨未停 提交于 2019-12-29 01:35:39
问题 I'm trying to debug an application which gets an InvalidCastException. The failing line is decimal d = (decimal)row[denominator]; inspecting this in the debugger(see screenshot below), row[denominator] holds a double with value 8.0 as far as I can tell. Surly there shouldn't be any problem casting that to a decimal ? (The 'row' type is from 3. party library, which again is filled from data from MySQL. The issue arised when testing against an older MySQL server which apparently returns some

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

风流意气都作罢 提交于 2019-12-28 18:44:40
问题 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 and that it might not be possible to answer but, how can I tell if an error will be found at compile or at runtime? Would you be able to send me some website links that

SEHException not caught by Try/Catch

£可爱£侵袭症+ 提交于 2019-12-28 16:53:13
问题 In a background thread, my application regularly examines a network folder (UNC Path) for application updates. It reads out the assembly version of the file, like so: Try newVers = System.Reflection.AssemblyName.GetAssemblyName("\\server\app.exe").Version Catch ex As Exception ' ignore End Try This snippet is executed quite often, in total I'd guess way more than 100.000 times on multiple customer sites so far without a problem. Sometimes, GetAssemblyName raises a FileNotFoundException , for

Java PatternSyntaxException: Illegal repetition on string substitution?

為{幸葍}努か 提交于 2019-12-28 14:01:11
问题 I am trying to write a method that will accept a String , inspect it for instances of certain tokens (e.g. ${fizz} , ${buzz} , ${foo} , etc.) and replace each token with a new string that is fetched from a Map<String,String> . For example, if I pass this method the following string: "How now ${fizz} cow. The ${buzz} had oddly-shaped ${foo}." And if the method consulted the following Map<String,String> : Key Value ========================== "fizz" "brown" "buzz" "arsonist" "foo" "feet" Then

Getting Exception org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

徘徊边缘 提交于 2019-12-28 13:43:28
问题 My code is very simple using apache-log4j-2.0.2: import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; public class Log4jtest { static Logger log =Logger.getLogger(Log4jtest.class); public static void main(String[] args) { BasicConfigurator.configure(); log.debug("This is debug message"); } } But I'm getting exception like: Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: java.lang.ClassCastException: org.apache.logging.slf4j.SLF4JLoggerContext