Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 54471 invoked from network); 28 Sep 2000 21:24:54 -0000 Received: from adsl-63-198-58-39.dsl.snfc21.pacbell.net (HELO mail.4charity.com) (63.198.58.39) by locus.apache.org with SMTP; 28 Sep 2000 21:24:54 -0000 Received: from morpheus (tucker-5.xDSL.avalon.net [205.217.142.38]) by mail.4charity.com (8.10.1/8.10.1) with SMTP id e8SLNUN22246 for ; Thu, 28 Sep 2000 21:23:30 GMT Reply-To: From: "Bill Lynch" To: Subject: RE: JspC task (including code) Date: Thu, 28 Sep 2000 16:23:29 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Importance: Normal In-Reply-To: <771F0E6D9C72D411930A00B0D04995B75D0E52@apollo.office.netdecisions.co.uk> X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Jonathan, Very cool. I can't wait to try this task as it's something I've wanted to use in my build scripts for Jive (our open-source forum product). One thing though -- I noticed in your code that you have a 'replaceString' method and it looks pretty inefficient. We (coolservlets.com) have a fast string replacement method. We wrote it to be as fast as possible since it's called often in one of our filters. Here's the code -- you might want to give it a spin: /** * Replaces all instances of oldString with newString in line.

* * CoolServlets.com * (APL license: http://www.coolservlets.com/jive/liscense.jsp) * * @param line the String to search to perform replacements on * @param oldString the String that should be replaced by newString * @param newString the String that will replace all instances of oldString * * @return a String will all instances of oldString replaced by newString */ public static final String replace( String line, String oldString, String newString ) { int i=0; if ( ( i=line.indexOf( oldString, i ) ) >= 0 ) { char [] line2 = line.toCharArray(); char [] newString2 = newString.toCharArray(); int oLength = oldString.length(); StringBuffer buf = new StringBuffer(line2.length); buf.append(line2, 0, i).append(newString2); i += oLength; int j = i; while( ( i=line.indexOf( oldString, i ) ) > 0 ) { buf.append(line2, j, i-j).append(newString2); i += oLength; j = i; } buf.append(line2, j, line2.length - j); return buf.toString(); } return line; } (this code resides in the com.coolservlets.util package in StringUtils.java. All source is available as part of Jive: www.coolservlets.com/jive) --Bill +--------------------------------------------------------+ | Bill Lynch | |--------------------------------------------------------| | blynch@4charity.com http://www.4charity.com | | bill@coolservlets.com http://www.coolservlets.com | +--------------------------------------------------------+ > -----Original Message----- > From: Jonathan Gray [mailto:jonathan.gray@netdecisions.co.uk] > Sent: Thursday, September 28, 2000 12:27 PM > To: ant-dev@jakarta.apache.org > Subject: JspC task (including code) > > > I have been working on a task, most of which is a > copy-and-paste from > both and tasks, which supports jasper.jspc and should > eventually support the weblogic.jspc compiler. However, a few issues have > arisen: > > I am trying to emulate the Tomcat JSP compilation process as closely as > possible and as such, when scanning the destination directories for JSPs > which have already been compiled, I am replacing all underscores > with their > Unicode equivalent '0005f' which Tomcat seems to do with all of the .java > and .class files it creates in its web application tomcat/work > directory. I > am not sure whether I should be doing this as I don't know whether it is > standard behaviour across both Jasper and WebLogic jspc compilers. > > Also, the weblogic.jspc compiler also has the ability to then compile the > generated java classes to check whether they compile. jasper.jspc does not > provide this option so it would either mean leaving this second phase of > compilation for a separate Ant task or have the two-phases built-in to the > jspc task. > > Also, what are the chances of having this task, once complete, included in > the standard Ant distribution? > > thanks > > Jon > >