Need more information on Exception getCause and GetMessage

Hi,
I wass developing a module for displaying exceptions in my application.
Depending on the log level, I wanted to display contents in a log.
I wanted to know the what are these useful - getMessage(), getCause() and printstacktrace().
Printstacktrace might not be preferred logging message and not sure what else can be a better log.
Thanks & Regards,
Chandra

Try this program that prints exception in three different ways.
public class ExceptionDemo{
   private static final int STACK_SIZE=5;
   public static void throwException1(int i){
      if(i == 0){
         throw new RuntimeException("Exception from method throwException1");
      throwException1(--i);
   public static void throwException2(int i){
      if(i == 0){
         try{
            throwException1(STACK_SIZE);
         } catch(Exception ex){
            throw new RuntimeException("Exception from method throwException2", ex);
      throwException2(--i);
   private static void printMessages(Throwable ta){
      while(ta != null){
         System.err.println(ta.getMessage());
         ta=ta.getCause();
   private static void printAllComplete(Throwable ta){
      while(ta != null){
         System.err.println(ta.getMessage());
         StackTraceElement[] elements=ta.getStackTrace();
         for(int i=0; i < elements.length; i++){
            System.err.println(elements);
ta=ta.getCause();
public static void main(String argv[]){
try{
throwException2(STACK_SIZE);
} catch(Exception ex){
System.err.println("--------------- Here is general stack trace ------------------");
ex.printStackTrace();
System.err.println("------------------ Here are just messages --------------------");
printMessages(ex);
System.err.println("----------------- Here are complete traces -------------------");
printAllComplete(ex);
You can use either of them.
May help,
Regards,

Similar Messages

  • Just need more information about this product and who is it avaliable to?

    Hi Everyone,
    Thanks for reading my post, when I heard about Firefox releasing a Mobile OS for Android I was filled with joy, I know a lot of work is needed to get it user friendly and bug free but its great to hear this.
    I am curious on a few things really and here are my questions some might be easy some might not have answers just yet.
    I have a HTC Desire X smartphone would I be able to install Firefox OS onto this?
    If "Yes" will it be an easy installation or will I need Linux background to fully understand its process?
    Any dates yet on its release?
    Will Mozilla be releasing this out in the market were you get a choice of IOS, Android, Windows and Firefox phones? or will it be only be available to download manually and install?
    Thanks for answering and all the best Mozilla :)
    Best regards,
    Zeussrapidfire

    Firefox OS is released on July 1st for more
    *https://blog.mozilla.org/blog/2013/07/01/mozilla-and-partners-prepare-to-launch-first-firefox-os-smartphones/
    You can install Firefox OS in your mobile
    *https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Installing_on_a_mobile_device
    Firefox OS comes with device and also you can download and install it manually too
    for more
    *http://www.mozilla.org/en-US/firefox/partners/

  • Need More information on Orders,Deliveries and shipments

    Hi All,
    I want to bring the Orders,Deliveries and Shipments information into BW.
      I need all levels of information which is exists in R/3 ,i know some data sources or available but what exact data sources i can use for above requirement so that i can get the good data from those data sources???.Can any one tell me the data flow???.
    Any ideas or suggestions??
    Thanks,

    Hi,
    here are some links to BI Content which you can use for dataflow from R/3 to BI:
    Enterprise Sales and Distribution
    http://help.sap.com/saphelp_nw04/helpdata/en/90/d4f33b949b6b31e10000000a11402f/frameset.htm
    Sales Overview (InfoCube)
    http://help.sap.com/saphelp_nw04/helpdata/en/71/1769372b2b7d20e10000009b38f842/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/73/0bf23839caf878e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/0f/09b19811e211d4af1f080009d2232d/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/646737bc5c2c7de10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/1f/0bf23839caf878e10000000a114084/frameset.htm
    Regards
    Andreas

  • N unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    some one can help me please
    i have no idea what i must to do.
    an unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    The Exception Handler gave all the info that you need. No need to print the whole stack trace.
    The exception handler says
    Exception Details: java.lang.IllegalArgumentException
    TABLE1.NAME
    Look in the session bean (assuming that is where your underlying rowset is). Look in the _init() method for statements similar to the following:
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
    personRowSet.setTableName("PERSON");
    What do you have?

  • Apple needs more information to complete your iMessage registration. Please call AppleCare in your country (listed below) and provide them with the following validation code:

    When I try to open imessage on my Macbook Pro I get the message "Apple needs more information to complete your iMessage registration. Please call AppleCare in your country (listed below) and provide them with the following validation code:"  Then it makes me call a number for AppleCare whish then makes me buy a $19 incident care. 
    I message has worked on this machine and works on my macbook air.  What is happening?
    Charles

    Hi,
    Apple Care Level one responders are very Script Led.
    This means they try to fit what you are saying into a Software or Hardware issue and into a Apple Care Period or  not.
    If you are having problems convincing them it is an Account/Apple ID problem (even though it only effects the Mac's use of it in iMessages) ask to speak to a Level 2 person who should be more knowledgeable because fixing and Id issue is free and not subject to Apple Care.
    9:00 pm      Monday; December 15, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Apple needs more information to complete your iMessage registration. Please call AppleCare in your country (listed below) and provide them with the following validation code:  3384-1797-2190

    I tried to use iMessage on my MacBook Air but i get the following message
    Apple needs more information to complete your iMessage registration. Please call AppleCare in your country (listed below) and provide them with the following validation code:
    3384-1797-2190

    Hi,
    Apple Care Level one responders are very Script Led.
    This means they try to fit what you are saying into a Software or Hardware issue and into a Apple Care Period or  not.
    If you are having problems convincing them it is an Account/Apple ID problem (even though it only effects the Mac's use of it in iMessages) ask to speak to a Level 2 person who should be more knowledgeable because fixing and Id issue is free and not subject to Apple Care.
    9:00 pm      Monday; December 15, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Need more Information about setupvscanrfc

    <b>Hello,</b>
    we need more Information from SAP about the <b>setupvscanrfc_78-10003831.exe</b>.
    Do you have more Information about this Installation (Documation?)?
    The Customer use a SAP Enterprise Portal (Sun OS) without a SAP Gateway.
    So we installed the SAP Gateway on Windows 2003 with AntiVir VSA.
    The memoryscan is running, but file their are bigger as 100 kb must be copy to the AntiVir VSA on Windows 2003 Server and this copycommand is not running.
    Logfile:
    ERROR file opened at 20070125 170340 W. Europe Stan, SAP-REL 700,0,79 RFC-VER 3 859699 MT-SL
    T:4328 Error in program 'vscan_rfc': ======> CPIC-CALL: 'SAP_CMNOREGTP'
    LOCATION CPIC (TCP/IP) on local host
    ERROR partner '10.35.43.32:3300' not reached
    TIME Thu Jan 25 17:03:40 2007
    RELEASE 700
    COMPONENT NI (network interface)
    VERSION 38
    RC -10
    MODULE nixxi.cpp
    LINE 2764
    DETAIL NiPConnect2
    SYSTEM CALL connect
    ERRNO 10061
    ERRNO TEXT WSAECONNREFUSED: Connection refused
    COUNTER 1
    ERROR file opened at 20070125 170341 W. Europe Stan, SAP-REL 700,0,79 RFC-VER 3 859699 MT-SL
    T:5016 Error in program 'vscan_rfc': ======> CPIC-CALL: 'SAP_CMNOREGTP'
    LOCATION CPIC (TCP/IP) on local host
    ERROR partner '10.35.43.32:3300' not reached
    TIME Thu Jan 25 17:03:41 2007
    RELEASE 700
    COMPONENT NI (network interface)
    VERSION 38
    RC -10
    MODULE nixxi.cpp
    LINE 2764
    DETAIL NiPConnect2
    SYSTEM CALL connect
    ERRNO 10061
    ERRNO TEXT WSAECONNREFUSED: Connection refused
    COUNTER 1
    ERROR file opened at 20070125 175912 W. Europe Stan, SAP-REL 700,0,79 RFC-VER 3 859699 MT-SL
    T:5548 Error in program 'VSCAN_FE0BOS192': <* RfcIsValidHandle [1] : returns 18:RFC_INVALID_HANDLE
    com.sap.security.core.server.vsi.api.exception.VSIServiceException: The virus scan server VSCAN_FE0BOS192 is not running on localhost!
    Thanks for your help.
    Greetings,
    Steve Neubert
    Avira GmbH

    Thanks for your Posting.
    No thats not the Problem.
    The Customer use a SAP Portal on Sun OS without a SAP Gateway.
    Enterprise Portal Server --> VSCAN Destination  to --> over TCP /IP --> another Server (Windows 2003) with AntiVir VSA und vscan_rfc + SAP Gateway
    Now the Customer use the installation from SAP  "setupvscanrfc_78-10003831.exe"
    Content for this Installation is: SAP Gateway + vscan_rfc
    The Problem is that the VSI Interface shows a errormessage by scanning file bigger as 100kb:
    If Files bigger as 100 kb the Destination must copy the File to the Virus Scan Apdater, but thats not working.
    com.sap.security.core.server.vsi.api.exception.VSIServiceException: The virus scan server VSCAN_FE0BOS192 is not running on localhost!
    VSCAN_FE0BOS192 is the Destination on Portal-Site...
    Need this Installation also a SAP Gateway on the Portal Site or whats the Problem?
    Thanks for your Feedback.
    greetings,
    Steve Neubert

  • New to SAP PI, I need more information on SAP PI Topics

    Hi Guys,
    I'm New to SAP PI, I need more information on SAP PI Topics which are related to Development and configuration.
    i have gather some information please add more topics and major scenarios if i missed out.
    SAP PI Topics:
    1.     Mapping
    u2022     Standard Functions
    u2022     User-defined Functions
    u2022     Message Mapping
    u2022     Multi-Mapping
    u2022     Java, XSLT mapping overview
    2.     Business Process Management
    u2022     BP Modeling
    u2022     BP Engine
    3.     Design and Configuration
    u2022     System Landscape Directory
    u2022     Enterprise Services Repository
    u2022     Integration Directory
    4.     Runtime
    u2022     Integration Engine
    u2022     Different installations of Adapter Engines
    u2022     Runtime Workbench / Monitoring
    u2022     Architecture
    5.     PI as Component of SAP NetWeaver
    u2022     Positioning
    6.     Overview and Basic Concepts
    u2022     Adapters & J2EE Adapter framework
    u2022     Business Process Management
    u2022     Mapping
    7.     Adapters
    8.     Technical Connectivity for communication with SAP and non-SAP systems
    u2022     File/FTP(S) (File Systems / FTP Servers)
    u2022     JDBC (RDBMS systems)
    u2022     JMS (Messaging systems, e. g. MQSeries, SonicMQ)
    u2022     SOAP (Web Services based on SOAP)
    u2022     WS-RM (Web Services based on WS Reliable Messaging)
    u2022     HTTP_AAE Adapter
    u2022     Plain HTTP(S)
    u2022     Mail (Mail Servers via SMTP, IMAP4, POP3)
    u2022     SAP Business Connector (SAP BC)
    u2022     Marketplace (SAP Marketplaces)
    9.     Application Connectivity
    u2022     RFC
    u2022     IDOC_AAE Adapter
    u2022     IDoc
    u2022     Proxy (ABAP and Java)
    10.     SAP Industry Business Packages (contain adapters and content)
    u2022     RNIF 2.0 (RosettaNet)
    u2022     RNIF 1.1 (RosettaNet)
    u2022     CIDX (RNIF 1.1)
    11.     Advanced Adapter Engine Extended u2013 AAE
    u2022     PI as Infrastructure for Service Oriented Architecture (SOA)
    SAP PI Scenarios:
    u2022     SOAP to JDBC scenario
    u2022     RFC to FILE scenario
    u2022     Multiple IDOC's to File scenario
    u2022     File to File scenario
    u2022     File to RFC scenario using BPM
    u2022     File to JDBC scenario
    u2022     Idoc to File scenario
    u2022     Abap Proxy to XI scenario
    u2022     Idoc Flatfile to Idoc XML Scenario

    You may search for all basic topics on SCN and you will get required information. Such basic questions should be searched before posting. Thread locked.
    Regards,
    Prateek Raj Srivastava

  • Impossible to open muse CC, it needs more information, try to connect but cannot connect...

    I need to work with Muse CC, but It doesn't want to open.
    It tells me it need more information and want to connect to the Adobe server.
    After 10 sec. tells me it cannot connect and ask me to connect my computer to the internet... I'm connected !!!!!
    Help !!!

    Chat Now button near the bottom for Activation and Deactivation problems may help
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html
    OR
    -http://helpx.adobe.com/creative-cloud/kb/error-downloading-cc-apps.html
    -http://forums.adobe.com/community/download_install_setup
    -http://helpx.adobe.com/creative-cloud/kb/troubleshoot-cc-installation-download.html
    -http://helpx.adobe.com/x-productkb/global/errors-or-unexpected-behavior-websites.html
    -http://helpx.adobe.com/creative-cloud/kb/unknown-server-error-launching-cc.html
    -Server won't connect https://forums.adobe.com/thread/1233088

  • HT204053 My iPad will not join the iCal at my work after I've been invited. It says it needs more information.

    My iPad will not join the iCal at my work after I've been invited. It says it needs more information. What up?

    A reset should help. Tap and hold the Home button and the On/Off buttons for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons.

  • Need more information for ADT

    Hi Guys,
                I need more information about ADT. I am new to ADT.So will u plz provide the docs related ADT?
                  Thanks in advance.
    Best Regards,
    Purna.

    It is good mobo , unless unscheduled (my)problem (bad sata cables) ALL is fine!
    Recommendation.

  • " 3 items could not be synced. See iTunes for more information"  I have searched and I have tried the solutions on the forum. My iPhone has been successfully synced without error and I am trying to sync with new laptop.

    " 3 items could not be synced. See iTunes for more information"  I have searched and I have tried the solutions on the forum. My iPhone has been successfully synced previously on my mac mini without error. I am trying to sync my iPhone with new MacBook Pro.

    Modular77:  With respect the dialog on the iPhone 'XX items could not be synced.  See iTunes for more information.' , would you happen to know where to look in iTunes?  I looked in all the places that seemed logical to me. 
    I am, however, asking only for future reverence, as the initial sync which generated the error dialog was done via USB, and almost immediately after the USB sync, I ran a WiFi Sync—two in a row in fact—both initiated from the iPhone.  Both WiFi syncs completed successfully with no error dialog. 
    I then ran another USB sync initiated from iTunes on the Macintosh, as was the first sync which gave the error. This second USB sync also completed successfully with no errors.
    I think someone in this thread mentioned non-AppleStore products or DMR issues which I think could not have been an issue in my case, as I was running the sync to install updated Apps from the AppStore, and additionally had deleted some music and movie items to make sure there was room for the App updates. Nothing was added other than the recently downloaded App updates from the AppStore. 
    iPhone3GS  iOS 5.1.1 build 9B206. 
              Developer Profile enabled.  iCloud enabled.
              32 GB “disk.” About 1.5 GB free after sync.
              iPhone NOT jailbroken
    MacBook 13-inch Aluminum, Late 2008 (NOT Macbook Pro)
         Lion 10.4.7 build 11E53.  2 GB RAM.
    Thanks for any info or advice.  Problem IS now solved, but it absorbed a lot of time to reach that point.

  • In order to install IOS7 on my 4S, I need more storage of  3.1GB and presently have only 1.3 GB. My biggest usage is the camera roll at 9.8GB.  Photo stream is at 584 MB. My question is -should I delete the camera roll pics? They are saved on my computer.

    In order to install IOS7 on my 4S, I need more storage of  3.1GB and presently have only 1.3 GB. My biggest usage is the camera roll at 9.8GB.  Photo stream is at 584 MB. My question is -should I delete the camera roll pics? They are saved on my computer.

    At 1.3GB available, your storage space is getting very thin no matter what you do further.  As long as you have the photo's in the camera roll saved on your computer you can delete them.  Just make sure first that they are in your photo software.  If updating in iTunes, just backup/sync first, then update, and that will save the camera roll in the backup as well.
    At only 1.3GB you eventually are going to find yourself unable to install or update some app, or unable to take any new pictures, or some other limitation that will force you to free up space anyway.  So now, before updating, sounds like a good time to make sure everything is backed up or stored somewhere else, and clean house a bit, then update.

  • I am trying to download a free app and it say I need billing information, I do that and it still won't download

    I am trying to download a free app and it say I need billing information, I do that and it still won't download

    Hi alphapack21,
    Thank you for using Apple Support Communities. 
    I see you are having difficulties with downloading a free app from the App Store without a credit card. The following article explains how to set up your account without a credit card or payment method. 
    Create an iTunes Store, App Store, or iBooks Store account without a credit card or other payment method - Apple Support
    Regards,
    Jeff D. 

  • I need more information than is covered in the Apple TV Set-Up guide on the Remote Functionality re how to turn off Apple TV

    I need more information than is covered in the Apple TV Set-Up guide on the Remote Functionality re how to turn off Apple TV

    If you are using the included remote control, under settings there is a 'Sleep Now'. What ATV generation do you have?

Maybe you are looking for

  • Unable to load iLife 11 on MacMini after upgrading to OS 10.6

    I bought the combo pack to upgrade two computers.  Upgrading the MacBook from 10.5 went smoothly as did adding ILife and iWork.  Now I'm working on the MacMini.  Upgraded the OS from 10.4.  Installed iWork easily but can't do iLife.  I get a message

  • Photoshop CS6 update error U44M2P22 or U44M2I218

    I bought the permanent license version of Photoshop CS6 standard.  as-installed, it is version 13.0.0 I wanted to update to 13.0.4.  so I tried installing via update feature.  got an error. so I manually downloaded the 13.0.4 updater patch. still get

  • Please Help My Friend and I Settle a Dispute!

    hello everyone! my friend and i have a small question for all of you: i leave my mac in sleep mode for most of the time, saying that if you are using the laptop every day (which we are), it is better for the computer to not shut it down every night a

  • I installed Lion, but did not get the multi touch gestures feature. Also my "front row" is gone.

    I installed Lion, but did not get the multi touch gestures feature. Also my "front row" is gone.

  • I book G4

    Hi, my I Book's Airport is going wrong, I think. When I log on to a network it does not ask for the relevant passwords / codes. I just says I am on line but will not let me on. I am using Safari. Is this a problem with the Airport or Safari? Also my