{"id":1143,"date":"2020-03-23T18:01:49","date_gmt":"2020-03-23T05:01:49","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1143"},"modified":"2021-09-28T14:04:07","modified_gmt":"2021-09-28T01:04:07","slug":"java-option-xxshowcodedetailsinexceptionmessages","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1143","title":{"rendered":"ShowCodeDetailsInExceptionMessages Java Option"},"content":{"rendered":"<p>Use the following java option to have a more verbose exception message especially for NullPointerException:<\/p>\n<pre style=\"white-space: pre;\">-XX:+ShowCodeDetailsInExceptionMessages<\/pre>\n<p>For example, if we have the following snippet:<\/p>\n<pre style=\"white-space: pre;\">var a = null;\r\na.b = 1;\r\n<\/pre>\n<p>Running the above snippet will have the following exception:<\/p>\n<pre style=\"white-space: pre;\">Exception in thread \"main\" java.lang.NullPointerException: Cannot assign field \"b\" because \"a\" is null\r\n<\/pre>\n<p><em>Note: This is more useful if the classes were compiled with debugging info (i.e. javac -g )<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use the following java option to have a more verbose exception message especially for NullPointerException: -XX:+ShowCodeDetailsInExceptionMessages For example, if we have the following snippet: var a = null; a.b = 1; Running the above snippet will have the following exception: Exception in thread &#8220;main&#8221; java.lang.NullPointerException: Cannot assign field &#8220;b&#8221; because &#8220;a&#8221; is null Note: This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[61,71],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1143"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1143"}],"version-history":[{"count":3,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1143\/revisions"}],"predecessor-version":[{"id":1146,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1143\/revisions\/1146"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}