How to throw bundled exceptions thrown by checkErrors()

Hi,
I call pl/sql to do update, and call checkErrors() , the code looks like following, but it doesn't display read friendly message on the screen. What is the right way to throw bundled exception from checkErrors() method?
try{
xxg2cGoalPk.startWf (conn,
new BigDecimal(srpGoalHeaderId),
new BigDecimal(userId),
returnStatus,
msgCount,
msgData);
int msgCount1 = 0;
if(msgCount[0] != null){
msgCount1 = Integer.parseInt(msgCount[0].toString());
String returnStatus1 = returnStatus[0];
String msgData1 = msgData[0];
OAExceptionUtils.checkErrors(tx,msgCount1, returnStatus1, msgData1);
catch(OAException e) {
e.printStackTrace();
throw new OAException(e.getDetailMessage(),OAException.ERROR);
thanks
Lei

What Shiv said is only an alternative, but what you are using is correct.I haven't tested but as per javadoc of
OAExceptionUtils.checkErrors(tx,msgCount1, returnStatus1, msgData1);
will itself raise bundled exceptions. You need to write this line outside try/catch block.
--Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to properly handle Exception thrown in a .tag file?

    I've got a .jsp file that makes use of some custom tags, each defined in their own .tag file, and located in WEB-INF/tags. I'm having a lot of trouble with the scenario of cleanly dealing with an exception raised by scriptlets in either a .jsp file, and a .tag file. I'm using both Java and Tomcat 6....
    Originally, I wanted to use .tag files in order to componentize common elements that were present in .jsp pages, as well as move ugly scriptlets out of .jsp pages, and isolate them in tag files with their associated page elements.
    Things started getting hairy when I started exploring what happens when an exception is thrown (bought not handled) in a scriptlet in a .tag file. Basically, my app is a servlet that forwards the user to various .jsp pages based on given request parameters. The forwarding to the relevant .jsp page is done by calls to the following method:
    servletContext.getRequestDispatcher("/" + pageName).forward(request, response);
    Where 'pageName' is a String with the name of the .jsp I want to go to...
    Calls to this method are enclosed in a try block, as it throws both a ServletException, and IOException...
    When either my .jsp, or .tag throw an exception in a scriptlet, the exception is wrapped in a JSPException, which is then wrapped in a ServletException.
    I can catch this exception in my servlet... but then what? I want to forward to an error page, however, in the catch block, I can't forward in response to this exception, as that results in an IllegalStateException, as the response has already been committed. So what do I do? How do I get from this point, to my "error.jsp" page?
    It was suggested to me that I use the <% @ page isErrorPage="true" %> directive in my error.jsp,
    and the in my real .jsp, use <%page errorPage="/error.jsp" %>.
    This works great when the exception is thrown in my .jsp.... But when the exception is thrown in the .tag file... not so much...
    My .jsp page was rendered up until the point where the <my:mytag/> (the tag with the offending raised exception) was encountered. Then, instead of forwarding to the error page when the error in the tag is encountered, the error page is rendered as the CONTENT of of my TAG. The rest of the .jsp is then NEVER rendered. I checked the page source, and there is no markup from the original .jsp that lay below the my tag. So this doesn't work at all. I don't want to render the error page WITHIN the half of the .jsp that did render... Why doesn't it take me away from the .jsp with the offending tag altogether and bring me to the error.jsp?
    Then it was suggested to me that I get rid of those page directives, and instead define error handling in the web.xml using the following construct:
    <error-page>
    <exception-type>java.lang.Exception</exception-type>
    <location>/error</location>
    </error-page>
    <error-page>
    <error-code>404</error-code>
    <location>/error</location>
    </error-page>
    For this, I created a new servlet called ErrorServlet, and mapped it to /error
    Now I could mangle the end of the URL, which causes a 404, and I get redirected to the ErrorServlet. Yay.
    However, exceptions being thrown in either a .jsp or .tag still don't direct me to the ErrorServlet. Apparently this error handling mechanism doesn't work for .jsp pages reached via servletContext.getRequestDispatcher("/" + pageName).forward(request, response) ????
    So I'm just at a total loss now. I know the short answer is "don't throw exceptions in a .jsp or .tag" but frankly, that seems a pretty weak answer that doesn't really address my problem... I mean, it would really be nice to have some kind of exception handler for runtime exceptions thrown in a scriptlet in .tag file, that allows me to forward to a page with detailed stacktrace output, etc, if anything for debugging purposes during development...
    If anyone has a few cents to spare on this, I'd be ever so grateful..
    Thanks!!
    Jeff

    What causes the exception?
    What sort of exception are you raising from the tag files?
    Have you got an example of a tag file that you can share, and a jsp that invokes it so people can duplicate the issue without thinking too much / spending too much time?
    My first instinct would be that the buffer is being flushed, and response committed before your Exception is raised.
    What you describe is pretty much standard functionality for Tomcat in such cases.

  • How to Throw/Catch Exceptions in BPM

    Hi All,
    I've seen a couple articles that talk about how to Throw/Catch an execption in a BPM. My question has two parts:
    1) RFC Call: I was able to catch an Fault Message in an exception step when calling an RFC (Synchronous Interface). What I wanted to do is use the fault message (exception) and store it in a DB for later review.
    2) IDOC: I'm sending an IDOC to R3 from a BPM. The send step is enclosed in a block w/ an exception. The send step is throwing an error (IDOC adpater system error), but the exception is never thrown. My question is: when the error occurrs at the adapter level does it still throw an exception in a BPM?
    Thanks for any tip/advice/anything!
    Fernando.

    Hi Fernando,
    1) Define a send step in the exception branch.
    2) If u send a IDoc from R/3 to XI and the IDoc adapter is running to an error of course there cant be an exception in ur business process. Usually the IDoc adapter sends back status back up via ALEAUD. In case of success IDoc should have then '03', if the adapter cannot send anything the IDoc should remain at '39'. U should send a ALEAUD in case of exception of BPM switching to status '40', in case of success to '41'.
    Regards, Udo

  • How to throw an exception that is not treated as error

    Hi,
    I have a repository manager displayed as /root/myrepository. Now when someone who's not authorized clicked it, I wish an error message will display on top in red, but not throw an exception as System Error.
    Now my implementation is to throw an ResourceException in getChildren() of the node. But when the user clicked on /root/repository, a System Error screen appeared, but what I want is just an error message.
    Any help is much appreciated~
    I don't know how to attach the screenshots. My MSN is [email protected]
    Thanks,
    Ray

    If you want to disallow getChildren altogether, throw an AccessDeniedException. If you want to hide specific children, just don't put them into the result list.
    Best regards, Julian

  • How to Throw an Exception in a SapServer

    Hello,
    We have successfully implemented SAPServer in our external process.
    The only thinks that doesn't work perfectly is that we can't throw an exception in the implementation of remote function module.
    The ABAP Program that is calling our fontion waits on expetion 0, 1, 2, 3 and 4. But when we throw the exception like this : throw new RfcException( "Error" );
    the ABAP catch this exception, but as exception 4 (others) and not as 3 (Error)
    Can someone help. Thanks

    Hello
    Thanks for the answer.
    In the while we tried the following:
    RfcAbapException( "ERROR" );
    but it doesn't work.
    The solution was to call this method with 2 parameters:
    RfcAbapException( "ERROR", "Some error text...");
    And now OK.

  • How to throw 2 Exceptions,

    Hello,
    I have a problem with a method. I would like to do something like:
    boolean thisIsATest ( ) throws PepeException,PacoException {
    Is it possible ? I already hava thought in wrapping then into a general exception, but I would like to find out if this is possible.
    Thanks in advace for your help,
    Sitomania

    boolean thisIsATest ( ) throws
    PepeException,PacoException {The "throws" clause simply states what exceptions the method can throw. You can list as many as you want, separated by commas.
    However, you can't actually throw multiple exceptions at once. This is reasonable: there should be a single definable condition that prevents your code from continuing.

  • How to throw custom exception from sessionbean

    I define an AppException generalize from EJBException.
    public class AppException extends EJBException{
    when error occurs in sessionbean,I throw AppException, Container perform rollback operation. but at client. I only get EJBException, Why? and How can I get AppException from sessionbean?

    AppException extends RuntimeException

  • How to throw exception in run() method of Runnable?

    Hi, everyone:
    I want to know how to throw exception in run() method of interface Runnable. Since there is no throwable exception declared in run() method of interface Runnable in Java API specification.
    Thanks in advance,
    George

    Thanks, jfbriere.
    I must add though that if your run() methodis
    executed after a call to Thread.start(), then
    it is not a good choice to throw anyRuntimeException
    from the run() method.
    The reason is that the thrown exception won't be
    handled appropriately by a try-catch block.Why do you say that "the thrown exception won't be
    handled appropriately by a try-catch block"? Can you
    explain it in more detail?
    regards,
    George
    Because the other thread runs concurrently with and independently of the parent thread, there's no way you can write a try/catch that will handle the new thread's exception: try {
        myThread.start();
    catch (TheExceptionYouWantToThrowFromRun exc) {
        handle it
    do the next thing This won't work because the parent thread just continues on after myThread.start(). Start() doesn't throw the exception--run() does. And our parent thread here has lost touch with the child thread--it just moves on to "do the next thing."
    Now, you can do some exception handling with ThreadGroup and uncaughtException(), but make sure you understand why the above won't work, in case that was what you were planning to do.

  • How to check that exception is not thrown for particular exception alone

    Hi,
    I want to check for Exception but I don't want it to throw exception when it is
    java.net.SocketException.
    I want to throw message for all other exception.
    Please let me know how to implement it.
    Thanks & Regards,
    Nasrin.N

    try {
    //some exception throwning code
    } catch (SocketException e) {
      //handle the exception
    } catch (Exception e) {
    //all other exceptions are handled here
    }

  • How to handle exceptions thrown by event

    Hi all,
    i have this slight problem, i'm trying to handle accessing a databse from a button click, i'm trying to simulate somebody logging on to a network. the code is as follows;
    *@author James Taylor
    *@version 30-11-2003
    *Logon gui
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.sql.*;
    public class LogonUI extends JFrame {
         //instance variables
         private JLabel userNameL;
         private JPasswordField password;
         private JButton logon;
         ButtonHandler handler;
         Connection con;
         Statement stmt;
          *Constructor initialises and creates UI, adds functionality to the button.
         public LogonUI() throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException{
              super("Employee Logon");
              Container c = getContentPane();
              c.setLayout(new FlowLayout() );
              //handles what happens when user presses the button
               handler = new ButtonHandler();
              userNameL = new JLabel("Please Enter Password:");
              c.add(userNameL);
              password = new JPasswordField(15);
              c.add(password);
              logon = new JButton( "Logon" );
              //anonymous inner class that is created once the button is pressed.
              //it connects to database to validate user
              logon.addActionListener( handler );
              c.add(logon);
              c.setBackground( Color.pink );
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              setSize(250,150);
              setVisible(true);
          *class that opens connection to validate user
         private class ButtonHandler implements ActionListener {
              public void actionPerformed(ActionEvent ae)throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException{
                   try{
                        boolean isValidUser = false;
                        //Load mysql driver
                         Class.forName("com.mysql.jdbc.Driver").newInstance();
                         //make a connection
                        String url = "jdbc:mysql://localhost/flight";
                        con = DriverManager.getConnection(url)
                        //Create and instantiate a statement obj
                        stmt = con.createStatement();
                        //get a result set
                        ResultSet rs = stmt.executeQuery("SELECT Password FROM employees");
                        //Iterate through the result set
                        while ( rs.next() ){     
                             String savedPassword = rs.getString("Password");
                             if (password.getText().equals(savedPassword) ){
                                  isValidUser = true;
                                  JOptionPane.showMessageDialog(null,"Yipeeeee");
                        if (isValidUser == false){
                             JOptionPane.showMessageDialog(null,"Invalid Password");     
                        stmt.close();
                        con.close();
                   }catch(Exception e){ e.printStackTrace();}
              public static void main (String[] args) throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException{
              LogonUI testAirApp = new LogonUI();
    }When the user presses the button the app tries to validate the user.
    I have not been able to test the code due to SQL Exceptions thrown in the handler class, and when i try and throw them up from here i get;
    LogonUI.java:52: actionPerformed(java.awt.event.ActionEvent) in LogonUI.ButtonHandler cannot implement actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener; overridden method does not throw java.lang.InstantiationExceptionAny ideas on my code and how to handle these exceptions will be very appreciated. Regards, James

    Turn your checked exceptions into unchecked exceptions and retrieve the cause later:
    RuntimeException unchecked = new RuntimeException(checked);
    Throwable t = unchecked.getCause();Stephen

  • Help Me, How to catch exception thrown from ejbStore

    Hi,
    I am working on application running on Iplanet Application Server 4.0. Problem is the application exception thrown from the ejbStore don't reach the calling servlet, calling servlet receive TransactionRollback exception which is system exception. But there is no sign of my application exception thrown from ejbStore. Can anybody tell me how I can get my ApplicationException thrown from ejbStore in my calling servlet.
    I am calling entity beans set method in servlet and in entity bean ejbStore method I am throwing Application exception.
    in entity bean
    public void ejbStore() throws MyException
    if(true) throw new MyException();
    in servlet
    try {
    MyEntityHome home = .......
    MyEntityRemote remote = home.findBy.....
    remote.setMyValue(MyValue value); //Transaction required Container managed
    }catch(MyException e) {
    e.printStackTrace(); // Not cahcing My Exception
    }catch(Exception e) {
    e.printStackTrace(); //catching TransactionRolledBackException
    Thanks
    Shakti

    Hi Ravi
                                    Try this
                                                try
                    Object retMsgs = output.get(bapiretrunmsgobject);
                      if(result != null )
    IrecordSet rmsg = (IrecordSet) result
                   catch(Exception ex)
                        printException(ex, "Error getting function result");
    Lemme know for any further questions.
    Regards
    Praveen

  • How to handle exception thrown in standard bo method in the workflow design

    Hi Experts
        how to handle exception thrown from standard bo method in the workflow design. For example, bo BUS2032, METHOD confirm. If the user cancel it, it will throw exception. In the workflow, how to catch this exception and add corresponding steps in the workflow.

    @jrockman li
    Try to implement the logic that what ever you are performing in the BO mehtod in a FM and in the FM you have tab with name EXECPTIONS define the execption in that tab.Now in the BO method you call this FM  and if the exception occurs by using RAISE you can raise the exception in the FM and based on the number of exceptions your sy-subrc value will be set
    so when sys-subrc is not eq 0 then pass a value back t the workflow container., I think this will work.
    a sample Snippet for understanding purpose
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename         = <path>
        filetype         = 'ASC'
      IMPORTING
        filelength       = lv_len
      TABLES
        data_tab         = l_txt_tab
      EXCEPTIONS
        file_write_error = 1          " If this Exception occurs
        invalid_type     = 2
        no_authority     = 3
        unknown_error    = 4
        OTHERS           = 10.
    CASE sy-subrc.
      WHEN 1. " SY-SUBRC value will be 1 then,
          " Pass or set the value back to the workflow conatiner element
    ENDCASE.

  • How to omit parameter values from exceptions thrown by the JDBC driver

    Is there a way to get the Oracle JDBC driver to omit the parameter values from the message when it throws an exception?
    We have an application that persists credit cards and when an exception is thrown by the driver, it's including the credit card number in the error message, which ultimately gets logged by the application. There are too many layers and locations, including OpenJPA, Spring, and our own application, where we'd have to massage the error data to remove that card number.
    For example, we get the following exception:
    Caused by: org.apache.renamed.openjpa.lib.jdbc.ReportingSQLException: ORA-20104: Permission denied
    ORA-06512: at "PROTEGRITY.PTY", line 57
    ORA-06512: at "PROTEGRITY.PTY", line 383
    ORA-06512: at "SUBSDSYS.TORDERPAYMENT_UPD", line 16
    ORA-04088: error during execution of trigger 'SUBSDSYS.TORDERPAYMENT_UPD'
    {prepstmnt 6603044
    UPDATE PAYMENT
         SET CARD_HOLDER_NAME = ?, CARD_TYPE = ?, EXPIRY_MONTH = ?, EXPIRY_YEAR = ?, GATEWAY = ?
         WHERE UIDPK = ?
    [params=(String) Test Test, (String) VISA, (String) 03, (String) 2012, (String) CREDITCARD, (long) 106901]} [code=20104, state=72000]
    at org.apache.renamed.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
    at org.apache.renamed.openjpa.lib.jdbc.LoggingConnectionDecorator.access$800(LoggingConnectionDecorator.java:57)
    The actual content of the message appears to come from the JDBC driver, not OpenJPA.
    This particular example doesn't show the card number, but only exposed that possibility as a risk.
    BTW: before you ask, for PCI compliance we're using a database layer service to encrypt the card numbers before they're stored in the table.
    Thanks much.

    [email protected] wrote:
    The actual content of the message appears to come from the JDBC driver, not OpenJPA.Wrong. This is a dump of parameters used to execute a query - and it comes from some upper layer, not the JDBC driver.
    I would start looking at the source code starting here:
    org.apache.renamed.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)

  • How to throw Exception in Thread.run() method

    I want to throw exception in Thread.run() method. How can I do that ?
    If I try to compile the Code given below, it does not allow me to compile :
    public class ThreadTest {
         public static void main(String[] args) {
         ThreadTest.DyingThread t = new DyingThread();
         t.start();
         static class DyingThread extends Thread {
         public void run() {
         try {
                   //some code that may throw some exception here
              } catch (Exception e) {
              throw e;//Want to throw(pass) exception to caller
    }

    (a) in JDK 1.4+, wrap your exception in RuntimeException:
    catch (Exception e)
    throw new RuntimeException(e);
    [this exception will be caught by ThreadGroup.uncaughtException() of this thread's parent thread group]
    In earlier JDKs, use your own wrapping unchecked exception class.
    (b) if you know what you are doing, you can make any Java method throw any exception using Thread.stop(Throwable) regardless of what it declares in its "throws" declaration.

  • How to throw a permanent exception during mapping?

    I'm using the java coding: "throw new RuntimeException(message);" to trigger an error during mapping.
    This will set the message status to: "System error, manual restart possible".
    How can I throw a permanent exception during mapping? So that the message is set to error but will NOT be restartable.

    Hi,
    Any error in  asynchronous mode in XI will be in a Restart Mode.  I dont think this can be done.
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    /people/sap.user72/blog/2005/11/29/xi-how-to-re-process-failed-xi-messages-automatically
    Regards,
    Bhavesh

Maybe you are looking for

  • Pdf form can't send via email

    my pdf form is not being sent via email as adobe is not asking fr mail address to b sent to

  • Change in the alv report?

    Hi guys, My output in the alv is displaying like this at the moment. Component  Material Desc  Comp.MRP  Qunatity  Unit  Price  Currency  Entries 009/19222     ABC                c11               1          EA   100       usd          1 009/19222   

  • Associate a password to an image

    Hy, i would like know if it's possible associate a password to an image in java in such way that I need the password when i open the image in a second moment. Thanks

  • Idvd closing projects

    this is my first time using idvd, im making a wedding dvd for a friend. after a few days work on a project making slideshows of photos etc my project just closed itself, when trying to open the project back up again all that appears is the idvd windo

  • Deficit of PU IR quantity 5,000 EA

    Hi Expert, I did the MIGO for 5 Materials which they posted to quality inspection stcok, since quality management is activated.then i did MIRO as system has accepted and it is blocked in status due to settings in QM key.After this I did Quality Inspe