exception

why wrong name with NoClassDefFoundError

ぐ巨炮叔叔 提交于 2019-12-30 15:03:21
问题 I created a List.java file in folder UtilityPack which contains this code package Utilities; public class List { private class node{} public void insert(int data){} public void print(){} public static void main(String[] s){} } To compile i did C:\UtilityPack>javac List.java But when I try to run with C:\UtilityPack>java -classpath . List OR C:\UtilityPack>java List I get error Exception in thread "main" java.lang.NoClassDefFoundError: List (wrong name: Uti lities/List) at java.lang

why wrong name with NoClassDefFoundError

…衆ロ難τιáo~ 提交于 2019-12-30 15:02:45
问题 I created a List.java file in folder UtilityPack which contains this code package Utilities; public class List { private class node{} public void insert(int data){} public void print(){} public static void main(String[] s){} } To compile i did C:\UtilityPack>javac List.java But when I try to run with C:\UtilityPack>java -classpath . List OR C:\UtilityPack>java List I get error Exception in thread "main" java.lang.NoClassDefFoundError: List (wrong name: Uti lities/List) at java.lang

why wrong name with NoClassDefFoundError

混江龙づ霸主 提交于 2019-12-30 15:02:28
问题 I created a List.java file in folder UtilityPack which contains this code package Utilities; public class List { private class node{} public void insert(int data){} public void print(){} public static void main(String[] s){} } To compile i did C:\UtilityPack>javac List.java But when I try to run with C:\UtilityPack>java -classpath . List OR C:\UtilityPack>java List I get error Exception in thread "main" java.lang.NoClassDefFoundError: List (wrong name: Uti lities/List) at java.lang

What could cause EvoPDF “unable to render html” exception when deployed to Azure Website

删除回忆录丶 提交于 2019-12-30 11:56:25
问题 Using EvoPDF for a .Net web application works locally, however once deployed to a Microsoft Azure website it throws a generic exception: "unable to render html". Stack trace: [Exception: Could not render the HTML string.] EvoPdf.HtmlToImageConverter.ᜀ(String A_0, String A_1, String A_2, ᜴& A_3, Hashtable& A_4) +2129 EvoPdf.HtmlToPdfConverter.ᜀ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) +8369 EvoPdf.HtmlToPdfConverter.ᜀ(Stream A_0, String A_1, String A_2, String A_3, String A

weird - mysql's sql::SQLException is not caught by its type, but is caught as std::exception and cast back successfully

℡╲_俬逩灬. 提交于 2019-12-30 11:51:34
问题 I am using mysql c++ connector with this (a bit simplified) code. try { statement->setString(1, word); statement->executeUpdate(); } catch( sql::SQLException& e ) { // I don't get here return sqlerrno_to_error_code( e.getErrorCode() ); } catch( std::exception& e ) { // I do get here and the cast works sql::SQLException& sqle = (sql::SQLException&) e; return sqlerrno_to_error_code( sqle.getErrorCode() ); } The connector is supposed to throw the sql::SQLException which derives from std:

What is the point of re-raising exceptions?

心不动则不痛 提交于 2019-12-30 11:35:16
问题 So I've seen mention elsewhere of using the following to re-raise an exception. try: whatever() except: raise What is the purpose re-raising an exception? Surely an uncaught exception will just raise to the top anyway? i.e: try: int("bad") except: raise has identical output to: int("bad") i.e. I get a ValueError in the console. 回答1: Imagine the following code. A little setup: You are responsible for maintaining a huge database of information for example, and any loss of data would be

Return exception from JAX-RS Rest Service as JSON

本小妞迷上赌 提交于 2019-12-30 11:34:33
问题 Is it in some way possible that an exception thrown from a rest service is returned as JSON? I have a JAX-RS Rest Service where I would like to achieve this. When I throw it now, it's mapped to an HTML response, which is not what i want. From what I have understood an ExceptionMapper will also map it to HTML? Is there any other alternative or libraries that allows the exception to be returned in JSON format? 回答1: It will respond as JSON. @Provider @Singleton public class

Break a loop in OCaml

末鹿安然 提交于 2019-12-30 11:28:09
问题 I often need to break a loop in OCaml, there are at least two ways: (* by exception *) try for i = 0 to 100 do ... if cond then raise BreakLoop done; ... with BreakLoop -> ... (* by while *) let cond = ref false in let i = ref 0 in while (not !cond) && (i<= 100) do ... i := !i + 1 done; if !cond then ... What I care most is the optimisation of running time, as long as the program can be easily read and understood. The way while makes loops complicated when there are several nested loops. I

Why do I lose type information when using boost::copy_exception?

倖福魔咒の 提交于 2019-12-30 11:07:16
问题 When I use boost::copy_exception to copy an exception to an exception_ptr , I lose type information. Take a look at the following code: try { throw std::runtime_error("something"); } catch (exception& e) { ptr = boost::copy_exception(e); } if (ptr) { try { boost::rethrow_exception(ptr); } catch (std::exception& e) { cout << e.what() << endl; cout << boost::diagnostic_information(e) << endl; } } From this, I get the following output: N5boost16exception_detail10clone_implISt9exceptionEE Dynamic

Why do I lose type information when using boost::copy_exception?

混江龙づ霸主 提交于 2019-12-30 11:07:13
问题 When I use boost::copy_exception to copy an exception to an exception_ptr , I lose type information. Take a look at the following code: try { throw std::runtime_error("something"); } catch (exception& e) { ptr = boost::copy_exception(e); } if (ptr) { try { boost::rethrow_exception(ptr); } catch (std::exception& e) { cout << e.what() << endl; cout << boost::diagnostic_information(e) << endl; } } From this, I get the following output: N5boost16exception_detail10clone_implISt9exceptionEE Dynamic