Swift try with question mark

I see the following in the code maintained by me: func parse(values: NSMutableDicationary) { let data = try? JSONSerialization.data(withJSONObject: values, options: JSONSerialization.WritingOptions()) } Pay attention that the method does not m...
more »

2017-09-19 13:09 (3) Answers

*When* does a C++ exception blow up C code

Ok, so I need -fexceptions to allow a C++ exception to propagate through C code. I tried to compare the results from both C++ and C, and, from what I can tell, the compiled routines are identical at the assembly, even without that option [1]. Here is...
more »

2017-09-12 20:09 (1) Answers

Unknown Error: Not reproducible Fatal Exception

My app is experiencing a weird error which I cannot reproduce. I know the existence of this error because some users have reported it to me and I could catch it using the Fabric SDK. Apparently it happens at any location, at any given time. It doesn...
more »

2017-08-26 08:08 (0) Answers

Javax.mail on Linux

I try to connect to a mailserver via javax.mail and "imap". This code works perfectly fine on Windows, but when i try it on Linux, it doesen't work. public static void init() { try { Properties props = System.getProperties(); pr...
more »

2017-08-07 15:08 (0) Answers

How to clear cache above 23 api in android

I am using IPackageDataObserver.class for removing cache, it is working till android 5.1.1 but not for android 6.0.1. and above. As it is deprecated for the above versions and gives security exception and Method.Invocation exception. Now I have seen ...
more »

2017-08-05 12:08 (0) Answers

How to send raw data to printer with Java

I am trying to create a simple program that sends a string to a printer to print. This is what my program looks like: import javax.print.Doc; import javax.print.DocFlavor; import javax.print.DocPrintJob; import javax.print.PrintException; import jav...
more »

2017-08-03 23:08 (1) Answers

How to store an exception

I want to throw an exception and to display it. In my IF block I throw the exception. Do I have to store the exception to pass it as a variable in the method which precedes. if(count !=0) { throw new Exception(); eventLogger.logError("The count ...
more »

2017-08-03 16:08 (6) Answers

JayBizzle/Crawler-Detect dont found class

I download the files and try to use Crawler-Detect The Usage say: use Jaybizzle\CrawlerDetect\CrawlerDetect; $CrawlerDetect = new CrawlerDetect; . . . The problem is when I want to create new CrawlerDetect then I get the error Uncaught Error...
more »

2017-07-31 09:07 (0) Answers

MethodNotAllowedHttpException Laravel 5.4

i'm starting now with Laravel i get an MethodNotAllowedHttpException while trying to add a new user from an authenticated one. this is the input form (add.blade.php) <form method="POST" action="{{ action('Backend\UserController@store') }}">...
more »

2017-07-16 12:07 (3) Answers

Where to handle Exceptions in Spring Applications

I'm still learning Spring. I have an Application set upped and i'm trying to understand exception handling in Spring. I'm using @ControllerAdvice to handle exceptions. In my application there are few layers such as Services, Controllers, Models and ...
more »

2017-07-11 14:07 (5) Answers

cancelling a future task in java

I want to cancel a task submitted to ExecutorService thus allowing the corresponding thread to pick a new task from the queue. Now this question have been answered many times on this forum.... like checking Thread.currentThread().interrupt() or catc...
more »

2017-07-03 13:07 (1) Answers

Exception handling and ternary operators

To my understanding following code should compile successfully. However, when i try to compile and it gives following error : Unhandled exception type Exception&Test.I. I am really not sure about the root cause. Please help me to understan...
more »

2017-06-30 08:06 (2) Answers

c++ throw exception make undefined behavior

I am writing generic list. I am using an iterator that when the list is empty the iterator is null and derafferencing of the iterator (*itr) should return exception. The problem is once I throw the exception the program going very weird. Here is th...
more »

2017-06-24 18:06 (0) Answers