Study security related exception handling in Java

Hi all,
I am required to do an indepth study on security-related exception handling in Java, their Pluses and minuses... Can ppl suggest me places where I can get a kick start? Any resource that u know can help me out?
I appreciate ur help in this regard...FYI, I am a grad student and I am doing this as a part of my course-work...I am writing up a report on this...
Thanx a bunch, in advance for ur help ppl..

Take a look at the JAAS API and docs.
- Saish

Similar Messages

  • Integration Process exception handling & alerts, Java

    Hello,
    I would like to enhance my basic scenarios fool proof and with as much Java as possible.
    I have set up several asynchronous and synchronous File to SOAP transfers between systems A and B
    using PI70 including my own Java mapping classes and PI's AF_Modules beans. They work just fine.
    I have not designed my own Integration Processes yet, so execution is based on channel settings and availability timing.
    I have learned this aproach may be exposed to general faults resulting manual monitoring and repairing.
    For example server problems at receiver side can result data losses as sender channel just keeps removing source
    files like normally, as the process would be better to just stop right there and alert or something.
    My question is, is the "Enterprise services Builders" Integration Process & Graphical definition screen the one and only tool to 
    customize whole process exception handling and alerts in PI, and Java is not an option?
    Appreciate your advice on this.
    Kind regards m

    Hi m,
    Strange Name
    >>I have learned this aproach may be exposed to general faults resulting manual monitoring and repairing. For example server problems at receiver side can result data losses as sender channel just keeps removing source  files like normally, as the process would be better to just stop right there and alert or something.
    If you are looking to handle this particular scenario, then we have the alert mechanism and CCMS monitoring. There you will come to know whether the end system down or not.
    Also in addition to this you can write your own java (in message mapping, as modules, java mapping) /abap code (as abap mapping, user exit in standard functions etc) for providing more details in error scenarios. But you need to validate whether the maintenance/development cost for the code is justified in your scenarios
    Regards
    Suraj

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

  • Generic Exception handler in java

    We have developed a client java application with our own exception hierarchy derived from java.lang.exception. We raise our own exception in case of error scenarios. But there is one additional thing which we want to do:
    1. When ever any exception is raised in our exception we want to do some generic exception handling (like kicking of some module which collects the log files and send it to the administrator.
    2. We want the above activity to happen also when any runtime exception is raised. We are not catching any runtime exception and we have no handle for this.
    How should we go about this. Can we write a very low-level generic exception handler?
    We do not want to have done at every catch block we have in our code. I mean we want to have some hook at a very generic place.
    Let me know if some body can be help me on this.

    As far as I know, for exceptions that are caught, you must make a call to a generic handler in the catch block, or you may rethrow the exception as a RuntimeException, and let it propagate.
    For RuntimeExceptions and Errors in threads that you create, the easiest way to solve this is to subclass ThreadGroup, override uncaughtException with the appropriate code, and create all your threads in this group. For a thread like main, have the first thing in the thread be the creation of a new thread in the new group, then pass control to that thread. For fixed threads, like the event queue, someone had a suggestion already. Note that uncaughtException is only called just before the thread ends, so an exception that shouldn't end the thread should be handled seperately.

  • Give me a idea for null pointer exception handling in java

    dear friends,
    Now i'm doing one program thats read a xml file element and store on txt file in java.now it's working but i have one problem.The problem is the parent node have number of child node.For a example, now i read the file.The first parent have a 5 child.that time work.the next parent have a 4 child this time one child is not on there.so now my program show one run time error.thats "NullPointerException" please give me a solution.its very urgently.
    advance Thanks !

    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    public class rsk1{
    public static void main (String argv []){
    try {
                   int j=0,arry=0;
                   FileWriter Out = new FileWriter("file1.txt");
                   BufferedWriter f1 = new BufferedWriter (Out);
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
    Document doc = docBuilder.parse (new File("Transaction.xml"));
    // normalize text representation
    doc.getDocumentElement ().normalize ();
    System.out.println ("Root element of the doc is " +
    doc.getDocumentElement().getNodeName());
    NodeList listOfPersons = doc.getElementsByTagName("transactionid");
    int totalPersons = listOfPersons.getLength();
    System.out.println("Total no of people : " + totalPersons);
    arry = totalPersons * 5;
    String sr[] = new String[arry];
                   String s1=" ";
                   int k=0;
    for(int s=0; s<listOfPersons.getLength() ; s++,k++){
    Node firstPersonNode = listOfPersons.item(s);
    for(int r=0; r<4;r++)
    if(firstPersonNode.getNodeType() == Node.ELEMENT_NODE){
    Element firstPersonElement = (Element)firstPersonNode;
    NodeList firstNameList = firstPersonElement.getElementsByTagName("item");
    Element firstNameElement = (Element)firstNameList.item(r);
    NodeList textFNList= firstNameElement.getChildNodes(); //ERROR OCCUR IN THIS LINE
    sr[++j]=((Node)textFNList.item(0)).getNodeValue().trim();
    }//end of if clause
    }//end of for loop with s var
    System.out.println("Process completed");
    for(int i=1;i<=j;i++)
         f1.write(sr);
                                       f1.write(" ");
                                       if(i%3==0)
                                            f1.newLine();
    f1.close();
    }catch (SAXParseException err) {
    System.out.println ("** Parsing error" + ", line "
    + err.getLineNumber () + ", uri " + err.getSystemId ());
    System.out.println(" " + err.getMessage ());
    }catch (SAXException e) {
    Exception x = e.getException ();
    ((x == null) ? e : x).printStackTrace ();
    }catch (Throwable t) {
    t.printStackTrace ();
    }//end of main

  • Handling exceptions in EBS Java concurrent program

    Hi,
    I want to do exception handling in Java concurrent program, is there any standard set of exceptions already provided by EBS for concurrent programs or should I create my own Exception class for exception handling.
    Thanks!

    Hi Kashif, Thanks for replying.
    I am creating a Java concurrent program in EBS by implementing the interface - oracle.apps.fnd.cp.request.JavaConcurrentProgram
    EBS Version - 12.1.3
    DB - Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit
    OS - Oracle Linux Server release 6.2
    Also can I create a properties file to store messages and access the file from my concurrent program.
    Thanks!

  • Exception Handling Within Methods

    I'm currently looking over exception handling within Java and have what whats probably a very simple question to answer!
    If within a method I have a try and catch block to handle all exceptions that the specific method may throw, do I then also need to specify the exceptions that the method will throw within its signature? (As I have already handled them).

    After a bit more reading I think i've found my answer.
    You only declare a method throws an exception if you wish to deal with it further up the method call stack. This raises another question though. If I did handle the exceptions that my method could throw within the method itself as well as declaring the method to throw the exceptions within its signature. What would happen?

  • Java Exception Handling

    Hello everyone,
    I'm searching for a design pattern / framework to manage exception handling. I'm currently working on a distributed document management system for PC / AS/400, which consists of Commandline clients, a Socket Server and a windows NT daemon in java, which accepts network requests from the Socket Server. Communication is done via serialized Objects.
    My Problem is, that exceptions can be thrown either on the server or on the client side and have to be transferred to the user. Error Messages should be read from the database. Exception handling should prefferably take place in a central piece of code, such as the two endpoints of network connections, the SocketServer as service under win32 and another SocketServer as Application on another box, currently with UNIX OS.
    thanks in advance for any answers
    regards

    You should look into Bridge [GOF:151] and Memento [GOF:273].
    Bridge allows you to decouple your mechanism from the implementation memento on how to propergate the decoupled exception information.

  • Test exact exception messages in java SE with locale for program handling

    My problem is test the exact exceptions returned by JAVA Standard Engine for program handling.
    I work in systems usually set to "Italian Locale" and the result is different in different platforms.
    When I work in MSWindows with Java almost messages are in English but not all, for example IOException "Cannot assign requested address" in the Italian Locale is "Indirizzo richiesto non valido nel proprio contesto" but other messages like "Socket Closed" remain "Socket Closed".
    Catch the exact exception through description is not a good idea but I don't found other way for Java SE native exceptions!
    In Solaris I try to set English LANG environment in the user context and it works.
    In MS Windows I try to set the definition in start java with:
    *"java -Duser.language=en -Duser.region=US"*
    and in the code I try to add the statement:
    Locale.setDefault(Locale.US);
    but without results.
    Is there anybody that has the same problem?
    Is there a better way to catch the exact type of Java SE exceptions ?
    My test Environments:_
    Solaris 10 jdk 1.6.0.02
    MS Windows 2000 jdk 1.6.0.02
    MS Windows XP jdk1.6.0.02 and 1.5.0.12
    Fragment program example for additional explanation:_
    try {
    } catch (IOException ex) {
    if (ex.getMessage().equals("Socket Closed"))
    System.out.println("Ok socket closed exception catched");
    if (ex.getMessage().equals("Cannot assign requested address"))
    System.out.println("Ok assign requested address exception catched");
    }

    My problem is test the exact exceptions returned by JAVA Standard Engine for program handling.
    I work in systems usually set to "Italian Locale" and the result is different in different platforms.
    When I work in MSWindows with Java almost messages are in English but not all, for example IOException "Cannot assign requested address" in the Italian Locale is "Indirizzo richiesto non valido nel proprio contesto" but other messages like "Socket Closed" remain "Socket Closed".
    Catch the exact exception through description is not a good idea but I don't found other way for Java SE native exceptions!
    In Solaris I try to set English LANG environment in the user context and it works.
    In MS Windows I try to set the definition in start java with:
    *"java -Duser.language=en -Duser.region=US"*
    and in the code I try to add the statement:
    Locale.setDefault(Locale.US);
    but without results.
    Is there anybody that has the same problem?
    Is there a better way to catch the exact type of Java SE exceptions ?
    My test Environments:_
    Solaris 10 jdk 1.6.0.02
    MS Windows 2000 jdk 1.6.0.02
    MS Windows XP jdk1.6.0.02 and 1.5.0.12
    Fragment program example for additional explanation:_
    try {
    } catch (IOException ex) {
    if (ex.getMessage().equals("Socket Closed"))
    System.out.println("Ok socket closed exception catched");
    if (ex.getMessage().equals("Cannot assign requested address"))
    System.out.println("Ok assign requested address exception catched");
    }

  • Can't fix a java.security.AccessControlException exception

    Hi.
    I have a webapp running under j2ee with a ContextListener that performs some initialization tasks.
    One of these tasks consists in querying a database and putting the results in a xml file according to an existing xml file that acts as a map for it maps the rows and columns of the result set to elements and attributes in the xml doc (this task is really performed by an EJB that the ContextListener instantiates).
    To do this, at some point the EJB tries to instantiate a new org.w3c.dom.Document object pointing to the xml map file witch, like I said, will be used to 'massaje' the data in the query into a xml format.
    Here's the revelant portion of the code:
    mapDoc = docbuilder.parse(mapfilepath);
    When the EJB tries to do this, the following exception is thrown:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\j2sdkee1.3.1\public_html\iFAQs\xml\temas-map.xml read)
    I've checked the server.policy file and it seems ok, it has a grant section that makes me believe I should have read and write access to all files under public_html:
    grant codeBase "file:${com.sun.enterprise.home}/public_html/-" {
    permission java.lang.RuntimePermission "loadLibrary.*";
    permission java.lang.RuntimePermission "accessClassInPackage.*";
    permission java.lang.RuntimePermission "createClassLoader";
    permission java.lang.RuntimePermission "queuePrintJob";
    permission java.lang.RuntimePermission "modifyThreadGroup";
    permission java.io.FilePermission "<<ALL FILES>>", "read,write";
    Any help will be much appreciated!
    Thanks!
    Best regards,
    Piponline, Portugal

    hi piponline,
    thanx for the question details u have specified, part of ur details are used to solve my problem. i have just copied the permissions statements for servlets to j2ee server section in server.pliciy file
    bye
    kireet

  • Exception Handling related problem

    Can anybody tell me why it is not giving ArithmeticException.
    package pckg1;
    * @author anil_saini
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    import java.io.FileNotFoundException;
    public class Average7 {
         public static void main(String[] args) throws InterruptedException,FileNotFoundException {
         try {                                                      // (1)            System.out.println(printAverage(100, 0));                                  // (2)
         } catch (ArithmeticException ae) {                         // (3)
         Thread.sleep(1000);
              ae.printStackTrace(); // (4)
    System.out.println("Exception handled in " + // (5)
         "main().");
         finally {
         System.out.println("Finally in main()."); // (6)
         System.out.println("Exit main()."); // (7)
    public static int printAverage(int totalSum, int totalNumber) {
         int average=0;
         try {                                                      // (8)
    average = computeAverage(totalSum, totalNumber); // (9)
         System.out.println("Average = " + // (10)
         totalSum + " / " + totalNumber + " = " + average);
         return average;
         } catch (IllegalArgumentException iae) {                   // (11)
              iae.printStackTrace(); // (12)
    System.out.println("Exception handled in " + // (13)
         "printAverage().");
         } finally {
    System.out.println("Finally in printAverage()."); // (14)
         return average;
         }     // (15)
    public static int computeAverage(int sum, int number) {
         System.out.println("Computing average.");
         if (number == 0) // (16)
    throw new ArithmeticException("Integer division by 0");// (17)
         return sum/number; // (18)
    Output
    =======================
    Computing average.
    Finally in printAverage().
    0
    Finally in main().
    Exit main().

    Because return statements in finally blocks are evil!
    int average = 0;
    try
    { // (8)
         average = computeAverage(totalSum, totalNumber); // (9)
         System.out.println("Average = " + // (10)
                   totalSum + " / " + totalNumber + " = " + average);
         return average;
    catch (IllegalArgumentException iae)
    { // (11)
         iae.printStackTrace(); // (12)
         System.out.println("Exception handled in " + // (13)
                   "printAverage().");
         throw new IllegalArgumentException();
    finally
         System.out.println("Finally in printAverage()."); // (14)
         return average; // (15)
    }You get an exception at (9), but finally is guaranteed to be executed, so the JVM executes it. Now you return in your finally block (15), and the JVM is left with the choice of executing your return statement or propagating the exception. Since, as said, finally is guaranteed to be executed, it returns and swallows the exception.
    That's why IMHO return statements in finally blocks should not be allowed.
    (Some compilers issue warnings)
    If you move your return statement out of the finally block, it will work as you'd expect it.

  • JAVA BEANSHELL EXCEPTION HANDLING

    Hi
    still new to ODI
    I have created a java beanshell script in ODI which calls a simple java class, cars, then sets the no of seats to a value designed to raise an exception. Exception raised but procedure works OK,
    How can I register the fact that it has failed through exception handling? (It is possible that my java exception handling isn't quite right)
    The no of seats has no effect on the success/failure of the ODI procedure, but the log shows that the exception is caught !
    any assistance gratefully received.
    Regards
    Terry
    cars class: (added to agent start)
    ====================
    public class cars {
    private int seats;
    public void setSeats (int seats) throws tooManySeatsException {
    if (seats) < 100) {
    this .seats = seats;
    } else {
    throw new tooManySeatsException("Too many seats");
    public int getSeats () {
    return this.seats;
    class tooManySeatsException extends Exception {
    public tooManySeatsException (String msg){
    super();
    Java beanshell procedure in ODI
    ====================
    import cars;
    public class carsTest {
    public carsTest(){
    public void init(){
    cars c = new cars();
    c.setSeats(20);
    //c.setseats(200);
    try {
    carsTest ct = new carsTest();
    ct.init();
    } catch (Exception e) {
    throw Error (e);
    }

    Your code throws exception when you set value >100 but you are setting 20 thus it would not throw exception.
    In the procedure step you can uncheck "Ignore error" flag to let execution failed on throwing any exception from your code. If you check that flag then the execution would not fail rather lease the task in warning state.

  • Is Exception Handling  in every Java code?

    Hi there,
    just curious, is including exception handling the "norm" for any Java code?

    Java divide the exception handling in two kinds :
    - exceptions which need to be programatically handled
    - exceptions which are automatically handled by Java such as ArrayIndexOutOfBounds, DivisionByZero, and lot of subclasses of RuntimeException.
    It's not because they are automatically handled that you can't handle them programatically, but programming will be too difficult and long if they wasn't handled automatically.
    Exception mechanism is very powerfull but a little bit long when an exception is thrown.
    Denis

  • Help! JDOM SAXParserFactory causing Security exception in Microsoft Java VM

    Hiya all, I'm really hoping you can offer me a hand with this problem.
    I'm having a problem with SAXParserFactory causing a security exception in
    Microsoft Internet Explorer, using JDOM b7.
    here is the error string it spits out:
    String...com.ms.security.SecurityExceptionEx[javax/xml/parsers/SAXParserFact
    ory.newInstance]: Unable to access system property:
    javax.xml.parsers.SAXParserFactory
    at com/ms/security/permissions/PropertyPermission.check
    (PropertyPermission.java)
    at com/ms/security/PolicyEngine.shallowCheck (PolicyEngine.java)
    at com/ms/security/PolicyEngine.checkCallersPermission (PolicyEngine.java)
    at com/ms/security/StandardSecurityManager.chk
    (StandardSecurityManager.java)
    at com/ms/security/StandardSecurityManager.checkPropertyAccess
    (StandardSecurityManager.java)
    at java/lang/System.getProperty (System.java)
    at javax/xml/parsers/SAXParserFactory.newInstance
    (SAXParserFactory.java:139)
    at java/lang/reflect/Method.invoke (Method.java)
    at org/jdom/input/SAXBuilder.createParser (SAXBuilder.java)
    at org/jdom/input/SAXBuilder.build (SAXBuilder.java)
    at org/jdom/input/SAXBuilder.build (SAXBuilder.java)
    at aim/AIMPanel.parseXML (AIMPanel.java:673)
    at aim/AIMPanel.serverCall (AIMPanel.java:486)
    at aim/LogicalAIM.<init> (LogicalAIM.java:62)
    at aim/AIMPanel.customInitialize (AIMPanel.java:1595)
    at shout3d/Shout3DPanel.n (Shout3DPanel.java)
    at shout3d/Shout3DPanel.run (Shout3DPanel.java)
    at java/lang/Thread.run (Thread.java)
    Using Microsoft's 5.0.0.3802 VM, this error results in a NullPointer
    Exception further down, causing the app to quit.
    in 5.0.0.3310, it reports the error but continues to run.
    in 5.0.0.3234, no errors are reported at all.
    Do you guys have any idea what's going on and why, and what I might be able
    to do to correct this?
    Any help is greatly appreciated...
    -J

    The factory classes (DocumentBuilderFactory and SAXParserFactory) use a Systems Property to determine which parser to use. Since applets do not have access to the Systems properties, a security exception is usually thrown.
    I have not done work with Applets that use JAXP, however I would bet if you search this forum you will find other who have had this problem along with a possible work around.
    Hope this helps.

  • Handling apllication java.Exceptions

    I've developed an Weblogic WebService Application with several webservices inside.
    They are working fine but when a WebService throws a java Exception this exception is putted inside a SoapFaultException.
    After some research I figured that I should create my own Exceptions that inherits from SoapFaultException to best format the exception message
    my clients will receive, ok it is done and it's working. Now I need to handle all java Exceptions (witch were not throw by me) to put it in my own Exceptions witch inherits from soapFaultException. Does anybody know if I can implement an Exception handler that will capture all java Exceptions unhandled by my applicatio.
    I'm using WLS 9.2.

    Rethrow an exception and catch it in the call in JavaFX code?

Maybe you are looking for