I had the following library in my path
bsf.jar (2.4.0)
commons-logging-1.1.jar
commons-logging-adapters-1.1.jar
Js.jar
Still I am getting the following error message:
//-------
chg-date:
[dateConvert] Dec 1, 2006 9:16:45 AM org.apache.bsf.BSFManager exec
[dateConvert] SEVERE: Exception :
[dateConvert] java.security.PrivilegedActionException:
org.apache.bsf.BSFException: JavaScript Error: syntax error
(scriptdef_dateConvert#4)
[dateConvert] at java.security.AccessController.doPrivileged(Native
Method)
[dateConvert] at org.apache.bsf.BSFManager.exec(BSFManager.java:491)
[dateConvert] at
org.apache.tools.ant.util.ScriptRunner.executeScript(ScriptRunner.java:128)
[dateConvert] at
org.apache.tools.ant.taskdefs.optional.script.ScriptDef.executeScript(Script
Def.java:317)
[dateConvert] at
org.apache.tools.ant.taskdefs.optional.script.ScriptDefBase.execute(ScriptDe
fBase.java:47)
[dateConvert] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[dateConvert] at org.apache.tools.ant.Task.perform(Task.java:364)
[dateConvert] at org.apache.tools.ant.Target.execute(Target.java:341)
[dateConvert] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[dateConvert] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[dateConvert] at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[dateConvert] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
[dateConvert] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[dateConvert] at org.apache.tools.ant.Main.runBuild(Main.java:668)
[dateConvert] at org.apache.tools.ant.Main.startAnt(Main.java:187)
[dateConvert] at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
[dateConvert] at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
[dateConvert] Caused by: org.apache.bsf.BSFException: JavaScript Error:
syntax error (scriptdef_dateConvert#4)
[dateConvert] at
org.apache.bsf.engines.javascript.JavaScriptEngine.handleError(JavaScriptEng
ine.java:195)
[dateConvert] at
org.apache.bsf.engines.javascript.JavaScriptEngine.eval(JavaScriptEngine.jav
a:147)
[dateConvert] at
org.apache.bsf.util.BSFEngineImpl.exec(BSFEngineImpl.java:141)
[dateConvert] at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)
[dateConvert] ... 17 more
BUILD FAILED
D:\AvayaTraining\LFCG\sortdata.xml:27:
org.mozilla.javascript.EvaluatorException
: syntax error (scriptdef_dateConvert#4)
//-------
Is this error due to my code, I am not able to get where I am wrong (I am
not familiar with JavaScript)?
My code looks like this:
Sortdata.xml
------------
<project name="ConvertData" default="sort" basedir=".">
<!-- property file="data"/ -->
<!-- property name="giveDate" location="data"/ -->
<!-- ============================================================== -->
<!-- Changing the date format -->
<!-- ============================================================== -->
<target name="chg-date">
<scriptdef name="dateConvert" language="javascript">
<attribute name="in"/>
<attribute name="out"/>
<![CDATA[
in = new java.io.File(attributes.get("in"));
out = new java.io.File(attributes.get("out"));
fIn = new java.text.SimpleDateFormat("yyyy/MM/dd");
fOut = new java.text.SimpleDateFormat("MMM dd, yyyy");
while(line = in.readLine()) {
out.writeln( fOut.format( fIn.parse(line) ));
}
in.close();
out.close();
]]>
</scriptdef>
<dateConvert in="D:/AvayaTraining/LFCG/data" out="Datachange"/>
</target>
<target name="sort" depends="chg-date">
<echo message="Hello "/>
</target>
</project>
//***********************************************************************
//***********************************************************************
-----Original Message-----
From: Peter Reilly [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 30, 2006 8:51 PM
To: Ant Users List
Subject: Re: Changing Date format
On 11/30/06, Steve Loughran <[EMAIL PROTECTED]> wrote:
> Peter Reilly wrote:
> > On 11/30/06, Pritesh Saharey <[EMAIL PROTECTED]> wrote:
> >>
> >> Thanks for quick reply, but when I tried to use the code like this:
> >>
> >> //----------------------------------------------
> >> //----------------------------------------------
> >> When I tried running my build file, it's giving me logging error
> >>
> > .
> > .
> >
> >> //-------------------------------------------------
> >> BUILD FAILED
> >> java.lang.NoClassDefFoundError:
> >> org/apache/commons/logging/LogFactory
> >
> > You are using the new BSF library (2.4.0) For some reason, the BSF
> > people have added a new dependence on
> >
> > commons-logging-1.1.jar, you need to add this jar to the directory
> > with bsf.jar
>
> oh, no, that's the version of commons-logging whose maven dependencies
> (that ivy picks up) includes junit and avalon logkit.
>
> I have nothing against the artifact, but its metadata is wrong.,
Ok, I meant to say that bsf 2.4.0 now depends on commons-logging.
and commons-logging-1.1.jar works for me!
Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
> commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]