exception-handling

How to correctly close resources?

泪湿孤枕 提交于 2019-12-11 05:17:23
问题 I have methods that all propagate exceptions and then I have handling on one place, however I realized something. Let's say I have method like this public void foo() throws Exception e { Statement stmt = createStatement(); doSomething(stmt); stmt.close(); } My issue is that if exception is thrown by doSometing() method the statement will not be closed, but I don't want to handle exception there. Is the right approach to have try and catch that only rethrows exception and finally to close

Is it possible to continue running code from the point of failure?

▼魔方 西西 提交于 2019-12-11 05:00:24
问题 Okay, I have some very simple code which I will post below. Essentially, I have a connection to a database and I want to map a subset of columns in a query to a particular class. The problem is that it is possible for these to be null. I would like to know if it is possible if an exception is thrown at a particular line, can we resume the entire block from the next line. So if this code below was to execute and Line 6 catches an error. Is there an elegant way to catch the exception and make

Logging not Persisting When Exception Occurs in Method Executed in a Trigger

亡梦爱人 提交于 2019-12-11 04:57:55
问题 I have been stuck all day on this issue and cannot seem to find anything online pointing me to what might be causing it. I have the below logging method in a Logger class and the below code calling the logger. When no exception occurs all the log statements work perfectly, however when an exception occurs the log statements do not run at all (however they do run from the web service call). Logger Log Method: public static Guid WriteToSLXLog(string ascendId, string masterDataId, string

Crosstool-ng g++ not compiling c++11 std::current_exception

a 夏天 提交于 2019-12-11 04:54:19
问题 I build a gcc toolchain using Crosstool-ng, but the resulting g++ does not compile and/or link C++11 exceptions. If I try to compile: #include <exception> int main() { std::current_exception(); } via: arm-none-linux-gnueabihf-g++ -std=c++11 foo.cpp I get: foo.cpp: In function 'int main()': foo.cpp:5:9: error: 'current_exception' is not a member of 'std' std::current_exception(); ^~~ However, if I additionally provide cortex-a9 as cpu the haviour changes: arm-none-linux-gnueabihf-g++ -mcpu

JSF Error page not shown when ViewExpiredException occurs

泪湿孤枕 提交于 2019-12-11 04:53:39
问题 I have the following error when view within a page is expired. The message says that the Error page '/home.xhtml' will be shown. but actually nothing is shown, the page remains the same, and it is just frozen. I am using FullAjaxExceptionHandler from Omnifaces , described by balusC. I am using Primefaces 3.5 and Mojarra 2.1.17. Mär 11, 2013 1:40:30 PM org.apache.catalina.core.ApplicationContext log SEVERE: FullAjaxExceptionHandlerx: An exception occurred during processing JSF ajax request.

Apache Camel multicast, exception and Aggregation strategy

元气小坏坏 提交于 2019-12-11 04:47:14
问题 I define a complex route in which I had to to orchestrate different simple operations. from(cxfCartEndpoint).routeId("receiveCart") .to("log:com.sdmo.input?level="+LOG_LEVEL) .process(cartWSExtractProcessor) .to(loggingMesssagesPath+"?fileName=originalRequest${date:now:yyyyMMdd-HHmmss}.xml") .multicast(aggregationStrategy).stopOnException() .to("mock:doNothing","direct:copyItem","direct:XmlSave","direct:manageFinalResponse") .end() .to(loggingMesssagesPath+"?fileName=finalResponse${date:now

Struct RUNTIME_FUNCTION

瘦欲@ 提交于 2019-12-11 04:33:55
问题 I found a large array in .pdata segment of RUNTIME_FUNCTION structures by IDA. So, where I can find information: from what it's compiled, how I can create this and how to use it in C++. Give me please books, or links with good descriptions and tutorials for exception handling and unwinding with this structure. 回答1: You can find more information on RUNTIME_FUNCTION and related structures at Microsoft's MSDN. These structures are generated by the compiler and used to implement structured

How to show a flashMessage raised by an exception without the error template

落花浮王杯 提交于 2019-12-11 04:33:26
问题 I have an exception raised in my service. This exception is handle by a Listener attached by : $this->listeners[] = $events->attach(MvcEvent::EVENT_RENDER_ERROR, array($this, 'handleException')); $this->listeners[] = $events->attach(MvcEvent::EVENT_DISPATCH_ERROR, array($this, 'handleException')); Handle Exception designed into flashMessage by: public function handleException(MvcEvent $event) { $exception = $event->getParam('exception'); if ($exception) { $flashMessenger = new FlashMessenger(

Can I return execution to the failing method after an unhandled exception?

六眼飞鱼酱① 提交于 2019-12-11 04:27:55
问题 I have an ASP.NET web site that houses some WCF services. I have hooked up to the Application_Error event, so can log any unhandled exceptions. What I would really like to do is pass the execution back to the method that was called, so I can return something sensible to the client, rather than throwing a FaultException. I know I can wrap each individual service call in a try/catch block, but that means a load of boilerplate code in every single method. What I would really like to do is have a

<cfcatch> not 'catching' an error

你说的曾经没有我的故事 提交于 2019-12-11 04:16:29
问题 I've got an image processing CFC to handle uploaded images. In the method, I'm creating an new image of the uploaded file with ImageNew() and then resizing it if needed (along with some other validation to make sure it's an image). Here's a snippet of the code: <cftry> <cfset ImageScaleToFit(#local.uploadedImage#, 72, "", "highestPerformance")> <cfimage action="write" source="#local.uploadedImage#" destination="#local.newThumbName#" overwrite="yes" > <cfcatch type="any"> <cfset local.response