DIADEM STRING VARIABLE SET

I am using the DIADEM STRING VARIABLE SET.vi in LV8.6.1 to set the T3 variable in DD11.1.
the string is being truncated 
For example I sent 1527 characters
------start ------
Custom_Count=0&Plot_Size=Letter&Plot_Orientation=Landscape&Plot_Count=1&Plot1_Style=S Parameter&Plot1_UseTestSetup=1&Plot1_Run_Mode=Most Recent&Plot1_Run_Field=Step_Tag&Plot1_Run_Field_Value=&Plot1_LineType=0&Plot1_X_Unit=MHz&Plot1_X_Min=500&Plot1_X_Max=800&Plot1_AxisType=Split&Plot1_Auto_X=1&Plot1_Auto_Y=1&Plot1_Y_Format=Delay&Plot1_Scale=10&Plot1_Reference=0&Plot1_Position=5&Plot1_Curve1_Parameter=S11&Plot1_Curve1_LimitOn=1&Plot1_Curve1_LimitFill=0&Plot1_Curve1_Label=LABEL&Plot1_Curve1_Autoscale=1&Plot1_Curve1_Scale=2.5&Plot1_Curve1_Reference=-50&Plot1_Curve1_Position=0&Plot1_Curve1_Format=Log Mag&Plot1_Marker1=1000&Plot1_Marker4=Limit Maximum&Plot1_Marker2=Trace Maximum&Plot1_Marker3=Trace Minimum&Plot1_Marker5=Limit Minimum&Plot1_Curve2_Parameter=S21&Plot1_Curve2_LimitOn=1&Plot1_Curve2_LimitFill=0&Plot1_Curve2_Label=&Plot1_Curve2_Autoscale=1&Plot1_Curve2_Scale=10&Plot1_Curve2_Reference=0&Plot1_Curve2_Position=5&Plot1_Curve2_Format=Phase&Template_dHeight=8.500000&Template_dWidth=11.000000&Plot1_run_id=&preview=1&report_path=C:\DEVELOPMENT\SPARTAN\www\temp\preview_preview_99452782.png&data_path=C:\DEVELOPMENT\SPARTAN\data\tdm&test_status=&ReportFooter_txt=&serial_number=
------ end ------
but received only 1192 characters in Diadem
------start ------
Custom_Count=0&Plot_Size=Letter&Plot_Orientation=Landscape&Plot_Count=1&Plot1_Style=S Parameter&Plot1_UseTestSetup=1&Plot1_Run_Mode=Most Recent&Plot1_Run_Field=Step_Tag&Plot1_Run_Field_Value=&Plot1_LineType=0&Plot1_X_Unit=MHz&Plot1_X_Min=500&Plot1_X_Max=800&Plot1_AxisType=Split&Plot1_Auto_X=1&Plot1_Auto_Y=1&Plot1_Y_Format=Delay&Plot1_Scale=10&Plot1_Reference=0&Plot1_Position=5&Plot1_Curve1_Parameter=S11&Plot1_Curve1_LimitOn=1&Plot1_Curve1_LimitFill=0&Plot1_Curve1_Label=LABEL&Plot1_Curve1_Autoscale=1&Plot1_Curve1_Scale=2.5&Plot1_Curve1_Reference=-50&Plot1_Curve1_Position=0&Plot1_Curve1_Format=Log Mag&Plot1_Marker1=1000&Plot1_Marker4=Limit Maximum&Plot1_Marker2=Trace Maximum&Plot1_Marker3=Trace Minimum&Plot1_Marker5=Limit Minimum&Plot1_Curve2_Parameter=S21&Plot1_Curve2_LimitOn=1&Plot1_Curve2_LimitFill=0&Plot1_Curve2_Label=&Plot1_Curve2_Autoscale=1&Plot1_Curve2_Scale=10&Plot1_Curve2_Reference=0&Plot1_Curve2_Position=5&Plot1_Curve2_Format=Phase&Template_dHeight=8.500000&Template_dWidth=11.000000&Plot1_run_id=&pr
------ end ------
jim

Hi Jim,
The problem here is that DIAdem's ActiveX servers still use the old autosequence syntax, where strings constants can be created with the apostrophe ( ' ) character instead of the more usual double-quote ( ") character.  So if I were to send a command from LabVIEW to DIAdem to assign the string "hello" to the variable "T1", it would look like this:
T1:= 'hello'
So I agree with you that the ( ' ) character termination is DIAdem's fault, but it would be more a designed behavior than a bug.  It was also possible in an autosequence to use the normal ( " ) character to specify a string constant, like this:
T1:= "hello"
Actually, when I try to use the "CmdExecuteSync" method I am able to sidestep the ( ' ) character termination problem, whereas the "TextVarSet" method reproduces it.  I'd recommend using the VI equivalent of "CmdExecuteSync":
Set ToCommand = CreateObject("DIAdem.ToCommand")Call ToCommand.CmdExecuteSync("T1:= 'hello'")Call ToCommand.CmdExecuteSync("T1:= ""he'llo""")'Call ToCommand.TextVarSet("T1", """hello""")
'Call ToCommand.TextVarSet("T1", """he'llo""")Call ToCommand.TextVarGet("T1", TextVar)Set ToCommand = Nothing MsgBox TextVar 
Brad Turpin
DIAdem Product Support Engineer
National Instruments

Similar Messages

  • Setting Prompt Directory path using a string variable?

    So when you define a Prompt you get the form P[promptname.wav] and all is good.  What we want to do is have that prompt name be retrieved from a prompt directory which is defined by a string.   So assume all your prompts have the same numbers like 1001.wav but the actual file is customized based on things like Sales/1001.wav and Marketing/1001.wav   and you want to have a StringValue DirectoryName set the Directory to Sales or Marketing.   The Script does not seem to support setting P["DirectoryName"/1001.wav] where Directory Name is a string variable.    Is there a solution to this other than changing the entire prompt to a string type and dropping the P[] data type entirely?   

    I am working with a similar issue.   It is simple enought to set the Prompt Directory but when it is a variable it seems to have different results.  The attached simple script is used to demonstrate Sam's recommendation.  The XML document is embedded in the script variable, so you dont need to create it.   So the script reaches into the XML document and pulls up the variable strDirectoryName and then adds "/" to it and then sets the strPromptDirectory.   I have done it three ways:  Hard coded, string value for prompt' and prompt data type resolved from string.  As you single step through the script you will find that all values populate appropriately, but only the hard coded play prompt actually plays the prompt.  The other two assemblies fail.  (Clearly it assumes the prompt 10001.wav is in the directory Generic/ if you want to try it).    Written in  Version 8.5 editor.  

  • Set "url" in HTTPService using String variable

    Hi,
    How can I set "url" in HTTPService using String variable (see below). I've tried different formats of string & variable concatenations.
    privtate var myurl:String = "http://localhost/";
        <mx:HTTPService id="post_submit_service"
            url="{myurl+'test.php'}"
            method="POST"
            resultFormat="text"
          result="result_handler(event)"
          fault="fault_handler(event)">
            <mx:request xmlns="">
          </mx:request>
        </mx:HTTPService>
    Thanks,
    ASM

    try following:
    url="{myurl}test.php"

  • Set a string variable equal to a JTextField entry

    Like the title says, how could I go about setting a string variable equal to a JTextField entry

    Ah, I remember you.
    http://forum.java.sun.com/thread.jspa?threadID=5267710
    You've been told to read the API before.
    At least you should show some effort. In your post state, I read the API and I tried this method or that method but it didn't work because of so and so. Otherwise, you may appear lazy, and that just won't do.
    Edited by: petes1234 on Feb 24, 2008 7:38 AM

  • How to compare numbers in a string variable?

    I have a powershell script that is grabbing the output of a website and storing it into a string variable. What I would like to do is check a line in the output which contains two numbers - the number of emails sent out of the total number of emails.
    I have not come up with a way to do this that works. I was thinking of maybe using a regex, but there are other numbers I don't care about that keep getting caught.
    Here is a sample of what is contained in the string variable:
    Email ID: 46862270 : Succeded. Time Taken: 00:00:00.0924511
    Email ID: 46862272 : Succeded. Time Taken: 00:00:00.0493887
    -- Sent 250 of 250 emails successfully. Total Dispatch Time: 00:00:08.1406995
    --State Written to DB. Time Taken for DB Write: 00:00:00.4611053
    Here is another sample:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 17 of 17 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    So if I have the above contained in a variable called $httpResponse how can I find only the line that starts with -- Sent
    and then subtract the first number from the second number?
    So for example if I have this:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    I would want the check to return 10. Is this even possible?
    Any help is appreciated!

    Sure.
    $String = @'
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    if ( $string -match 'Sent (\d+) of (\d+) emails .+' )
    { $FailedEmailCount = [int]$matches[2] - $matches[1] }
    $FailedEmailCount
    10
    Each set of parens will designate a capture group, and those can be referenced from $Matches after a successful -match.
    Just remember that they will all be strings, and to do a math operation you have to cast at least the one on the LH side to a numeric type first.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to load a text file (ASCII) into a TS string variable?

    I need to load a ASCII file into a TS string variable for subsequent processing. I tried the SecuenceBuilder DLL (in the examples directory) but it seems that this DLL has a bug. Some text files are not loaded properly. I have also tried the kernel32 functions (openfile, createfile, readfile ... ) handling them as a C program, but with no success. The property loader feature of TS is not the suitable solution for me, because I would have to modify all my text files to include some specific fields (step name, variables, starmarker ...). Doy you know an alternative procedure to load text files or any DLL that implements what I look for ? Any help would be grateful. Cesar ([email protected])

    Hi Cesar,
    I don't know if you have found a solution, but attached is a DLL built in VC that will read the text out of a file into a TestStand variable. The attached sequence file \SequenceFile1.seq contains a step type that is set to call the DLL responsible for reading the file. It reads the file specified under Step.FilePath and stores the data in Step.ReadData. Please let me know if this works for you. I have attached the source as well.
    Regards,
    Bob
    Attachments:
    ReadFile.zip ‏3628 KB

  • EnterProjectStage - reading GUID from a string variable within Workflow created in Visual Studio 2012.

    Hi,
    I am creating a Project Server Workflow (site workflow) using Visual Studio 2012.
    If i set the "EnterProjectStage" activity with a GUID within quotes the workflow works
    (as suggested in the MSDN blog (http://blogs.msdn.com/b/project_programmability/archive/2012/11/07/creating-project-workflows-using-visual-studio-2012.aspx).
    However, the GUID of stages will change from environment to environmet (QA, Stage, PROD). So, I tried setting the GUID in a string variable (which i am populating dynamically) and assigned the string variable to the "EnterProjectStage"
    activity. However, this dynamic assignment of stage id to "EnterProjectStage" does not work and after deployment the workflow dumps with the following error:
    ===============================================
    Exception Starting Workflow: Sequence contains no elements. Trace: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.<FillWorkflowStatusTableFromXaml>b__47(XElement
    e) at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1
    source) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.FillWorkflowStatusTableFromXaml(String xaml, WorkflowDataSet& ds, Guid projUid) at Microsoft.Office.Project.Server.BusinessLayer.Workflow.StartWorkflow(Guid projectGuid, Guid enterpriseProjectTypeUid,
    Boolean isNewProject, Guid previousEntepriseProjectTypeUid, Boolean skipStage, Guid stageToSkipTo):
    WorkflowExceptionStartingWorkflow (35115). Details: id='35115' name='WorkflowExceptionStartingWorkflow'
    uid='b31d825e-1d00-e411-9466-005056b11412'. 
    ===============================================
    Is there a way the "EnterProjectStage" can be made dynamic so that it reads from a variable.
    Thanks,
    Amitava.

    Arthur,
    Thank you for your reply.  But at this point, one of my points of confusion is what software I have available to me.  I wish I had a useful central help desk to call up and just say, "Hey, load me up with all of the professional version(s) of Visual
    Studio.  But I do not know what we have license to.  And I kind of need to know what the options are, so that I can ask a specific question of our vast buracracy.
    For now, I have downloaded only free versions of Visual Studio client software.  Since my company does have servers running Microsoft SQL Server, I am going to assume that we have proper licensing for those servers.  But does that server license
    allow me to get any professional versions of the PC client software for the various Visual Studio(s) 2012?
    And if I get a professional version of Visual Studio 2012, does that do away with the three different flavors that I have right now?  I have 2012 versions of SQL Server Management Studio, Visual Studio Express, and Visual Studio Shell (Integrated).
    Your feedback is much appreciated.
    Thanks!

  • Regular Expressions and String variables

    Hi,
    I am attempting to implement a system for searching text files for regular expression matches (similar to something like TextPad, etc.).
    Looking at the regular expression API, it appears that you can only match using string variables. I just wanted to make sure this is true. Some of these files might be large and I feel uneasy about loading them into ginormous Strings. Is this the only way to do it? Can I make a String as big as I want?
    Thanks,
    -Mike

    Newlines are only a problem if you're reading the
    text line-by-line and applying the regexp to each
    line. It wouldn't catch expressions that span
    lines.
    @sabre150: your note re: CharSequence -- so what
    you're suggesting is to implement a CharSequence that
    wraps the file contents, and then use the regexps on
    the whole thing? I like the idea but it seems like
    it would only be easy to implement if the file uses a
    fixed-width character set. Or am I missing
    something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
    While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
    'uncle_alice' is the regex king round here so listen to him.
    :-( I should read further ahead next time!
    Message was edited by:
    sabre150
    Message was edited by:
    sabre150

  • Replacement string variable in data form

    Hi everybody,
    in Planning 11.1.2, is it possible to set a replacement variable, with type String, and then use it in a data form to let the user inserting a string value (i.e "actual")?
    I need to reuse the value inserted in a business rule. I think to use the @MEMBER to refrence it to the corresponding dimension member.
    For example:
    If I define a string variable named SCENARIO and the user insert in the data form "actual", can i reference it in a cross-dimension:
    Account1->Peiod1->Fy12 -> @MEMBER(SCENARIO)
    does this cross-dimension return the value corresponding to Account1->Period1->FY12->Actual?
    Thank All
    Maurizio

    Why you just don't use RPT with type Member ?
    Users chose member name from the LOV (no chance for mistake) and run your rule

  • Calling variable set in Scene 1

    apologies for the repost/redo but previous did not work as I
    thought it did!
    I'm working with Scene 1 with 2 buttons, "Corporate" and
    "Editorial" and a movie clip, mcMainScreenArea. I want the buttons
    to set a variable which can be called in movie clip
    mcMainScreenArea. This variable is then used in mcMainScreenArea
    (and later also in another movie clip) to move the timeline along
    to a label string set in the variable by the buttons in Scene 1.
    With the following scripts the mcMainScreenArea simply plays
    the timeline to the next clip - the variable does not appear to be
    defined and a trace(this.varSubject); in the code returns
    "undefined".
    Code for Scene 1 is as follows.
    stop();
    //Navigation variables
    var varSubject:String = "opening";
    gotoAndStop(varSubject);
    trace(varSubject);
    function moveToCorporate(event:MouseEvent):void {
    var varSubject:String = "corporate";
    gotoAndStop(varSubject);
    this.mcMainScreenArea.play();
    trace(varSubject);
    btn_corporate.addEventListener(MouseEvent.CLICK,
    moveToCorporate);
    function moveToEditorial(event:MouseEvent):void {
    var varSubject:String = "editorial";
    gotoAndStop(varSubject);
    this.mcMainScreenArea.play();
    trace(varSubject);
    btn_editorial.addEventListener(MouseEvent.CLICK,
    moveToEditorial);
    The code for mcMainScreenArea is
    stop(); //at labels named "corporate" and "editorial"
    //and
    gotoAndPlay(this.varSubject); //after the labels named
    "corporate" and "editorial"

    This I find surprising! No way of calling a variable set in
    another element? Are there any alternatives to set a variable (or
    whatever) to be read by mcMainScreenArea? Is there a way for
    mcMainScreenArea to check what button has been clicked without
    having the script in Scene 1 telling mcMainScreenArea what button
    has been clicked. Pull rather than push the infor from the
    button...
    Thanks.

  • How to swap two string variables without using a 3rd variable?

    How to swap two string variables without using a 3rd variable?
    ex.
    A = "aa"
    B = "bb"
    Result required
    A = "bb"
    B = "aa"
    Thanks

    How to swap two string variables without using a 3rd
    variable?
    Something like this.
    Append A with B (so A equals "aabb")
    Set B equal to a substring of A starting with the first character and ending at A's length minus B's length. (So B equals "aa")
    Set A equal to a substring of A starting from B's length and ending at the end of A. (So A equals "bb")

  • Frmf2xml.sh: why do i need a display variable set to transform fmb to xml?

    hallo,
    why do i need a display variable set to transform fmb to xml with a shell script (frmf2xml.sh) ?
    OS: SunOS 5.10
    Oracle Forms Developer: 10.1.2
    thank you
    christian

    Hi DrClap,
    I just wanted to check with you whether I understood your comment correctly.
    It's not possible to directly specify a physical file location path, like it is specified for HTTP URL +<c:import url= http://...+, that would internally/automatically convert in one of the form - Reader, Source, Document, String.
    It can only be produced/specified explicitly in one of the form - Reader, Source, Document, String.
    Am I correct in my understanding?
    Regards,
    Gnanam

  • Tabulator in string variable?

    I am using Labview 5.1 and I want to show a header
    part of a file in a labview program. I display the
    information using a string variable. There are
    tabulators in the header string to separate the
    information. These tabulators are diplayed as \t
    if I use the "\"Code display setting of the string
    variable. If I use the normal display setting the
    tabulators are only displayed as blanks.
    Is it possible to get working tabulators in a
    labview string???
    Mike
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

    One way to get round this would be to use a string array indicator on the
    front panel. Then use the 'Spreadsheet string to array' function to turn
    your tab text to the string array. Dont forget to connect a string array
    constant to the array type connector.
    [email protected] wrote in message <7n1nkf$pfu$[email protected]>...
    >I am using Labview 5.1 and I want to show a header
    >part of a file in a labview program. I display the
    >information using a string variable. There are
    >tabulators in the header string to separate the
    >information. These tabulators are diplayed as \t
    >if I use the "\"Code display setting of the string
    >variable. If I use the normal display setting the
    >tabulators are only displayed as blanks.
    >
    >Is it possible to get working tabulators in a
    >labvi
    ew string???
    >
    >Mike
    >
    >
    >Sent via Deja.com http://www.deja.com/
    >Share what you know. Learn what you don't.

  • How can I put all output error message into a String Variable ??

    Dear Sir:
    I have following code, When I run it and I press overflow radio button, It outputs following message:
    Caught RuntimeException: java.lang.NullPointerException
    java.lang.NullPointerException
         at ExceptionHandling.ExceptTest.actionPerformed(ExceptTest.java:72)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)Caught RuntimeException: java.lang.NullPointerException
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)I hope to catch all these error message into a String Variable such as StrErrorMsg, then I can use System.out.println(StrErrorMsg) to print it out or store somewhere, not only display at runtime,
    How can I do this??
    Thanks a lot,
    See code below.
    import java.awt.Frame;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.FileInputStream;
    import javax.swing.ButtonGroup;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JRadioButton;
    public class ExceptTest extends JFrame implements ActionListener {
        private double[] a;
      private JRadioButton divideByZeroButton;
      private JRadioButton badCastButton;
      private JRadioButton arrayBoundsButton;
      private JRadioButton nullPointerButton;
      private JRadioButton negSqrtButton;
      private JRadioButton overflowButton;
      private JRadioButton noSuchFileButton;
      private JRadioButton throwUnknownButton;
      public ExceptTest() {
        JPanel p = new JPanel();
        ButtonGroup g = new ButtonGroup();
        p.setLayout(new GridLayout(8, 1));
        divideByZeroButton = addRadioButton("Divide by zero", g, p);
        badCastButton = addRadioButton("Bad cast", g, p);
        arrayBoundsButton = addRadioButton("Array bounds", g, p);
        nullPointerButton = addRadioButton("Null pointer", g, p);
        negSqrtButton = addRadioButton("sqrt(-1)", g, p);
        overflowButton = addRadioButton("Overflow", g, p);
        noSuchFileButton = addRadioButton("No such file", g, p);
        throwUnknownButton = addRadioButton("Throw unknown", g, p);
        getContentPane().add(p);
      private JRadioButton addRadioButton(String s, ButtonGroup g, JPanel p) {
        JRadioButton button = new JRadioButton(s, false);
        button.addActionListener(this);
        g.add(button);
        p.add(button);
        return button;
      public void actionPerformed(ActionEvent evt) {
        try {
          Object source = evt.getSource();
          if (source == divideByZeroButton) {
            a[1] = a[1] / a[1] - a[1];
          } else if (source == badCastButton) {
            Frame f = (Frame) evt.getSource();
          } else if (source == arrayBoundsButton) {
            a[1] = a[10];
          } else if (source == nullPointerButton) {
            Frame f = null;
            f.setSize(200, 200);
          } else if (source == negSqrtButton) {
            a[1] = Math.sqrt(-1);
          } else if (source == overflowButton) {
            a[1] = 1000 * 1000 * 1000 * 1000;
            int n = (int) a[1];
          } else if (source == noSuchFileButton) {
            FileInputStream is = new FileInputStream("Java Source and Support");
          } else if (source == throwUnknownButton) {
            throw new UnknownError();
        } catch (RuntimeException e) {
          System.out.println("Caught RuntimeException: " + e);
          e.printStackTrace();
          System.out.println("Caught RuntimeException: " + e);
        } catch (Exception e) {
          System.out.println("Caught Exception: " + e);
      public static void main(String[] args) {
        JFrame frame = new ExceptTest();
        frame.setSize(150, 200);
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.show();
    }

    yes, I update as follows,
    but not looks good.
    import java.io.*;
    public class UncaughtLogger implements Thread.UncaughtExceptionHandler {
        private File file;
        private static String errorMessage;
        public UncaughtLogger(File file) {
            this.file = file;
            //Thread.setDefaultUncaughtExceptionHandler(this);
        public UncaughtLogger(String str) {
            this.errorMessage = str;
            Thread.setDefaultUncaughtExceptionHandler(this);
        //@Override()
        public void uncaughtException(Thread t, Throwable e){
            try {
                log(e);
            } catch (Throwable throwable) {
                System.err.println("error in logging:");
                throwable.printStackTrace();
        private void log(Throwable e) throws IOException {
            PrintWriter out = new PrintWriter(new FileWriter(file, true));
            try {
                e.printStackTrace(out);
            } finally {
                out.close();
        private static UncaughtLogger logger = new UncaughtLogger(new File("C:/temp/log.txt"));
        private static UncaughtLogger logger2 = new UncaughtLogger(errorMessage);
        public static void main(String[] args) {
                String s1 = "Hello World!";
                s1 = null;
                String s2 = s1.getClass().getName();
                System.out.println(s1);
                System.out.println(s2);
                System.out.println("errorMessage =" + errorMessage);
    }

  • How to catch exception into a String variable ?

    I have a code
    catch(Exception e)
                e.printStackTrace();
                logger.error("\n Exception in method Process"+e.getMessage());
            }when i open log i find
    Exception in method Process null.
    But i get a long error message in the server console !! I think thats coming from e.printStackTrace().
    can i get the error message from e.printStackTrace() into a String variable ?
    I want the first line of that big stacktrace in a String variable.
    How ?

    A trick is to issue e.printStackTrace() against a memory-based output object.
    void      printStackTrace(PrintStream s)
             // Prints this throwable and its backtrace to the specified print stream.
    void      printStackTrace(PrintWriter s)
    //          Prints this throwable and its backtrace to the specified print writer.Edited by: BIJ001 on Oct 5, 2007 8:54 AM

Maybe you are looking for

  • Application.addEventListener not working as expected

    I wanted to add a global KEY_DOWN event listener and MOUSE_CLICK event listener to my app. The help files say to use the application.addEventListener(type, handler) to do this. I added the listeners in my creationComplete function but they do not wor

  • Errors when running db_stat from command line

    Hi, I'm trying to use db_stat at the command line to generate statistics. However, I keep getting errors. I cannot use the db->stat call because this is to be done at a customer site using their existing binary. Note that the call to db_stat -m fails

  • How to delete entries in table HRP1000

    Hi, I have lots of expired entries in HRP1000 in SRM system.  (Around 26 million) Do you know how/which report help me to delete the expired data? I guess the below options: 1. use report to delete them in SRM directly? or 2. use report to delete the

  • How can I remove redundant entries it the "Open With" pull down?

    In Mountain Lion, now, when I right click on a document or image and move down to "Open With" I get a triple redundant (long) list of applications that might do the task. How can I purge the list of all the duplicates?  Part of the problem COULD be t

  • Confused over saving files in Bridge or Camera Raw CS4

    I'm a little confused the way Bridge and Camera Raw saves files that have been adjusted. For example, when I took a photo and just applied a crop to it, I clicked on "save image" in camera raw, set up a new folder and new file name. I clicked on ok e