Get stack trace into a string with CLDC

I want to get the stack trace of an application into a string, so that I may print the stack trace elsewhere.
CLDC api does not have a printStackTrace(PrintWriter pw) or printStackTrace(PrintStream ps) which is present in j2se.
Could you please suggest another way in CLDC to obtain the stack trace into a string.

Set System.err to your designated PrintStream and then call Throwable.printStackTrace().
This will do what you desire.
rob,

Similar Messages

  • HT201263 i need to get my iphone into recovery mode with a broken home button and is disabled, my exgirlfriend has the laptop i synced it with, what should i do??

    i need to get my iphone into recovery mode with a broken home button and is disabled, my exgirlfriend has the laptop i synced it with, what should i do??

    i have the same probelm did u get it solved if yess how ?

  • How to get stack trace of an exception

    Hi,
    I want to get whole stack trace and show it in a new Frame instead of showing on command line.
    when I say,
    e.getMessage();
    it gives just first line, not rest of the part.
    Can anybody help me with that?
    Thanks in advance.

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    e.printStackTrace(pw);
    String stackTrace = sw.toString();

  • Converting a Labview time into a string with Measurement Studio C++

    In my Measurement Studio-based C++ application, I'll be sent a Labview
    time in the format of a double, which I believe is seconds since 1904.
    Does Measurement Studio for Visual C++ contain a function that will
    convert that time value into a string format? I'd like to end up with
    something like "hh:mm:ss:msec". I'm basically looking for the
    equivalent of the Labview vi, "Format Time/Date String". If Measurement
    Studio doesn't provide this, is there some other (hopefully simple) way
    to do this?
    I can request that the Labview application send me time in a string
    format as well as a double; this will require several changes to the
    Labview application sending the timestamp, but if that is a simpler
    solution that's the option we'll take.
    Thanks in advance,
    Adam

    Measurement Studio does not have a function for this, but you can do
    this yourself by first converting from LV epoch (1/1/1904) to Unix
    epoch(1/1/1970) and then using c runtime time functions
    UNIXEpochOffset is the difference between the 2 epochs at GMT. To
    convert to a UNIX system clock value, just subtract the sum of this
    number and your time zone offset in seconds
    lvTime is the value returned by LV timestamp
    #define  UNIXEpochOffset 2082844800
    int _tmain(int argc, _TCHAR* argv[])
        __int64 lvTime = 3214396284; //10:48:13.173 AM 11/9/2005
        //GMT offset for Central Time is -6 (3600 seconds). You will need to account for daylight savings time.
        int offset = -3600;
        time_t unixTime = lvTime - UNIXEpochOffset - offset;  
        struct tm *newtime = localtime(&unixTime);
        printf(asctime( newtime )); //prints out the time in a string format.
        return 0;
    Bilal Durrani
    NI

  • Abstract Trace into a string

    HI Folks,
    I am working on a graphical mapping and I am using a global container to write all my traces say     trace.addInfo("Line 1");   trace.addInfo("Line 4"); etc etc
    Now I want to retrieve  the trace information and return them as a string or an array of string to another field/fields.
    Can anyone suggest how can I write that abstract trace(which we can see while executing the mapping in test tab) information into a field ???
    Thanks,
    VK

    HI Everyone,
    Let me make my question simple:
    I am not looking for something at the stage of writing data!!
    Let us assume I dont have any chance to edit it!!!
    My requirement is that if the data is already there in the trace, can we retrieve it ???
    When we write data into abstract trace we can see it when we execute the mapping (Just a java i/o stuff).
    but I want to retrieve the data from abstract trace in some field mapping!!!
    Hope this explains my question!!!
    Thanks & Regards,
    VK

  • How can i get the length of a string with Simplified Chinese?

    when i use eventwriter to add content to a xmldocument,there are some chinese simplified string in it,i use String.length() for the length ,but it is not correct~how can i get the right length for eventwriter?

    Below is a simple patch for this problem. Using this patch you need to pass 0 as the length argument for any XmlEventWriter interfaces that take a string length.
    Regards,
    George
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp    Fri Nov  3 12:26:11 2006
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsEventWriter.cpp      Thu Mar 15 13:58:13 2007
    *** 234,239 ****
    --- 234,241 ----
            CHECK_NULL(text);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)text);
            if (!_current)
                    throwBadWrite("writeText: requires writeStartDocument");
            try {
    *** 413,418 ****
    --- 415,422 ----
            CHECK_NULL(dtd);
            CHECK_SUCCESS();
    +       if (!length)
    +               length = ::strlen((const char *)dtd);
            if (_current) {
                    if (!_current->isDoc())
                            throwBadWrite("writeDTD: must occur before content");
    diff -c dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp
    *** dbxml-2.3.10/dbxml/src/dbxml/nodeStore/NsWriter.cpp Tue Jan  2 16:01:14 2007
    --- dbxml-2.3.10.patch/dbxml/src/dbxml/nodeStore/NsWriter.cpp   Thu Mar 15 13:59:25 2007
    *** 326,331 ****
    --- 326,333 ----
                    needsEscape = false;
            else
                    needsEscape = true;
    +       if (!length)
    +               length = ::strlen((const char *)chars);
            writeTextWithEscape(type, chars, length, needsEscape);
    *** 336,341 ****
    --- 338,345 ----
                                  bool needsEscape)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)chars);
                    if ((type == XmlEventReader::Characters) ||
                        (type == XmlEventReader::Whitespace)) {
                            char *buf = 0;
    *** 381,386 ****
    --- 385,392 ----
      NsWriter::writeDTD(const unsigned char *data, int len)
            if(_entCount == 0) {
    +               if (!len)
    +                       len = ::strlen((const char *)data);
                    _stream->write(data, len);
      }

  • Ok how can i get songs back into my ipod with itunes 7

    alright well heres the deal ever since i updated my itunes its been saying my ipod is corrupted and wouldnt update it...EVER...so i tried pluggin it n unpluggin it bout 5-9 times to c if it wud work again..i gave up and just restored it...and now it gives me an "the contents of this ipod cannot b read" and it says to restore it..but the ipod does not show up in the preferences tabs or in the source list...so i dont kno how 2 restore it...HOW CAN I GET MY IPOD WORKING AGAIN?!?!?!?!?!?!? plz help =(

    i have had the same problem with my ipod nano... i updated my itunes to itunes 7 and since then - it says that i have no internet connection - and my ipod won't even show up at all... it says to restore it - did that, but still wont work...
    I need help with this too!!!

  • How can I get a song into my iPhone with iTunes match on?

    I have some spanish learning tracks, and it wont upload to the cloud.
    I cannot access my music in the sync mode of my phone. it just says I have match on.
    How can I get these track on my phone so I can learn spanish?

    Much like the act of putting your old chumbawumba cd in a box in the attic to make space on your shelf for newer and better music, you should cleanse your iphone of old music files regularly.  Songs aren't gone forever, you can still dust them off and listen to them later if the mood strikes.
    Open settings click general>usage>storage>music>edit
    Then delete all locally stored music
    If your in the mood you can always download that catchy "I get knocked down, but I get up again... You ain't ever gonna keep me down" track and rock out like its 1998 (or whenever that **** song came out)

  • Solution: Stack traces on actual devices

    I've created a tool to work around one of the major problems when developing for CLDC: getting proper stack traces. Using the tool you get stack traces (with correct line number info) on exception situations also when running MIDlets on real devices. You can redirect the trace to any desired destination (e.g. a log file).
    There isn't much documentation yet but it works and it's a real time saver. Check it out at [http://jarrut.sourceforge.net].

    I believe this does what you're talking about.
    yourLoggerName.error("your error message",yourException);Since you are using log4j, check their documentation about the methods:
    http://logging.apache.org/log4j/docs/api/index.html
    While there, look up debug, info, warn, error, fatal, and if you are using a recent version of log4j also see trace. You'll want the methods that pass the message and Throwable.

  • Is it possible to write into the clipboard with HTML flavor ?

    Hello,
    Last week I already posted this question in the awt abstract  forum, but since nobody answered, I guess it was not the right place. Thanks for any suggestions or comments
    I'm having a problem with the code below. Here is the scenario I wish to perform :
    1. Display a web page with my favorite navigator
    2. Select a few lines from this page and copy this area to the clipboard (CTL-C)
    3. When doing CTL-V (move) in a JTextPane, I intercept this action, to manipulate the data ( method clearClipBoard)
    4. This method does the following
    a) read the clipboard get the result into a String (this works fine).
    b) loop on this String to find occurrences of a particular word, and suppress the line containing this word.
    c) re-write the new String into the clipboard.
    This works pretty well when having the JTextPane with a RTF EditorKit. But it does not work with an HTMLEditorKit.
    I guess there is something wrong with DataFlavors, but I don't know how to set the DataFlavor to a text/html mime when writting the data back.
    When testing the authorized DataFlavor, none "text/html" mimes appear and of course I get an exception for the one I'm trying to use.
    Therefore the data is just a continuous string displayed in the JTextPane with all html tags visible instead of having formated data
    I did a lot of tries, but I failed. below is a piece of code I'm using.
    Thanks a lot, for any suggestions<
    Gégé
    private void clearClipboard()
      String      str     =      null,
                   result =      null;
    DataFlavor           flv          =      null;
    StringWriter             sw           =     null;
    try
         flv = new DataFlavor("text/html;charset=unicode;class=java.lang.String" );
         result= readClipBoard(flv );    //  This works fine
         sw = new StringWriter();       
         BufferedReader buffreader = new BufferedReader( new StringReader(result));
         BufferedWriter buffwriter = new BufferedWriter(sw);
         while ((str = buffreader.readLine()) != null)
            if (str.length() <= 0) continue;
            str=str.trim();                            
            String wk = "";
            while (true)
               //  re-create the string...... into str.  then break;     
            buffwriter.write(str);
      buffwriter.close();
    catch(Exception e) { e.printStackTrace();}
    writeClipBoard(sw.toString(),flv);      // on écrit dans le clipboad
    public static void  writeClipBoard(String s, DataFlavor flavor)
       try
          java.awt.datatransfer.Clipboard  clipboard = 
                            java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
          java.awt.datatransfer.Transferable transferable =
                       new java.awt.datatransfer.StringSelection(s);
          //  DataFlavor[] flv = transferable.getTransferDataFlavors();
          //   for (int i=0; i<flv.length; i++) System.out.println(flv.toString());
    // The Dataflavor I'm using is not in the flv table and
    // of course it raises an exception.
    transferable.getTransferData(flavor);
    clipboard.setContents(transferable, null);
    catch (Exception ex) {System.out.println( ex.toString());}

    Stanislav, I'm back with my complete test code.
    In fact, rather than modifying anything, I wrote this sample to just read the clipboard and write it back (without any change).
    1) First, you may test it without entering my code (that's the default) . Just start my sample.
    2) Go to your favorite Web browser. Select a few lines, and (copy to clipboard)
    3) Go to the application and "Paste" I works fine
    4) Then if you go to the initialize method, and please, uncomment the instruction where I'm defining the KeyListener (at the end of the method).
    5) Restart the application and redo the same. It does not work.
    In the list of flavors that I have printed (I got only 2 valid flavors, I tested both, without any success. I even try to set the flavor to null (got an exception of course).
    Thanks again to your help. I hope my English is not too bad, to make you understand.
    Gege
    package test;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyListener;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.StringReader;
    import java.io.StringWriter;
    import javax.swing.text.html.HTMLEditorKit;
    public class TestTextPane extends javax.swing.JFrame implements KeyListener, ActionListener
         private static final long serialVersionUID = 1L;
         private final javax.swing.JTextPane myTextPane =   new javax.swing.JTextPane();
         private final javax.swing.JPanel frameContentPane = new javax.swing.JPanel();
         private final javax.swing.JButton  Terminer = new javax.swing.JButton();
         public TestTextPane() {
              super();
              initialize();
          public void actionPerformed(java.awt.event.ActionEvent e)
               System.exit(0);
        public static void clearClipboard()
             String      str          =      null,
                       result      =      null;
                        DataFlavor           flv          =      null;
                       StringWriter      sw           =     null;
             try
                  flv = new DataFlavor("text/html;charset=unicode;class=java.lang.String" );
                  result=  readClipBoard(flv );    // get clipboard content
                  sw = new StringWriter();       
                  BufferedReader buffreader = new BufferedReader( new StringReader(result));
                  BufferedWriter buffwriter = new BufferedWriter(sw);
                  while ((str = buffreader.readLine()) != null)
                       //  I re-write without processing     to see what's happening     
                       System.out.println(str);
                       buffwriter.write(str);
                  buffwriter.close();
             catch(Exception e) { e.printStackTrace();}
             writeClipBoard(sw.toString(),flv); // on écrit dans le clipboad
         public static void writeClipBoard(String s, DataFlavor flavor)
         try
                // flavor= new DataFlavor("application/x-java-serialized-object;class=java.lang.String");
              java.awt.datatransfer.Clipboard  clipboard = 
                        java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
              java.awt.datatransfer.Transferable transferable =
                        new java.awt.datatransfer.StringSelection(s);
              DataFlavor[] flv = transferable.getTransferDataFlavors();
              for (int i=0; i<flv.length; i++) System.out.println(flv.toString());
              transferable.getTransferData(flavor);
              clipboard.setContents(transferable, null);
         catch (Exception ex) {System.out.println( ex.toString());}
    public void FrameCenter( )
         java.awt.Dimension fenetre = this.getSize();
         int sizex = fenetre.width, sizey = fenetre.height;
         java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
              setBounds((screen.width - sizex) / 2,(screen.height - sizey) / 2, sizex, sizey);
    private void initialize()
              setName("TestTextPane");
              setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
              setSize(557, 451);
              myTextPane.setName("myTextPane");
              myTextPane.setBounds(23, 18, 513, 307);
              Terminer.setName("Terminer");
              Terminer.setText("Finish");
              Terminer.setBounds(230, 370, 101, 25);
              frameContentPane.setName("myFrame");
              frameContentPane.setLayout(null);
              frameContentPane.add(myTextPane, myTextPane.getName());
              frameContentPane.add(Terminer, Terminer.getName());
              setContentPane( frameContentPane);
              Terminer.addActionListener(this);
              FrameCenter( );
              HTMLEditorKit htmlKit = new HTMLEditorKit();
              myTextPane.setEditorKit(htmlKit);
              myTextPane.setEditable(true);
              myTextPane.setText("Hello. Clipbard contains should be appended below" );
              // myTextPane.addKeyListener(this); // to be uncommented to trap clipboard events
    this.setVisible(true);
         public void keyPressed(java.awt.event.KeyEvent ke)
              if (ke.getKeyCode() == java.awt.event.KeyEvent.VK_V)
                   int i = ke.getModifiers();
                   if ( (i & java.awt.event.InputEvent.CTRL_MASK) == java.awt.event.InputEvent.CTRL_MASK)      {clearClipboard();}
         public void keyReleased(java.awt.event.KeyEvent ke){}
         public void keyTyped(java.awt.event.KeyEvent ke){}
         public static String readClipBoard(DataFlavor type)
              java.awt.datatransfer.Transferable contents = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
              if (! contents.isDataFlavorSupported(type) ) return null;
              if ((contents != null) && contents.isDataFlavorSupported(type))
                   try
                        return (String) contents.getTransferData(type);
                   catch (java.awt.datatransfer.UnsupportedFlavorException ex){return  ex.toString();     }
                   catch (java.io.IOException ex)      {return  ex.toString();     }
              else return "";
         public static void main(java.lang.String[] args) {
              new TestTextPane();

  • XML into one string element

    Hello,
            In Graphical mapping, Could anyone pls tell me in detail about how to achieve One whole xml into one string element. This XML file i want to send to DATABASE.

    Thi blog might be of some help
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping

  • Instrument stack trace on config.xml

    I upgraded my aplication from weblogic 6.1 to 8.1,
    "instrument stack trace" is working fine with 6.1.
    it is not making any difference with 8.1,(i.e)
    i could't see any server side exception stack trace from the client when application got deployed on 8.1.
    what should i do in order to see the stack trace

    Hi,
    have you checked that whether InstrumentStackTraceEnabled is true or not ?
    With this attribute enabled, if a client issues an RMI call to a server subsystem or to a module running within the server, and if the subsystem or module generates an exception that includes a stack trace, the server will return the exception as well as the stack trace. With this attribute disabled, the server will return exceptions without the stack trace details.
    Regards
    Anilkumar kari

  • Convert the IDOC XML file into single string?

    Hello All,
    I have a scenario, where i need to conver the IDOC XML  into single string, to send it to target.
    Please let me know how can we achive this, I dont know java coding.
    Please help me out to write the java code.
    Thanks and Regards,
    Chinna

    Hi Chinna,
    You can do this in two ways -
    1. Java mapping
    https://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String
    https://wiki.sdn.sap.com/wiki/display/Snippets/JavaMapping-ConverttheInputxmltoString
    2. XSLT mapping
    /people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
    Regards,
    Sunil Chandra

  • Split a multiline string from TextEdit into multiple strings

    Hi all,
    I have a small question. I have a string that comes from a multiline TextEdit used for comments. This string has to be split into multiple strings with max 72 chars. The wrapping is set to "hard".
    Can anybody help me on this?
    Thanks
    Francisco

    Hi Francisco,
    this is the complete code I tested, a bit ugly concerning the println etc... (****, not formatting here?):
    package com.btexx;
    import java.util.StringTokenizer;
    import com.sapportals.htmlb.Button;
    import com.sapportals.htmlb.Form;
    import com.sapportals.htmlb.TextEdit;
    import com.sapportals.htmlb.enum.TextWrapping;
    import com.sapportals.htmlb.event.Event;
    import com.sapportals.htmlb.rendering.IPageContext;
    import com.sapportals.htmlb.rendering.PageContextFactory;
    import com.sapportals.portal.prt.component.AbstractPortalComponent;
    import com.sapportals.portal.prt.component.IPortalComponentRequest;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    public class TextEditExample extends AbstractPortalComponent
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
            IPageContext pageCtx = PageContextFactory.createPageContext(request, response);
            Event lastEvent = pageCtx.getCurrentEvent();
            if (lastEvent == null) {
                Form form = pageCtx.createFormDocument("myFormDocument");
                TextEdit te = new TextEdit("Edit_Text");
                te.setId("TextEditID");
                te.setText("Text to change - or just add text");
                te.setWrapping(TextWrapping.HARD);
                te.setTooltip("Edit and/or add text");
                te.setRows(10);
                te.setCols(72);
                form.addComponent(te);
                Button btn = new Button("MyButton");
                btn.setOnClick("react");
                form.addComponent(btn);
                pageCtx.render();
            } else {
                TextEdit te = (TextEdit) pageCtx.getComponentForId("TextEditID");
                String text = te.getText();
    //            for (int j = 0; j < text.length(); j++) {
    //                System.out.println(text.getBytes()[j] + " - " + text.substring(j, j+1));
                StringTokenizer st = new StringTokenizer(text, "nr");
                String[] texts = new String[st.countTokens()];
                while (st.hasMoreTokens()) {
                    System.out.println("Line : " + st.nextToken());
    I swear, I did not press Return within the TextEdit box, and after that, 13/10 appeared within the text. If just this code does not work the same on your machine, then it seems to be a bug in (your) htmlb (because my P/HF are the most actual, at least they have been yesterday).
    Hope it helps
    Detlev
    Message was edited by: Mark Finnern
    added the [code ] [/code ] (without the blanks)

  • Concatenate multiple columns into one string

    Hello,
    I am using Oracle 11.2, how can I concatenate the value of multiple columns into one string with one SQL:
    create table testTb(classId number(5), classRoom varchar2(32));
    insert into testTb value(101, 'room101');
    insert into testTb value(101, 'room201');
    insert into testTb value(101, 'room301');
    insert into testTb value(202, 'room444');
    insert into testTb value(202, 'room555');
    I would like to generate the result as followings:
    Class 101 is in room101, room201, room301
    Class 202 is in room444, room555
    Thanks,

    Hi,
    Since you're using Oracle 11.2, you can use the aggregate LISTAGG function:
    SELECT       'Class ' || classid
                   || ' is in '
                 || LISTAGG ( classroom
                         ) WITHIN GROUP (ORDER BY classroom)
                   AS txt
    FROM       testtb
    GROUP BY  classid
    ;The generic name for concatenating all the strings in a group is String Aggregation . This page shows several ways to do it, suitable for different versions of Oracle.

Maybe you are looking for

  • After 3 days onto the support at Adobe my cloud app still wont work. Error given is Install Failed!

    I have had creative cloud for over a month now and have not been able to get the thing to work. I have spent around 2 and a half days onto the technical support. I have tried it on two different laptops the second I brought to replace my old one as t

  • Can't boot from external HD with Leopard on MacBook Pro or PowerBook

    I can't boot from an external HD with 10.5.5 Leopard on either my MacBook Pro or my PowerBook G4. I had a PowerBook G4 from which I could boot from either an external FW400 drive or an external FW800 drive. At some point, I stopped being able to boot

  • How do I open .wim files on my macbook pro?

    When my hard drive crashed for the second time on my HP computer, I knew it was time for a change. The HP help menue gave me the option to backup everything onto an external hard drive. I did this and now when I try to open the files inside, they are

  • Auto Forward to next field?

    I have had this program for a very short time and have created my first form. On the form I am requesting an account # that is between 6 and 7 digits using a total of 7 text fields to separate each character in the account #. Is there a way to have t

  • Statment used like PreparedStatement

    following is the code of a DAO written by one of the team member. He says that PreparedStatements are slower and so he is writing DAO using Statements. For queries which takes dynamic parameters this code uses a StringUtil class to parse queries and