Query regarding Exception and invocation.

I have a query regarding Exception.
In my code, which throws an ArithmeticException:
<code>
public class TestArithmeticException{
public static void main(String[] args)
int a,b ;
try {
b=0;
a = 50/b;
}catch(Exception ex) {
ex.printStackTrace()
</code>
The above code is catching exception of type Exception(which is superclass of all RuntimeExceptions)
and which inturn extends the Throwable class.
ie. Throwable -
Exception -
RuntimeException
ArithmeticException
Am I correct in my assumption below:
a Because ArithmeticException is an indirect subclass of Throwable and has access to its inherited methods,
it overrides the methods defined in 'Throwable', and then via polymorphism(superclass reference 'ex' in the catch clause)
invokes the method ex.printStackTrace() ?
Does it mean that all runtime exception child classes override the methods defined in Throwable, and then via polymorphism execute overridden
methods?

Yes.

Similar Messages

  • Query Regarding Exceptions

    Hi all,
    Sorry, i couldn't find any forum for exception so i am posting it here.
    Whenever we have to define any custom exception we always extends Exception class, or in other term whenever we extends Exception class it is said to be checked exception.
    My query is like even RuntimeException class also extends Exception class so why is it considered unchecked exception?
    I am confused over here please solve my query.
    Thanks.

    Because those are the rules. If the exception is a subclass of RuntimeException, it is unchecked and you don't have to account for it. If the exception is subclass of Exception but not a subclass of RuntimeException, you must either catch it or have a throws clause on the containing method.
    The choice of whether to make an exception checked or unchecked is controversial; see for example the discussion in Chapter 9 of Joshua Bloch's book "Effective Java". Based on my experiences, I don't find much use for checked exceptions and don't like them. Other people smarter than me think they're great.
    You should document any exceptions you throw with @throws javadoc comment, including unchecked exceptions.
    Edited by: ghstark on Apr 13, 2009 2:00 PM: added sentence about @throws javadoc

  • Query regarding 'EXCEPTION'.Please see.

    I have a question regarding Exception.
    Lets assume that I have a method that throws an 'ArithmeticException',but
    instead of catching this exception,I will catch the 'Exception' object.
    try {
        }catch(Exception e){
        } Now correct me if I am mistaken in my analysis :
    Normally having a 'superclass and subclass heirarchy' gives you polymorphism.
    The subclass will override the method defined in the superclass and gives it
    its own implementation.
    I can then use the 'superclass reference' as a argument to a method which can execute
    the overridden method dynamically.
    Because the subclass has overridden the base class method,polymorphism takes place.
    Am I right in the above analysis?
    Now look at the exception example on top.
    I am passing the Exception reference to the catch clause (which is an indirect parent
    of ArithmeticException).
    My Question is:
    1)Which method has ArithmeticException overridden for polymorphism to take place?
    (ie,I am passing the superclass of the exception,and the JVM knows which exception to
    generate)
    2)Am I right in my analysis?

    Lets assume that I have a method that throws an
    'ArithmeticException',butThen your app is buggy.
    instead of catching this exception,I will catch the
    'Exception' object.Don't do that. Better fix your code.
    Am I right in the above analysis?Yepp, I guess so.
    1)Which method has ArithmeticException overridden for
    polymorphism to take place?Look at its source. Probably none.
    (ie,I am passing the superclass of the exception,and
    the JVM knows which exception to
    generate)That doesn't make sense. You're not passing anything. The code or JVM knows which exception to generate, and you just tell it which one to catch.

  • Query regarding handling and monitoring of OSB Errors in a specific manner

    Hi,
    I'm using
    - OSB 10gR3 (10.3.1)
    Context
    To give some context, the setup I currently have a proprietory frontend client that is making XML/HTTP requests to OSB
    which in turn is getting info from downstream systems.
    I have no control over the behaviour/logic of the frontend client .. apart from knowing that it has a specific
    request/response format.
    So now to the issue..
    The issue I'm facing is regarding handling of errors. Based on my knowledge of OSB, the error handling of the transaction has been
    built along these lines
    (Within the stage) If an error scenario's occurred, error is being thrown
    (Within the error handler stage) Logging the error (using the 'Log' function .. with severity 'Error')
    (Within the error handler stage) The response payload is being built .. so that the error can be reported to the frontend client
    (Within the error handler stage) I'm doing a 'Reply with Success'
    Now this does give me the expected behavior from the frontend client's perspective (... i.e. it receives the payload and displays whatever error that's occurred)
    However from OSB's perspective, because I have done a 'Reply with success', the OSB Service Health Page ... (screenshot below) does not
    increment the 'Errors' count for the respective proxy service ....
    [OSB Service Health Page|http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/operations/monitoring.html#wp1107685] (Looking at Figure 3-8)
    The only way I could achieve this was to set the error handler stage to 'Reply with Failure' (which would return HTTP 500) ...
    The issue however is that, the proprietory frontend simply sees the incoming HTTP 500 code and doesn't read the return XML payload (containing the error details ..)
    which beats the whole idea of being able to maintain some sort of traceability for the failed transactions.
    So what I'm basically trying to find is .. that when an error occurs
    - Some 'call' to make the during the error handler stage so that it registers as an error in the OSB Service Health Page.. and I can clearly
    see the error count, etc for each of the proxy services
    - After that being able to still use 'Reply with Success' ... so that the payload is being returned with HTTP 500 code...
    so the frontend can read the payload ...
    ............. in essence, the idea being to register errors so that they can be monitored via the Service Health Dashboard ..but at the same time
    being able to return the 'error details' payload successfully
    With my limited (but growing) knowledge of OSB .. I've tried quite a few ways to achieve this with no success...
    Would very much appreciate any help here ...
    Lastly, if there is some way of achieving what I'm trying to get to above through different means, I'm open
    to trying out alternate stuff.
    Regards,
    Himanshu

    Hi Atheek,
    Many thanks for the reply. Does appear to be a pretty neat way of doing it ..
    One more clarification I'd like on this however ....
    Given that I have a set up like this below
    [External frontend client] <------> (1 Parent Service) <------> (2 Child Service)
    (1 Parent Service) .... has error handler .. and all it does is 'Reply with success'
    (2 Child Service) .... has error handler for particular stage
    so...
    2 Child Service - is doing the actual work (has error handler where custom error msg is being populated in $body)
    1 Parent Service - is the one that is getting called by the external client (has error handler .. and all it does is 'Reply with success')
    What I currently have is ..once the error occurs, I'm populating $body ... with the custom error message within the error handler
    Previously I had 'Reply with Success' in the 2 Child Service's error handler and the custom error message would get returned to the external client.
    Now, with the error handler only creating the custom error msg.... and 1 Parent service doing the 'Reply with Success' .. it doesn't appear
    to return the $body .. with the custom msg that I'd populated .. in 2 Child Service's error handler.
    Are the $body contents populated in 2 Child Service's error handler lost ...once the error propagates up to 1 Parent service's error handler ?
    If yes... is there way of getting around it ? I could see for instance that the $fault message context has a 'user populated' Details variable
    but the documentation covering this is sparse.
    Regards,

  • Query regarding passivation and PS_TXN tables

    Hi All ,
    I am working on a read only Dashboard UI where the DB user has only read privileges.
    The jbo.server.internal_connection uses the same DB connection to create PS_TXN & PS_TXN_SEQ tables which fails for obvious reasons & I get the error -
    "Couldnot create persistence table PS_TXN_seq".
    I have disabled passivation at all the VO levels and also disabled jbo.isSupportsPassivation to be false at the AMLocal level , but still I am getting this error.
    I have also increased the initial AM pool size in bc4j.xcfg & Connection Pool at the weblogic server level to avoid snapshots been written to this table.
    Is there any way I can prevent any interaction with this table as the client too is not interested in any kind of passivation to happen for the time being.
    Thanks

    Thanks for your reply Chris.
    Chris Muir wrote:
    You might be taking the wrong approach to solving this. Rather than disabling the AM pooling (which btw is not supported by Oracle) to the database, instead you can get ADF to passivate to file or memory of the app server.I am confused as to what exactly jbo.ampool.issupportspassivation = false does then ? I read on one of the blogs that its a viable use case for Programatic VOs ?
    Also regarding passivating to file system as per http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcstatemgmt.htm#ADFFD1307 , its not really a recommended approach.. hence was not going for that.
    Can you please throw some more light ?
    Thanks

  • Query regarding characteristics and key figures

    Hi All,
    Can anybody pls tell me in what scenarios a key figure can be used as a attribute of a characteristic?
    what are the scenarios in which each type of DSO can be use?

    Hi,
    Can anybody pls tell me in what scenarios a key figure can be used as a attribute of a characteristic?
    if  your key figure in trasnctional data level it's give you the Fact.
    If you use your key figure in your master data lvel it's give you the present truth.
    Like this you have 0Material and Material price has the attribute of 0Material.
    read below link
    http://help.sap.com/saphelp_nw04/helpdata/en/dd/f470375fbf307ee10000009b38f8cf/content.htm
    what are the scenarios in which each type of DSO can be use?
    We have 3 DSO in BI 7.
    1. Standard DSO : it's contaions 3 tables (New,Active,Change log tables) : If you want overwrite funcationality go for this dso
    2. Direct Update DSO : It's Contaion only Active Table : If you want write some data using with  APD and BAPI go for this dso.
    3. Write Optimized DSO : It's Contaion only Active Table : If you want load mass uploads and stageing purpose we use this dso.
    Hope it helps you.
    Regards,
    Venkat.

  • JSF general query regarding UISelectItem and UISelectItems

    I am seeing a couple of peculiar behavior and i have no explanation for them at the moment . It would be great if someone can explain the apparently different behavior of JSF in general.
    Whenever there is 'n' number of UISelectItem components inside a UISelectOne component , the getter method of the property of the backing bean to which the UISelectOne component's value is bound is getting called "n" number of times when the page is rendered.
    Whenever there is a single UISelectItems component inside a parent UIselectOne component , the getter method of the property(in my case a List of SelectItem components) of the backing bean to which the UISelectItems component's value is bound is getting called "2" times when the page is rendered.
    The pattern is same for the first time when the page is requested and for any subsequent requests for the page.
    What might be the possible reason for the afore mentioned behaviors of JSF?

    Getters and setters will be called different times in different Lifecycle phases.
    This may help... http://www-128.ibm.com/developerworks/java/library/j-jsf2/
    in particular, Select Components have some validation checks that loop over the items in the select component - I believe basically it loops over the selectItems and makes sure the selectItem.value "type" is the same as the selectComponent.value "type"
    Also... I just posted this to another thread....
    I found adding a Phase Listener with debug logging has helped enourmously with seeing when getter and setters were called in which phase.
    public class DebugPhaseListener implements PhaseListener {
        private static final Log LOGGER = LogFactory.getLog(DebugPhaseListener.class);
        public PhaseId getPhaseId() {
            return PhaseId.ANY_PHASE;
        public void beforePhase(PhaseEvent event) {
            LOGGER.debug("beforePhase(" + event.getPhaseId() + ")");
        public void afterPhase(PhaseEvent event) {
            LOGGER.debug("afterPhase(" + event.getPhaseId() + ")");
    in your faces-config.xml... add
    <lifecycle>
    <phase-listener>com.mycompany.DebugPhaseListener</phase-listener>
    </lifecycle>

  • Query regarding speech and telephony api

    hello everybody,
    i am thinking of doing my academic project in java. according to the project requirement i need to call a phone (pstn or mobile) from a pc and give a voice message to the receiver of the phone call. i thought of doing it with java speech api and telephony api. i would also like to know about javaphone api , java communications api and media framework. can the objective be achieved using the latter three? or do i have to go for speech and telephony api only. i am really confused. please guide me.
    where can i download jtapi library?
    also suggest some good tutorial for jsapi and jtapi.
    Thank you.
    Sriram K

    hi
    i'm also doing my project using jtapi.
    u can download JTAPI java files then compile it .u ll get the class file.if u know more about jtapi means mail [email protected]

  • Query regarding Singletons and Database connection pool

    Hi there,
    I am trying to understand the Singleton pattern in relation to a pool of database connections.
    Frankly,I have not fully understood this.
    If my pool of database connections is set to 10, how can a singleton design come into this?
    In what way is this beneficial?
    Please can someone explain this?
    No offence meant

    bhuru_luthria wrote:
    Hi there,
    I am trying to understand the Singleton pattern in relation to a pool of database connections.They are related like a hiccup is related to a wiffle ball.

  • A Query regarding 'Events' published and 'Event' subscribed

    I have a query regarding 'Events' and 'EventHandling' in Java Swing.
    Swing in an EVENT based application whereby 'events' are generated
    by interacting with the components.
    Eg: Clicking on a Button generates an 'ActionEvent' and every event
    generated has an associated 'EventListener'.
    Now,my question is:
    a)When an event is generated,(let's say by clicking a button),
    an 'event' is published,right?
    That means that there is an 'Event Publisher'.
    In the above case,the Button is the 'Publisher' of the event,right?
    b) Who are the subscribers for the events generated?
    Where do we specify the 'subscibers' to the events generated?(and once
    the subscribers get the Event,the subscriber will call the methods
    of the event object)
    We just say
       addButton.addActionListener(new ButtonHandler);
       private class ButtonHandler implements ActionListener {
            public void actionPerformed(ActionEvent e){
      In the above code :
    a) Who is the Event Publisher?
    b) Who is the Event Subscriber?
    No offence meant for the question.

    The 'event publisher' for the mouse click is the ToolKit implementation (translates the OS mouse event to a Java mouse event).
    The 'event subscriber' for the mouse click on a button is typically a ButtonUI (you can add a mouse listener directly though).
    The 'event publisher' for the action event is the ButtonModel (notified by the ButtonUI when the button is unpressed, etc).
    The 'event subscriber' for the action event are the action listeners.

  • Query regarding the Node manager configuration(WLS and OAM Managed server)

    Query regarding the Node manager configuration(WLS and OAM Managed server):
    1) In the nodemanager.properties I have added the ListenAddress:myMachineName and ListenPort: 5556
    My setup : One physical Linux machine(myMachineName) has : WLS admin server, managed server(OAM 11G) and nodemanager.No clustered environment.
    2) nodemanager.log has the following exception when I start the oam_server1 using EM(Enterprise Manager11g):
    Mar 23 2012 1:39:55 AM> <SEVERE> <Fatal error in node manager server>
    java.net.BindException: Address already in use
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:336)
    at java.net.ServerSocket.bind(ServerSocket.java:336)
    at javax.net.ssl.impl.SSLServerSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.<init>(ServerSocket.java:202)
    at javax.net.ssl.SSLServerSocket.<init>(SSLServerSocket.java:125)
    at javax.net.ssl.impl.SSLServerSocketImpl.<init>(Unknown Source)
    at javax.net.ssl.impl.SSLServerSocketFactoryImpl.createServerSocket(Unknown Source)
    Default port on which node manager listen for requests is localhost:5556.I have changed it to point to my machine. The port should be of WLS admin server or it should be the managed server port?
    3) I have started the NodeManager using the startNodeManager.sh script.
    4) The admin server port is 7001 and the oam managed server port is 14100.
    Any inputs on what might be wrong in the setup will be helpful.Thanks !

    By using netstat -anp|grep 5556 you can check which process on your machine is using the 5556 port.

  • Query regarding Inline Query and a Join.Please see

    I have a query regarding Inline Queries
    I have 2 tables
    TRADE and POSTING
    TRADE has Primary Key:id_trade_ref and POSTING has Foriegn.Key: id_trade_ref
    id_trade_ref 5V973781B has 5 records in POSTINGS
    If i need to join these 2 tables,I use
    1) Select t.id_entity,t.id_trade_ref,p.am_stock
       from trade t,posting p
       where t.id_trade_ref = '5V973781B'
       and   p.id_trade_ref = '5V973781B'
    2) Now I can use the same as an Inline Query:
       select
       t.id_entity,
       t.id_trade_ref,
       (  select p1.am_stock 
          from posting p1
          where p1.id_entity =  t.id_entity
          and   p1.id_trade_ref= t.id_trade_ref
          and   p1.id_posting_type in ( 'NEW', 'CAN')
    from
    trade t
    where t.id_entity = 'DBL'
    and   t.id_trade_ref = '5V973781B'
    My Query:
    Of the two,which is a better option to use.?
    Is Inline a better option or a normal join?

    I would rewrite the first one to:
    Select t.id_entity,t.id_trade_ref,p.am_stock
    from trade t,posting p
    where t.id_trade_ref = '5V973781B'
    and p.id_trade_ref = t.id_trade_ref
    This way, you really make the join between the table.
    I think the join is better because it uses less code. I do not think you will notice much performance win between one or the other, especially because it concerns only a few rows.

  • BAPI to export features of Exceptions and Jump query from BW system to othe

    Is there any BAPI is available to export features of Exceptions and Jump query from BW system to other SAP or Non SAP system, whereas won't  need to re-define Exceptions and Jump Query. I mean directly export features of Exceptions and Jump query from BW system to other system.
    Thanks,
    Rohan

    Thanks for quick response.
    I am working on Hyperion, they are using essbase, and Integration connector to connet BW directly and takes data from BW System.They have features to define Exceptions(Traffic Light) and Jump query in the Hyperion side. But now they want to import directly features of Exceptions(Traffic light) and Jump query from BW System(using BAPI) instead of defining Exceptions and Jump Query in the Hyperion side.
    Please help me on this.
    Thanks,
    Rohan

  • Query regarding updating rows in JTable

    Query regarding updating rows in JTable
    Hello,
    I have a JTable with 6 columns and 1000s of rows (which are data read from flat files)
    I can select 1 or more rows and change the values of the
    columns. each time I do this I need to update the values
    in the flat file.
    Currently I assign the updated Jtable values to a vector
    Vector rowVector = (Vector)defaultModel.getDataVector();
    then I iterate over the vector and compare the values with the (old) data
    in the JTable.
                for(int rowCount = 0; rowCount<rowVector.size(); rowCount++){
                    Vector v = (Vector)rowVector.elementAt(rowCount);
                        //smsList is the Vector that contains the old JTable values
                        for(int i=0; i<smsList.size(); i++){
                                //If colums values have been changed; add that
                                //vector value to another vector
                                selectedsmsList.add(smsList.get(i));
                for(int i=0; i<selectedsmsList.size(); i++){
                         //Update the values in the flat file
                }This works fine except that it takes ages to iterate over the updated vecor and un-updated,old vector; is there any way to directly get the list of rows that were updated in the jtable; so that I can directly do an I/O operation to update the jtablke values?

    Just a suggestion.
    You could add a listener and use a vector of booleans to keep track of the rows that have been changed. You could then iterate through this boolean vector and update the changed rows.
    See
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#modelchange
    Don't know whether this will be helpful.
    Regards, Darryl

  • Regarding Exceptions in Reporting!!!

    Hi BI Experts,
    Is there any way to get or change the available colors in Exceptions on a query.
    I mean it gives three colors for exception reporting Green, Yellow and Red, but instead I want Green, <b>Blue</b> and Yellow.

    Hi Arun,
    You can change the color of exception at workbook level not query level.
    Please go through this Bhanu Gupta Post,
    Customizing color for defined exceptions
    and
    Re: regarding exceptions
    if it is useful assign points
    Regards,
    Senthil

Maybe you are looking for

  • Adobe Reader X - cannot view local PDF's fully or web PDF's at all

    I have downloaded Adober Reader X onto my Windows XP IE v8 PC, yet I cannot fully open any PDF documents. On local PDF's I can see part of them, scroll up and down them, and print them though. When looking at local docs I can also see the desktop beh

  • Screenshot a frame in a Youtube video?

    Sometimes I want to take a screenshot of a certain frame in a Youtube video, so I was looking for a way to take a screenshot of just one frame in the video, not the window, and not a selection, just the frame in its exact size. I was playing around w

  • Issue with extending HzPuiDQMSrchResultsVO

    Hey all, I have a requirement to alter the order by statement in HzPuiDQMSrchResultsVO from "ORDER BY SCORE DESC" to "ORDER BY SCORE DESC, PARTY_NUMBER". I was able to create a new VO by extending the seeded oracle.apps.ar.hz.components.search.server

  • HtmlDataTable rendering is resulting into java.lang.OutofMemoryException

    Requirement is such that thousands or records are to be displayed in data table in single page without pagination. --> JSF data table while rendering consumes lots of heap memory which is throwing out of memory exception. --> If we renders some limit

  • How to pass parameter in Discoverer inner query  PLZ give solution-URGENT

    Hi All, My need is I have a query in Disco Admin which has inner query as mention below: select Net_Drawn_Amount,Undrawn_Amount,Business_Date from (select * from t_FacilityExtract) A, We are creating a workbook using Diso Plus and creating a paramete