AnsweredAssumed Answered

JavaScript error while create a newfile using timestamp

Question asked by Ravindra_532 on May 23, 2018
Latest reply on May 23, 2018 by Rick.Brown

import com.itko.lisa.test.TestEvent;
import com.itko.util.*;
import java.io.*;
import java.text.SimpleDateFormat;

 

var vDate = new Date();
var vnumber = vDate.getTime();
var res = vnumber/1000;


resp = testExec.getStateValue("lisa.Web Service Response.rsp");
testExec.setStateValue("result",resp);
//myDate = testExec.getStateValue("lisa_vse_datechecker_time_millis_zoneformat");
//file = testExec.getStateValue("DateVal");
testExec.setStateValue("date",res);

out = new java.io.BufferedWriter(new java.io.FileWriter("location"+res+".txt"));
out.write(resp);
out.close();

 

When Trying to execute above script.Getting error as below

 

| Message: Sourced file: inline evaluation of: ``import com.itko.lisa.test.TestEvent; import com.itko.util.*; import java.io.*; . . . '' : Error in method invocation: Method write( com.itko.lisa.gui.XMLResultsCache ) not found in class'java.io.BufferedWriter'
----------------------------------------------------------------------------
| Trapped Exception: Sourced file: inline evaluation of: ``import com.itko.lisa.test.TestEvent; import com.itko.util.*; import java.io.*; . . . '' : Error in method invocation: Method write( com.itko.lisa.gui.XMLResultsCache ) not found in class'java.io.BufferedWriter'
| Trapped Message: Sourced file: inline evaluation of: ``import com.itko.lisa.test.TestEvent; import com.itko.util.*; import java.io.*; . . . '' : Error in method invocation: Method write( com.itko.lisa.gui.XMLResultsCache ) not found in class'java.io.BufferedWriter' : at Line: 18 : in file: inline evaluation of: ``import com.itko.lisa.test.TestEvent; import com.itko.util.*; import java.io.*; . . . '' : out .write ( resp )

Outcomes