Exception Handling -- Help pls.

This is the function that calculates cost taking deatils from two other tables .could you help me how handle exception for the second select statement, Which will have no value at some stage and also it will return multiple values.
CREATE OR REPLACE FUNCTION get_cost_value
(provis_id number,fyr_id number)
return number
as
commi_id number;
costperunit number;
units_p number;
weeklycost number;
cost number := 0;
weeks number;
pro_s_date date;
pro_e_date date;
v_flag varchar2(1);
begin
begin
select actual_start_date, actual_end_date
into pro_s_date,pro_e_date
from provisions
where
     identifier = provis_id;
exception
WHEN no_data_found THEN
     v_flag := 'N';
END;
[b]for x in
(select identifier, units_provided
from cost_commitments
where
provis_identifier = provis_id)
loop
commi_id := x.identifier;
units_p := x.units_provided;
if v_flag != 'N'
then
costperunit := to_number(get_rate_value(pro_s_date,provis_id,commi_id));
weeks := num_weeks(pro_e_date,fyr_id);
cost := units_p * costperunit * weeks;
else
cost := 0;
end if;
return cost;
end loop;
end;
/*EXCEPTION
WHEN no_data_found THEN
v_flag := 'N';*/

Isn't it what you need ?
SQL> var flag char(1);
SQL> var dept number;
SQL> exec :flag := 'Y';
PL/SQL procedure successfully completed.
SQL> exec :dept := 10;
PL/SQL procedure successfully completed.
SQL> declare
  2   cnt number;
  3  begin
  4   for v in (select empno from emp where deptno = :dept) loop
  5    cnt := 1;
  6   end loop;
  7   if cnt is null then
  8    raise no_data_found;
  9   end if;
10  exception
11    when no_data_found then
12     :flag := 'N';
13  end;
14  /
PL/SQL procedure successfully completed.
SQL> print flag
FLAG
Y
SQL> exec :dept := 100;
PL/SQL procedure successfully completed.
SQL> declare
  2   cnt number;
  3  begin
  4   for v in (select empno from emp where deptno = :dept) loop
  5    cnt := 1;
  6   end loop;
  7   if cnt is null then
  8    raise no_data_found;
  9   end if;
10  exception
11    when no_data_found then
12     :flag := 'N';
13  end;
14  /
PL/SQL procedure successfully completed.
SQL> print flag
FLAG
NRgds.

Similar Messages

  • OPEN out_cur FOR        SELECT  exception handling help

    Here is the stored procedure for reading a data based on the input, if no data then return null ref cursor and proper error message.
    I am not sure, i am handling proper exception handling ? Please help me to complete this item.
    Thanks.
    PROCEDURE testing
    module IN VARCHAR2,
    module_id IN VARCHAR2,
    out_cur OUT SYS_REFCURSOR,
    out_error_no OUT NUMBER
    BEGIN
    out_error_no := 0;
    CASE
    WHEN module = 'a' AND module_id = 'b' THEN
    BEGIN
    OPEN out_cur FOR
    SELECT id,
    mime_type,
    file_length,
    file_name ,
    uploadeddate,
    created_user ,
    status_name
    FROM l_table_cnt
    WHERE id = module_id;
    EXCEPTION
    WHEN OTHERS THEN
    OPEN out_cur_file_cursor FOR
    SELECT
    NULL id,
    NULL mime_type,
    NULL file_length,
    NULL file_name,
    NULL uploadeddate,
    NULL created_user,
    NULL status_name
    FROM dual
    WHERE 1= 0;
    out_error_no := 2;
    RAISE_APPLICATION_ERROR(-20024,'No Document ');
    END;

    Venkadesh wrote:
    The correct way is to just open the ref cursor and pass it back and then the receiving code that is going to use that cursor handles whether there is any code in it or not. can you please explain with simple exampleIs it really that difficult?
    Ok...
    Here's the procedure to return a ref cursor...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure get_rc(p_deptno in number, p_rc out sys_refcursor) is
      2  begin
      3    open p_rc for 'select * from emp where deptno = :1' using p_deptno;
      4* end;
    SQL> /
    Procedure created.Now we have some application that wants to consume a ref cursor... in this case the application is SQL*Plus, but it could be Java or .NET etc.
    It declares it's local reference to the ref cursor...
    SQL> var r refcursor;then calls the procedure to get a ref cursor reference assigned...
    SQL> exec get_rc(10, :r);
    PL/SQL procedure successfully completed.Now, the application itself determines if there is any data when it comes to actually perform the fetches on it...
    SQL> print r;
         EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10
          7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10
          7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10in the above case it had data, so it displayed it.
    So what if there isn't any data...
    SQL> exec get_rc(90, :r);
    PL/SQL procedure successfully completed.
    SQL> print r;
    no rows selected
    SQL>SQL*Plus (the application that calls the procedure) is the one that has determined that there was not data when it came to fetch it (using the print statement in this case). And when it found there was no data it handled it itself (in this case printing the message "no rows returned").
    The procedure doesn't have to do any overhead of determining if there is data going to be returned or not, because it's not it's responsibility and completely unnecessary. The calling application can easily determine if there is data or not when it starts to try and fetch it.

  • Exception handling help

    I am working on JTable.
    Vector properties = MainFrame.getPropertyList(Object);
    if(properties.size() > 1) {
    tm.setDataVector(properties, colNames);
    txtProperties.setText(dataModelObject.toString());
    else {
    if the properties i.e the vector is null I want to throw an exception i.e in the else part of the code. Which says the not valid properties or something like that.
    I don't know how to write an exception. Need help with this. Thanks.

    Create a new Exception Class. All exceptions of class "Exception" or subclasses thereof--except
    "RuntimeException"s--must be caught.
    RuntimeException:
    public class NullDefException extends RuntimeException
    String errorMsg;
    public void NullDefException(String errorMsg){
    this.errorMsg=errorMsg;
    public String getErrorMsg()
    return errorMsg;
    If NullDefException is not a "RuntimeException", the Java compiler would ask you to either "try-catch"
    "NullDefException " or declare it in the throws clause of the method.
    public class NullDefException extends Exception{
    String errorMsg;
    public void NullDefException(String errorMsg){
    this.errorMsg=errorMsg;
    public String getErrorMsg()
    return errorMsg;
    Method with throws clause:
    public void DataVector throws NullDefException(){
    Vector properties = MainFrame.getPropertyList(Object);
    if(properties==null)
    throw NullDefException;
    if(properties.size() > 1) {
    tm.setDataVector(properties, colNames);
    txtProperties.setText(dataModelObject.toString());
    else {
    Method with try-catch:
    public void DataVector (){
    try{
    Vector properties = MainFrame.getPropertyList(Object);
    if(properties.size() > 1) {
    tm.setDataVector(properties, colNames);
    txtProperties.setText(dataModelObject.toString());
    else {
    catch(NullDefException e){System.out.println("NullDefException:"+e.getErrorMsg);}
    }

  • Exception Handling - Help me out here

    This is my program...
    public void addTransaction() {
    data.addElement(JOptionPane.showInputDialog("Enter Transaction Number: "));
    data.addElement(JOptionPane.showInputDialog("Enter Name of Client: ")); data.addElement(JOptionPane.showInputDialog("Enter Transaction Type: "));     
    data.addElement(JOptionPane.showInputDialog("Enter Account Number: "));
    data.addElement(JOptionPane.showInputDialog("Enter the Total Amount: "));
    where "data" is a vector element.
    i need to make sure that a valid input is entered for each Input Dialog. If there is no input, the same dialog box should appear until a valid input is entered...

    Do not crosspost: http://forum.java.sun.com/thread.jsp?forum=54&thread=353639

  • Noob Exception Handling Help

    OK, basicly. Theres 3 fields. If a user enters data into 1 of the fields, it searches and prints something out of the DB. But if a user enters nothing it should throw an error telling them to input something. It all occurs in the doGet. Experts.. halp?
    import javax.servlet.http.*;
    import java.sql.*;
    import java.io.*;
    public class PizzaQuery extends HttpServlet
    private Statement st;
    private Connection con;
    private     String sRecords = new String();
    private String sSQL = new String();
    private String sMessage = new String();
    private final String url = "jdbc:odbc:Pizza";
    private PrintWriter out;
         public void init(){
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection(url);
              catch (ClassNotFoundException e)
                   sMessage = "Failed to load the driver" +e;
              catch (SQLException e)
                   sMessage = "Unable to connect"+e;
              public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException
                   try
                   if (req.getParameter("Name") != null) {
                        String name = req.getParameter("Name");
                        sSQL = "SELECT * FROM PizzaOrder WHERE Name=?";
                        PreparedStatement ps = con.prepareStatement(sSQL);
                        ps.setString(1,name);
                        ResultSet rec = ps.executeQuery();
                        while (rec.next())
                             sRecords += "<tr><td>" + rec.getString(1);
                             sRecords += "</td><td>" + rec.getString(2);
                             sRecords += "</td><td>" + rec.getString(3);
                             sRecords += "</td><td>" + rec.getString(4);
                             sRecords += "</td><td>" + rec.getString(5);
                             sRecords += "</td><td>" + rec.getString(6);
                             sRecords += "</td></tr>";
                   if (req.getParameter("City") != null) {
                        String city = req.getParameter("City");
                        sSQL = "SELECT * FROM PizzaOrder WHERE City=?";
                        PreparedStatement ps = con.prepareStatement(sSQL);
                        ps.setString(1,city);
                        ResultSet rec = ps.executeQuery();
                        while (rec.next())
                             sRecords += "<tr><td>" + rec.getString(1);
                             sRecords += "</td><td>" + rec.getString(2);
                             sRecords += "</td><td>" + rec.getString(3);
                             sRecords += "</td><td>" + rec.getString(4);
                             sRecords += "</td><td>" + rec.getString(5);
                             sRecords += "</td><td>" + rec.getString(6);
                             sRecords += "</td></tr>";
                   if(req.getParameter("Size") != null) {
                        String size = req.getParameter("Size");
                        sSQL = "SELECT * FROM PizzaOrder WHERE Size=?";
                        PreparedStatement ps = con.prepareStatement(sSQL);
                        ps.setString(1,size);
                        ResultSet rec = ps.executeQuery();
                        while (rec.next())
                             sRecords += "<tr><td>" + rec.getString(1);
                             sRecords += "</td><td>" + rec.getString(2);
                             sRecords += "</td><td>" + rec.getString(3);
                             sRecords += "</td><td>" + rec.getString(4);
                             sRecords += "</td><td>" + rec.getString(5);
                             sRecords += "</td><td>" + rec.getString(6);
                             sRecords += "</td></tr>";
                   if (sRecords != null)
                        res.setContentType("text/html");
                        out = res.getWriter();
                        out.println("<b><u>Pizza Orders</u></b><br /><br /><table border = 6>");
                        out.println("<th>Order</th><th>Name</th><th>Address</th><th>City</th><th>Size</th><th>Toppings</th>");
                        out.println(sRecords);
                        out.println("</table>");     
                        out.println("<br>");     
                        out.println("<br>");                    
                   } else {
                        sMessage = "Please input SOMETHING!";
                        out.println(sMessage);     
                   sRecords ="";
                   catch (SQLException e)
                        sMessage = "Failed to submit data "+e;
              public void destroy()
                   try
                        st.close();
                        con.close();     
                   catch (SQLException e)
                        sMessage = "Database not closed " + e;
    }

    FuNk wrote:
    Exacly rayom. It just doens't want to work?...
    rayom, flounder, can i show you through vnc if you have time?No.
    Well here is something you could do that is less ideal but should work.
    boolean isProcessed = false;
    if(A){
      // do A
      isProcessed = true;
    if((!isProcessed)&&(B)){
      // do B
      isProcessed = true;
    if((!isProcessed)&&(C)){
      // do C
      isProcessed = true;
    if(!isProcessed){
      // user did not supply ANY values. say something here.
    }That's an idea anyway. It's copying the if else structure which I suppose you got lost in the braces somewhere or something. But give it a shot.
    Have to walk my dog and eat dinner now so don't panic if I'm not back for awhile.

  • Pls help..Constructor,setter, getter and Exception Handling Problem

    halo, im new in java who learning basic thing and java.awt basic...i face some problem about constructor, setter, and getter.
    1. I created a constructor, setter and getter in a file, and create another test file which would like to get the value from the constructor file.
    The problem is: when i compile the test file, it come out error msg:cannot find symbol.As i know that is because i miss declare something but i dont know what i miss.I post my code here and help me to solve this problem...thanks
    my constructor file...i dont know whether is correct, pls tell me if i miss something...
    public class Employee{
         private int empNum;
         private String empName;
         private double empSalary;
         Employee(){
              empNum=0;
              empName="";
              empSalary=0;
         public int getEmpNum(){
              return empNum;
         public String getName(){
              return empName;
         public double getSalary(){
              return empSalary;
         public void setEmpNum(int e){
              empNum = e;
         public void setName(String n){
              empName = n;
         public void setSalary(double sal){
              empSalary = sal;
    my test file....
    public class TestEmployeeClass{
         public static void main(String args[]){
              Employee e = new Employee();
                   e.setEmpNum(100);
                   e.setName("abc");
                   e.setSalary(1000.00);
                   System.out.println(e.getEmpNum());
                   System.out.println(e.getName());
                   System.out.println(e.getSalary());
    }**the program is work if i combine this 2 files coding inside one file(something like the last part of my coding of problem 2)...but i would like to separate them....*
    2. Another problem is i am writing one simple program which is using java.awt interface....i would like to add a validation for user input (something like show error msg when user input character and negative number) inside public void actionPerformed(ActionEvent e) ...but i dont have any idea to solve this problem.here is my code and pls help me for some suggestion or coding about exception. thank a lots...
    import java.awt.*;
    import java.awt.event.*;
    public class SnailTravel extends Frame implements ActionListener, WindowListener{
       private Frame frame;
       private Label lblDistance, lblSpeed, lblSpeed2, lblTime, lblTime2, lblComment, lblComment2 ;
       private TextField tfDistance;
       private Button btnCalculate, btnClear;
       public void viewInterface(){
          frame = new Frame("Snail Travel");
          lblDistance = new Label("Distance");
          lblSpeed = new Label("Speed");
          lblSpeed2 = new Label("0.0099km/h");
          lblTime = new Label("Time");
          lblTime2 = new Label("");
          lblComment = new Label("Comment");
          lblComment2 = new Label("");
          tfDistance = new TextField(20);
          btnCalculate = new Button("Calculate");
          btnClear = new Button("Clear");
          frame.setLayout(new GridLayout(5,2));
          frame.add(lblDistance);
          frame.add(tfDistance);
          frame.add(lblSpeed);
          frame.add(lblSpeed2);
          frame.add(lblTime);
          frame.add(lblTime2);
          frame.add(lblComment);
          frame.add(lblComment2);
          frame.add(btnCalculate);
          frame.add(btnClear);
          btnCalculate.addActionListener(this);
          btnClear.addActionListener(this);
          frame.addWindowListener(this);
          frame.setSize(100,100);
          frame.setVisible(true);
          frame.pack();     
        public static void main(String [] args) {
            SnailTravel st = new SnailTravel();
            st.viewInterface();
        public void actionPerformed(ActionEvent e) {
           if (e.getSource() == btnCalculate){
              SnailData sd = new SnailData();
           double distance = Double.parseDouble(tfDistance.getText());
           sd.setDistance(distance);
                  sd.setSpeed(0.0099);
              sd.setTime(distance/sd.getSpeed());
              String answer = Double.toString(sd.getTime());
              lblTime2.setText(answer);
              lblComment2.setText("But No Exception!!!");
           else
           if(e.getSource() == btnClear){
              tfDistance.setText("");
              lblTime2.setText("");
       public void windowClosing(WindowEvent e){
                   System.exit(1);
        public void windowClosed (WindowEvent e) { };
        public void windowDeiconified (WindowEvent e) { };
        public void windowIconified (WindowEvent e) { };
        public void windowActivated (WindowEvent e) { };
        public void windowDeactivated (WindowEvent e) { };
        public void windowOpened(WindowEvent e) { };
    class SnailData{
       private double distance;
       private double speed;
       private double time;
       public SnailData(){
          distance = 0;
          speed = 0;
          time = 0;
       public double getDistance(){
          return distance;
       public double getSpeed(){
          return speed;
       public double getTime(){
          return time;
       public void setDistance(double d){
          distance = d;
       public void setSpeed(double s){
          speed = s;
       public void setTime(double t){
          time = t;
    }Pls and thanks again for helps....

    What i actually want to do is SnailTravel, but i facing some problems, which is the
    - Constructor,setter, getter, and
    - Exception Handling.
    So i create another simple contructor files which name Employee and TestEmployeeClass, to try find out the problem but i failed, it come out error msg "cannot find symbol".
    What i want to say that is if i cut below code (SnailTravel) to its own file(SnailData), SnailTravel come out error msg "cannot find symbol".So i force to put them in a same file(SnailTravel) to run properly.
    I need help to separate them. (I think i miss some syntax but i dont know what)
    And can somebody help me about Exception handling too pls.
    class SnailData{
       private double distance;
       private double speed;
       private double time;
       public SnailData(){
          distance = 0;
          speed = 0;
          time = 0;
       public double getDistance(){
          return distance;
       public double getSpeed(){
          return speed;
       public double getTime(){
          return time;
       public void setDistance(double d){
          distance = d;
       public void setSpeed(double s){
          speed = s;
       public void setTime(double t){
          time = t;

  • Exception Handling in Java .. Help

    Hi folks I needed some help in exception handling ...
    I know that I could go like this
    public class MyClass
         public static void main(String args[])
              try
              System.out.println(1/0);
              catch(java.lang.Exception e)
                   e.printStackTrace();
    Now what if i want to throw an error for example in C++ we would go like
    try
    throw 1;
    throw 0;
    throw 'A';
    catch (int i) //If exception is of integer type ... you may overload it
    cout << "Integer value thrown and caught \n";
    catch (...) //Unexpected error
    cout << "Some other unexpected exception \n";
    How could i impliment a code such as the above in Java using throw...
    Thanks again folks...

    1. When you post code, use code tags to make it readable. Copy/paste from your original source in your editor (NOT from your earlier post here), highlight the code, and click the CODE button. Use the Preview tab to see how your post will work.
    2. [http://download.oracle.com/javase/tutorial/essential/exceptions/]

  • Exceptions Handling Programs Needed! Pls!!!

    Hi!
       Can any one give some sample programs of how exception handling is done in abap.
      Pls send it guys looking for your reply.
      [email protected]
       Rahul.

    Hi,
    Exceptions are situations that occur while an ABAP program is being executed, in which normal continuation of the program does not make any sense.
    Exceptions can be raised either implicitly in the ABAP runtime environment or explicitly in the ABAP program.
    For example, division by zero leads to an exception in the ABAP runtime environment. It is possible to determine this situation through a query in the ABAP program and to trigger an exception there.
    See the demo program DEMO_HANDLE_EXCEPTIONS in se38.
    *-------------------------------------EXAMPLE FOR RUNTIME ERROR---------------------------------------------------------------------------
    *DATA : VALUE1 TYPE I.
    *VALUE1 = 1 / 0. "------------->>>>>> IT MAKES RUN TIME ERROR.
    *WRITE : VALUE1.
    *---------------------------------EXAMPLE FOR HOW TO CATCH THE ARITHMETIC ERROR AT THE RUN TIME USING SUBRC---------------------------------
    *DATA : VALUE1 TYPE I.
    *CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 1.
    *VALUE1 = 1 / 0.
    *WRITE : VALUE1.
    *ENDCATCH.
    *IF SY-SUBRC = 1.
    *WRITE : ' IT MAKES ERROR'.
    *ELSE.
    *WRITE : VALUE1.
    *ENDIF.
    in abap program we handle exceptions based on value returned by the system variable SY-SUBRC.
    if SY-SUBRC = 0.
    means execution completed sucessfull.
    if SY-SUBRC = 1........n.
    means execution compleated not sucessfully.
    if sy-sbrc = 0.
    write:/ 'execution sucessfull.
    **here write logic as per u r requirement
    else sy-subrc = '1'
    message
    elseif sy-subrc eq '2'
    message
    elseif sy-subrc eq '3'
    message
    elseif sy-subrc eq '4'
    message
    endif
    messages are defined in SE91..
    these messages are 5 types..
    A Termination Message
    The message appears in a dialog box, and the program terminates. When the user has confirmed the message, control returns to the next-highest area menu.
    <b>E Error Message</b>
    Depending on the program context, an error dialog appears or the program terminates.
    <b>I (nformation)<b>
    The message appears in a dialog box. Once the user has confirmed the message, the program continues immediately after the MESSAGE statement.
    <b>S(Status Message)<b>
    The program continues normally after the MESSAGE statement, and the message is displayed in the status bar of the next screen.
    <b>W(Warning)<b>
    Depending on the program context, an error dialog appears or the program terminates.
    <b>X(Exit)<b>
    No message is displayed, and the program terminates with a short dump. Program terminations with a short dump normally only occur when a runtime error occurs. Message type X allows you to force a program termination. The short dump contains the message ID.
    regards,
    Ashokreddy.

  • Plz help in exception handling

    Hello
    I am trying to do this exception handling in string to numeric conversion. Everything is working fine except when i enter any number with letters f and d on exception handling doesnt work like for example if i enter 5f or 4 d progam is working fine, but it supposed to show that it is error.
    here is the code:
    class AlsMark implements ActionListener
            public void actionPerformed(ActionEvent ae)
               try {
                double amount=0;
                amount=Double.parseDouble(tfConvert.getText());
                amount=amount*0.168;
                lbResult.setText(tfConvert.getText()+" mark is "+Double.toString(amount)+" euro");
                validate();
                catch (NumberFormatException nfe)
                    System.out.println(tfConvert.getText()+" is not an integer");
                   // tfConvert.setText("0");
                    JOptionPane.showMessageDialog(null,"Please enter a decimal value","Error",JOptionPane.ERROR_MESSAGE);
        }

    The Double.parseDouble() method will accept f (float) and d (double) letters.
    Try with:
    class AlsMark implements ActionListener
            public void actionPerformed(ActionEvent ae)
               try {
                double amount=0;
                amount=(double)Integer.parseInt(tfConvert.getText());
                amount=amount*0.168;
                lbResult.setText(tfConvert.getText()+" mark is "+Double.toString(amount)+" euro");
                validate();
                catch (NumberFormatException nfe)
                    System.out.println(tfConvert.getText()+" is not an integer");
                   // tfConvert.setText("0");
                    JOptionPane.showMessageDialog(null,"Please enter a decimal value","Error",JOptionPane.ERROR_MESSAGE);

  • Exception question! pls help

    i dont seem to get around the Java exception using the User-defined-exception classes.
    I have three classes OldException, TooYoungException and InvalidException.
    In my TooYoungException i have:
    public class AgeTooOldException
        extends ArithmeticException {
      public AgeTooOldException()
      public AgeTooOldException(String message)
        super ( message );
      }And in my main i have:
      try {
          String age = JOptionPane.showInputDialog("Please your age");
          int conAge = Integer.parseInt(age);
        catch (AgeTooOldException ato ) {
           if (conAge > 80) //if over 80 error
          JOptionPane.showMessageDialog( this,
                                         "Age is too old, must be less then 120",
                                         "Invalid age entered format",
                                         JOptionPane.ERROR_MESSAGE );
        catch (Exception x ) {
          JOptionPane.showMessageDialog(this, "Error has occurred");
        }I am doing something wrong, and i need some one to advise me what i did wrong, because i just dont seem to get the exception handling.

    This design is wrong.
    First of all, your AgeTooOldException should not extend ArithmeticException. If you read the javadocs, you don't have an ArithmeticException here, in spite of the fact that a number is involved. Extending Exception is enough.
    Second, you didn't write the exception class properly. Exception has four constructors. You should override them all.
    Third, you don't use exceptions like goto statements. They're not supposed to be for program control. They're supposed to signal conditions that the program cannot handle. This one is a bit on the fuzzy side of that line.
    If you insist on using your exception, do it like this:
    public class AgeTooOldException extends Exception
        public AgeTooOldException() { super(); }
        public AgeTooOldException(String message)
            super(message);
        public AgeTooOldException(String message, Throwable cause)
            super(message, cause);
        public AgeTooOldException(Throwable cause)
            super(cause);
        try
            String age = JOptionPane.showInputDialog("Please your age");
            int conAge = Integer.parseInt(age);
            if (conAge > 80) //if over 80 error - 80 is a "magic" number - terrible.
                throw new AgeTooOldException("Age is too old, must be less then 120");
        catch (AgeTooOldException ato)
            JOptionPane.showMessageDialog(ato.getMessage(), JOptionPane.ERROR_MESSAGE);
        catch (Exception e)
            JOptionPane.showMessageDialog(e.getMessage(), JOptionPane.ERROR_MESSAGE);

  • Exception Handler Error: Source File Error please help me out

    Hai i have simply added a text field and a button and i am trying to submit the data entered in text field to the database by pressing button.
    It is compiling and running successfully. but when i press the button it is showing that exception handler : Source File error.

    Could you post initial part of the exception displayed in the Error Page. With out it, it is difficult to say what is happening!
    - Winston
    http://blogs.sun.com/winston

  • Exception Handling in Message Mapping and Alert

    Hello,
    1. Pls let me know the concept of Exception Handling and Alerts.
    2. Pls provide some blogs for Exception Handling in Message Mapping.
    3.What are Alerts and how it help us in XI. Pls provide some blogs for Alert
    4.How are Alerts and Exception Handling can be related say for some scenario
    Regards

    Hi,
    Plz check out these blogs of Sravya on Error Handling:
    /people/sravya.talanki2/blog/2006/11/22/error-handling-framework-xiout-of-the-box-episode-1
    /people/sravya.talanki2/blog/2006/11/23/error-handling-framework-xiout-of-the-box-episode-2
    Also check this SAP Presentation:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9418d690-0201-0010-85bb-e9b2c1af895b
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    Error Handling :
    http://help.sap.com/saphelp_nw04/helpdata/en/56/b46c3c8bb3d73ee10000000a114084/frameset.htm
    Alerts:
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step
    http://help.sap.com/saphelp_nw04/helpdata/en/56/d5b54020c6792ae10000000a155106/content.htm
    BPM:
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    Working with acknowledgements
    regards

  • Exception Handling in Stripes framework

    Pls help me to setup the Exception handling...
    1.how to catch the exception occuring in ActionBean method,using our custom
    exception handle method?
    not sure to integrate this both?
    http://stripesframework.org/display/stripes/Exception+Handling
    becas in the example it shows only the MyExceptionHandler class ...how it is
    linked to the method in the ActionBean
    Thanks
    Kris

    The same answer as in: http://forum.java.sun.com/thread.jspa?threadID=5264689

  • Implementing Exception Handling Application Block in custom web parts, event receivers

    hi,
      I am currently implementing try {} catch(Exception expp) { throw expp;} to handle exceptions in my intranet appln.
    I have several custom web parts, event receivers, few console applciations as timer jobs etc. If i want to implement a  robust exception handling what should be  the approach. by searching, i saw, ms patterns n practices provides the
    appln blocks.
    But I think[ pls correct me if i am wrong ] those  appln blocks are meant for asp.net applns ONLY.
    if not, anyone has implemented those appln blocks in SP development? if yes, can anyone provide one sample /  link to implement Exception Handling in SP.
    help is appreciated! 

    Hi,
    Here are some articles for your reference:
    Handling Error Centrally in a SharePoint Application
    http://www.codeproject.com/Articles/26236/Handling-Error-Centrally-in-a-SharePoint-Applicati
    Using Microsoft Enterprise Library Application Block in SharePoint
    http://www.codeproject.com/Articles/21389/Using-Microsoft-Enterprise-Library-Application-Blo
    Exception Handling in SharePoint
    http://spmatt.wordpress.com/2012/02/01/exception-handling-in-sharepoint/
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Recommended Practice for Exception handling in JSP portlets

    Hi,
    This may be a redundant question, but hope to get some feedback on the generally used practice of catching exceptions in a JSP based Portal application.
    Is it okay to just make use of the standard JSP errorpage directive in each of the JSP portlets to point to the same errorpage.jsp. If a problem occurs in any of the portlets, the userfriendly message in the errorpage.jsp would be rendered.
    Of course there could be some kind of error logging done in the errorpage.jsp to track the error stack. This also means, that you would not want to catch any exceptions inside each of the portlet JSPs but rather let the errorpage directive, be the catch all?
    regards
    -Ananth

    Mohana,
    Pls ignore the voice mail,it was for something else and I was able to talk to Peter as well about this.
    Regarding the error/exception handling -
    If the errorPage.jsp is used in each of the JSP portlets with the help of the JPS errorPage directive, if a general system failure or major appln. error occurs, you will get the errorPage.jsp containing the user friendly message to show up in each of the half a dozen portlets on the page!!. Is that allright.
    You cannot really redirect the entire page using the code inside the JSP portlet. It will only render inside the same portlet. The only way you can do this is to use Javascript.
    -Ananth

Maybe you are looking for

  • No phone service after FIOS installation

    Can someone please help me.  We have had no phone service since a crew installed FIOS on part of our street Sept. 20th.  Went through troubleshooting online and final step is to call for help...hard to do since the phone has no dial tone.  

  • Is it possible to block my lost iPhone 4 from being use?

    i lost my iphone 4 yesterday, can apple block it?

  • Nokia C3 Problems after update to v 07.20

    I have updated my C3 and found: 1 Most of .jar software not working, including google maps, games etc 2 Sync with server for back up contacts etc. now not working Please help arshadMEHMOOD

  • Can i connect my canon 7d to my iPad air

    Can I connect my Canon EOS 7D camera to my iPad Air with or without a cable for picture download or remote shooting.

  • Mail.app manual

    Is there a user manual or guide available for the mail app? I do not understand everything that is shown in the left hand pane and how to manage it (except for the inboxes, of course).