Is it possible to restrict control flow based on the excpetions?

Hello,
I am doing a program, in which if any exception is occured, then, program shouldn't continue. It should stop execution and comeout of program and display Exception message.
Example:
In the code below, i have one divide method and add method. If divide method throws excption, add method should not be executed.
How to do this?
public class Testcatch
private int a=0;
private int b=3;
private int c=0;
private int d=0;
     public int divide(int x)
                              try
                                        a=x;
                                        System.out.println("a="+a);
                                        d=6/a;
                                    }catch(Exception e)
                                        System.out.println("Error= "+e);
                              return d;
public int add()
          c=a+b;
          System.out.println("b="+b);
          return c;
public static void main(String args[])
     Testcatch tc=new Testcatch();
     System.out.println("Divided value c= "+tc.divide(0));
     System.out.println("Added Value d= "+tc.add());
}Please help,Thanks for taking time,
Regards,
Ashvini

Simple, make the divide() method not handle the exception by itself.
public class Testcatch
    private int a=0;
    private int b=3;
    private int c=0;
    private int d=0;
    public int divide(int x) throws Exception
        a=x;
        System.out.println("a="+a);
        d=6/a;
        return d;
    public int add()
        c=a+b;
        System.out.println("b="+b);
        return c;
    public static void main(String args[])
        try {
            Testcatch tc=new Testcatch();
            System.out.println("Divided value c= "+tc.divide(0));
            System.out.println("Added Value d= "+tc.add());
        catch (Exception e) {
            e.printStackTrace();
}

Similar Messages

  • CUP question - Possible to restrict available roles based on the requester?

    Helo all,
    One of our customers wants to put restrictions on the access requester in the CUP module: meaning that some requesters should only be able to request roles assigned to functional area u2018Procurementu2019, while other requesters should only be able to request roles that are assigned to all functional areau2019s except for u2018Procurementu2019.
    Do you know if this is possible or do you see an alternative solution?
    Thanks in advance,

    There is no real way to restrict people from doing that, but you could use the buisness process in role attributes to ensure if the select the correct buisness process only roles listed under a particular buisness process are listed when being searched.
    You could make the buisness process field mandatory on the main screen and than that gets carried over when searching for roles, obviuosly that can always be changed by the user.
    regards,
    Chinmaya

  • How to attach a search help in a table control coloumn based on the search

    Hi,
    Can anyone help me for attaching a search help in a table control coloumn based on the search help value of another coloumn
    in the same table control.
    Regards,
    Ratheesh BS

    check
    Re: Switch Search Help during runtime

  • Restrict Org details based on the User in Business partner creation..

    Hi Gurus,.
    I have to assign Sales Org , DIV, Distribution Channel to the Business Partner in Sales Area data.  When I try system shows entire Org structure. But I want the Org structure should be displayed based on the user log on. Assume that, I am assigned to Shangai and creating Business partner for Shangai, the system should not show Beijing or other Org Unit since I belong to Shangai.  How to address this scenario thro standard customization?
    Is it common problem in CRM Webui(6.0 and 7.0).
    My Org Structure:
    Global
      China
         Shangai
         Beijing
       Nanjing.
    Thanks in Advance....

    Hi Denis,
       Thanks for your reply. I believe Org determination rule is applicable for Transaction types not for Account Creation. I want to get Sales area data based on login user. It shows complete Sales Area(Sales Org IDDistribution ChannelDivision) when I create an Account.. Assume that you are an employee and assigned to Newyork, when you create New Customer in Newyork, system should not show Boston, Washington Sales areas...Please throw some light on this...
    Thanks in Advance.,

  • Update an ADF Task Flow based on Human Task

    Hello friends,
    I'm working on Oracle BPM Suite 11g. So, I created a process including its human tasks. Later, I created a Task Flow based in the human task that I setup before. Now I added a new parameter to the human task and I need to update the task flow because (of course) it only contains the payload of the previous configuration.
    Can I do that? What can be the solution?
    Regards....
    AYVR

    It's covered in docs here: http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10224/bp_designtf.htm#BDCDFBCB
    Note that this only updates the control. You'll have to now drag those new payload properties onto the form. If you had removed any properties you'd need to remove those from the form.
    You should also do a refresh of the window that contains the data controls. Sometimes that's necessary to see the changes.

  • How to Restrict Search based on the Roles for External crawled sites

    I have a situation where the search results have to be restricted based on role
    When External sites are crawled, how can we restrict the search results based on roles,
    I know that we can restrict the search to a group or set of groups that can contain many users but if the group have different roles and if that group has given access to a web repository search, how can we restrict the document/search access based on roles for the same group?
    For Example an Index that has external site as data source and the permissions were set for a group and that group has 2 roles, lets say <b>"Admin" and "user"</b> and the external site have some documents when searched the documents should come up only for the "Admin" role during search, but should not come up for the "user" role
    Is it possible to achieve this? Is there a solution?
    Any advices are greatly appreciated and awarded
    Thanks,
    kk

    Is it possible to restrict on role based?
    Any suggestions are appreciated
    Thanks
    KK

  • Is it possible to lock the structure Tab in Solar02 based on the users

    Hi,
    In Solar02 transaction of solution manager , under configuration node - > structure Tab , it is possible to change the structure . Is it possible to restrict this authorisation based on login users.
    Best Regards,
    Saravana.

    Hi
    You can't restrict users as you required
    because if they have change access they can very well proceed.
    Moreover if you hide it will be hidden for all users from solar_project_admin...project tab
    Regards
    Prakhar
    Edited by: Prakhar Saxena on Sep 24, 2010 12:12 PM

  • Dialog control flow case not opening in new browser window

    Hello -
    Using JDev 11gR1.
    I have a page fragment that contains a table of command links like so:
            <af:commandLink text="#{row.id}" id="cl2"
                            action="#{reportRunnerBean.runReportAction}"
                            useWindow="true" windowHeight="500" windowWidth="500">
              <f:param value="#{row.id}" name="reportId" id="p2"/>
            </af:commandLink>the runReportAction method returns the String: "dialog:runReport"
    in my page flow, the page fragment has a control flow case with the outcome "dialog:runReport" that leads to a URL View with the URL setting set to #{pageFlowScope.reportUrl}
    (the reportRunAction places a string in page flow scope with the key of "reportUrl". in case it matters, the url is external to the application)
    When I click on the link, I am directed to the correct URL. However, it does not open in a new browser window - it takes up the main browser window.
    Is there something obvious that I am doing wrong?
    Thank you for reading this,
    -- Scott

    Well, I couldn't figure out why the dialog wasn't working correctly, so I changed my page to use a server listener to handle the logic I wanted and just used af:goLink instead of a command link. That command link above became:
              <af:goLink text="#{row.id}" id="gl1"
                         destination="#{row.reportUrl}"
                         targetFrame="_blank">
                <af:clientAttribute name="reportId" value="#{row.id}"/>
                <af:clientListener method="logReport" type="click"/>
                <af:serverListener type="LogReportEvent"
                                   method="#{reportListBean.logReportInvocation}"/>
              </af:goLink>with the following client listener:
        <af:resource type="javascript">
          function logReport(evt) {
              var component = evt.getSource();
              var reportIdParam = component.getProperty("reportId");
              AdfCustomEvent.queue(component,
                                   "LogReportEvent",
                                   { reportId: reportIdParam}, false);
        </af:resource>and code in the bean:
        public void logReportInvocation(ClientEvent clientEvent) {
                String reportId =
                    (String)clientEvent.getParameters().get("reportId");
                //...do something w/reportId here...
        }Thanks to anyone who took the time to read this.

  • Filter a Query Based on the Output of Another Query

    Is it possible to run a query based on the put put of another query? I have two queries. One query is based on GL Line items and shows the account assignemnt of postings where a customer has had a debt raised and it been credited to an account assignment e.g. Order, Cost Centre or Profit Centre. The other query is on an AR cube and that shows payment made. I want to bring these together to show the owners of the various account assignments to what extent customers have actually paid the debts that have been raised and credited to them. This I do as the source document of the CO doscument matches the allocation of the ar document. So I have a query that shows the CO journal and another query that shows payments. But I only want to show the payments in the second query for documents displayed in the first query (which can be restricted by period and fiscal year and the particular account assignment).

    Hi,
    This can be acheived by usign a replacement path variable.
    Create replacement pathe variables for those the filter values in the second report nneds tobe restricted from the first.
    Then in the properties of the varioable say replce by query result and input the first query name in it.
    Use these variables in teh filter section of the second report.
    Make sure the characteristics for which you created the replacement path variables are in teh row section of the first Query.
    Now on executing the second query you will have it filtered based on teh values of the first Query.
    Hope this helps.
    Regards.
    Shafi.

  • Restrict no. of entries in the multiple selection of DOCNUM of EDID4 tab

    Hi,
    Is it possible to restrict number of entries in the multiple selection of DOCNUM of EDID4 table.
    i.e., Select the content button on se11 for EDID4 table. We can see the selection screen of the table. Press the multiple selection button of 'DOCNUM', we get a popup. Is it possible to restrict the no. of docnum entry to 500. If i enter more that 500 entries, it should popup a message.
      Please share your ideas. I am working on 4.6c.
      Points will be rewarded.
    Thank you.
    Regards,
    Ramesh

    Hi Atish,
       Thanks for your reply.  I checked for BAdis. But I couldnt find. Is there any other ways of doing this?
    User is trying to import the docnum values from presentation server file using the 'Import from text file' icon on multiple selection popup. As the no. of docnum were 4500, during the execution of this process, other process trying to connect to oracle is going for short dump with message 'Run-time error (Oracle error code: ORA-4031)'.  So user wanted to restrict it to 500.
    Hope my explanation is clear.
    Regards,
    Ramesh

  • Problem about implementation of a controller in main_vi based on the test data of sub_vi

    Hi Group:
     I am developing a measurement and control system based on the PCI-6040E and SCXI1001,1102, and 1160.
    But now, I have a question ,which is how to implement a controller in main_vi based on the test data of sub_vi.
    my  program is consist of main_vi and  several sub_vi,  the main_vi is used for controlling and give the operation signal to hardware system (relay). and sub_vi is used for sampling data.
    for example: the sub_vi collects data from the hardware and the control algorithm and output is implemented in the main_vi, so the question is how to transfer the test data from the sub_vi to main_vi synchronously.
    I try to set the output connecter, but the data just return when  sub_vi is closed.
    anybody have good idea about it.
    Thanks a lot

    Hi hanwei,
    I'm making the assumption that you are not using LabVIEW Real-Time. If you are, you should use RT FIFOs. Otherwise, follow MikeS81's advice.
    I would go a step further and say that most likely it would be a better design to remove the loop (while loop?) from the subVI and instead place the subVI within a while loop in your top-level VI. This way on each execution of your subVI it will quickly return your data. Then you can also perform all the queue and dequeue operations in the two seperate while loops in your top-level VI. This organization will be easier to read, document, and understand.
    Mike Lyons
    National Instruments
    http://www.ni.com/devzone

  • To Select Template based on the responsibility

    Hi All,
    i have created a rdf with multiple templates.
    Whether it is possible to select templates automatically based on the responsibility.
    For ex:
    When the user selects xxx responsibility then xxx template should be default template suppose if user select aaa responsibility the aaa template should be default template.
    Please help me in getting solution for this.
    Thanks
    Rajesh

    I am not giving the solution, one way is, you need to call your program (xxxx) from another program(yyyy, it is a new program). While calling program xxxx from program yyyy, you need to calculate the template name based on the responsibility and use that in fnd_request.add_layout.

  • HT201304 Is it possible to restrict access to specific IOS apps based on the WIFI profile that a user has connected to?

    Is it possible to restrict access to specific IOS apps based on the WIFI profile that a user has connected to?

    you might be able to block it if the app uses Internet access
    and depending on your wireless you might be able to block a specific user
    accessing the backend host that the app uses
    some firewalls offer application filtering but I'm not aware of any that work with ios apps

  • Why : Data Control entry not expandable/empty - ADF Task flow based on HT.

    Hi All,
    I've hoping to create an ADF Task flow based on a human task. I have a stand alone ADF application within the ViewController of which I am attempting to create this task flow. The resultant data control entry doesn't seem to be expandable.
    Questions
    1. When creating an ADF Taskflow based on a human task, should it always be within a project in the same application as the SOA components?
    2. If no, is the resultant human task data control empty or not expandable because the xsd for the HT is based on the MDS? I have configured all the MDS connections within my application.
    JDev : 11.1.1.4
    Thanks
    PP

    Hi,
    Answers :-
    1. No, it is not necessary that your ADF Taskflow based on Human Task should be in the same application where the SOA Project Resides. But for the deployment of that ADF Taskflow you will need the SOA Project.You can add that project whenever you want to deploy.
    2. It might be the cause due to the MDS Configuration .
    Do one thing , while creating the ADF Taskflow based on Human Task , you do select the .task file via the file system not from the MDS.
    If you will select the .Task file of your soa project then it will ask you to name the Taskflow, just name the taskflow as you want and say ok.
    After creating the taskflow, it will add a lot of xml files in your project and it will create a data control of it.
    Hope it helps!!
    Regards,
    Shah

  • In BD87  T /c  is it possible to control user based in Comp code...?

    In BD87  T /c  is it possible to control user based in Comp code...?
    Thanks
    Mahi

    BD87 is a transaction to work with IDOCs.
    one IDOC e.g. for vendor master can have several segments with different company codes.
    But you cannot post an IDOC only partially, that is technically not possible and does not make much sense.
    Further the IDOC segment in the table is just one huge field, It does not have single fields like company code.It is a generic field that can keep the segments of any IDOC.
    In my opinion there is no way to control it at company code level.
    In any case you posted it in the wrong forum. BD87 is not a MM transaction.
    Hence, moving it to the Abap Connectivity forum

Maybe you are looking for

  • Help with getting a better understanding on how APEX submits its pages

    Hi, I have implemented jquery with my app and have just applied the jquery UI plugins. I have the jquery UI dialog function working which gives the users some options. Now as an example, I have a cancel and a continue button. If the user clicks cance

  • Whitespace is not allowed at this location. Error while running CP using RDF with XML

    Hi All, I am using RDF report with output type as XML. It have following parameters: 1. Organization Name, 2. Invoice No From 3. Invoice No To 4. Date From 5. Date To I had developed an RTF and registered that in Oracle Applications. The output comes

  • I want to update multiple record in database which is based on condition

    hi all, I am using Jdev 11.1.2.1.0 I have one table named(Pay_apply_det) in this table i want to update one column named(Hierarchy) every time and according to change i want to update or i want to maintain my log table named(pay_apply_appr).It based

  • Unable to do something with Photoshop CC

    Hi, my configuration: imac 27 late 2013 3.2ghz 8go 1600MHz DDR3 Nvidia GeForce gt 755m OS X 10.10.1 Photoshop Creative Suite (fully legal) 15.2.2 I apologize in advance for my bad english, I'm a french. Since today I'm not able to work with Photoshop

  • Links in Weblog redirecting to old URL

    O.K., I've beaten this to death and I'm stumped. I am running a weblog server and for some reason when I click on the majority of links ("comment", etc.) within the blog I'm being redirected to an old URL that is non existant. This domain was one I d