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.

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 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.

  • 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

  • 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/]

  • 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;

  • 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 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

  • MC.9 and MCY1 and Exception Handling in (Logistics Inf. Sys)LIS

    Hi,
    I want the 'Valuated Stock Value" greater then or equal to zero (>=) appear in the MC.9 report. I can create 'Exception' in MCY1 but am unable to do so. Once I am in MCY1; I choose 'Requirements' then Key Figure 'Valuated Stock Value' then  'Type of condition' is 'Threshold Val. Anal.' is set to '> 0'. However, the report still displays zero values in MC.9. I don't want to display 'Valuated Stock Value' zero to be displayed on the report. Please help.
    Thanks
    Naved

    Hey Chris,
    I got the point for exception handling in weblogic 9.2. We ae using 9.2. It comes up with the concept of shared page flows which means all my unhandled exceptions are thrown to the shared page flow controller. There based on the type of exception, i can forward the request to appropraite page.
    Thanks anywyas,
    Saurabh

  • Delete Statement Exception Handling

    Hi guys,
    I have a problem in my procedure. There are 3 parameters that I am passing into the procedure. I am matching these parameters to those in the table to delete one record at a time.
    For example if I would like to delete the record with the values ('900682',3,'29-JUL-2008') as parameters, it deletes the record from the table but then again when I execute it with the same parameters it should show me an error message but it again says 'Deleted the Transcript Request.....' Can you please help me with this?
    PROCEDURE p_delete_szptpsr_1 (p_shttran_id IN saturn.shttran.shttran_id%TYPE,
    p_shttran_seq_no IN saturn.shttran.shttran_seq_no%TYPE,
    p_shttran_request_date IN saturn.shttran.shttran_request_date%TYPE) IS
    BEGIN
    DELETE FROM saturn.shttran
    WHERE shttran.shttran_id = p_shttran_id
    and shttran.shttran_seq_no = p_shttran_seq_no
    and trunc(shttran_request_date) = trunc(p_shttran_request_date);
    DBMS_OUTPUT.PUT_LINE('Deleted the Transcript Request Seq No (' || p_shttran_seq_no || ') of the Student (' || p_shttran_id ||') for the requested date of (' || p_shttran_request_date ||')');
    COMMIT;
    EXCEPTION WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('Error: The supplied Notre Dame Student ID = (' || p_shttran_id ||
    '), Transcript Request No = (' || p_shttran_seq_no || '), Request Date = (' || p_shttran_request_date || ') was not found.');
    END p_delete_szptpsr_1;
    Should I have a SELECT statement to use NO_DATA_FOUND ???

    A DELETE statement that deletes no rows (just like an UPDATE statement that updates no rows) is not an error to Oracle. Oracle won't throw any exception.
    If you want your code to throw an exception, you'll need to write that logic. You could throw a NO_DATA_FOUND exception yourself, i.e.
    IF( SQL%ROWCOUNT = 0 )
    THEN
      RAISE no_data_found;
    END IF;If you are just going to catch the exception, though, you could just embed whatever code you would use to handle the exception in your IF statement, i.e.
    IF( SQL%ROWCOUNT = 0 )
    THEN
      <<do something about the exception>>
    END IF;In your original code, your exception handler is just a DBMS_OUTPUT statement. That is incredibly dangerous in real production code. You are relying on the fact that the client has enabled output, that the client has allocated a large enough buffer, that the user is going to see the message, and that the procedure will never be called from any piece of code that would ever care if it succeeded or failed. There are vanishingly few situations where those are safe things to rely on.
    Justin

  • Exception handling is not working in GCC compile shared object

    Hello,
    I am facing very strange issue on Solaris x86_64 platform with C++ code compiled usging gcc.3.4.3.
    I have compiled shared object that load into web server process space while initialization. Whenever any exception generate in code base, it is not being caught by exception handler. Even though exception handlers are there. Same code is working fine since long time but on Solaris x86, Sparc arch, Linux platform
    With Dbx, I am getting following stack trace.
    Stack trace is
    dbx: internal error: reference through NULL pointer at line 973 in file symbol.cc
    [1] 0x11335(0x1, 0x1, 0x474e5543432b2b00, 0x59cb60, 0xfffffd7fffdff2b0, 0x11335), at 0x11335
    ---- hidden frames, use 'where -h' to see them all ----
    =>[4] __cxa_throw(obj = (nil), tinfo = (nil), dest = (nil), , line 75 in "eh_throw.cc"
    [5] OBWebGate_Authent(r = 0xfffffd7fff3fb300), line 86 in "apache.cpp"
    [6] ap_run_post_config(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x444624
    [7] main(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x42c39a
    I am using following link options.
    Compile option is
    /usr/sfw/bin/g++ -c -I/scratch/ashishas/view_storage/build/coreid1014/palantir/apache22/solaris-x86_64/include -m64 -fPIC -D_REENTRANT -Wall -g -o apache.o apache.cpp
    Link option is
    /usr/sfw/bin/g++ -shared -m64 -o apache.so apache.o -lsocket -lnsl -ldl -lpthread -lthread
    At line 86, we are just throwing simple exception which have catch handlers in place. Also we do have catch(...) handler as well.
    Surpursing things are..same issue didn't observe if we make it as executable.
    Issue only comes if this is shared object loaded on webserver. If this is plain shared object, opened by anyother exe, it works fine.
    Can someone help me out. This is completly blocking issue for us. Using Solaris Sun Studio compiler is no option as of now.

    shared object that load into web server process space
    ... same issue didn't observe if we make it as executable.When you "inject" your shared object into some other process a well-being of your exception handling depends on that other process.
    Mechanics of x64 stack traversing (unwind) performed when you throw the exception is quite complicated,
    particularly involving a "nearly-standartized" Unwind interface (say, Unwind_RaiseException).
    When we are talking about g++ on Solaris there are two implementations of unwind interface, one in libc and one in libgcc_s.so.
    When you g++-compile the executable you get it directly linked with libgcc_s.so and Unwind stuff resolves into libgccs.
    When g++-compiled shared object is loaded into non-g++-compiled executable's process _Unwind calls are most likely already resolved into Solaris libc.
    Thats why you might see the difference.
    Now, what exactly causes this difference can vary, I can only speculate.
    All that would not be a problem if _Unwind interface was completely standartized and properly implemented.
    However there are two issues currently:
    * gcc (libstdc++ in particular) happens to use additional non-standard _Unwind calls which are not present in Solaris libc
    naturally, implementation details of Unwind implementation in libc differs to that of libgccs, so when all the standard _Unwind
    routines are resolved into Solaris version and one non-standard _Unwind routine is resolved into gcc version you get a problem
    (most likely that is what happens with you)
    * libc Unwind sometimes is unable to decipher the code generated by gcc.
    However that is likely to happen with modern gcc (say, 4.4+) and not that likely with 3.4.3
    Btw, you can check your call frame to see where _Unwind calls come from:
    where -h -lIf you indeed stomped on "mixed _Unwind" problem then the only chance for you is to play with linker
    so it binds Unwind stuff from your library directly into libgccs.
    Not tried it myself though.
    regards,
    __Fedor.

  • Exception handling for all the insert statements in the proc

    CREATE PROCEDURE TEST (
    @IncrStartDate DATE
    ,@IncrEndDate DATE
    ,@SourceRowCount INT OUTPUT
    ,@TargetRowCount INT OUTPUT
    ,@ErrorNumber INT OUTPUT
    ,@ErrorMessage VARCHAR(4000) OUTPUT
    ,@InsertCase INT --INSERT CASE INPUT
    WITH
    EXEC AS CALLER AS
    BEGIN --Main Begin
    SET NOCOUNT ON
    BEGIN TRY
    DECLARE @SuccessNumber INT = 0
    ,@SuccessMessage VARCHAR(100) = 'SUCCESS'
    ,@BenchMarkLoadFlag CHAR(1)
    ,@BenchmarkFlow INT
    ,@MonthYearStart DATE
    ,@MonthYearEnd DATE
    ,@StartDate DATE
    ,@EndDate DATE
    /* Setting the default values of output parameters to 0.*/
    SET @SourceRowCount = 0
    SET @TargetRowCount = 0
    /*Setting the Start and end date for looping */
    SET @MonthYearStart = @IncrStartDate;
    SET @MonthYearEnd = @IncrEndDate;
    /* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
    @InsertCase =0 means data will be inserted in the target TAB1
    @InsertCase =1 means data will be inserted in the target TAB2
    @InsertCase =2 means data will be inserted in the target TAB3
    @InsertCase =3 means data will be inserted in the target TAB4
    @InsertCase =4 means data will be inserted in the target TAB5
    @InsertCase =5 means data will be inserted in the target TAB6
    if @InsertCase =0
    WHILE (@MonthYearStart <= @MonthYearEnd)
    BEGIN
    SET @StartDate = @MonthYearStart;
    SET @EndDate = @MonthYearEnd;
    /* Delete from target where date range given from input parameter*/
    DELETE FROM TAB1
    WHERE [MONTH] BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
    AND [YEAR] BETWEEN year(@StartDate) and year(@EndDate)
    /*Insert data in target-TAB1 */
    BEGIN TRANSACTION
    INSERT INTO TAB1
    A,B,C
    SELECT
    A,BC
    FROM XYZ
    COMMIT TRANSACTION
    SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
    SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
    END -- End of whileloop
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT>0
    ROLLBACK TRANSACTION
    SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
    END CATCH
    END--End of Main Begin
    I have the above proc inserting data based on parameters  where in @InsertCase  is used for case wise execution.
     I have written the whole proc with exception handling using try catch block.
    I have just added one insert statement here for 1 case  now I need to add further insert  cases
    INSERT INTO TAB4
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    INSERT INTO TAB3
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    INSERT INTO TAB2
                    A,B,C
    SELECT
                                    A,BC
    FROM XYZ
    I will be using following to insert further insert statements 
    if @InsertCase =1 
    I just needed to know where will be my next insert statement should be fitting int his code so that i cover exception handling for all the code
    Mudassar

    Hi Erland & Mudassar, I have attempted to recreate Mudassar's original problem..here is my TABLE script;
    USE [MSDNTSQL]
    GO
    /****** Object: Table [dbo].[TAB1] Script Date: 2/5/2014 7:47:48 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[TAB1](
    [COL1] [nvarchar](1) NULL,
    [COL2] [nvarchar](1) NULL,
    [COL3] [nvarchar](1) NULL,
    [START_MONTH] [int] NULL,
    [END_MONTH] [int] NULL,
    [START_YEAR] [int] NULL,
    [END_YEAR] [int] NULL
    ) ON [PRIMARY]
    GO
    Then here is a CREATE script for the SPROC..;
    USE [MSDNTSQL]
    GO
    /****** Object: StoredProcedure [dbo].[TryCatchTransactions1] Script Date: 2/5/2014 7:51:33 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE [dbo].[TryCatchTransactions1] (
    @IncrStartDate DATE
    ,@IncrEndDate DATE
    ,@SourceRowCount INT OUTPUT
    ,@TargetRowCount INT OUTPUT
    ,@ErrorNumber INT OUTPUT
    ,@ErrorMessage VARCHAR(4000) OUTPUT
    ,@InsertCase INT --INSERT CASE INPUT
    WITH
    EXEC AS CALLER AS
    BEGIN --Main Begin
    SET NOCOUNT ON
    BEGIN TRY
    DECLARE @SuccessNumber INT = 0
    ,@SuccessMessage VARCHAR(100) = 'SUCCESS'
    ,@BenchMarkLoadFlag CHAR(1)
    ,@BenchmarkFlow INT
    ,@MonthYearStart DATE
    ,@MonthYearEnd DATE
    ,@StartDate DATE
    ,@EndDate DATE
    /* Setting the default values of output parameters to 0.*/
    SET @SourceRowCount = 0
    SET @TargetRowCount = 0
    /*Setting the Start and end date for looping */
    SET @MonthYearStart = @IncrStartDate;
    SET @MonthYearEnd = @IncrEndDate;
    /* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
    @InsertCase =0 means data will be inserted in the target TAB1
    @InsertCase =1 means data will be inserted in the target TAB2
    @InsertCase =2 means data will be inserted in the target TAB3
    @InsertCase =3 means data will be inserted in the target TAB4
    @InsertCase =4 means data will be inserted in the target TAB5
    @InsertCase =5 means data will be inserted in the target TAB6
    IF @InsertCase =0
    WHILE (@MonthYearStart <= @MonthYearEnd)
    BEGIN
    SET @StartDate = @MonthYearStart;
    SET @EndDate = @MonthYearEnd;
    /* Delete from target where date range given from input parameter*/
    DELETE FROM TAB1
    WHERE START_MONTH BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
    AND START_YEAR BETWEEN year(@StartDate) and YEAR(@EndDate)
    /*Insert data in target-TAB1 */
    BEGIN TRANSACTION
    INSERT INTO TAB1 (COL1,COL2,COL3)
    VALUES ('Z','X','Y')
    SELECT COL1, COL2, COL3
    FROM TAB1
    COMMIT TRANSACTION
    SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
    SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
    END -- End of whileloop
    END TRY
    BEGIN CATCH
    IF @@TRANCOUNT > 0
    ROLLBACK TRANSACTION
    SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
    END CATCH
    PRINT @SUCCESSMESSAGE
    END--End of Main Begin
    GO
    I am just trying to help --danny rosales
    UML, then code

  • ADF Task Flow Exception Handling

    Hi ,
    I tried a very simple thing for taskFlow exception handling.
    I created a bounded task flow with a page fragment (View1.jsff) and another view which is the TaskFlow ExceptionHandler (error.jsff).
    The view1.jsff has a button whose action is bound to the backing bean. In the backingBean method I deliberately do division by 0.
    Since this is an unHandled exception, I would have expected the control to come to error.jsff. But, instead I am shown a pop up box with the error message.
    Why is the control not getting redirected to error.jsff ?
    Thanks.
    S.Srivatsa Sivan

    Hi Frank , im having the same problem.
    I want to handle exceptions that occur while navigating task flows (example: A user navigates to a task flow that he/she does not have view permission)
    I tried using a view activity and method activity as the exception handler but none of them works, the exception is still not handles. It does not even navigate to the exception handler on the task flow.
    on the view page i have:
    <af:panelStretchLayout topHeight="50px" id="psl1">
    <f:facet name="top">
    <af:panelGroupLayout layout="scroll"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
    id="pgl1">
    Error message:  
    <af:outputText value="#{controllerContext.currentRootViewPort.exceptionData.message}" id="ot2"/>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="center">
    <af:outputText value="#{my_exception_Handler.stackTrace}" id="ot1"/>
    <!-- id="af_one_column_header_stretched" -->
    </f:facet>
    </af:panelStretchLayout>
    I tried getting the error message and stacktrace from the controllerContext via EL like this "#{controllerContext.currentRootViewPort.exceptionData.message}"
    and from the controllerContext class in functions that i have declared in my_exception_Handler class like this
    " ControllerContext ctx = ControllerContext.getInstance();
    ViewPortContext vCtx = ctx.getCurrentViewPort();
    if(vCtx.getExceptionData() != null){
    StringWriter stringWriter = new StringWriter();
    PrintWriter printWriter = new PrintWriter(stringWriter);
    vCtx.getExceptionData().printStackTrace(printWriter);
    return stringWriter.toString();"
    But all this dont even matter because when the exception occurs on the task flow it does not navigate to the default exception handler.
    thanks for your interest and help in advance.
    Cyborg_0912

  • Using Exception Handler in an ADF Task Flow

    Hi folks.
    Today I gave a try on Exception Handling. while i go through the blog.
    https://blogs.oracle.com/ADFProgrammers/entry/using_exception_handler_in_an
    I cant able to attain the Solution 2: Re-Routing the task flow to display an error page As per the Figure 9 i make it out.
    but it is not navigating error.jsff.
    Taskflow return is not working i hope. only Exception thrown only happens from method.
    anyone help me out. what I'm missing ?
    - jdev 11.1.1.6.0

    hi,
    is there anyone help me out of this issue.

Maybe you are looking for

  • How can I use the /home directory

    I'm doing development work on my Mac (running Snow Leopard). The output location for the production server I use is under "/home/subdir". I'd like to develop my files on the Mac so they reside in the same relative location, but from the default insta

  • 1 computer 2 iPhones - How do I manage this?

    Both my wife and I each have an iPhone. We have a large music collection in iTunes. We want to share a single music folder (on a Windows based PC) for all our iPods and iPhones. iPods are easy - we can use single user account (& iTunes) and select wh

  • What went wrong? misuse? abuse?

    ive had my iphone for sometime now, bought it back in june of 2009... had some problems, it was replaced the last time... about a week ago i had been running around from work and other places with no real time to charge my phone, it had gone dead bef

  • New T520 With Dead Pixels

    Hi, I have a new T520 that I have purchased about 30 days ago and it already has some deak pixels on the screen. How can I go about getting these fixed?  Thanks, Josh

  • OCI Catalogs in MM

    Hi Guys, as we all know since ECC6.0 we can use OCI catalogs in MM. I now have a vendor who send me his OCI interface data. I customized the data. Everything is fine. But I now have additions wishes: 1. Integration of multiple catalogs - only the def