Catch Stack Overflow Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss stack overflow error c++ the workings and policies of this site About Us Learn more
Fix Stack Overflow Error
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack stack overflow error windows xp Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping stack overflow error windows 7 each other. Join them; it only takes a minute: Sign up try/catch on stack overflows in java? up vote 13 down vote favorite Can you try/catch a stack overflow exception in java? It seems to be throwing itself either way. When my procedures overflows, I'd like to "penalize" that value. java stack-overflow share|improve this question edited Mar 29
Stack Overflow Javascript Error
'10 at 12:23 skaffman 276k62614652 asked Mar 29 '10 at 3:57 stereos 78115 10 prevention is better than catching.... –Mitch Wheat Mar 29 '10 at 4:02 4 catching is useful for debugging :) –JonnyBoy Nov 6 '14 at 0:11 add a comment| 5 Answers 5 active oldest votes up vote 19 down vote accepted Seems to work: public class Test { public static void main(String[] argv){ try{ main(null); } catch(StackOverflowError e){ System.err.println("ouch!"); } } } share|improve this answer answered Mar 29 '10 at 3:59 Thilo 158k56338474 1 Ah I was trying with a generic exception. Thanks! –stereos Mar 29 '10 at 4:06 I agree that finding out what is causing the exception and preventing it would be better though. –Thilo Mar 29 '10 at 4:07 5 @stereos You weren't trying to catch Exception were you? Error extends Throwable directly, not through Exception. –Tom Hawtin - tackline Mar 29 '10 at 4:19 4 catch (XyzError) is going to end in tears.... –skaffman Mar 29 '
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About stack overflow line error Us Learn more about Stack Overflow the company Business Learn more about hiring stack overflow line 0 error developers or posting ads with us Programmers Questions Tags Users Badges Unanswered Ask Question _ Programmers Stack Exchange is
Stack Overflow Error Java
a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a http://stackoverflow.com/questions/2535723/try-catch-on-stack-overflows-in-java question Anybody can answer The best answers are voted up and rise to the top Is it *ever* okay to catch StackOverflowError in Java? up vote 25 down vote favorite 1 I used to think that it's not, but yesterday I had to do it. It's an application that uses Akka (an actor system implementation for the JVM) to process asynchronous jobs. One of the http://programmers.stackexchange.com/questions/209099/is-it-ever-okay-to-catch-stackoverflowerror-in-java actors performs some PDF manipulation, and because the library is buggy, it dies with a StackOverflowError every now and then. The second aspect is that Akka is configured to shutdown its whole actor system if any JVM fatal error (e.g. StackOverflowError) is caught. The third aspect is that this actor system is embedded inside a web app (for WTF-ish, legacy, reasons), so when the actor system is shut down, the web app is not. The net effect is that on a StackOverflowError our job processing application becomes just an empty web app. As a quick fix I had to catch the StackOverflowError being thrown, so that the thread pool of the actor system isn't torn down. This lead me to think that maybe it's sometimes okay to catch such errors especially in contexts like this? When there's a thread pool processing arbitrary tasks? Unlike an OutOfMemoryError I can't imagine how a StackOverflowError can leave an application in an inconsistent state. The stack is cleared after such an error, so computation can go on normally. But maybe I'm missing something important. Also, let it be noted that I'm all for fixing the error i
and DropEventsExpandableListViewGridViewHorizontalScrollViewImageButtonImageViewLinearLayoutListViewNotificationsPasswordProgressBarProgressDialogRadioButtonRadioGroupRatingBarRelativeLayoutScrollViewSelectorSettingsSpinnerSurfaceViewTextBoxTimePickerToastToggleButtonWebViewviewMenuOnClickListenerViewPagerwidgetAutoCompleteTextViewEditTextFrameLayoutSeekBarSlidingDrawerStackViewTextViewViewFlipperxmlgamescanvasmain loopOpenGL ESCore JavaanimationapacheANTcommonsbeanutilsconvertersArrayConvertercliBasicParsercodecbinaryBase64Base64OutputStreamcsvdbcpBasicDatasourcePoolingConnectioniocomparatorCompositeFileComparatorDirectoryFileComparatorLastModifiedFileComparatorNameFileComparatorPathFileComparatorFilenameUtilsFileUtilsIOUtilsmonitorFileAlterationMonitorlang3CharUtilsClassPathUtilsmathFractionNumberUtilsStringUtilsloggingLogfactorynetCookieStoreFTPClientURLClassLoaderURLConnectionluceneappletaspectjbeanscajoCharacterclassComperablecryptoDesign PatternsdecoratorstrategyGenericsGradlegsonGsonBuilderstreamJsonReaderJsonWriterioBufferedInputStreamBufferedOutputStreamBufferedReaderBufferedWriterByteArrayInputStreamByteArrayOutputStreamConsoleDataInputStreamDataOutputStreamExternalizableFileFileDescriptorFileInputStreamFilenameFilterFileOutputStreamFileReaderFileWriterInputStreamInputStreamReaderIOExceptionObjectInputStreamObjectOutputStreamOutputStreamPrintWriterRandomAccessFileSerializableStreamTokenizerStringReaderStringWriterjsonJacksonJSON.SimplejunitlangmanagementN
Learning soars 7 habits of highly effective developers 10 hard-core coding tips for faster Python Beyond jQuery: An expert guide to choosing the right JavaScript framework More Insider Sign Out Search for Suggestions for you Insider email Core Java All Core Java Agile Development Java Concurrency Java Language Java Platform Java Security Programming Careers Testing and Debugging Enterprise Java All Enterprise Java Big Data Cloud Computing Data Analytics Development Tools Java APIs Java App Dev Java Web Development Open Source Scripting and JVM Languages Learn Java All Learn Java Design Patterns Mobile Java All Mobile Java Java Android Developers Java iOS Developers News Features How-Tos Blogs Resources/White Papers Newsletters × Close Home Dustin's Software Development Cogitations and Speculations By Dustin Marx About | A software developer's public collection of tips and tricks, real-world solutions, and industry commentary related to Java programming. How-To Diagnosing and Resolving StackOverflowError More like this Effective Java NullPointerException Handling JavaScript in Java Writing good unit tests, Part 2: Follow your nose Email a friend To Use commas to separate multiple email addresses From Privacy Policy Thank you Your message has been sent. Sorry There was an error emailing this page. Comments JavaWorld | Jul 4, 2009 3:04 PM PT Comments A recent JavaWorld Community forum message (Stack Overflow after instantiating new object) reminded me that the basics of the StackOverflowError are not always understood well by people new to Java. Fortunately, the StackOverflowError is one of the easier of the runtime errors to debug and in this blog posting I will demonstrate how easy it often is to diagnose a StackOverflowError. Note that the potential for stack overflow is not limited to Java.Diagnosing the cause of a StackOverflowError can be fairly straightfoward if the code has been compiled with the de