Bug in Sun code sample... throwing an exception from a static variable decl

I got this line from a Sun tutorial (on logging):
private static FileHandler fh = new FileHandler("mylog.txt");
Declared in a class as a variable. The compiler (1.4) warns that an IOException must be thrown or caught, and refuses to compile this line. I thought I could program Java (been at it for 4 years) until now, and I realize that I don't know what to do. How do you catch an exception thrown outside of a method? Is this really such a hard case, or am I stupidly missing something obvious?
Everlasting gratitude to the kind person who can solve my quandry.
(Code sample taken from http://java.sun.com/j2se/1.4.1/docs/guide/util/logging/overview.html#2.3)

You can do this:
private static FileHandler fh;
static
   try
      fh = new FileHandler("mylog.txt");
   } catch (IOException e)
      //Handle the exception
}I don't think there's anyway of handling exceptions outside the scope of a function.
Regards,
Nille

Similar Messages

  • How do i throw BPEL exception from java embedded activity

    Hello everybody,
    i want to use some embedded java code in my BPEL process (bpelx:exec). This code would sometimes throw exceptions. How can i deal with these exceptions to control my BPEL process? I would like, in a sense, to do some catching of java exceptions but at the BPEL level... for example, my java code would throw an exception, that my BPEL process would "catch" and react the way i want. Is it possible to do that?
    Thanks for your help!

    Re: Embedded Java in BPEL and exception handling

  • Throwing an exception from XSLT

    Just wanted to share a finding with the Oracle XDB community and possibly suggest an enhancement to the xdb product development team (care of MDRAKE).
    I had a scenario where I wanted to throw an exception from the XSLT.
    A little Googling revealed this helpful post:
    http://weblogs.asp.net/george_v_reilly/archive/2006/03/01/439402.aspx
    ...so I gave it a shot.
    In my XSLT, I have a <xsl:choose> block with the following <xsl:otherwise> block:
    <xsl:otherwise>
        <xsl:message terminate="yes">Unknown Document Type</xsl:message>                          
    </xsl:otherwise>I used a stub test to run this through, giving it a file which would exercise the exception:
    select xmltype(bfilename('XML_RESOURCES', 'data.xml'),0).transform(xmltype(bfilename('XML_RESOURCES', 'sanitize_xml.dev.xsl'),0))
    from dual;..and to my 'joy', I did get an exception:
    ORA-30998: transformation error: execution of compiled XSLT on XML DOM failedHmm...would of been nicer to get something like what Eclipse/Xalan pops out:
    file:/H:/eclipse_indigo_workspace/XSLT/sanitize_xml.xsl; Line #28; Column #59; Unknown Document Type
    (Location of error unknown)Stylesheet directed termination...i.e. my custom error message "Unknown Document Type" isn't output by Oracle.
    Just to be safe, I tried a file which would NOT exercise this xsl:otherwise block and it did run through OK.
    So, could XDB report a better error?
    Thoughts?

    SQL> VAR XSL VARCHAR2(4000)
    SQL> --
    SQL> begin
      2    :XSL :=
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      5     <xsl:output method="xml" indent="yes"/>
      6     <xsl:template match="/">
      7             <Result>
      8                     <xsl:choose>
      9                             <xsl:when test="Input=''1''">
    10                                     <Output>1</Output>
    11                             </xsl:when>
    12                             <xsl:when test="Input=''2''">
    13                                     <xsl:message>The value is 2</xsl:message>
    14                                     <Output>2</Output>
    15                             </xsl:when>
    16                             <xsl:when test="Input=''3''">
    17                                     <xsl:message terminate="no">The value is 3</xsl:message>
    18                                     <Output>3</Output>
    19                             </xsl:when>
    20                             <xsl:otherwise>
    21                                     <xsl:message terminate="yes">Invalid value</xsl:message>
    22                                     <Output>Bad Input</Output>
    23                             </xsl:otherwise>
    24                     </xsl:choose>
    25             </Result>
    26     </xsl:template>
    27  </xsl:stylesheet>';
    28  end;
    29  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> select XMLTRANSFORM(XMLTYPE('<Input>1</Input>'),XMLTYPE(:XSL))
      2    from dual
      3  /
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <Result>
      <Output>1</Output>
    </Re
    Elapsed: 00:00:00.01
    SQL> select XMLTRANSFORM(XMLTYPE('<Input>2</Input>'),XMLTYPE(:XSL))
      2    from dual
      3  /
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <Result>
      <Output>2</Output>
    </Re
    Elapsed: 00:00:00.00
    SQL> select XMLTRANSFORM(XMLTYPE('<Input>3</Input>'),XMLTYPE(:XSL))
      2    from dual
      3  /
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    <Result>
      <Output>3</Output>
    </Re
    Elapsed: 00:00:00.01
    SQL> select XMLTRANSFORM(XMLTYPE('<Input>4</Input>'),XMLTYPE(:XSL))
      2    from dual
      3  /
    ERROR:
    ORA-30998: transformation error: execution of compiled XSLT on XML DOM failed
    no rows selected
    Elapsed: 00:00:00.01
    SQL>
    SQL>The actuall error is not unreasonalbe. The Execution did fail beacuse you terminated it.. Contacting Oralce Support may be a little excessive...
    Now with respect to message the question is where...
    We 'could' output into the same buffer as is used by DBMS_OUTPUT, but that has limits in terms of the amount of output that can be generated.
    We could write it to the trace file, but that may be difficulat for a developer to get to
    We could write it to a log file in the XDB repository, but where and how to name it...
    We could another parameter to XMLTransform, which would be a Message Buffer
    All of these are in effect enhancements..
    BTW I checked with XML Spy and they seem to ignore message too, so I'm wondering how widely used this is...
    We cannot add it to the output of the XSL since XMLTransform defines the output of the XML to be well formed XML, and adding a random set of text nodes would viloate that rule..

  • Is it possible to throw an exception from a handler chain with JAXWS???

    I know I cannot throw directly an exception from the handler cause my handler extends SOAPHandler and the method handlerMessage cannot throw exceptions. The problem is that I would like to validate some authorization and if the client doesn't have the appropriate rights, I would like to throw an exception from the handler without calling the web service itself, so the client would receive a valid soap response from the server. Is it possible?? Is there another mechanism that I can use to do that??
    Thanks a lot
    Korg

    You can throw a ProtocolException or RuntimeException from handleMessage().
    If you throw ProtocolException, HandleFault() is called on previously invoked handlers.
    If you throw a RuntimeException, handleFault() or handleMessage() is not called on previously invoked handlers, and the Exception is converted to Fault message and dispatched.

  • Is it possible to throw an exception from run method of a thread?

    Is it possible to throw an exception from "run method of a thread"(implemented as runnable implementation)?
    Is it advisable to do so?

    Is it possible to throw an exception from "run method
    of a thread"(implemented as runnable
    implementation)?Yes, an unchecked one. Runtime exceptions.
    Is it advisable to do so?If you mess up it happens automatically. But basically: no.

  • Throw an exception from one class to another?

    I have an applet that analyzes different sorting algorithms. Each sorting algorithm is a seperate class. The applet passes the sorting algorithm class an unsorted array, the sorting algorithm sorts the array, and returns the sorted array to the applet. Sometimes the sorting class will generate a stack overflow exception. How do i catch the exception in the sorting class and throw it to the applet, which can then display a dialog box. In the sorting class I have setup a try/catch block that throws the exception and in the class decleration it says "throws Exception". The code in the applet that executes the sort class is inside of at try block as well. When the prog generates an exception in the sorting class it wont throw and be caught by my applet. How can this be done?
    Thanks,
    Dave

    StackOverflowException is not descendand of Exception class:
    java.lang.Object
      |
      +--java.lang.Throwable
            |
            +--java.lang.Error
                  |
                  +--java.lang.VirtualMachineError
                        |
                        +--java.lang.StackOverflowErrorSo if you like to catch it dont declare method to throw Exception (Error class is unchecked exception so it doesn't need to be declared to be thrown). Just try to catch StackOverflow or Throwable. Good luck !

  • Getting the name of the page that throws an exception from an error page

    How can I get the name of the page that throws an
    error exception from an error page?.
    Thanks.

    In each of your jsp pages, u should set the name of page in the request object. e.g.
    In jsp page called main.jsp you should do request.setAttribute("pageName","main.jsp");
    Then in error page you can get the name like
    String pageInError = (String) request.getAttribute("pageName");
    I hope that answers your question.
    thx

  • Throwing Runtime Exceptions from BPM. How?

    Hi !
    I want to make appear a red flag in the SXMB_MONI as a result of a custom condition inside a BPM. I tried with the control step, but it makes no "red flag".
    Should I make a transform step between 2 dummy message types with a UDF that throws the runtime exception there?? is there another way ?? We want a red flag as a result of a expired deadline while waiting a file adapter transport acknowledgement.
    Thanks !!
    Matias.

    Matias,
    As you said before you want the BPM to be errored out if it reach the deadline, am I right. In control step if u say cancel process it equivalent to logically deleting the work items, so obviously you will get an succesfull message. What I suggest you to do is in  Deadline branch - control branch select throw exception. The exception name has to be defined in Block level. So if you throw an exception it will look for the exception branch in the same block level if not the higher(super)block level, if it couldn't find the exception branch it will run out to error. Actually the exception branch is used to catch that exception and continue the rest of the process, so i think there is no need for defining the exception branch itself.
    Hope it helps you!!!
    Best regards,
    raj.

  • Code Sample: Easy RFC Lookup From XSLT Mappings Using a Java Helper Class

    Hi everyone,
    This is just a shameless plug for my article: <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/05a3d62e-0a01-0010-14bc-adc8efd4ee14">Easy RFC Lookup From XSLT Mappings Using a Java Helper Class</a>. I hope you're interested in reading it, and I welcome your comments in this thread.
    Kind regards,
    Thorsten

    Hi Stefan. Thanks for your post. I have already done that. It still does not work. As a base for my java helper class I have usesd Thorstens code.
    The problem is quite confusing. I will try to ouline both issues here.
    First of all, when try to test from within the Operation Mapping, I always get a java error saying it cannot find the communication channel (it is there and working because I have tested it with the RFCLookup in graphical mapping). I have found a way to work around this, and that is to uncheck the "Use SAP XMLToolkit" checkbox --> switch to test tab, enter my ReceiverService in the parameter tab (header parameter) --> switch back to Definition tab, check the "Use SAP XMLToolkit" checkbox --> switch to Test tab and run the test. Then the XSLT and call to java helper class will work. Of course this is not really something you want to do all the time. Maybe there is a bug.
    Secondly, it never works when I try to do it "live". I am using a file adapter to pick up one file, convert it and a file adapter to drop the converted file. I get the following error code in SXMB_MONI.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!--  Request Message Mapping   -->
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">TRANSFORMER_CONF_EX</SAP:Code>
      <SAP:P1>ATJ_Accounting2XML_Accounting.xsl</SAP:P1>
      <SAP:P2>http://rd.accounting.logica.com</SAP:P2>
      <SAP:P3>fd552c30-bad9-11dd-9761-c21dac1b818c</SAP:P3>
      <SAP:P4>-1</SAP:P4>
      <SAP:AdditionalText />
      <SAP:Stack>TransformerConfigurationException triggered while loading XSLT mapping ATJ_Accounting2XML_Accounting.xsl; http://rd.accounting.logica.comfd552c30-bad9-11dd-9761-c21dac1b818c-1</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Using an XSLT without a call to a java helper class, works just fine.
    I am totally at a loss here. Any more input would be much appreciated.
    /Patrik

  • Throw JBO exception from doDML method-urgent HELP

    Hi,
    I am catching an exception on deleting a parent record without deleting a child record(FK constraint) in doDML delete operation method,when i am throwing a JBOexception with a custom message with in the catch block it is not refelecting in the front end,how can i display the FK contraint as a custom message in the front end?
    however i was able to throw a jbo exception in TP2 with in the doDml method,which was displaying to the front end.
    im using ADf TP3 11g
    -regards

    Hi,
    a similar question was posted last week. I replied saying that TP3 is supposed to work as TP2. If this isn't the case, please wait for TP4 to verify if the problem still exist and if, post another message with a reproducible testcase. TP4 will be out soon
    Frank

  • Throwing Business Exception from Human Task

    Hi,
    Can anyone point me to some examples, of how can I configure a Human Task to throw a business exception in a BPMN process ?
    I want to provide th user with the ability of completing the task normaly, or launch a business exception like, cancel the order, or lack of stock.
    I'm using Fusion 11g.
    Thank You.
    /RG

    Hi
    Thanks for the reply. But, I'm not sure I understood you correctly. What I want, is not to capture an exception after a human task, but to generate one in it. I want to add an error boundary event to a human task. The user can fill the form normally (for example a purchase order) and the normal flow continues or he can generate an exception (like cancel case, or lack of stock) that will be cought by the error boundary event.
    What I want to know is how can I generate a business exception inside a human task? For example in the interface.
    Is this the right way to do it ? Am I missing something ?

  • Calling a PP03 BDC  from abap webdynpro throws an exception from the class

    Hi Experts,
    I am calling a BDC FM for PP03 TCPDE form abap webdynpro.
    When i run the standalone FM, it works fine and When called from Webdynpro its giving a dump saying an exception is raised in the class CL_GUI_SPLITTER_CONTAINER.
    Can you please let me know how to resolve the issue? Your siggestions will be of great help to me.
    Thanks,
    Shilpa

    >
    shilpa hv wrote:
    > Hi Experts,
    >
    > I am calling a BDC FM for PP03 TCPDE form abap webdynpro.
    > When i run the standalone FM, it works fine and When called from Webdynpro its giving a dump saying an exception is raised in the class CL_GUI_SPLITTER_CONTAINER.
    >
    >
    > Can you please let me know how to resolve the issue? Your siggestions will be of great help to me.
    >
    >
    > Thanks,
    > Shilpa
    Hi,
    The FM might be calling a dialog or bringing a GUI screen up. This would cause the Webdynpro session to disconnect abruptly.
    Any conversion exit, GUI screen,dialog popup, transaction handling..etc would cause the webdynpro to disconnect. So you cannot use all FM's as it is.

  • Throwing jbo exception from AppModule class

    If a JBO exception does not appear on the JSF page when thrown from the AppModule class, what are some things that should be checked?

    Jaime,
    I'm not really sure what your question is, but backing beans would generally be considered part of the controller layer, in my opinion.
    JBO exceptions are typically raised from the Model layer.
    What exactly are you trying to do here? Can you share the use case?
    John

  • How to throw custom exception from sessionbean

    I define an AppException generalize from EJBException.
    public class AppException extends EJBException{
    when error occurs in sessionbean,I throw AppException, Container perform rollback operation. but at client. I only get EJBException, Why? and How can I get AppException from sessionbean?

    AppException extends RuntimeException

  • Code Sample: cardinfo for JCOP41V22 Card

    Listed below is the code sample, cardinfo.java, deduced from loader.java for JCOP41V22 card:
    import java.io.*;
    import com.ibm.jc.*;
    import com.ibm.jc.terminal.*;
    * Sample cardinfo. Demonstrates how to use the offcard API to list applets informatoin,
    * JCOP41V22 by shrinking the loader.java code.
    * Modified by: freiheit / 13/10/2005
    public class cardinfo{
         protected static final byte[] JCOP_CARD_MANAGER_AID = { (byte) 0xa0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00};
         protected static final byte defaultInstallParam[] = { -55, 0 }; // don't know what it's for
         public static void main(String[] args){
         if (args.length == 0){
         System.out.println("cardinfo.main(): missing cap-file argument");
         System.exit(1);
         try{
         cardinfo l = new cardinfo();
         //l.load(args[0]);
         l.getcardinfo();
         }catch(Exception e){
         System.err.println("EX: msg " + e.getMessage() + ", class " + e.getClass());
         e.printStackTrace(System.err);
         System.exit(0);
    private cardinfo(){}
    //private void load(String capFileName) throws Exception{
    private void getcardinfo() throws Exception{
         //CapFile capFile = new CapFile(capFileName, null);
    /*CapFile capFile = new CapFile("C:\\Documents and Settings\\Seah Peng Chew\\workspace\\Helloworld\\bin\\com\\acme\\helloworld\\javacard\\helloworld.cap", null);
         System.out.println("Package name: " + capFile.pkg);
         byte[][] applets = capFile.aids;
         if ((applets == null) || (applets.length == 0)){
         throw new RuntimeException("no applets in cap file");
         // Get connection to terminal, we look for the simulation.
         // As you might want to use "pcsc", "4" or "tcl", "10" in case of
         // Windows or "PCSC", null in case of Linux, you should pass the name
         // of the terminal on the command line or in a properties file
         System.out.println("Open terminal ...");     
         //Make sure the simulator jcop.exe is activated before unmark this satement
         //before running
         //Issue /close command at "cm" prompt if the card is in use,, ie it should
         //have "-" prompt.
         JCTerminal term = JCTerminal.getInstance("Remote", null);
         //For real JCOP41V22 card, please unmark this statement before running
         //Issue /close command at "cm" prompt if the card is in use,, ie it should
         //have "-" prompt.
         //JCTerminal term = JCTerminal.getInstance("pcsc:4", null);
         term.open();
         term.waitForCard(5000);
         TraceJCTerminal _term = new TraceJCTerminal();
         _term.setLog(new PrintWriter(System.out));
         _term.init(term);
         term = _term;
         System.out.println("Get card ...");
         JCard card = new JCard(term, null, 2000);
         System.out.println("Select card manager ...");
         CardManager cardManager = new CardManager(card, CardManager.daid);     
         cardManager.select();
         byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
         cardManager.setKey(new OPKey(255, 1, OPKey.DES_ECB, dfltKey));
         cardManager.setKey(new OPKey(255, 2, OPKey.DES_ECB, dfltKey));
         cardManager.setKey(new OPKey(255, 3, OPKey.DES_ECB, dfltKey));
         System.out.println("Authenticate to card manager ...");
         cardManager.initializeUpdate(255, 0, CardManager.SCP_UNDEFINED);
         cardManager.externalAuthenticate(OPApplet.APDU_CLR);
         cardManager.update();
         JCInfo info = JCInfo.INFO;
         System.out.println("\nCardManager AID : " + JCInfo.dataToString(cardManager.getAID()));
         System.out.println("CardManager state : " + info.toString("card.status", (byte) cardManager.getState()) + "\n");
         Object[] app = cardManager.getApplets(1, 0, true);
         if (app == null) {
         System.out.println("No applets installed on-card");
         } else {
         System.out.println("Applets:");
         for (int i = 0; i < app.length; i++) {
              System.out.println(info.toString("applet.status", (byte) ((OPApplet) app).getState()) + " " + JCInfo.dataToString(((OPApplet) app[i]).getAID()));
         Object[] lf = cardManager.getLoadFiles(0, true);
         if (lf == null) {
         System.out.println("No packages installed on-card");
         } else {
         System.out.println("Packages:");
         for (int i = 0; i < lf.length; i++) {
              System.out.println(info.toString("loadfile.status", (byte)((LoadFile) lf[i]).getState()) + " " + JCInfo.dataToString(((LoadFile) lf[i]).getAID()));
         term.close();
    static String numbers = "0123456789abcdef";
    private byte[] c2b(String s) {
         if (s == null) return null;
         if (s.length() % 2 != 0) throw new RuntimeException("invalid length");
         byte[] result = new byte[s.length() / 2];
         for (int i = 0; i < s.length(); i += 2) {
         int i1 = numbers.indexOf(s.charAt(i));
         if (i1 == -1) throw new RuntimeException("invalid number");
         int i2 = numbers.indexOf(s.charAt(i + 1));
         if (i2 == -1) throw new RuntimeException("invalid number");
         result[i / 2] = (byte) ((i1 << 4) | i2);
         return result;
    I have tested the code with JCOP Plug-in 3.1.1a in Windows environment.
    Please give your comments and feedback.

    The posted code had some errors in the part which enumerate the installed applets and packages. I corrected that.
    Second I changed the class name from "cardinfo" to "CardInfo", because of java code style.
    import java.io.PrintWriter;
    import com.ibm.jc.CardManager;
    import com.ibm.jc.JCInfo;
    import com.ibm.jc.JCTerminal;
    import com.ibm.jc.JCard;
    import com.ibm.jc.LoadFile;
    import com.ibm.jc.OPApplet;
    import com.ibm.jc.OPKey;
    import com.ibm.jc.terminal.TraceJCTerminal;
    * Sample cardinfo. Demonstrates how to use the offcard API to list applets informatoin, JCOP41V22
    * by shrinking the loader.java code. Modified by: freiheit / 13/10/2005
    public class CardInfo {
        protected static final byte[] JCOP_CARD_MANAGER_AID = { (byte) 0xa0, 0x00, 0x00, 0x00, 0x03,
                0x00, 0x00, 0x00 };
        protected static final byte defaultInstallParam[] = { -55, 0 }; // don't know what it's for
        public static void main(String[] args) {
             * if (args.length == 0){ System.out.println("cardinfo.main(): missing cap-file argument");
             * System.exit(1); }
            try {
                CardInfo l = new CardInfo();
                // l.load(args[0]);
                l.getcardinfo();
            } catch (Exception e) {
                System.err.println("EX: msg " + e.getMessage() + ", class " + e.getClass());
                e.printStackTrace(System.err);
            System.exit(0);
        private CardInfo() {
        // private void load(String capFileName) throws Exception{
        private void getcardinfo() throws Exception {
            // CapFile capFile = new CapFile(capFileName, null);
             * CapFile capFile = new CapFile("C:\\Documents and Settings\\Seah Peng
             * Chew\\workspace\\Helloworld\\bin\\com\\acme\\helloworld\\javacard\\helloworld.cap",
             * null); System.out.println("Package name: " + capFile.pkg); byte[][] applets =
             * capFile.aids; if ((applets == null) || (applets.length == 0)){ throw new
             * RuntimeException("no applets in cap file"); }
            // Get connection to terminal, we look for the simulation.
            // As you might want to use "pcsc", "4" or "tcl", "10" in case of
            // Windows or "PCSC", null in case of Linux, you should pass the name
            // of the terminal on the command line or in a properties file
            System.out.println("Open terminal ...");
            // Make sure the simulator jcop.exe is activated before unmark this satement
            // before running
            // Issue /close command at "cm" prompt if the card is in use,, ie it should
            // have "-" prompt.
            JCTerminal term = JCTerminal.getInstance("Remote", null);
            // For real JCOP41V22 card, please unmark this statement before running
            // Issue /close command at "cm" prompt if the card is in use,, ie it should
            // have "-" prompt.
            // JCTerminal term = JCTerminal.getInstance("pcsc:4", null);
            term.open();
            term.waitForCard(5000);
            TraceJCTerminal _term = new TraceJCTerminal();
            _term.setLog(new PrintWriter(System.out));
            _term.init(term);
            term = _term;
            System.out.println("Get card ...");
            JCard card = new JCard(term, null, 2000);
            System.out.println("Select card manager ...");
            CardManager cardManager = new CardManager(card, CardManager.daid);
            cardManager.select();
            byte[] dfltKey = c2b("404142434445464748494a4b4c4d4e4f");
            cardManager.setKey(new OPKey(255, 1, OPKey.DES_ECB, dfltKey));
            cardManager.setKey(new OPKey(255, 2, OPKey.DES_ECB, dfltKey));
            cardManager.setKey(new OPKey(255, 3, OPKey.DES_ECB, dfltKey));
            System.out.println("Authenticate to card manager ...");
            cardManager.initializeUpdate(255, 0, CardManager.SCP_UNDEFINED);
            cardManager.externalAuthenticate(OPApplet.APDU_CLR);
            cardManager.update();
            JCInfo info = JCInfo.INFO;
            System.out.println("\nCardManager AID : " + JCInfo.dataToString(cardManager.getAID()));
            System.out.println("CardManager state : "
                    + info.toString("card.status", (byte) cardManager.getState()) + "\n");
            OPApplet[] app = (OPApplet[]) cardManager.getApplets(1, 0, true);
            if (app == null) {
                System.out.println("No applets installed on-card");
            } else {
                System.out.println("Applets:");
                for (int i = 0; i < app.length; i++) {
                    System.out.println(info.toString("applet.status", (byte) app.getState()) + " "
    + JCInfo.dataToString(app[i].getAID()));
    LoadFile[] lf = cardManager.getLoadFiles(0, true);
    if (lf == null) {
    System.out.println("No packages installed on-card");
    } else {
    System.out.println("Packages:");
    for (int i = 0; i < lf.length; i++) {
    System.out.println(info.toString("loadfile.status", (byte) lf[i].getState()) + " "
    + JCInfo.dataToString(lf[i].getAID()));
    term.close();
    static String numbers = "0123456789abcdef";
    private byte[] c2b(String s) {
    if (s == null)
    return null;
    if (s.length() % 2 != 0)
    throw new RuntimeException("invalid length");
    byte[] result = new byte[s.length() / 2];
    for (int i = 0; i < s.length(); i += 2) {
    int i1 = numbers.indexOf(s.charAt(i));
    if (i1 == -1)
    throw new RuntimeException("invalid number");
    int i2 = numbers.indexOf(s.charAt(i + 1));
    if (i2 == -1)
    throw new RuntimeException("invalid number");
    result[i / 2] = (byte) ((i1 << 4) | i2);
    return result;

Maybe you are looking for

  • How do i reset a counter in crio scan interface mode

    Hai,      I am using cRIO 9104 with NI 9421(DI SINKING) module for my counter application in scan mode. I have a doubt that how do i reset my counter previous value when my system is in idle mode(i.e stable mode).I tried to use a timeout in property

  • How to use (Verify database) in DB13.

    Dear all, I tried to use (Verify database) in DB13 but it doesnt works. It says that the instance is up. HOw do I use this option in DB13. Thanx in advance. Lalit Rana

  • Tracing an external RFC call

    Hi I am calling a Remote Function Module from a web dynpro  application in BW system but somehow it is not functioning properly. I want to  find out if the control has actually reached the Function Module in BW system and then some error is happening

  • The Adobe Forms was created with Disable Fields!

    Hi All, I am new in Adode Interactive Forms ABAP.  I am trying to implement a simple scenario using Web Services published by RFC on ABAP side and simple form with one field  MATNR to bring a Description MARKT, and button to call the Web Services.  I

  • CALL TRANSACTION 'MM06'

    Hi, I am calling a transaction as; CALL TRANSACTION 'MM06' USING BATCH_ITAB MODE pMODE                    MESSAGES INTO MES_ITAB UPDATE 'S'. in BATCH ITAB: 'X' 'SAPMM03G' '0100', ' ' 'RM03G-MATNR' "any matnr, ' ' 'RM03G-WERKS' "any werks, ' ' 'RM03G-