How to handle AddressException ...executiuon opf code still continues

Hey buddies ..
I have a Javamail code and i have put taht code in a try cathc block to catch the AddressException ....and i purposely for testing give wrong adddresses ...The thing i am facing is that the exception is caugh but the execution of the rest of the code in the try catch still goes on ...it does not escape execution ....
for eeg my code has ten lines of code ....the address exception occurs in the 5th line ...the execution of the rest of the 5 lines does not stop ..it still continues ....
This pecukliar situation i am facintg with only addressExceptin...please can someonetell me how do i catch and handle this exception and how can i stop the execution of the rest of the lines of code ...
thatrnks a lot guys
Nihkil

It's kind of hard to tell if you don't post some actual code. However, if you're doing something like this: do something
do more
try {
   do address stuff
catch (AddressException exc) {
    do nothing, except maybe log it
do next thing Then the problem is that you're misunderstanding how exceptions work. If an exception occurs, then the closest enclosing try block ends, and, if there's a catch block for that exception, then whatever comes after the catch is executed as if nothing when wrong.
If you want that sequence of steps to stop when an exception is encountered, either don't catch the exception, or change you code thusly: try {
    do something
    do more
    do address stuff
    do next thing
catch (AddressException exc) {
    handle, log, whatever
} Also, check out the exception tutorial:
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html

Similar Messages

  • How to handle SQL code for Daylight Savings for MST Time zone

    Hi,
    1. My time zone is MST. My data showing differently as day light saving started from November. Please help me how to handle these issue.
    2. After Mar 09 2014 Daylight saving going to end.( For this how to handle in the SQL codes)
    Please answer for the above 2 doubts.
    Thanks in advance.
    Regards,
    LuckyAbdul

    Hi Abdul,
    Daylight saving is basically like switching to another timezone. If your normal time zone is Mountain Standard Time (MST), you will switch to Mountain Daylight Time in the summer.
    If daylight saving or timezones are a concern. It is best to store your dates in a DATETIMEOFFSET(0) column. This data type includes the offset between your selected timezone (MST or MDT) and UTC. The offset between MST and UTC is -7 hours and the offset
    between MDT and UTC is -6 hours.
    Be sure to datetimeoffset(0) and not just datetimeoffset. datetimeoffset(0) uses 8 bytes to store it's data (same as datetime), but datetimeoffset uses 10 bytes. This is especially important if you are going to index this column.
    Also be sure to use a similar data type in your application or the timezone information will be lost. If it is an .Net application you should use The DateTimeOffset type. Most other programming languages have equivalent types.
    Hope this helps. If you have anymore questions please let me know.
    For more information see:
    http://msdn.microsoft.com/en-us/library/bb630289.aspx
    http://msdn.microsoft.com/en-us/library/ms187819.aspx
    http://msdn.microsoft.com/en-us/library/system.datetimeoffset%28v=vs.110%29.aspx

  • How to Handle ArrayIndexBoundException

    Hi
    How to Handle ArrayIndexBoundException in my code.
    Though it is Unchecked Excption.

    Hi
    How to Handle ArrayIndexBoundException in my code.
    Though it is Unchecked Excption.By checking your indexing before it gets to the VM.
    It's called: Proper usage of "conditional" statements, you know, like an "if" statement?
    if (index >= myArray.length)
    // don't try to access myArray[index] here
    else
    // safe! (assuming index is also >= 0)
    }

  • How to handle multiple exceptions by the same code?

    Hi, all:
    In my situation I want AException and BException handled by the same code, while CException and DException handled by another code. How can I write my try-catch code in a simple way? Of course I can do the following:
    public void TheMainFunction() {
        try {
        } catch (AException e) {
            Handle_AB();
        } catch (BException e) {
            Handle_AB();
        } catch (CException e) {
            Handle_CD();
        } catch (DException e) {
            Handle_CD();
    private void Handle_AB() {
    private void Handle_CD() {
    }But is there a simpler way?
    Thanks in advance.

    If you have one or two places in your code that need multiple exceptions, just do it with multiple catch statements. Unless you are trying to write the most compact Programming 101 homework program, inventing tricks to remove two lines of code is not good use of your time.
    If you have multiple catches all over your code it could be a code smell. You may have too much stuff happening inside one try statement. It becomes hard to know what method call throws one of those exceptions, and you end up handling an exception from some else piece of code than what you intended. E.g. you mention NumberFormatException -- only process one user input inside that try/catch so it is easy to see what error message is given if that particular input is gunk. The next step of processing goes inside its own try/catch.
    In my case, the ArrayIndexOutOfBoundsException and
    NumberFormatException should be handled by the same way.Why?
    I don't think I have ever seen an ArrayIndexOutOfBoundsException that didn't indicate a bug in the code. Instead of an AIOOBE perhaps there should be an if statement somewhere that prevents it, or the algorithm logic should prevent it automatically.

  • How to handle source code changes in apex

    hi all,
    can anybody help me plz...
    how to handle source code changes in apex.
    which development process is best suite for apex.
    Regards
    Alekh

    Thanks Andy, so as per the suggestion we have to handle the above snippet as individual if block statements as i had shown below.
    But in this case how we show the else part as NULL.
    correct me if my understanding is wrong.
    if  'Products' in (:P1_ENG_GRP1, :P1_ENG_GRP2, :P_ENG_GRP3) then
                    lv_to_email_id :='[email protected]';
    end if;
    if  'Materials' in (:P1_ENG_GRP1, :P1_ENG_GRP2, :P_ENG_GRP3) then
               lv_to_email_id :='[email protected]';
    end if;Thanks,
    Anoo..

  • How to handle area code split

    It's looking like the phone company is going to split our area code in the next year or two.  This is because there are not enough numbers left, so there's a good chance that one part of the geographical area using the current area code will be assigned a new 3-digit code.
    I am trying to figure out how to handle this in my OSX, iOS and iCloud world.  If I could select all the contacts with the existing area code and export them to a tab-delimited file, I'd stand a good chance of selecting the ones that need to be changed and then doing a "find and replace all" operation in Exel or Numbers.  But I'm not seeing that as an option. 
    It would really be OK for me if there were "an app for that" so I could do the work on my iPad and let iCloud take care of my other devices.  But I'm not seeing that as an option either.
    Does anyone have good esperience or suggestions on how to handle this?

    Integer is a final class, it can not be extended. So, you could as well write:
    SortedSet<Integer> set = new TreeSet<Integer>();
    Comparator<? super Integer> c = set.comparator();
    c.compare(new Integer(5), new Integer(5));On the other hand, If you were thinking of a set allowing different kinds of numbers, this is what you might be looking for.
    SortedSet<? super Number> set = new TreeSet<Number>();
    Comparator<? super Number> c = set.comparator();
    c.compare(new Integer(5), new Long(5));Why it must be "super" instead of "extends" is explained by [PECS rule|http://stackoverflow.com/questions/2723397/java-generics-what-is-pecs].

  • How to handle such code: ? super ? extends Type

    Hi I faced of a problem which I don't handle:
    SortedSet<? extends Integer> set = new TreeSet<>();
    Comparator<? super ? extends Integer> c = set.comparator();//how to handle such code?
    ...Best Regards
    Andrej

    Integer is a final class, it can not be extended. So, you could as well write:
    SortedSet<Integer> set = new TreeSet<Integer>();
    Comparator<? super Integer> c = set.comparator();
    c.compare(new Integer(5), new Integer(5));On the other hand, If you were thinking of a set allowing different kinds of numbers, this is what you might be looking for.
    SortedSet<? super Number> set = new TreeSet<Number>();
    Comparator<? super Number> c = set.comparator();
    c.compare(new Integer(5), new Long(5));Why it must be "super" instead of "extends" is explained by [PECS rule|http://stackoverflow.com/questions/2723397/java-generics-what-is-pecs].

  • Timeline: How to handle a still like a clip?

    I would like to paint on a clip I generated from a still.
    Now I can´t use the OnionSkins and if I paint my brushstroke
    is on the whole clip not only the first frame.
    Do you know any workaround?
    Thanks,
    Timo
    I´m working with CS6 on a Mac

    timolefronque wrote:
    Timeline: How to handle a still like a clip?
    I would like to paint on a clip I generated from a still.
    Now I can´t use the OnionSkins
    and if I paint my brushstroke is on the whole clip not only the first frame.
    Do you know any workaround?
    I'm having a problem understanding what you have written I use a PC not a Mac it may be a nomenclature thing.
    "I would like to paint on a clip I generated from a still."
      It sounds like you have created a clip.  What file format is this clip of yours.
      "Now I can´t use the OnionSkins"
      What are OnionSkins and where did they come from.
    "if I paint my brushstroke is on the whole clip not only the first frame."
    What in Photoshop did you paint on.  I just don't understand what your Photoshop active document looks like. Can you post a screen capture of Photoshop with your active document with Photoshop panels visible in the screen capture.

  • How to handle "Validation failed for the field - Tax code" issue?

    We had mass uplaod the order that create on Mar with tax code effective date on Apr. Now we would like return on this order  and getting error of "Validation failed for the field - Tax code". How to handle this issue?

    Hi
    You will have to check if the Tax_Code of RMA being received is the same as the one in the related sales order.
    If not you will need to use the same tax_code.
    Refer below document : Doc ID 1584338.1

  • How to handle null values in RTF templates

    Hi - I have two groups in a report for different SQL and two formulas for each group, CF_ELE_CNT and CF_ELE_CNT1. In the template I use the below code to print or not print a section.
    <?if:number(CF_ELE_CNT +CF_ELE_CNT1) >0?>    
    The problem is when there is no data in the second group its not creating the XML tag for CF_ELE_CNT1, though CF_ELE_CNT has 13, it still does not print that partucular section. If I remove CF_ELE_CNT1 from the condition it works fine. I was wondering how to handle this.
    Any help would be appreciated!!
    Thanks,
    Rav

    Hey Rav,
    You can add a check to identify it the element/tag is present or not
    <?if:(CF_ELE_CNT1)?> will give true, if the element is present otherwise falsesince you are adding the two elements, you have to add a or condition.
    <?if:(CF_ELE_CNT and number(CF_ELE_CNT) >0 ) or ( CF_ELE_CNT1 and CF_ELE_CNT1 >0)?>

  • How To Handle Error Message In TCD Recording?

    Hi All,
      I tried recording a transaction (my own transaction) by not enterring value in an obligatory field. the error message came. but when i executed the script, it showed an error. but actualy, the error message was expected right? how to handle this situation? i tried with tcd and sapgui recording. both gave almot the same result.
      i am including the script which i have written.
    MESSAGE ( MSG_1 ).
    *TCD ( ZCUST , ZCUST_1 , ECC ).
    SAPGUI ( SAP_1 , ECC ).
    ENDMESSAGE ( E_MSG_1 ).
    v_mno = &tfill.
    v_msg = E_MSG_1[v_mno]-msgtext.
    v_mtp = E_MSG_1[v_mno]-msgtyp.
    If Msg Type is E *** **** It Has To Be E ****
    IF ( v_mtp = 'E' and v_msg = 'Account no AC02 does not exist EXIT = X').
    logtext(0,'Passed').
    ELSE.
    log(v_mtp).
    log(v_msg).
    logtext(1,'Failed').
    ENDIF.
    End Of The Condition For Message Type E ******

    I have recording messages using the TCD command.
    My script (very simple):
    MESSAGE ( MSG_2 ).
    TCD ( ME21 , ME21_1 , R3 ).
    ENDMESSAGE ( E_MSG_2 ).
    In the MESSAGE command interface, I defined rules to allow several kind of messages.
    Execution: 3 mesages found:
          * transform PR into PO
           MESSAGE     MSG_2 [1,009 sec]
             RULES  MSG_2 = XML-DATA-01
            Message  MODE  EXIT  TYPE  ID    NR
            [1]      'A'         'I'   06    456
            [2]      'A'         'W'   'ME'  080
            [3]      'A'         'E'   'ZE'  029
             TCD    ME21                 [0,545 sec N] Target sys R3 -> ZDA010A219
            S06017 Standard PO created under the number 8201075606
               Tgt System Z_A219->R3->ZDA010A219 (ZDA 010 ... HP-UX ORACLE)
               CALL TRANSACTION ME21 ME21_1 XML-DATA-01
               03 MESSAGES FROM ME21 ME21_1 XML-DATA-01
               I  06 456 Release effected with release code 00001
               W  ME  080 Delivery date: next workday is 02.05.2007
               S  06 017 Standard PO created under the number 8201075606
           ENDMESSAGE  E_MSG_2 (&TFILL = 0)
    As you can see, 3 messages are found but the &TFILL variable is still 0.
    I guess (but cannot test yet) I would manage to record those messages using SAPGUI command.
    Is there anything wrong with my script?
    My SAP_BASIS component is in version 620. I'm not using the ultimate version of eCATT (no WEBDYNPRO command, etc.). Could it be an explanation?
    Thank you in advance,
    Olivier

  • How to handle the dynamic rows in pdf table

    Dear All,
    earlier i posted one thread reagarding getting pdf table data
    [facing problem while getting interactive form table data;
    this is working fine, i sued bind_table in wddoinit, but here i am fixing the rows count and bind_table.
    for example i have initially taken row count as 3 then i want to increase the rows in pdf table.
    i know we can use the formcalc to increase the rows by taking a button in pdf layout.
    this also working, but the data is not picking for newly added rows, i hope the problem is because the table node in the context is not binded for this new rows.
    even i tried using with webdynpro native button controlls still not working.
    any one help me what exactly this bind_table is doing and how to handle this code in form calc.
    since my table is pdf table.
    Thanks,
    Mahesh.Gattu

    Hi Thomas,
    Thanks for your confirmation,
    i have checked the paramets of submit button we have only wdevent parameters they are
    CL_WD_CUSTOM_EVENT
              PARAMETERS - Hashed table having 2 columns
              ID     ->IF_TDS (Interactive Form element Name)
             CONTEXT_ELEMENT     ->->
    these are same in case of submit button1 and submit button 2.
              NAME - Name of the Button Event i.e ON_SUBMIT (  this is also same in both the buttons).
    so i think it is not possible to work with multiple buttons by assinging to multiple tables on form.
    The other option is to place the buttons outside of the forum in the surrounding WDA area.
    This way you have no problem handling the events.
    in wddoinit if i use bind_table with 5 rows form table is populating with 5 rows, but when i take a button
    out side the form and use bind_table by incremeting the rows the pdf table rows are not adding, if i enter
    some thing on pdf table then click on add row button then the table rows are getting add. if i don't do any
    action on pdf table and click on add row button pdf is not getting update.
    is there any issue.. if i don't keep cursor on table and type some thing.. the add button is not updating
    the rows.
    if i take a  button on wd view i.e outside the form and use bind table i shall add the rows.. but in case of remove rows how to do.
    in case of normal table we can use Remove_Element( ) but how can i know the selected row from the pdf table, please help me in this concern also.
    Regards,
    Mahesh.Gattu
    Edited by: Maheshkumar gattu on Jan 7, 2009 3:57 PM
    Edited by: Maheshkumar gattu on Jan 7, 2009 4:03 PM
    Edited by: Maheshkumar gattu on Jan 7, 2009 5:21 PM

  • How to handle an Oracle error

    I want to handle an Oracle Error in my code where the "execute immediate" statement comes to play.
    My code goes against several tables
    ID_TABLE_08
    ID_TABLE_07
    ID_TABLE_06
    If table does not exist in database (ie: ID_TABLE_05) I get : Oracle Error ORA-0942 table or view does not exist.
    How can I capture and handle this error so
    1. The code will continue to run getting the next value
    2. The bad record still will get written in to a table called bad_table.
    v_year := TO_CHAR (pp_eff_dtg (indx), 'yy');
    BEGIN
    EXECUTE IMMEDIATE
    'SELECT DISTINCT ID_number
    FROM ID_TABLE_'|| v_year||'
    WHERE NAME = :NAME
    AND EFFECTIVE_DATE = : EFFECTIVE_DATE
    INTO v_ID_number
    USING pp_NAME (indx),
    pp_eff_dtg (indx);
    GOTO END_LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    GOTO INSERT_ADD_RECORD;
    END;
    Thank you for your help!

    if you want to handle a specific oracle error number you can also declare an exception, match that exception to the error number and handle it.
    Like this (not syntax checked)
    declare
      e_table_does_not_exist exception;
      pragma exception_init (-942,e_table_does_not_exist); -- I hope I got the parameters in the right order
    begin
       EXECUTE IMMEDIATE('select * from ID_TABLE_'|| v_year||' where ...');
    exception
       when e_table_does_not_exist then -- handle specific error
           raise_application_error(-20001,'The table ID_TABLE_'|| v_year||' could not be found. Next time enter a valid year!');
    end;

  • How to handle table type record in OAF

    Hi ,
    Req:
    There is a search page that can be accessed from different locations .
    The result set should be different when accessed from each location .
    Approach to be used :
    Call a PL/SQL api which returns a table type input parameter for different search conditions . Each record that is returned by the table type input needs to be iterated and a new row should be created in a transtient VO to show results on the UI
    Problem :
    How to handle to table type input returned from pl/sql in java and show the results?
    Thanks in advance.

    There is a requirement to fetch records from cursor into a collection .Following is the code snippet that I have used.
    /** creating an object **/
    CREATE OR REPLACE TYPE XXCRM_GBL_DSW_AUDIT_RSTLS_O_TP AS OBJECT (
    CUSTOMER_NAME VARCHAR2(360),
    PROJECT_NAME VARCHAR2(40),
    BOARD_NAME VARCHAR2(40),
    ARROW_UNIQUE_NO NUMBER,
    FIELD_NAME VARCHAR2(2000),
    OLD_VALUE VARCHAR2(2000),
    NEW_VALUE VARCHAR2(2000),
    USER_ID NUMBER,
    USER_NAME VARCHAR2(100),
    AUDIT_DATE DATE,
    AUDIT_TYPE VARCHAR2(1),
    SUPP_SYS_LAST_UPDATE_ON DATE,
    SUPP_TRACKING_NUM VARCHAR2(50),
    CONSTRUCTOR FUNCTION XXCRM_GBL_DSW_AUDIT_RSTLS_O_TP
    RETURN SELF AS RESULT
    /** initializing the object **/
    CREATE OR REPLACE TYPE BODY XXCRM_GBL_DSW_AUDIT_RSTLS_O_TP IS
    CONSTRUCTOR FUNCTION XXCRM_GBL_DSW_AUDIT_RSTLS_O_TP
    RETURN SELF AS RESULT IS
    BEGIN
    self.customer_name := fnd_api.g_miss_char;
    self.project_name := fnd_api.g_miss_char;
    self.board_name := fnd_api.g_miss_char;
    self.arrow_unique_no := fnd_api.g_miss_num;
    self.field_name := fnd_api.g_miss_char;
    self.old_value := fnd_api.g_miss_char;
    self.new_value := fnd_api.g_miss_char;
    self.user_id := fnd_api.g_miss_num;
    self.user_name := fnd_api.g_miss_char;
    self.audit_date := fnd_api.g_miss_date;
    self.audit_type := fnd_api.g_miss_char;
    self.supp_sys_last_update_on := fnd_api.g_miss_date;
    self.supp_tracking_num := fnd_api.g_miss_char;
    return;
    END;
    END;
    /** creating a collection of object**/
    CREATE TYPE XXCRM_GBL_DSW_AUDIT_RSTLS_C_TP AS TABLE OF XXCRM_GBL_DSW_AUDIT_RSTLS_O_TP;
    /**Inside the package body **/
    CURSOR c_proj_cur is
    SELECT NULL CUSTOMER_NAME,
    (SELECT project_name
    FROM xxcrm_gbl_dsw_projects_all
    WHERE project_id = xgda.project_id) PROJECT_NAME,
    DECODE(xgda.board_id,NULL,'test',
    (SELECT board_name
    FROM xxcrm_gbl_dsw_boards_all
    WHERE board_id = xgda.board_id)) BOARD_NAME,
    DECODE(xgda.internal_dwr_id,
    NULL,NULL,
    (SELECT internal_dwr_id
    FROM xxcrm_gbl_dsw_regstrations_all
    WHERE internal_dwr_id = xgda.internal_dwr_id)) ARROW_UNIQUE_NO,
    fielslu.meaning FIELD_NAME,
    xgda.old_value OLD_VALUE,
    xgda.new_value NEW_VALUE,
    xgda.created_by USER_ID,
    'kuldeep' USER_NAME,
    xgda.Creation_Date AUDIT_DATE,
    xgda.audit_Level AUDIT_TYPE,
    SYSDATE SUPP_SYS_LAST_UPDATE_ON,
    't001' SUPP_TRACKING_NUM
    FROM XXCRM_GBL_DSW_AUDIT_ALL xgda ,
    FND_LOOKUP_VALUES_VL fielslu
    WHERE xgda.project_id =174
    AND fielslu.lookup_type = 'XXCRM_DSW_REV_FIELD_NAMES'
    AND fielslu.lookup_code = xgda.FIELD_NAME
    AND enabled_flag = 'Y'
    AND TRUNC(SYSDATE) BETWEEN TRUNC(NVL(fielslu.start_date_active,sysdate))
    AND TRUNC(NVL(fielslu.end_date_active,sysdate))
    ORDER BY xgda.creation_date;
    Tab XXCRM_GBL_DSW_AUDIT_RSTLS_C_TP ;
    BEGIN
    OPEN c_proj_cur;
    LOOP
    FETCH c_proj_cur BULK COLLECT INTO tab; --ERROR type mismatch found at 'TAB' between FETCH cursor and INTO variables
    END LOOP;
    END;
    /**Error */
    When the above script is executed it gives an error “type mismatch found at 'TAB' between FETCH cursor and INTO variables” (at line highlighted above).
    I have validated the data type of cursor and object too. But still the error is not resolved .
    Did anyone of you come across a similar requirement, fetching the values from cursor into a collection? Please help.

  • How to handle write errors in non blocking sockets

    Hi,
    I'm using sockets registered with a Selector for read operations. I've seen code examples that put the SocketChannel in non blocking mode before registering it with the selector, and in fact not doing so would cause an IllegalBlockingModeException to be thrown.
    My problem is that I can't handle write errors. The call to write() returns inmediately without throwing any exception. Even worse, when the network timeout expires the selector wakes up and I get an exception on read(). So I can't tell the difference between a real read error and a write error.
    What can I do? Is there a magic method I haven't heard about?
    Thanks

    ejp wrote:
    OK, so what happens is this: you write from your ByteBuffer; if there is room in the socket send buffer, the data is transferred and the transfer count is returned. (If there isn''t, the write returns zero and nothing has happened.) Your application code then continues. Meanwhile TCP is trying to send the data in the send buffer and get an ACK from the peer. If the peer is down as per your test, eventually those write attempts will time out. You will then get a connection reset exception on the next read or write.
    Even worse, when the network timeout expires the selector wakes upCorrect, to tell you there is an error condition pending. This is good, not bad.You're right. This way my program can know that something happened.
    But I still don't understand what the difference between a failed write() and a failed read() is. I mean, the error condition may appear during a send attempt, or it may appear after sending. In both cases I get an error when trying to read. How can my program know if data have been received by the other end?
    Do I have to implement ACK messages in the application level protocol??? It'd be nice if TCP could do this for me...

Maybe you are looking for