VisualAge for Java - generated error handling code

The code that VAJ generates to handle errors is getting on my nerves, and I'd like to know if someone else is experiencing this difficulty.
It's not possible to specify which exception you're handling. The generated catch code produced is of the form below:
catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
This rules out any attempt to handle specific exceptions in a try catch block such as:
try {
} catch (java.sql.SQLException e) {
} catch(java.io.IOException e2) {
It also prevents the very useful compiler errors you get when you ignore certain exceptions, because they all end up caught in the Throwable section.
I know I can partially go around this with RTTI, or even worse, by cleverly coding the user code sections, such as in:
try {
// user code begin {1}
// user code end
[...] myCode(); [...]
// user code begin {2}
} catch (SQLException e) {
[...] myCatchCode(); [...]
// TRICKY BIT - NOTICE THE user code end
// This actually does nothing, but rids me of the
// default catch block
try {
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
// user code end
handleException(ivjExc);
Anyone with this trouble? How do you go around it?

Actually, from what I could tell, you can actually program almot entirely by resorting to the visual programming tool. Better said than done, of course, because a good deal of coding would end up being less practical than actually typing. And the tangling of connections would be ridiculous. But with some more fine tuning of these features, IBM might end up with a very, very effective visual tool, especially if you do your own programming with this in mind.
Specifically, I'm doing some database programming and I'd like to handle SQLExceptions differently than all the other "Throwable" ones. In particular, I'm getting a bunch of records when a JFrame is windowOpened, and if there's an error I'm showing a window that details the list of database errors that occurred (each SQLException allows access to the next in the list through getNextException(), so I'm adding all of these to a JList). This window is a DetailSQLExceptionDialog which extends DetailThrowableDialog (a class of mine which adds a Throwable's message to a list).
The actual code where I get the records is below. Don't bother with the details, but as you can see I had to use "instanceof" to figure out what class I'm getting as an exception.
* connEtoM2: (MasterFrame.window.windowOpened(java.awt.event.WindowEvent) --> fctMasterTableModel.setListOfRecords(Ljava.util.ArrayList;)V)
* @param arg1 java.awt.event.WindowEvent
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void connMasterFrame_WindowOpened(java.awt.event.WindowEvent arg1) {
try {
// user code begin {1}
// user code end
getumMasterTableModel().setListOfRecords(Master.getAllRecords(conn));
// user code begin {2}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {3}
if (ivjExc instanceof SQLException) {
MessageWithDetail.show(
"Error getting the records.",
new DetailSQLExceptionDialog((SQLException) ivjExc, this, getTitle(), true),
this,
getTitle());
dispose();
} else {
MessageWithDetail.show(
"Error getting the records.",
new DetailThrowableDialog(ivjExc, this, getTitle(), true),
this,
getTitle());
dispose();
return;
// user code end
handleException(ivjExc);
It's still not a good solution because since the actual "catch" part has a "throwable" in it, which catches EVERY exception, since Throwable is The Mother Of all Exceptions, I wouldn't get the compiler error for not handling the SQLException. In fact, I'm not aware of what kind of errors can be raised by the class/methods I'm using, unless I delve into all the docs and that can be a daunting task. Basically, the help that the compiler would give me pointing those exceptions as not caught, which is so nice in Java, is gone with the wind.
:-P

Similar Messages

  • " loading failed please check your page for  java script errors" please Help

    recently my project starts crashing.... when it loads it gives a java scrip error .. saying " loading failed please check your page for  java script errors"

    Hey, If you have an error, you should see the error in Edge and you can correct it. In the window/code there will be a red dot too.

  • Step by Step documents for Process Chain Error Handling with Screen Shots

    Hi
    Is anybody having Step By Step Documents for Process Chain Error Handling with Screen Shots ?. Please forward it to me to my e-mail [email protected] .  I will reward points to u immediately.
    bye
    Aamira Khan

    Hi,
    You can find lots of topic related to process chain issues in SDN.Please make a search in SDN.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_library&query=process+chain&adv=true&sdn_author_name=&sdn_updated_on_comparator=ge&sdn_updated_on=&sortby=cm_rnd_rankvalue
    Regards.

  • Visualage for java to Eclipse migration tool.

    Hi
    Here im trying to convert Visualage for java to Eclipse.I exported all the project in Visualage for java to Eclipse.
    I can get the output of project perfectly ,but the main problem is Visual Editor is not coming properly.
    I just tried 3.1,3.2,3.4 Eclipse versions.
    I couldn't able to get any tool for migration.Is there anything is avaliable .
    Other wise i have to go for some other way .
    U have any qns regarding this issue , plaese u can ask ...
    Thanks.
    Jai
    Email : [email protected]

    @ jwenting
    Hi jwenting
    I just tried 2.0 Eclipse but that is also creating same issue .I want to know any other way to deal.
    please can u just give me some suggestion.
    thanks
    jai.

  • DML error table intermittently fails to generate error handling in package

    Hi!
    In OWB 11gR2 (11.2.0.1), we're seeing an issue when setting the DML Error table name on a target table. Sometimes, mostly on older and complex mappings, the error handling logic does not get generated when we deploy the mapping, and nothing is populated in the error tables for error conditions, though the errors display as warnings in the OWB UI.
    When I create a new mapping that is very simple - one table loading another - setting the DML Error table name always results in errors being put in the error table. That's great, but that doesn't help us with our more-complex mappings that aren't logging errors.
    We can't determine the cause of the issue. I can't see a difference in the configuration of the mappings that work and don't work. Generation Mode is All Operating Modes. Default Operating Mode is Set based fail over to row based. We've generated the error table using DBMS_ERRLOG.CREATE_ERROR_LOG. The target tables do not have primary keys.
    I've tried synchronizing the target table operator in the mapping as another forum thread suggested. No change.
    Has anyone else seen this issue or know of a workaround?
    Thanks,
    Jayce

    Which logic did you talk about ?
    For the version 10, you will find the error table more on the insert statement such as:
    INSERT INTO "TSALES"
      ("PROD_ID",
      "SALES"."AMOUNT_SOLD" "AMOUNT_SOLD"
    FROM
      "SALES"  "SALES"
    LOG ERRORS INTO TSALES_ERR (get_audit_detail_id) REJECT LIMIT 50;Come from here:
    http://blogs.oracle.com/warehousebuilder/2007/08/set_based_errors_dml_error_log.html
    Then check the insert SQL generated.
    Cheers
    Nico

  • Parser for Java---namespace error

    When I try to run the sample program to translate an xml doc using the sample xsl file, I get errors indicating not in namespace. This sounds like some kind of environment problem....but I don't have a clue what? This is on NT, with the Oracle parser for java .....any ideas what I'm missing?

    Change the namespace declaration in XSL to:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    I think you're sample is using the old namespace before XSLT1.0 came out.

  • Borland VisiBroker for java meet error when Installed Oracle 8i(V8.1.6)

    Oracle modified some register key value of Java Runtime
    Evironment which result in Java2IDL.exe's runninng error. I
    fixed the value in /software/javasoft/java runtime environment
    and reset the currentversion key to 1.3. Oralce use jre1.1.7.
    Can oracle meet errors when change it to sun jre1.3.1? May
    upgrade oracle jre1.1.7 to high version ? Tell me how to. Please
    tell me where to download If Oracle can't use Sun JRE1.3 . How
    can I deal with this problem and let VisiBroker for java and
    VisiBroker for C++ work well?
    Best Regards

    Hi,
    I am not aware of a sqlplus v8 for macosx so the nonexistence of it might be your problem. The way I remember it, there are sqlnet libs that are usable from other apps. What you could do is install the v9.2 developers release. This contains sqlplus and in that case just make sure the directory containing sqlplus is in your PATH (you also need a few other environment variables; they are set in DBENV).
    Ronald.
    http://ronr.nl/unix-dba

  • Equivalent for IBM specific Error handling routines

    Hi,
    There is a couple of IBM specific error handling routines - AFHCEEN (CEE3SPM) and XUFLOW in our FORTRAN source code which suppresses the overflow and underflow exceptions. Is there any equivalent of these routines available in SUN Solaris O/S ?

    Yes, there are two ways to do it. First, if you simply want to suppress those exceptions throughout the code you can compile with -ftrap=%none.
    If you need to be able to turn off those exceptions temporarily, then you can use the IEEE_EXCEPTIONS module, which is part of the Fortran standard (and thus ought to be portable). Here is an example:
    use ieee_exceptions
    real x
    integer status
    logical m
    call get_command_argument(1, status=status)
    if (status .eq. 0) then
       print *, 'Enabling signals'
       m = .true.
    else
       print *, 'Disabling signals'
       m = .false.
    end if
    call ieee_set_halting_mode((/ ieee_overflow, ieee_underflow, ieee_inexact /), m)
    x = 0.1
    do while (x .ne. 0.0)
       x = x / 2.0
    end do
    endYou should be aware, though, that the standard requires the halting mode to be saved on entry to a procedure and restored on exit. Therefore, you cannot write a subroutine whose purpose is to change the halting mode in the procedure that calls it.

  • Nees for better SQL error handling???

    Hello everybody!
    I am having problems with identifying the reason why SQLExceptions are thrown. What I mean is that the reason is stored in the sql state and the sql code variables. As far as I know, this sql code may be platform dependent which makes the whole mechanism somehow hard to use.
    I simply miss sublasses of the SQLException like - DuplicateEntrySQLException, ForeignKeyConstraintFailureSQLException, ...
    - I think this approach would be far too way natural and obvious.
    My question is: does anybody know about a package or something like that which would implement a kind of "re-thrower" class which would consume the SQLException, inspect it and based on the exception's state it would throw a nice exception in the sense described above?
    Thank you!
    Cheers,
    Miro

    Why not check the data beforehand only?
    Normally I have a validate method in which I run a check on the data submitted by the user. there I see if the Data is violating any of the foriegn key, unique constraints or length of the field.
    I don't insert the data first into the DB without any validation.
    If you don't do this, then there is no way for you to know whether the problem occurred because of the data provided by the user or because the DB is having system level or n/w level problem.
    On the fly analysis is not possible because a DB (ex. oracle, sql server) each is capable of throwing ten thousand kind of errors. you really can't translate it by a package.
    So the best way to handle your situation is that validate the data first. If there is a problem report it to the user. If validation suceeds then go ahead with the insert, update command.
    If the user still gets an SQLException then it assume a system level error and display message like "Foo Portal is temporarily unavailable. Kindly call 4343343 in case of emergency"
    Test your system pretty well specially the validation logic so that you don't display the sys unavailable message when the DB is available but the data has errors.
    hope this helps.
    regards,
    Abhishek.

  • Steps for ALE/EDI error handling using workflow

    Hi
    I need to handle errors in outbound IDoc generation using workflow. Can you please let me know the steps to be used for this. Step-by-step answer would be appreciated.
    Thanks

    Seetha,
    I have this already..
    IDOCPACKET                                                           
    Object type                         IDPKWMMBXY             
    End event                           MASSINPUTFINISHED      
    IDOC                                                          
    Object type                         IDOCWMMBXY             
    Start event                         INPUTERROROCCURRED     
    End event                           INPUTFINISHED          
    Application object                                                                      
    Object type                         BUS2017                           
    Start event

  • Seeking help for VisualAge for Java

    Hi,
    I am using VisualAge 3.5 Professional version to develop Java applications. But I don't know how to build an independent Java application that I can run it outside VisualAge. Can someone give me some tips? THanks!
    I can build an application, and I can run within VisualAge, but when I try to export it, I can only choose either ".class" or ".java" file, so is it possible for me to build an independent ".exe" file from VisualAge? Because if I want to submit an software to a customer, I can't require him to install VisualAge, so what I can do?
    Thanks a lot!

    Hi!
    - Right click on project
    - Select export
    - Select Jar flie
    - Give Path and Name of Jar file
    - Export!
    Execute jar File.... :-)
    I dont have Visual Age Installed on my machiene at the moment, so there could be a step missing.... :-S
    Plus you can also export your whole project out at class files and directly execute your class file, but thats not a good approach for deploying to the client side.
    Hope this helps
    Regards
    Omer

  • Is "IBM VisualAge For Java" any good ?

    Considering getting IBM's VAJ for our systems development team.
    I just thought I'd get peoples thoughts on it. All comments welcome !

    VAJ works just fine as long as you give it enough
    memory. But make sure you get training for your team,
    because its online help is almost totally useless.I would definitely agree with that. VAJ has a lot of nice features, but it also has a lot of things that can be really annoying, esp if you haven't had the training.
    My biggest annoyance with it is that I can't get my hands on the source code without exporting it. You can kind of work around this by using the source view, but the source view won't tell you where/if there are "doh!" type compile errors--you need to look at the workbench. And you can't see line numbers, so if you get a stack trace with a line number you can't just scroll to it. (You can hit CTRL-G to pop up a dialog to jump to it, though.)
    I also haven't gotten the PVCS integration to work right yet, which makes check out-edit-check in a hassle. It supposedly works, but when you're in a development mode it's hard to find time to play with your tools. =^p

  • Setting classpath in IBM VisualAge for Java Programming

    Hai,
    How to set classpath in IBM visualAge3.5 to run the Java programs
    Please respond immd..
    Thanx in advance

    Right click on the class whose path you need to set; then click the classpath tab and enter the classpath in the textfield provided.

  • Headstart Designer generated form crashes with Java EOF error

    When closing a form while in Enter Query mode, the form crashes & user is
    disconnected from the database with error:
    FRM-92100: Your connection to the server was interrupted.
    Details:
    Java Excepton
    java.io.EOF Exception
    at java.io.DataInputStream.readUnsignedByte(Unknown Source)
    at oracle.forms.engine.Message.readDetails(Unknown Source)
    at oracle.forms.netStreamMessageReader.run(Unknown Source)

    Designer generates the ON-ERROR block level trigger. It has
    execution style of BEFORE. Therefore, both the block level and
    form level ON-ERROR triggers will fire.
    Normally, in the block level trigger, Designer will generate
    calls to its own message handling package to display any
    constraint errors. However, Designer also allows you to specify
    your own custom message handling package.
    The package must contain:
    - a procedure called PUSH
    - a function called MSGGETTEXT, and
    - a procedure called RAISE_FAILURE.
    The preference MSGSFT, Package Used for Messaging, allows you to
    record the name of the custom package.
    Once you have recorded this in the preference, whenever you
    generate a form, Designer will use your package and procedures
    for its error handling code. That is why you see calls to
    Headstart specific code in the block level ON-ERROR triggers.
    If you want to customize the ON-ERROR triggers, you need to make
    sure you understand how the MSGSFT preference is used. Read the
    online help. Then, you can customize individual blocks by adding
    application logic to the block, or you can add your own ON-ERROR
    trigger to the object library in the CG$BLOCK object.
    However, be warned that the Headstart error handling mechanism
    depends on this code. Depending on what you do, you could end up
    breaking things.

  • LV7.1 Strange behavior with Automatic Error Handling occuring when it shouldn't [LV 7.1 Pro on WinXP for Tablet PC's]

    [LV 7.1 Pro on WinXP for Tablet PC's]
    I recently let a rather large LV app of mine run in the development environment while I was out for a couple of days. Upon returning I found that the app had hung for ~22 hours waiting for an answer to an Automatic Error Handling (AEH) dialog proclaiming an Error 7 in New File without any indication of the VI hierarchy that called New File.  I set about ensuring that AEH dialogs would not pop up and have not been able to discover how I could have possibly received one in the first place.
    Subsequent investigation revealed:
    Neither AEH option in Options>Block Diagrams were checked.
    Network problems had occurred around the time that the app had hung.  All file paths are network paths when running in the development environment, so the cause of the error was most likely valid, even if the AEH dialog appearance wasn't.
    My app has only one instance where the New File primitive is used by me. That subVI and all others above it in the hierarchy DO NOT have the AEH property enabled.  The error out cluster of New File in my subvi is wired.
    My app has three instances where New File is called from a vi.lib vi (Open/Create/Replace File.vi, Open Config Data.vi, and Prompt Web Browser Path.vi), none of which have the AEH property enabled.  Nor does any of their calling VI's.  All three instances also have their error out cluster wired.
    A utility to examine the AEH property of all VI's (with all top level and dynamic VI's loaded) in memory reported that only 1 of 308 vi's ( RGT Does File Exists.vi from the Report Generation Toolkit) had that property true.  That vi has no subVI's other than the File/Directory Info primitive and no calling VI's in common with any of the vi's that call New File, except a top level VI.
    As long as 'Enable automatic error handling dialogs' remains unselected in options>block diagram, I am unable to get an AEH dialog for either the New File or File/Directory Info primitives in a test VI with AEH property enabled and their error out clusters unwired no matter what invalid path I pass to the functions.  As soon as the options>block diagram>Enable AEH dialogs' is selected, both primitives fire AEH dialogs with no error out wired and don't when wired. i.e. works as advertised.
    In other words I can find no reason why I should have gotten the problem AEH dialog...
    I cannot afford for this app to hang because of a network problem, other portions of the app that were running concurrently correctly handled the error and, had the AEH dialog not appeared, the app would have made corrections or shutdown in an orderly fashion.
    Any ideas?

    Very good.
    Write Characters to File.vi>Open/Create/Replace File.vi>New File
    New File throws the error.  Open/Create/Replace strips the hierarchy from the source of the error.  Write Characters passes it to the General Error Handler.  I never looked above O/C/R file in the hierarchy except for enable automatic error handling property.  The tip-off should have been to realize that O/C/R file was stripping the hierarchy from the error and look above that. 
    The real irony is that Write Characters was being used to log error cluster data to an error log file...
    Save as... Copy without updating... the OEM 'Write Characters to File' is gone from this app.
    Thanx (a bunch)

Maybe you are looking for

  • Creating module pool programming in abap objects

    Hello... I just wanted to know how u create a give modulepool programming in classes and objects.Could anyone tell me the procedure how to do so.And i knew that module pool programming has become obsolete and now everyone are using object oriented co

  • Has anyone got the screen flick problem solved?

    as above thanks. (i am starting to get irritated of the flicking screen)

  • Regarding Address- Not Printing in ARE1 Document.

    Dear All, I have maintained the Address in the following table J_1IADDRES,however in the Table J_1IEXCHDR the Address field EXC_ADDRESS_NO is not getting picked up as a result of which the address is not printing in my ARE1 Document,please advice whe

  • HT3702 dispute a charge...

    I apparently bought something twice I only intended to buy once.  I tried to report a problem, but it kept opening word documents I can't read.  Anyone have a fix?

  • OIM password in target

    Hi, when admin changes it it is going in process form and database.When user login at change at next logon(first time) it is changing in process form and not in database? CAn u tell me what I need to do for that? Thanks