Re: [collections] When is the next release?
AFAIK, collections was prepared fully for a release, but the release never ocurred. There was a delay in the primitive subpackage, but I believe Rodney Waldorf completed his work there. I don't know who the release manager was, but they either need a little reminder, or a new one electing. This note affects other ideas/suggestions to collections which have been suggested recently, as the aim would be to get a release out before adding new code. Stephen - Original Message - From: Berin Loritsch [EMAIL PROTECTED] The Avalon team is waiting to know when the next official release is of Commons collections. We need to know this so that we can officially publish the deprecation of Avalon collections. Our CVS is all prepared, but we can make it public yet until there is a released version of Commons. We have already started moving our CVS source to the commons variant, but making a release with a snapshot jar is not the best... -- They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. - Benjamin Franklin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/email - New directory
jstrachan2002/10/10 02:27:45 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/email - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly project.xml
jstrachan2002/10/10 02:27:52 Modified:jelly/src/java/org/apache/commons/jelly jelly.properties jellyproject.xml Added: jelly/src/java/org/apache/commons/jelly/tags/email EmailTag.java package.html EmailTagLibrary.java Log: Added Jason Horman's email tag library submission so that email can be sent from a Jelly script. Many thanks Jason! Also added Jason and Morgan to the development team page Revision ChangesPath 1.24 +1 -0 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties Index: jelly.properties === RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/jelly.properties,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- jelly.properties 28 Aug 2002 08:58:00 - 1.23 +++ jelly.properties 10 Oct 2002 09:27:51 - 1.24 @@ -17,6 +17,7 @@ html = org.apache.commons.jelly.tags.html.HTMLTagLibrary betwixt = org.apache.commons.jelly.tags.betwixt.BetwixtTagLibrary jms = org.apache.commons.jelly.tags.jms.JMSTagLibrary +email= org.apache.commons.jelly.tags.email.EmailTagLibrary validate= org.apache.commons.jelly.tags.validate.ValidateTagLibrary ojb = org.apache.commons.jelly.tags.ojb.OjbTagLibrary beanshell = org.apache.commons.jelly.tags.beanshell.BeanShellTagLibrary 1.1 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/email/EmailTag.java Index: EmailTag.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/xml/XMLTagLibrary.java,v 1.9 2002/06/18 08:31:02 jstrachan Exp $ * $Revision: 1.9 $ * $Date: 2002/06/18 08:31:02 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Commons, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * $Id: XMLTagLibrary.java,v 1.9 2002/06/18 08:31:02 jstrachan Exp $ */ package org.apache.commons.jelly.tags.email; import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; import org.apache.commons.jelly.JellyException;
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/util - New directory
jstrachan2002/10/10 03:24:26 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/util - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly maven.xml
jstrachan2002/10/10 03:24:32 Modified:jellymaven.xml Added: jelly/src/test/org/apache/commons/jelly/util suite.jelly TestJelly.java Log: Added some JellyUnit test cases for the util:tokenize tag which also helped highlight the bug in Jexl Robert found. Will be adding some more unit test cases to Jexl shortly... Revision ChangesPath 1.1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/util/suite.jelly Index: suite.jelly === ?xml version=1.0? test:suite xmlns:j=jelly:core xmlns:util=jelly:util xmlns:test=jelly:junit xmlns:log=jelly:log test:case name=testTokenize util:tokenize var=tokens delim=,Test1,Test2,Test3,Test4/util:tokenize !-- j:set var=size value=${tokens.size()}/ test:assert test=${size == 4}/ test:assert test=${tokens.size() == 4}/ -- test:assertEquals expected=Test1 actual=${tokens[0]}/ test:assertEquals expected=Test2 actual=${tokens[1]}/ test:assertEquals expected=Test3 actual=${tokens[2]}/ test:assertEquals expected=Test4 actual=${tokens[3]}/ !-- test:assertEquals expected=Test4 actual=${tokens[size]}/ test:assertEquals expected=Test4 actual=${tokens[tokens.size() - 1]}/ test:assertEquals expected=Test4 actual=${tokens.get(tokens.size() - 1)}/ -- /test:case /test:suite 1.1 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/util/TestJelly.java Index: TestJelly.java === /* * $Header: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/core/JellyTestSuite.java,v 1.8 2002/07/06 13:53:39 dion Exp $ * $Revision: 1.8 $ * $Date: 2002/07/06 13:53:39 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Commons, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * * $Id: JellyTestSuite.java,v 1.8 2002/07/06 13:53:39
cvs commit: jakarta-commons-sandbox/jexl .cvsignore
jstrachan2002/10/10 03:29:32 Added: jexl .cvsignore Log: added a cvsignore file Revision ChangesPath 1.1 jakarta-commons-sandbox/jexl/.cvsignore Index: .cvsignore === .classpath .project build.properties dist target *.log *.gz tmp lib -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan2002/10/10 03:40:58 Modified:jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Added a few more test cases (that fail!) to demonstrate the .size() bug in Jexl. Revision ChangesPath 1.17 +14 -1 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java Index: JexlTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- JexlTest.java 19 Aug 2002 22:41:10 - 1.16 +++ JexlTest.java 10 Oct 2002 10:40:58 - 1.17 @@ -447,6 +447,19 @@ e = ExpressionFactory.createExpression(size(list)); o = e.evaluate(jc); assertTrue(4 : o incorrect, o.equals(new Integer(5))); + + +e = ExpressionFactory.createExpression(list.size()); +o = e.evaluate(jc); +assertTrue(4 : o incorrect, o.equals(new Integer(5))); + +e = ExpressionFactory.createExpression(map.size()); +o = e.evaluate(jc); +assertTrue(4 : o incorrect, o.equals(new Integer(5))); + +e = ExpressionFactory.createExpression(array.length); +o = e.evaluate(jc); +assertTrue(4 : o incorrect, o.equals(new Integer(5))); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/joran README.txt
ceki2002/10/10 03:55:54 Added: joranREADME.txt Log: First commit in joran. Revision ChangesPath 1.1 jakarta-commons-sandbox/joran/README.txt Index: README.txt === -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan2002/10/10 04:09:32 Modified:jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Added a few more test cases (that fail!). Also added a helper method assertExpression(jc, expressionText, expectedValue) that makes it really easy to add lots more tests. Also this helper method gives some helpful output so its easy to see which test failed etc. Revision ChangesPath 1.18 +33 -52 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java Index: JexlTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- JexlTest.java 10 Oct 2002 10:40:58 - 1.17 +++ JexlTest.java 10 Oct 2002 11:09:32 - 1.18 @@ -424,42 +424,26 @@ List list = new ArrayList(); -list.add(); -list.add(); -list.add(); -list.add(); -list.add(); +list.add(1); +list.add(2); +list.add(3); +list.add(4); +list.add(5); jc.getVars().put(list, list); -Expression e = ExpressionFactory.createExpression(size(string)); -Object o = e.evaluate(jc); -assertTrue(1 : o incorrect, o.equals(new Integer(5))); - -e = ExpressionFactory.createExpression(size(array)); -o = e.evaluate(jc); -assertTrue(2 : o incorrect, o.equals(new Integer(5))); - -e = ExpressionFactory.createExpression(size(map)); -o = e.evaluate(jc); -assertTrue(3 : o incorrect, o.equals(new Integer(5))); - -e = ExpressionFactory.createExpression(size(list)); -o = e.evaluate(jc); -assertTrue(4 : o incorrect, o.equals(new Integer(5))); - - -e = ExpressionFactory.createExpression(list.size()); -o = e.evaluate(jc); -assertTrue(4 : o incorrect, o.equals(new Integer(5))); - -e = ExpressionFactory.createExpression(map.size()); -o = e.evaluate(jc); -assertTrue(4 : o incorrect, o.equals(new Integer(5))); - -e = ExpressionFactory.createExpression(array.length); -o = e.evaluate(jc); -assertTrue(4 : o incorrect, o.equals(new Integer(5))); +assertExpression(jc, size(string), new Integer(5)); +assertExpression(jc, size(array), new Integer(5)); +assertExpression(jc, size(list), new Integer(5)); +assertExpression(jc, size(map), new Integer(5)); +assertExpression(jc, size(list), new Integer(5)); +assertExpression(jc, list.size(), new Integer(5)); +assertExpression(jc, map.size(), new Integer(5)); +assertExpression(jc, array.length, new Integer(5)); + +assertExpression(jc, list.get(size(list) - 1), 5); +assertExpression(jc, list[size(list) - 1], 5); +assertExpression(jc, list.get(list.size() - 1), 5); } @@ -736,25 +720,11 @@ assertTrue(o not instanceof Boolean, o instanceof Boolean); assertEquals(o incorrect, Boolean.FALSE, o); -e = ExpressionFactory.createExpression(bar == ''); -o = e.evaluate(jc); - -assertEquals(o incorrect, Boolean.TRUE, o ); -e = ExpressionFactory.createExpression(barnotexist == ''); -o = e.evaluate(jc); - -assertEquals(o incorrect, Boolean.FALSE, o ); - -e = ExpressionFactory.createExpression(empty bar); -o = e.evaluate(jc); - -assertEquals(o incorrect, Boolean.TRUE, o ); - -e = ExpressionFactory.createExpression(bar.length() == 0); -o = e.evaluate(jc); - -assertEquals(o incorrect, Boolean.TRUE, o ); +assertExpression(jc, bar == '', Boolean.TRUE); +assertExpression(jc, barnotexist == '', Boolean.FALSE); +assertExpression(jc, empty bar, Boolean.TRUE); +assertExpression(jc, bar.length() == 0, Boolean.TRUE); } /** @@ -994,4 +964,15 @@ } } + +/** + * Asserts that the given expression returns the given value when applied to the + * given context + */ +protected void assertExpression(JexlContext jc, String expression, Object expected) throws Exception +{ +Expression e = ExpressionFactory.createExpression(array.length); +Object actual = e.evaluate(jc); +assertEquals(expression, expected, actual); +} } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Validator and Karma
I am trying to fix a bug in the Validator code for struts, and bring it up to date for logging. It would help if I had karma to the commons. Is that possible ? -Rob -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[general] Should maven projects still use STATUS.html? (was Re: cvs commit: jakarta-commons-sandbox/jelly STATUS.html)
:-). This brings up an interesting point I've been meaning to get around to asking for some time. Much of the information thats expected in the original PROPOSAL.html and STATUS.html is actually inside the Maven descriptor (dependencies, aim, committers, versions etc). Should we decide only the missing pieces required for Maven generated sites and just document those? Or we could generate the STATUS.html and PROPOSAL.html from the project.xml descriptor? I just wanna avoid both stale documentation, unnecessary work and dual keying. James --- http://radio.weblogs.com/0112098/ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 10:00 PM Subject: cvs commit: jakarta-commons-sandbox/jelly STATUS.html morgand 2002/10/09 14:00:52 Added: jellySTATUS.html Log: adding required STATUS.html doc and myself as contributor, because I am patch-challenged :) Revision ChangesPath 1.7 +20 -57jakarta-commons-sandbox/jelly/STATUS.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: [general] Should maven projects still use STATUS.html? (was Re: cvs commit: jakarta-commons-sandbox/jelly STATUS.html)
+1, I think it is pretty easy to find the information from the project.xml wrt deps and committers/contributors. I've just added the proposal docs to the generated site for the project. Maybe a standard xdoc in cvs, proposal.xml? = Jeffrey D. Brekke Quad/Graphics [EMAIL PROTECTED] http://www.qg.com -Original Message- From: James Strachan [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 7:11 AM To: Jakarta Commons Developers List Subject: [general] Should maven projects still use STATUS.html? (was Re: cvs commit: jakarta-commons-sandbox/jelly STATUS.html) :-). This brings up an interesting point I've been meaning to get around to asking for some time. Much of the information thats expected in the original PROPOSAL.html and STATUS.html is actually inside the Maven descriptor (dependencies, aim, committers, versions etc). Should we decide only the missing pieces required for Maven generated sites and just document those? Or we could generate the STATUS.html and PROPOSAL.html from the project.xml descriptor? I just wanna avoid both stale documentation, unnecessary work and dual keying. James --- http://radio.weblogs.com/0112098/ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 10:00 PM Subject: cvs commit: jakarta-commons-sandbox/jelly STATUS.html morgand 2002/10/09 14:00:52 Added: jellySTATUS.html Log: adding required STATUS.html doc and myself as contributor, because I am patch-challenged :) Revision ChangesPath 1.7 +20 -57jakarta-commons-sandbox/jelly/STATUS.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[Lang] Was my message lost in the noise?
Hi, A couple of days ago I submitted a message about increasing the speed on StringUtils.replace, and I haven't seen any replies to it or any discussion at all. Is this due to it not being of any interest, or has it just been lost in the noise? Feel free to mail me directly ([EMAIL PROTECTED]) to say it's just not interesting, if you'd rather not waste list bandwidth. (Alternatively, if I posted in some incorrect way, please correct me so I can repost or whatever.) Cheers, Jon winmail.dat -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [Lang] Was my message lost in the noise?
Hi Jon, I think we're in post-release party hangover mode. Am sure your reminder will help us pull people from under the tables and get thinking again :) Will try to look at it myself today. Hen On Thu, 10 Oct 2002, Jon Skeet wrote: Hi, A couple of days ago I submitted a message about increasing the speed on StringUtils.replace, and I haven't seen any replies to it or any discussion at all. Is this due to it not being of any interest, or has it just been lost in the noise? Feel free to mail me directly ([EMAIL PROTECTED]) to say it's just not interesting, if you'd rather not waste list bandwidth. (Alternatively, if I posted in some incorrect way, please correct me so I can repost or whatever.) Cheers, Jon -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan2002/10/10 06:51:36 Modified:jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Added a few more test cases Revision ChangesPath 1.19 +44 -8 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java Index: JexlTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- JexlTest.java 10 Oct 2002 11:09:32 - 1.18 +++ JexlTest.java 10 Oct 2002 13:51:36 - 1.19 @@ -409,7 +409,7 @@ throws Exception { JexlContext jc = JexlHelper.createContext(); -jc.getVars().put(string, five!); +jc.getVars().put(s, five!); jc.getVars().put(array, new Object[5]); Map map = new HashMap(); @@ -432,7 +432,7 @@ jc.getVars().put(list, list); -assertExpression(jc, size(string), new Integer(5)); +assertExpression(jc, size(s), new Integer(5)); assertExpression(jc, size(array), new Integer(5)); assertExpression(jc, size(list), new Integer(5)); assertExpression(jc, size(map), new Integer(5)); @@ -795,10 +795,7 @@ assertTrue(o incorrect, Boolean.TRUE.equals(o)); -e = ExpressionFactory.createExpression(foo == 'bar'); -o = e.evaluate(jc); - -assertTrue(o incorrect, Boolean.TRUE.equals(o)); +assertExpression(jc, foo == 'bar', Boolean.TRUE); } /** @@ -811,11 +808,18 @@ JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); - + +// lets check the square function first.. +assertEquals(4, foo.square(2)); +assertEquals(4, foo.square(-2)); + jc.getVars().put(foo, foo ); Object o = e.evaluate(jc); assertEquals(o incorrect, new Integer(5), o); + +assertExpression(jc, foo.square(-2), new Integer(4)); +assertExpression(jc, foo.square(2), new Integer(4)); } public void testArrayProperty() @@ -857,6 +861,33 @@ //assertEquals(dot form failed, GET_METHOD_ARRAY2[1][1], o2); } +/** + * Attempts to recreate bug http://jira.werken.com/ViewIssue.jspa?key=JELLY-8 + */ +public void testCharAtBug() +throws Exception +{ +JexlContext jc = JexlHelper.createContext(); + +Foo foo = new Foo(); + +jc.getVars().put(s, abc); + +assertExpression(jc, s.charAt(2), new Character('b')); + +try { +assertExpression(jc, s.charAt(-2), null); +fail(this test should have thrown an exception ); +} +catch (IndexOutOfBoundsException e) { +// expected behaviour +} +catch (Exception e) { +throw e; +} +} + + public void testResolver() throws Exception { @@ -961,6 +992,11 @@ public boolean isSimple() { return true; +} + +public int square(int value) +{ +return value * value; } } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan2002/10/10 07:19:16 Modified:jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Added a few more test cases Revision ChangesPath 1.20 +5 -4 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java Index: JexlTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JexlTest.java 10 Oct 2002 13:51:36 - 1.19 +++ JexlTest.java 10 Oct 2002 14:19:16 - 1.20 @@ -871,12 +871,13 @@ Foo foo = new Foo(); -jc.getVars().put(s, abc); +jc.getVars().put(foo, abcdef); -assertExpression(jc, s.charAt(2), new Character('b')); +assertExpression(jc, foo.substring(2,3), cd); +assertExpression(jc, foo.charAt(2), new Character('b')); try { -assertExpression(jc, s.charAt(-2), null); +assertExpression(jc, foo.charAt(-2), null); fail(this test should have thrown an exception ); } catch (IndexOutOfBoundsException e) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly JellyContext.java
jstrachan2002/10/10 07:50:22 Modified:jelly/src/java/org/apache/commons/jelly JellyContext.java Log: avoided null pointer exception if inherit is true and there is no parent Revision ChangesPath 1.30 +5 -4 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java Index: JellyContext.java === RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/JellyContext.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- JellyContext.java 3 Oct 2002 07:52:37 - 1.29 +++ JellyContext.java 10 Oct 2002 14:50:21 - 1.30 @@ -214,10 +214,11 @@ public Object getVariable(String name) { Object value = variables.get(name); -if ( value == null - - isInherit() ) { -value = getParent().findVariable( name ); +if ( value == null isInherit() ) { +JellyContext parent = getParent(); +if (parent != null) { +value = parent.findVariable( name ); +} } return value; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [logging] Log4j's NDC and MDC
It looks like the concept is available in both LogKit and Log4J, although in slightly differenct forms. I don't know if the forms are compatible. It's not available in JDK 1.4 logging. So, the question is two-fold. Can the differences between LogKit and Log4J be harmonized, and is this useful if it might be a no-op? On Wednesday 09 October 2002 09:02 pm, Sean C. Sullivan wrote: I spotted this message on the jboss-developer mailing list. -Original Message- From: Jason Dillon [mailto:jason@pl...] Sent: Tuesday, October 08, 2002 8:24 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-dev] Design: Plans to decouple JBoss from log4j It is too bad commons logging does not provide abstractions for a ContextStack or ContextMap similar to Log4j's NDC and MDC. These are valuable constructs. Do you know anyone on the commons logging team? --jason -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: [Lang] Was my message lost in the noise?
I think we're in post-release party hangover mode. Am sure your reminder will help us pull people from under the tables and get thinking again :) LOL. Will try to look at it myself today. Cheers. If anyone fancies coming up with good test cases I'd be happy to optimise further. Admittedly it's somewhat tricker to optimise in terms of memory than speed, but I'll try to bear it in mind. Cheers, Jon -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [logging] Log4j's NDC and MDC
At 11:10 10.10.2002 -0400, Steve Downey wrote: It looks like the concept is available in both LogKit and Log4J, although in slightly differenct forms. I don't know if the forms are compatible. It's not available in JDK 1.4 logging. So, the question is two-fold. Can the differences between LogKit and Log4J be harmonized, and is this useful if it might be a no-op? Yes on both accounts. Yes they should be compatible, and yes a no-op under JDK 1.4 is better than having nothing under log4j or logkit. On Wednesday 09 October 2002 09:02 pm, Sean C. Sullivan wrote: I spotted this message on the jboss-developer mailing list. -Original Message- From: Jason Dillon [mailto:jason@pl...] Sent: Tuesday, October 08, 2002 8:24 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-dev] Design: Plans to decouple JBoss from log4j It is too bad commons logging does not provide abstractions for a ContextStack or ContextMap similar to Log4j's NDC and MDC. These are valuable constructs. Do you know anyone on the commons logging team? --jason -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl JexlTest.java
jstrachan2002/10/10 08:44:23 Modified:jexl/src/test/org/apache/commons/jexl JexlTest.java Log: Fixed a glaring bug I'd introduced into the unit test case by a bad cut and paste :-). the tests now demonstrate 3 main bugs in Jexl * .size() doesn't work in an expression * x.foo(-3) doesn't work - the '-' confuses the parser * we need support for variable name resolution, inside expressions Revision ChangesPath 1.21 +13 -38 jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java Index: JexlTest.java === RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/test/org/apache/commons/jexl/JexlTest.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- JexlTest.java 10 Oct 2002 14:19:16 - 1.20 +++ JexlTest.java 10 Oct 2002 15:44:23 - 1.21 @@ -671,38 +671,13 @@ assertTrue(o not instanceof Boolean, o instanceof Boolean); assertEquals(o incorrect, Boolean.TRUE, o); -/* - * also support the functional syntax extension - */ -e = ExpressionFactory.createExpression(empty(foo)); -o = e.evaluate(jc); - -assertTrue(o not instanceof Boolean, o instanceof Boolean); -assertEquals(o incorrect, Boolean.TRUE, o); - -e = ExpressionFactory.createExpression(bar == null); -o = e.evaluate(jc); - -assertTrue(o not instanceof Boolean, o instanceof Boolean); -assertEquals(o incorrect, Boolean.FALSE, o ); - -e = ExpressionFactory.createExpression(bar != null); -o = e.evaluate(jc); - -assertTrue(o not instanceof Boolean, o instanceof Boolean); -assertEquals(o incorrect, Boolean.TRUE, o ); - -e = ExpressionFactory.createExpression(foo != null); -o = e.evaluate(jc); - -assertTrue(o not instanceof Boolean, o instanceof Boolean); -assertEquals(o incorrect, Boolean.FALSE, o); - -e = ExpressionFactory.createExpression(foo == null); -o = e.evaluate(jc); - -assertTrue(o not instanceof Boolean, o instanceof Boolean); -assertEquals(o incorrect, Boolean.TRUE, o); +assertExpression(jc, empty foo, Boolean.TRUE); +assertExpression(jc, bar == null, Boolean.FALSE); +assertExpression(jc, foo == null, Boolean.TRUE); +assertExpression(jc, bar != null, Boolean.TRUE); +assertExpression(jc, foo != null, Boolean.FALSE); +assertExpression(jc, empty(bar), Boolean.FALSE); +assertExpression(jc, empty(foo), Boolean.TRUE); } /** @@ -818,9 +793,9 @@ assertEquals(o incorrect, new Integer(5), o); -assertExpression(jc, foo.square(-2), new Integer(4)); assertExpression(jc, foo.square(2), new Integer(4)); -} +assertExpression(jc, foo.square(-2), new Integer(4)); + } public void testArrayProperty() throws Exception @@ -873,8 +848,8 @@ jc.getVars().put(foo, abcdef); -assertExpression(jc, foo.substring(2,3), cd); -assertExpression(jc, foo.charAt(2), new Character('b')); +assertExpression(jc, foo.substring(2,4), cd); +assertExpression(jc, foo.charAt(2), new Character('c')); try { assertExpression(jc, foo.charAt(-2), null); @@ -1008,7 +983,7 @@ */ protected void assertExpression(JexlContext jc, String expression, Object expected) throws Exception { -Expression e = ExpressionFactory.createExpression(array.length); +Expression e = ExpressionFactory.createExpression(expression); Object actual = e.evaluate(jc); assertEquals(expression, expected, actual); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/periodicity/src/java/org/apache/commons/periodicity/test ParamTests.java TestConstants.java VObjectTests.java
prickett2002/10/10 09:02:45 Removed: periodicity/src/java/org/apache/commons/periodicity/test ParamTests.java TestConstants.java VObjectTests.java Log: Removed some more test files. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: [general] Should maven projects still use STATUS.html? (was R e: cvs commit: jakarta-commons-sandbox/jelly STATUS.html)
I semi-agree. It seems that the project.xml is adequate for the list of committers. However, using that file to document dependencies is not very effective. There's a big difference between what you need to run an end-to-end Maven distribution and what you need to execute the core tags. Dependencies would be a bit tricky to document in a simple DTD; types of dependency will vary from project to project. --- Brekke, Jeff [EMAIL PROTECTED] wrote: +1, I think it is pretty easy to find the information from the project.xml wrt deps and committers/contributors. I've just added the proposal docs to the generated site for the project. Maybe a standard xdoc in cvs, proposal.xml? = Jeffrey D. Brekke Quad/Graphics [EMAIL PROTECTED] http://www.qg.com -Original Message- From: James Strachan [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 7:11 AM To: Jakarta Commons Developers List Subject: [general] Should maven projects still use STATUS.html? (was Re: cvs commit: jakarta-commons-sandbox/jelly STATUS.html) :-). This brings up an interesting point I've been meaning to get around to asking for some time. Much of the information thats expected in the original PROPOSAL.html and STATUS.html is actually inside the Maven descriptor (dependencies, aim, committers, versions etc). Should we decide only the missing pieces required for Maven generated sites and just document those? Or we could generate the STATUS.html and PROPOSAL.html from the project.xml descriptor? I just wanna avoid both stale documentation, unnecessary work and dual keying. James --- http://radio.weblogs.com/0112098/ - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 09, 2002 10:00 PM Subject: cvs commit: jakarta-commons-sandbox/jelly STATUS.html morgand 2002/10/09 14:00:52 Added: jellySTATUS.html Log: adding required STATUS.html doc and myself as contributor, because I am patch-challenged :) Revision ChangesPath 1.7 +20 -57 jakarta-commons-sandbox/jelly/STATUS.html -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] = Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons http://axion.tigris.org http://jakarta.apache.org/watchdog __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Commons Collections:Suggested MapUtils enhancements
That sounds plenty fast to me! Thanks for taking this on. As to the method signatures: I originally suggested that toMap should have a heavily overloaded method signature. The reason was to ease the pain of having to create all those java.lang.xxx objects instead of using basic types. It's a lot easier to write toMap(new int[][]{{1,1},{2,4}}) than toMap(new Object[][]{{new Integer(1), new Integer(1), {new Integer{2}, new Integer{4}}) So I'd like to see at least Map toMap(int[][]) Map toMap(Object[][]) The int[][] version would convert ints to Integers which would be a nice convenience. This may be blue sky, but something like Map toMap(String[][], Class keyClass, Class valueClass) would be great. The keyClass and valueClass would be java.lang type wrapper classes (Integer.class, Long.class, Boolean.class etc.). The toMap would then call the valueOf method of the keyClass to construct an appropriate object from that key string. For example: I want to create a Map that maps userNames to Integer ids (say I'm creating a mock object to simulate a database call in a unit test). I can say: Map userNameToIdMap = MapUtils.toMap( new String[][]{{spiderman, 1}, {superman, 22}, {batman, 500}},String.class, Integer.class); This will create the same thing as if I had written: Map userNameToIdMap = new HashMap(); userNameToIdMap.put(spiderman, new Integer(1)); userNameToIdMap.put(superman, new Integer(22)); userNameToIdMap.put(batman, new Integer(500)); Also, I think the method sig should take two-dimensional Object[][]. Yes, an Object array is technically an Object, so you can pass an Object[][] into an Object[] parameter, but if what you're expecting is an Object[][] created like this: {{hello, goodbye}{fast, slow}} that should be what the sig says - and gives a nice hint to the end user as to what to pass in. -Original Message- From: Moritz Petersen [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 11:08 AM To: Jakarta Commons Users List Subject: RE: Commons Collections:Suggested MapUtils enhancements I will develop toMap and asMap, but I will not finish it before Saturday. So, if it is urgent, someone else should do it. By the weekend I should get it done. Comments? Suggestions? Regards, Moritz. -Original Message- From: Phil Surette [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 4:49 PM To: 'Jakarta Commons Users List' Subject: RE: Commons Collections:Suggested MapUtils enhancements Moritz, are you saying that you will develop the toMap and asMap methods? If so, great! If not, I'll add it to my TODO list and try get to it sometime after I finish another project I'm working on... -Original Message- From: Moritz Petersen [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 4:30 AM To: Jakarta Commons Users List Subject: RE: Commons Collections:Suggested MapUtils enhancements I can do that. -Moritz. -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 10, 2002 10:15 AM To: Jakarta Commons Users List Subject: Re: Commons Collections:Suggested MapUtils enhancements Note that the semantics of asMap() and toMap() are different. asMap() will wrap the object array in a map interface, however, you cannot then add items to the map, as its data structure is the array. toMap() will copy the object array into a map, thus it acts as an initializer only. IMO, both methods would be useful additions to MapUtils. Also, a toList() would be a useful addition to ListUtils. I would suggest that you should stick to Object[] for the method signatures. You might also want to note that an ArrayUtils will be added to [lang] project fairly soon that could contain the int[] to Object[] containing Integer objects method. If you would like to write the code please write to the commons-dev list (to ensure no duplicated work), and see the directions for writing patches posted on the website. Stephen (committer) From: Moritz Petersen [EMAIL PROTECTED] Also, what about a nice way of initializing Maps? Languages such as Perl and Python have very nice ways of initializing hashes. Compare [python] squares = {1:1, 2:4, 3:9} [java] Map squares = new HashMap(); [java] squares.put(new Integer(1), new Integer(1)); [java] squares.put(new Integer(2), new Integer(4)); [java] squares.put(new Integer(3), new Integer(9)); In java, array initializers come closest to python's initializer. Why not have a MapFactory class that has methods like public Map createMap(int[][] pairs) public Map createMap(String[][] pairs) Then we could have [java] Map squares = MapFactory.createMap(new int[][]{{1,1},{2,4},{3,9}}); [java] Map genusSpecies = MapFactory.createMap(new String[][] {{homo,sapiens},{homo,habilis},{ursus,negra}}); I like this idea! It should be more
Re: [general] Should maven projects still use STATUS.html? (was R e: cvs commit: jakarta-commons-sandbox/jelly STATUS.html)
From: Morgan Delagrange [EMAIL PROTECTED] I semi-agree. It seems that the project.xml is adequate for the list of committers. However, using that file to document dependencies is not very effective. There's a big difference between what you need to run an end-to-end Maven distribution and what you need to execute the core tags. Dependencies would be a bit tricky to document in a simple DTD; types of dependency will vary from project to project. Agreed. Though for basic stuff, like jar dependencies its ideal. I guess rephrasing my original mail a bit. What do we think we need, in addition to a Maven project descriptor (for those commons projects that use Maven) to replicate the stuff available in the PROPOSAL.html and STATUS.html. e.g. we could even extend the project.xml, or have one or two extra documents to add the extra stuff and autogenerate these HTML documents (as Jeff said). So far I like Jeff's proposal; of just having a (combined status-proposal) proposal.xml in the xdocs that gets generated as part of the website. Any other thoughts? James --- http://radio.weblogs.com/0112098/ __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/discovery/src/java/org/apache/commons/discovery ResourceClass.java
rsitze 2002/10/10 11:34:23 Modified:discovery/src/java/org/apache/commons/discovery ResourceClass.java Log: Cause loadClass to force linking of class for JDK14. Only return classes that really can be loaded, preventing future surprises.. Revision ChangesPath 1.3 +17 -0 jakarta-commons/discovery/src/java/org/apache/commons/discovery/ResourceClass.java Index: ResourceClass.java === RCS file: /home/cvs/jakarta-commons/discovery/src/java/org/apache/commons/discovery/ResourceClass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ResourceClass.java30 Aug 2002 22:19:33 - 1.2 +++ ResourceClass.java10 Oct 2002 18:34:23 - 1.3 @@ -101,6 +101,23 @@ try { resourceClass = getClassLoader().loadClass(getName()); + +/** + * Loading the class does not necessarily link it... + * and we need to know, at this point in the flow, + * if the class is actually loadable or not! + * + * Force load (for Sun JDK14?): + */ +try { +resourceClass.getDeclaredMethod(anyName, new Class[0]); +} catch(NoClassDefFoundError e) { +// some dependency couldn't be found.. +// class cannot be loaded. +resourceClass = null; +} catch(NoSuchMethodException e) { +// ignore +} } catch (ClassNotFoundException e) { resourceClass = null; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[Betwixt] escaping question
Hi, I've been experimenting with Betwixt. My need is very simple. I'd like to turn some existing beans into xml files. I've been able to do most of this fairly easily, but am having problems with a few things. 1- Some of the bean properties contain strings with special characters. In some cases html. Many of these are automatically escaped when I BeanWriter to output the bean. Some are not: specifically doublequote and singlequote. Is there something special I need to do to include certain special characters in the escaping? I looked at some of the junit testing files (TestBeanWriter in particular) to make sure I was structuring the code properly. 2- Is there a way to exempt certain bean properties when writing the bean out to xml? For instance, if I had a bean with the properties name, age, and gender, but only wanted to include name and age in my xml? I know I could simply create a new bean with name and age only -- just wondering if there's a different way to do it. Thanks, mjm __ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos More http://faith.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/validators GoldenFileTag.java MaxRequestTimeTag.java ResponseHeaderTag.java StatusCodeTag.java StatusTextTag.java XPathTag.java
morgand 2002/10/10 11:44:25 Added: latka/src/java/org/apache/commons/latka/jelly/validators GoldenFileTag.java MaxRequestTimeTag.java ResponseHeaderTag.java StatusCodeTag.java StatusTextTag.java XPathTag.java Log: added the remainder of the validators Revision ChangesPath 1.1 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/validators/GoldenFileTag.java Index: GoldenFileTag.java === /* * $Header: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/validators/GoldenFileTag.java,v 1.1 2002/10/10 18:44:25 morgand Exp $ * $Revision: 1.1 $ * $Date: 2002/10/10 18:44:25 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Commons, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * */ package org.apache.commons.latka.jelly.validators; import java.io.File; import org.apache.commons.latka.Validator; import org.apache.commons.latka.validators.GoldenFileValidator; import org.apache.log4j.Category; /** * A class to compare an HTTP response to a golden * file * * @author Morgan Delagrange * @version $Id: GoldenFileTag.java,v 1.1 2002/10/10 18:44:25 morgand Exp $ */ public class GoldenFileTag extends HttpValidatorTagSupport { protected String _fileName = null; protected boolean _ignoreWhitespace = false; protected static final Category _log = Category.getInstance(GoldenFileTag.class); /** * return the golden file validator * * @return golden file validator */ public Validator getValidator() { GoldenFileValidator validator = new GoldenFileValidator(_label, new File(_fileName)); validator.setIgnoreWhitespace(_ignoreWhitespace); return validator; } /** * whether or not to ignore whitespace * * @param ignoreWhitespace * whether or not to ignore whitespace */ public void setIgnoreWhitespace(boolean ignoreWhitespace) { _ignoreWhitespace = ignoreWhitespace; } /** * set the file name for the golden file * * @param
cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly RequestTag.java SessionTag.java SuiteTag.java
morgand 2002/10/10 12:18:36 Modified:latka/src/java/org/apache/commons/latka/jelly RequestTag.java SessionTag.java SuiteTag.java Log: added session caching and implemented part of request skipping Revision ChangesPath 1.5 +35 -8 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java Index: RequestTag.java === RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RequestTag.java 8 Oct 2002 19:29:01 - 1.4 +++ RequestTag.java 10 Oct 2002 19:18:36 - 1.5 @@ -70,6 +70,7 @@ import org.apache.commons.latka.LatkaException; import org.apache.commons.latka.event.LatkaEventInfo; import org.apache.commons.latka.event.RequestErrorEvent; +import org.apache.commons.latka.event.RequestSkippedEvent; import org.apache.commons.latka.event.RequestSucceededEvent; import org.apache.commons.latka.http.Proxy; import org.apache.commons.latka.http.Request; @@ -98,6 +99,8 @@ protected Request _request = null; protected Response _response = null; +protected Session _session = null; +protected boolean _requestExecuted = false; protected static final Category _log = Category.getInstance(RequestTag.class); @@ -116,6 +119,14 @@ // may set headers and such invokeBody(xmlOutput); +LatkaEventInfo listener = +JellyUtils.getInstance().getLatkaEventInfo(getContext()); +if (listener.didSessionSucceed(findSession()) == false +_requestExecuted == false) { +listener.requestSkipped(new RequestSkippedEvent(createRequest(),null)); +return; +} + // even when there are no validations, we execute the request // to make sure the URL is accessible @@ -123,7 +134,6 @@ // be created, typically because of a malformed URL Response response = getResponse(); -LatkaEventInfo listener = JellyUtils.getInstance().getLatkaEventInfo(getContext()); if (listener.didRequestSucceed(_request)) { listener.requestSucceeded(new RequestSucceededEvent( response.getRequest(), response)); @@ -160,9 +170,7 @@ } } -// for now, create a new Session for each request -_log.warn(broken, needs session handling); -Session session = new SessionImpl(); +Session session = findSession(); Proxy proxy = null; if (proxyHost != null) { @@ -178,6 +186,23 @@ return session.createRequest(_label,url,_method,_httpVersion,_followRedirects,proxy); } +protected Session findSession() { +if (_session == null) { +SessionTag tag = (SessionTag) findAncestorWithClass(SessionTag.class); +if (tag == null) { +_session = new SessionImpl(); +} else { +_session = tag.getSession(); +} +} + +return _session; +} + +public boolean getRequestExecuted() { +return _requestExecuted; +} + /** * The first time this method is called, a live HTTP * call will be made to the server, returning null @@ -189,7 +214,9 @@ * error creating the Request (unrecoverable) */ public Response getResponse() throws LatkaException { -if (_request == null) { +if (_requestExecuted == false) { +_requestExecuted = true; + _request = createRequest(); LatkaEventInfo listener = 1.11 +31 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java Index: SessionTag.java === RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SessionTag.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- SessionTag.java 3 Oct 2002 18:10:19 - 1.10 +++ SessionTag.java 10 Oct 2002 19:18:36 - 1.11 @@ -61,9 +61,14 @@ package org.apache.commons.latka.jelly; +import java.util.Map; + import org.apache.commons.jelly.TagSupport; import org.apache.commons.jelly.XMLOutput; +import org.apache.commons.latka.http.Session; +import org.apache.commons.latka.http.SessionImpl; + /** * * @author Morgan Delagrange @@ -72,6 +77,7 @@ protected String _sessionId = null; protected String _label = null; +protected Session _session = null; /** Creates a new instance
Re: [logging] Log4j's NDC and MDC
I haven't used this feature - if anyone can provide a short description and a proposal for API it'll probably have my +1. Regarding no-op - it may be better to try to provide a 'default' or baseline implementation, if possible ( even if the behavior will be inefficient ). At least IMO, commons-logging should provide a common API but also try to harmonize the behavior. Costin Ceki Gülcü wrote: At 11:10 10.10.2002 -0400, Steve Downey wrote: It looks like the concept is available in both LogKit and Log4J, although in slightly differenct forms. I don't know if the forms are compatible. It's not available in JDK 1.4 logging. So, the question is two-fold. Can the differences between LogKit and Log4J be harmonized, and is this useful if it might be a no-op? Yes on both accounts. Yes they should be compatible, and yes a no-op under JDK 1.4 is better than having nothing under log4j or logkit. On Wednesday 09 October 2002 09:02 pm, Sean C. Sullivan wrote: I spotted this message on the jboss-developer mailing list. -Original Message- From: Jason Dillon [mailto:jason@pl...] Sent: Tuesday, October 08, 2002 8:24 PM To: [EMAIL PROTECTED] Subject: RE: [JBoss-dev] Design: Plans to decouple JBoss from log4j It is too bad commons logging does not provide abstractions for a ContextStack or ContextMap similar to Log4j's NDC and MDC. These are valuable constructs. Do you know anyone on the commons logging team? --jason -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- Costin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly RequestTag.java ValidateTag.java
morgand 2002/10/10 12:35:43 Modified:latka/src/java/org/apache/commons/latka/jelly RequestTag.java ValidateTag.java Log: cleaned up request skipping Revision ChangesPath 1.6 +8 -7 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java Index: RequestTag.java === RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/RequestTag.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RequestTag.java 10 Oct 2002 19:18:36 - 1.5 +++ RequestTag.java 10 Oct 2002 19:35:43 - 1.6 @@ -121,9 +121,10 @@ LatkaEventInfo listener = JellyUtils.getInstance().getLatkaEventInfo(getContext()); -if (listener.didSessionSucceed(findSession()) == false -_requestExecuted == false) { -listener.requestSkipped(new RequestSkippedEvent(createRequest(),null)); +if (listener.didSessionSucceed(findSession()) == false) { +if (_requestExecuted == false) { +listener.requestSkipped(new RequestSkippedEvent(createRequest(),null)); +} return; } @@ -148,7 +149,7 @@ * Error creating the request (unrecoverable, the script * must fail) */ -protected Request createRequest() throws LatkaException { +public Request createRequest() throws LatkaException { String host = _host; int port= _port; String proxyHost = _proxyHost; 1.3 +13 -3 jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java Index: ValidateTag.java === RCS file: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/ValidateTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ValidateTag.java 8 Oct 2002 19:29:01 - 1.2 +++ ValidateTag.java 10 Oct 2002 19:35:43 - 1.3 @@ -65,6 +65,7 @@ import org.apache.commons.jelly.XMLOutput; import org.apache.commons.latka.LatkaException; +import org.apache.commons.latka.event.LatkaEventInfo; import org.apache.commons.latka.http.Response; import org.apache.log4j.Category; @@ -82,6 +83,15 @@ * @throws Exception when any error occurs */ public void doTag(XMLOutput xmlOutput) throws Exception { + +RequestTag tag = (RequestTag) findAncestorWithClass(RequestTag.class); +LatkaEventInfo info = +JellyUtils.getInstance().getLatkaEventInfo(getContext()); +if (info.didSessionSucceed(tag.findSession()) == false) { +// the session is invalid, so return to the request tag, +// which will issue a RequestSkipped event +return; +} // execute the request Response response = getResponse(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/java/org - New directory
jstrachan2002/10/10 13:05:12 jakarta-commons-sandbox/threadpool/src/java/org - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/java - New directory
jstrachan2002/10/10 13:05:12 jakarta-commons-sandbox/threadpool/src/java - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/java/org/apache - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/java/org/apache - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src - New directory
jstrachan2002/10/10 13:05:12 jakarta-commons-sandbox/threadpool/src - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool - New directory
jstrachan2002/10/10 13:05:12 jakarta-commons-sandbox/threadpool - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/test/org/apache/commons - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/test/org/apache/commons - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/test - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/test - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/java/org/apache/commons - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/java/org/apache/commons - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/xdocs - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/xdocs - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/test/org - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/test/org - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/test/org/apache - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/test/org/apache - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/threadpool/src/java/org/apache/commons/threadpool - New directory
jstrachan2002/10/10 13:05:13 jakarta-commons-sandbox/threadpool/src/java/org/apache/commons/threadpool - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[collections][lang] deprecate StringStack
This class is badly named and I am not sure it belongs in collections. The original use of this class was to join sql fragments together to form a where clause or a list of columns, etc. So its class doc should be something like: This class provides a way to collect a list of unique strings and join them with an optional separator. This behavour is almost similar to StringUtils.join method though that does not handle the unique requirement. Maybe a suitable replacement could be added to lang.StringUtils? StringStack's original source was torque and we will adjust to the removal of the class. It really should be deprecated, I'm not sure I see the value in trying to create a Stack or List implementation out of the current class. john mcnally -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [logging] Log4j's NDC and MDC
At 13:40 10.10.2002 -0700, you wrote: Ceki Gülcü wrote: To illustrate this point, let us take the example of a servlet delivering content to numerous clients. The servlet can build the NDC at the very beginning of the request before executing other code. The contextual information can be the client's host name and other information inherent to the request, typically information contained in cookies. Hence, even if the servlet is serving multiple clients simultaneously, the logs initiated by the same code, i.e. belonging to the same logger, can still be distinguished because each client request will have a different NDC stack. Contrast this with the complexity of passing a freshly instantiated logger to all code exercised during the client's request. MDCs are similar except that they are map based instead of a stack. There is a tiny problem here - if per thread info is used and a servlet forgets to pop(), all other servelets in the same thread will be screwed. Wrong information will appear, yes. That makes abstracting this feature very important - to allow the container to cleanup the context after each servlet ( there are other things that the container need to be able to do for separation ). ??? Regarding no-op - it may be better to try to provide a 'default' or baseline implementation, if possible ( even if the behavior will be inefficient ). At least IMO, commons-logging should provide a common API but also try to harmonize the behavior. You can't really do that because the MDC has to be handled internally by the implementation. Well, I'm not sure what's the exact behavior - but creating a NDC stack per thread and adding the context before calling jdk1.4 logging doesn't seem to complicated. I'm sure the native implementation is better, but the workaround seems plausible. You can easily reproduce the MDC or NDC code, that is not the issue. Having JDK 1.4 logging to *use* the contextual information is the show stopper. Ceki - any proposal for the API ? Not at this stage. What about a new interface with the method you mentioned ( we can't use static - since we need to support multiple implementations ) ? Then add a method to get the implementation for each supported logger ( that would be in LogFactory ). You could indeed get the appropriate MDC implementation from some factory. However, if you consider that the classloader in use may vary for the same thread, things start to get complicated. -- Costin -- Ceki TCP implementations will follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others. -- Jon Postel, RFC 793 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/periodicity/src/plugins-build/database maven.xml
prickett2002/10/10 14:40:33 Modified:periodicity/src/plugins-build/database maven.xml Log: Added a plugin install goal and a pluging deploy goal. Revision ChangesPath 1.2 +15 -0 jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- maven.xml 10 Oct 2002 21:16:49 - 1.1 +++ maven.xml 10 Oct 2002 21:40:33 - 1.2 @@ -19,5 +19,20 @@ todir=${maven.repo.local}/maven/jars/ /goal + goal name=plugin:install +prereqs=plugin +description=Install the plugin in Maven's plugins directory +copy file=${maven.build.dir}/${maven.final.name}.jar +todir=${maven.home}/plugins/ + /goal + + goal name=plugin:deploy +prereqs=plugin +description=Install an unpacked version of the plugin +mkdir dir=${maven.home}/plugins/${maven.final.name}/ +unzip src=${maven.build.dir}/${maven.final.name}.jar + dest=${maven.home}/plugins/${maven.final.name}/ + /goal + /project -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/discovery .cvsignore maven.xml project.xml
jstrachan2002/10/10 14:52:25 Modified:discovery maven.xml project.xml Added: discovery .cvsignore Log: Patched Maven build so that commons-discovery can be built property from inside Maven Revision ChangesPath 1.2 +11 -0 jakarta-commons/discovery/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons/discovery/maven.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- maven.xml 23 Jul 2002 16:53:50 - 1.1 +++ maven.xml 10 Oct 2002 21:52:25 - 1.2 @@ -1,4 +1,15 @@ project default=java:jar xmlns:j=jelly:core + !-- copies unit testing stuff -- + postGoal name=test:compile +copy todir=target/test-classes + fileset dir=src/test +include name=**/*.properties/ +include name=META-INF/services/*/ + /fileset +/copy + /postGoal + + /project 1.9 +15 -0 jakarta-commons/discovery/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/discovery/project.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- project.xml 1 Sep 2002 03:58:02 - 1.8 +++ project.xml 10 Oct 2002 21:52:25 - 1.9 @@ -54,4 +54,19 @@ /dependencies + build +unitTest + includes +include**/TestAll.java/include + /includes +/unitTest + +resources + includes +include**/*.properties/include + /includes +/resources + /build + + /project 1.1 jakarta-commons/discovery/.cvsignore Index: .cvsignore === target -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl DefaultTagLibraryResolver.java
jstrachan2002/10/10 15:17:05 Modified:jelly/src/java/org/apache/commons/jelly/impl DefaultTagLibraryResolver.java Log: Patched to work against the latest snapshot of commons-discovery Revision ChangesPath 1.2 +24 -27 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagLibraryResolver.java Index: DefaultTagLibraryResolver.java === RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/impl/DefaultTagLibraryResolver.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DefaultTagLibraryResolver.java20 Aug 2002 17:24:23 - 1.1 +++ DefaultTagLibraryResolver.java10 Oct 2002 22:17:04 - 1.2 @@ -56,8 +56,10 @@ */ package org.apache.commons.jelly.impl; -import org.apache.commons.discovery.ServiceDiscovery; -import org.apache.commons.discovery.ServiceInfo; +import org.apache.commons.discovery.ResourceClass; +import org.apache.commons.discovery.ResourceClassIterator; +import org.apache.commons.discovery.resource.ClassLoaders; +import org.apache.commons.discovery.resource.classes.DiscoverClasses; import org.apache.commons.jelly.TagLibrary; @@ -80,7 +82,7 @@ /** The Log to which logging calls will be made. */ private static final Log log = LogFactory.getLog(DefaultTagLibraryResolver.class); -private ServiceDiscovery discovery; +private DiscoverClasses discovery; /** * The class loader to use for instantiating application objects. @@ -110,7 +112,7 @@ * so that the namespace URI should be treated as just vanilla XML. */ public TagLibrary resolveTagLibrary(String uri) { -ServiceDiscovery discovery = getServiceDiscovery(); +DiscoverClasses discovery = getDiscoverClasses(); String name = uri; if ( uri.startsWith( jelly: ) ) { name = jelly. + uri.substring(6); @@ -118,27 +120,20 @@ log.info( Looking up service name: + name ); -ServiceInfo[] infoArray = discovery.findServices(name); - -if ( infoArray != null infoArray.length 0 ) { -for (int i = 0; i infoArray.length; i++ ) { -ServiceInfo info = infoArray[i]; -try { -Class typeClass = info.getLoader().loadClass( info.getImplName() ); -if ( typeClass != null ) { -return newInstance(uri, typeClass); -} -} -catch (Exception e) { -log.error( Could not load service: + info.getImplName() - + with loader: + info.getLoader() - ); +ResourceClassIterator iter = discovery.findResourceClasses(name); +while (iter.hasNext()) { +ResourceClass resource = iter.nextResourceClass(); +try { +Class typeClass = resource.loadClass(); +if ( typeClass != null ) { +return newInstance(uri, typeClass); } } +catch (Exception e) { +log.error( Could not load service: + resource ); +} } -else { -log.info( Could not find any services for name: + name ); -} +log.info( Could not find any services for name: + name ); return null; } @@ -200,22 +195,24 @@ } /** - * @return the ServiceDiscovery instance to use to locate services. + * @return the DiscoverClasses instance to use to locate services. * This object is lazily created if it has not been configured. */ -public ServiceDiscovery getServiceDiscovery() { +public DiscoverClasses getDiscoverClasses() { if ( discovery == null ) { -discovery = ServiceDiscovery.getServiceDiscovery(); +ClassLoaders loaders = new ClassLoaders(); +loaders.put( getClassLoader() ); +discovery = new DiscoverClasses(loaders); discovery.addClassLoader( getClassLoader() ); } return discovery; } /** - * Sets the fully configured ServiceDiscovery instance to be used to + * Sets the fully configured DiscoverClasses instance to be used to * lookup services */ -public void setServiceDiscovery(ServiceDiscovery discovery) { +public void setDiscoverClasses(DiscoverClasses discovery) { this.discovery = discovery; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail:
cvs commit: jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/soap - New directory
jstrachan2002/10/10 15:19:09 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/soap - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/soap - New directory
jstrachan2002/10/10 15:19:09 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/soap - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/periodicity/src/plugins-build/database plugin.jelly maven.xml project.xml
prickett2002/10/10 15:43:08 Modified:periodicity/src/plugins-build/database maven.xml project.xml Added: periodicity/src/plugins-build/database plugin.jelly Log: Added an exclude line to exclude the install.properties file from the plugin distribution Changed the project id to periodicity-database-plugin Added a first cut of plugin.jelly Revision ChangesPath 1.3 +2 -1 jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- maven.xml 10 Oct 2002 21:40:33 - 1.2 +++ maven.xml 10 Oct 2002 22:43:08 - 1.3 @@ -10,6 +10,7 @@ exclude name=src/**/ exclude name=maven.xml/ exclude name=maven.log/ +exclude name=install*/ /fileset /copy jar jarfile=${maven.build.dir}/${maven.final.name}.jar @@ -32,7 +33,7 @@ mkdir dir=${maven.home}/plugins/${maven.final.name}/ unzip src=${maven.build.dir}/${maven.final.name}.jar dest=${maven.home}/plugins/${maven.final.name}/ - /goal + /goal /project 1.2 +1 -1 jakarta-commons-sandbox/periodicity/src/plugins-build/database/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/project.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- project.xml 10 Oct 2002 20:38:36 - 1.1 +++ project.xml 10 Oct 2002 22:43:08 - 1.2 @@ -1,7 +1,7 @@ ?xml version=1.0 encoding=ISO-8859-1? project pomVersion3/pomVersion - idjakarta-periodicity-db-plugin/id + idperiodicity-database-plugin/id namePeriodicity Database Plugin/name currentVersion0.0.1-dev/currentVersion organization 1.1 jakarta-commons-sandbox/periodicity/src/plugins-build/database/plugin.jelly Index: plugin.jelly === ?xml version=1.0? project goal name=database echoYou made it to the database plugin!!!/echo /goal /project -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/soap example.jelly
jstrachan2002/10/10 16:08:37 Modified:jelly/src/java/org/apache/commons/jelly/tags/soap InvokeTag.java jelly/src/test/org/apache/commons/jelly/soap example.jelly Log: Minor patch so that the soap:invoke tag can take the parameters as an attribute... soap:invoke params=${something}../ Also added another example that converts MM to inches using a web service; using Floats. Revision ChangesPath 1.2 +44 -5 jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/soap/InvokeTag.java Index: InvokeTag.java === RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jelly/tags/soap/InvokeTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InvokeTag.java10 Oct 2002 22:19:18 - 1.1 +++ InvokeTag.java10 Oct 2002 23:08:36 - 1.2 @@ -61,6 +61,10 @@ */ package org.apache.commons.jelly.tags.soap; +import java.util.Collection; + +import javax.xml.namespace.QName; + import org.apache.commons.jelly.JellyContext; import org.apache.commons.jelly.JellyException; import org.apache.commons.jelly.XMLOutput; @@ -71,8 +75,6 @@ import org.apache.axis.client.Service; import org.apache.axis.client.Call; -import javax.xml.namespace.QName; - /** * Invokes a web service * @@ -86,6 +88,7 @@ private String namespace = null; private String method = null; private Service service; +private Object params; public InvokeTag() { } @@ -102,6 +105,16 @@ if (method == null) { throw new MissingAttributeException(method); } + +Object[] params = getParamArray(); +if (params == null) { +params = new Object[]{ getBodyText() }; +} +else { +// invoke body just in case we have nested tags +invokeBody(output); +} + Service service = getService(); if (service == null) { service = createService(); @@ -113,14 +126,14 @@ call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(new QName(namespace, method)); -Object ret = call.invoke(new Object[]{getBodyText()}); +Object answer = call.invoke(params); if (var != null) { -context.setVariable(var, ret); +context.setVariable(var, answer); } else { // should turn the answer into XML events... -throw new JellyException( Not implemented yet; should stream results as XML events. Results: + ret ); +throw new JellyException( Not implemented yet; should stream results as XML events. Results: + answer ); } } @@ -168,6 +181,13 @@ this.var = var; } +/** + * Sets the parameters for this SOAP call. This can be an array or collection of + * SOAPBodyElements or types. + */ +public void setParams(Object params) { +this.params = params; +} // Implementation methods //- @@ -177,5 +197,24 @@ */ protected Service createService() { return new Service(); +} + +/** + * Performs any type coercion on the given parameters to form an Object[] + * or returns null if no parameter has been specified + */ +protected Object[] getParamArray() { +if (params == null) { +return null; +} +if (params instanceof Object[]) { +return (Object[]) params; +} +if (params instanceof Collection) { +Collection coll = (Collection) params; +return coll.toArray(); +} +// lets just wrap the current object inside an array +return new Object[] { params }; } } 1.2 +11 -0 jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/soap/example.jelly Index: example.jelly === RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/soap/example.jelly,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- example.jelly 10 Oct 2002 22:19:19 - 1.1 +++ example.jelly 10 Oct 2002 23:08:37 - 1.2 @@ -20,4 +20,15 @@ method=getTemp40031/soap:invoke log:infoSent: 40031 and received: ${answer} of type: ${answer.class.name}/log:info + + j:set var=x value=${300}/ + + soap:invoke + var=answer +
cvs commit: jakarta-commons/validator/src/example - New directory
turner 2002/10/10 16:41:39 jakarta-commons/validator/src/example - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/example/org/apache - New directory
turner 2002/10/10 16:41:56 jakarta-commons/validator/src/example/org/apache - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/example/org/apache/commons - New directory
turner 2002/10/10 16:42:05 jakarta-commons/validator/src/example/org/apache/commons - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/example/org/apache/commons/validator - New directory
turner 2002/10/10 16:42:12 jakarta-commons/validator/src/example/org/apache/commons/validator - New directory -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/example/org/apache/commons/validator ValidateBean.java ValidateExample.java applicationResources.properties validator-example.xml
turner 2002/10/10 16:44:32 Added: validator/src/example/org/apache/commons/validator ValidateBean.java ValidateExample.java applicationResources.properties validator-example.xml Log: Revision ChangesPath 1.1 jakarta-commons/validator/src/example/org/apache/commons/validator/ValidateBean.java Index: ValidateBean.java === /* * $Header: /home/cvs/jakarta-commons/validator/src/example/org/apache/commons/validator/ValidateBean.java,v 1.1 2002/10/10 23:44:32 turner Exp $ * $Revision: 1.1 $ * $Date: 2002/10/10 23:44:32 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Commons, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * */ package org.apache.commons.validator; /** * pA simple bean to use with the Validator Example./p * * @author James Turner * @version $Revision: 1.1 $ $Date: 2002/10/10 23:44:32 $ */ public class ValidateBean extends Object { String lastName, firstName, street1, street2, city, state, postalCode, age; public void setLastName(String lastName) { this.lastName = lastName; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setStreet1 (String street1) { this.street1 = street1; } public void setStreet2(String street2) { this.street2 = street2; } public void setCity(String city) { this.city = city; } public void setState(String state) { this.state = state; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public void setAge (String age) { this.age = age; } public String getLastName() { return this.lastName; } public String getFirstName() { return this.firstName; } public String getStreet1 () { return this.street1; } public String getStreet2() { return this.street2; } public String getCity() { return this.city; }
Re: Validator and Karma
Rob, Could you submit the patch to Bugzilla and I'll apply it after taking a look? Right now we're closing in on a release and are technically in feature freeze, but if it's common-sensical, I'd have no problem apply it. James At 08:02 AM 10/10/2002, Rob Leland wrote: I am trying to fix a bug in the Validator code for struts, and bring it up to date for logging. It would help if I had karma to the commons. Is that possible ? -Rob -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator build.xml
turner 2002/10/10 16:56:27 Modified:validator build.xml Log: Added build targets for build-example and example Revision ChangesPath 1.9 +175 -145 jakarta-commons/validator/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-commons/validator/build.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- build.xml 19 Jul 2002 03:09:06 - 1.8 +++ build.xml 10 Oct 2002 23:56:27 - 1.9 @@ -1,145 +1,175 @@ -!-- - You will need Ant setup properly to run this script. The build.properties.sample file - will need to be edited to point to some jar files and renamed to build.properties. --- -project name=Commons Validator default=jar basedir=. - !-- set global properties for this build -- - property file=build.properties/ - property file=../build.properties/ - property file=${user.home}/build.properties/ - - property name=title value=Commons Validator / - property name=name value=validator / - property name=validator.jar value=commons-validator.jar/ - property name=src value=src / - property name=build value=build / - property name=test value=test / - property name=share value=share / - property name=dist value=dist / - property name=docs value=docs / - property name=build.javadocs value=${dist}/${docs}/api / - property name=package.root value=org/apache/commons/validator/ - - !-- Setting Classpath -- - path id=base.classpath - pathelement path=${commons-beanutils.jar}/ - pathelement path=${commons-collections.jar}/ - pathelement path=${commons-digester.jar}/ - pathelement path=${commons-logging.jar}/ - pathelement path=${oro.jar}/ - /path - - path id=test.classpath - path refid=base.classpath/ - pathelement path=${junit.jar}/ - pathelement location=${xerces.jar}/ - pathelement path=${commons-beanutils.jar}/ - pathelement path=${commons-collections.jar}/ - pathelement path=${commons-digester.jar}/ - pathelement path=${commons-logging.jar}/ - pathelement path=${dist}/${validator.jar} / - pathelement path=${build}/${test} / - /path - - path id=javadoc.classpath - path refid=base.classpath/ - pathelement location=${xerces.jar}/ - pathelement path=${dist}/${validator.jar} / - /path - - target name=init description=creates any directories needed by the build process - !-- Create the time stamp -- - tstamp/ - !-- Create the build directory structure used by compile -- - mkdir dir=${build}/${share}/ - /target - - !-- Compile shared source -- - target name=build depends=init description=builds binary distribution - !-- Compile the java code from ${src}/${share} into ${build}/${share} -- - javac srcdir=${src}/${share} - destdir=${build}/${share} - classpath refid=base.classpath / - /javac - /target - - !-- Create distribution jar of shared source -- - target name=jar depends=build description=creates distributable jar of the binaries - !-- Create the ${dist} directory -- - mkdir dir=${dist} / - - !-- Put everything in ${build} -- - jar jarfile=${dist}/${validator.jar} - basedir=${build}/${share} - includes=${package.root}/**/ - /target - - !-- Create Javadocs -- - target name=javadocs depends=jar description=Creates the API documentation - mkdir dir=${build.javadocs}/ - javadoc packagenames=org.apache.commons.validator.* - sourcepath=${src}/${share} - destdir=${build.javadocs} - author=true - version=true - windowtitle=${title} API - doctitle=${title} - classpath refid=javadoc.classpath / - /javadoc - /target - - !-- Create distribution -- - target name=dist depends=jar,javadocs description=creates complete distribution - !-- Create the ${dist} directory -- - mkdir dir=${dist} / - - copy todir=${dist} file=../LICENSE/ - /target - - !-- Clean build and dist directories -- - target name=clean -description=Clean build and distribution directories - delete dir=${build}/ - delete dir=${dist}/ - /target - - !-- Compile JUnit Tests -- - target name=build-test depends=jar description=builds binaries for testing - mkdir dir=${build}/${test}/ - - !-- Compile the java code from ${src}/${test} into ${build}/${test} -- - javac srcdir=${src}/${test} -
cvs commit: jakarta-commons/validator STATUS.html
turner 2002/10/10 17:15:23 Modified:validator STATUS.html Log: Update status of Validator Revision ChangesPath 1.6 +21 -19jakarta-commons/validator/STATUS.html Index: STATUS.html === RCS file: /home/cvs/jakarta-commons/validator/STATUS.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- STATUS.html 1 Oct 2002 00:12:13 - 1.5 +++ STATUS.html 11 Oct 2002 00:15:23 - 1.6 @@ -59,12 +59,24 @@ a name=Release Info/a h33. RELEASE INFO/h3 - pCurrent Release: strongUnreleased, CVS Repository Only/strong/p -pPlanned Next Release: TBD/p - - +pPlanned Next Release: 1.0/p +PTentative Release Date: November 1st, 2002/P +PRelease Manager: James Turner/P +BOPEN BUGS/BBR +7318 javascript: zero - means bad integer?? BR +7349 Date Validation passes invalid date BR +8787 Indexed field validation patch BR +10584 Not all validation files are read in Validation PlugIn BR +10782 If two fields are required, and one has a mask, the mask is BR +13030 Digester unable to resolve external DTD BR +13421 GenericValidator GenericTypeValidator unused variables J BR +13472 Attempt to modify FastHashMap while in fast mode through ite P +BTO DO/BBR +Add DTD for Validation XMLBR +Improve JavadocBR +Write basic tutorialP a name=Committers/a h34. COMMITTERS/h3 @@ -87,24 +99,14 @@ table border=1 tr -th width=80%Action Item/th +th width=70%Action Item/th th width=20%Volunteer/th - /tr - tr -tdCreate Unit Tests./td -tdDavid Winterfeldt/td - /tr - tr -tdCreate Examples./td -tdDavid Winterfeldt/td +th width=10%Expected/th /tr tr tdDocumentation./td -tdDavid Winterfeldt/td - /tr - tr -tdCreate a emValidatorResults/em class to return the status of validations performed (in emorg.apache.commons.validator.Validator/em's validate method)./td -tdDavid Winterfeldt/td +tdJames Turner/td +td1.0 Release/td /tr tr td @@ -112,7 +114,7 @@ a global validation rule for an address object that can then be referenced in a form element. /td -td/td +td/tdtdPost 1.0/td /tr /table -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 7318] - javascript: zero - means bad integer??
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7318. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7318 javascript: zero - means bad integer?? [EMAIL PROTECTED] changed: What|Removed |Added AssignedTo|commons-|struts- |[EMAIL PROTECTED] |[EMAIL PROTECTED] Component|Validator |Validator Framework Product|Commons |Struts Version|unspecified |0.5 Final --- Additional Comments From [EMAIL PROTECTED] 2002-10-11 00:24 --- This is a bug in the Struts Javascript for the Validator Framework, not a base Validator bug. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 8787] - Indexed field validation patch
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8787. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8787 Indexed field validation patch --- Additional Comments From [EMAIL PROTECTED] 2002-10-11 00:51 --- At a minimum, this patch would need to be rewritten, as the guts of Validator.java have been refactored. Also, the large number of bogus change lines in the patch make it near-impossible to see what's actually being changed. Finally, as I said before, you can validate indexed properties just fine in Struts, as long as you set things up properly. Can you submit an example form you can't validate. Otherwise, I'm going to close this. James -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 10782] - If two fields are required, and one has a mask, the mask is not checked if the other field is blank
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10782. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10782 If two fields are required, and one has a mask, the mask is not checked if the other field is blank [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2002-10-11 01:03 --- Gee, I get to close my own bug. Fixed in the Great Refactoring of September. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator GenericTypeValidator.java GenericValidator.java
turner 2002/10/10 18:16:37 Modified:validator/src/share/org/apache/commons/validator GenericTypeValidator.java GenericValidator.java Log: Removed unused variables and fixed JavaDoc (Closes bug 13421 ) Revision ChangesPath 1.5 +5 -5 jakarta-commons/validator/src/share/org/apache/commons/validator/GenericTypeValidator.java Index: GenericTypeValidator.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericTypeValidator.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- GenericTypeValidator.java 2 Apr 2002 03:55:02 - 1.4 +++ GenericTypeValidator.java 11 Oct 2002 01:16:36 - 1.5 @@ -183,7 +183,7 @@ * is set to codefalse/code for all./p * * @paramvalue The value validation is being performed on. - * @paramdatePattern The pattern passed to codeSimpleDateFormat/code. + * @paramLocale The Locale to use to parse the date (system default if null) */ public static Date formatDate(String value, Locale locale) { Date date = null; 1.7 +7 -7 jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java Index: GenericValidator.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/GenericValidator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- GenericValidator.java 19 Sep 2002 17:25:27 - 1.6 +++ GenericValidator.java 11 Oct 2002 01:16:37 - 1.7 @@ -174,7 +174,7 @@ * is set to codefalse/code for all./p * * @paramvalue The value validation is being performed on. - * @paramdatePattern The pattern passed to codeSimpleDateFormat/code. + * @paramLocale The locale to use for the date format, defaults to the default system default if null. */ public static boolean isDate(String value, Locale locale) { boolean bValid = true; @@ -190,7 +190,7 @@ formatter.setLenient(false); - Date date = formatter.parse(value); + formatter.parse(value); } catch (ParseException e) { bValid = false; } @@ -221,7 +221,7 @@ SimpleDateFormat formatter = new SimpleDateFormat(datePattern); formatter.setLenient(false); - Date date = formatter.parse(value); + formatter.parse(value); if (strict) { if (datePattern.length() != value.length()) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 13421] - GenericValidator GenericTypeValidator unused variables JavaDoc
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13421. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13421 GenericValidator GenericTypeValidator unused variables JavaDoc [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2002-10-11 01:17 --- Thanks for the catch! James -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator Field.java
turner 2002/10/10 18:49:33 Modified:validator/src/share/org/apache/commons/validator Field.java Log: Can't modify a fast hash map while inside an iterate on it. (Closes bug 13472 ) Revision ChangesPath 1.6 +5 -5 jakarta-commons/validator/src/share/org/apache/commons/validator/Field.java Index: Field.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/Field.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Field.java30 Mar 2002 04:33:17 - 1.5 +++ Field.java11 Oct 2002 01:49:33 - 1.6 @@ -439,7 +439,7 @@ * to create the dependency codeMap/code. */ public void process(Map globalConstants, Map constants) { - hMsgs.setFast(true); + hMsgs.setFast(false); hArg0.setFast(true); hArg1.setFast(true); hArg2.setFast(true); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [clazz] New project? [was Re: [lang] Proposal for *NEXT* version]
Stephen Colebourne wrote: There seems to be some consensus that a new project is possible here. I have already been working locally on classes in this area. Below is the proposal.html file that I was using to control my scope:? h3(0) Rationale/h3 p The Java Reflection Framework provides a set of classes for accessing and calling classes, methods and fields dynamically at runtime. In addition, the beans Introspector class provides for examination of java beans. Together these offer very useful functionality that is widely used by todays applications. /p p There is a need for reflection and introspection code in a great many of the Commons, Jakarta and Apache projects. However, the standard Java classes have proved inadequate, causing each project to write their own reflection helper classes. In addition, many projects also require metadata to be stored against classes and properties. This is not supported by the current Java APIs. /p p The emClazz/em package will focus on introspection and class manipulation. Reflection helper code is located in the [lang] package. /p h3(1) Scope of the Package/h3 p The emClazz/em package shall create and maintain a package that provides introspection and class manipulation handling built upon the Java Reflection Framework and other providers, such as byte and source code readers/generators. /p p The package should: /p ul lihandle all classes, not just beans/li lisupport extensible metadata (not just for GUI builders)/li lihandle normal (today) bean conventions (get/set/add/put methods)/li lihandle future conventions that are not yet standard/li lisupport method overloading/li liprovide a complete alternative to using java.beans.Introspector/li libe simple to learn/li /ul /p In terms of code, [clazz] would begin by having classes/interfaces that represent a class, method and field like reflection. It would then provide mechanisms to build the structure via reflection and BCEL, and ideally to generate classes from the structure using BCEL. Note: One possibility would be to say that the BCEL dependency belongs in BCEL, and the commons version just uses reflection. [clazz] would also provide mechanisms for identifying methods as being property methods, coping with modern conventions such as addXxx(), lists and maps that the beans introspector doesn't. This would allow [clazz] to be used by betwixt and digester to add flexibility. (I remember reading a case where some swedish company had insisted on localising the words get and set in bean methods - [clazz] could cope with that) Thoughts? Stephen Not sure about the name, but I like the concept. Maybe we can call it Klass (sounds the same)? -- They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. - Benjamin Franklin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [collections] When is the next release?
Stephen Colebourne wrote: AFAIK, collections was prepared fully for a release, but the release never ocurred. There was a delay in the primitive subpackage, but I believe Rodney Waldorf completed his work there. I don't know who the release manager was, but they either need a little reminder, or a new one electing. This note affects other ideas/suggestions to collections which have been suggested recently, as the aim would be to get a release out before adding new code. Stephen Kool. So when can we get this done? -- They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. - Benjamin Franklin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DO NOT REPLY [Bug 13472] - Attempt to modify FastHashMap while in fast mode through iterator.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13472. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13472 Attempt to modify FastHashMap while in fast mode through iterator. [EMAIL PROTECTED] changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Additional Comments From [EMAIL PROTECTED] 2002-10-11 03:25 --- You need to set fast hash back to true at end of the method call. See patch I had enclosed. -Rob -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/periodicity/src/plugins-build/database install.user.properties maven.xml plugin.jelly
prickett2002/10/10 20:31:35 Modified:periodicity project.xml periodicity/src/plugins-build/database maven.xml plugin.jelly Added: periodicity/src/plugins-build/database install.user.properties Log: Added jelly to database maven file Added install.user.properties file Added a sourcesPresent jelly variable to the database maven file Added code to process and compile java code to the database maven file Added jelly to database plugin.jelly file Added a dbType jelly variable to the plugin.jelly file Added processing to create a mysql db url to the plugin.jelly file Added a database:url goal to the database plugin.jelly file Added a database:connection goal to the database plugin.jelly file Added a database:driver goal to the database plugin.jelly file Revision ChangesPath 1.11 +0 -1 jakarta-commons-sandbox/periodicity/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/project.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- project.xml 9 Oct 2002 18:18:50 - 1.10 +++ project.xml 11 Oct 2002 03:31:35 - 1.11 @@ -1,6 +1,5 @@ ?xml version=1.0 encoding=UTF-8? project - property file=conf/build/build.db.users.proeprties/ pomVersion3/pomVersion namePeriodicity/name idperiodicity/id 1.4 +27 -1 jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml Index: maven.xml === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/maven.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- maven.xml 10 Oct 2002 22:43:08 - 1.3 +++ maven.xml 11 Oct 2002 03:31:35 - 1.4 @@ -1,8 +1,16 @@ -project default=plugin +project default=plugin xmlns:j=jelly:core + property file=install.user.properties/ property file=install.developer.properties/ + j:set var=sourcesPresent value=${periodicity.database.sources.present}/ + + goal name=plugin +j:if test=${sourcesPresent == 'true'} + attainGoal name=java:compile/ + attainGoal name=test:test/ +/j:if mkdir dir=${periodicity.install.assembly.dir}/ copy todir=${periodicity.install.assembly.dir} fileset dir=. @@ -13,6 +21,11 @@ exclude name=install*/ /fileset /copy +j:if test=${sourcesPresent == 'true'} + copy todir=${assemblyDir} +fileset dir=target/classes/ + /copy +/j:if jar jarfile=${maven.build.dir}/${maven.final.name}.jar fileset dir=${periodicity.install.assembly.dir}/ /jar @@ -34,6 +47,19 @@ unzip src=${maven.build.dir}/${maven.final.name}.jar dest=${maven.home}/plugins/${maven.final.name}/ /goal + + goal name=plugin:uninstall +delete + fileset dir=${maven.home}/plugins +include name=periodicity-database*/ +include name=periodicity-database**/**/*/ +include name=periodicity-database-plugin-0.0.1-dev/ + /fileset +/delete +delete + fileset dir=${maven.home}/plugins/periodicity-database-plugin-0.0.1-dev/ +/delete + /goal /project 1.2 +31 -1 jakarta-commons-sandbox/periodicity/src/plugins-build/database/plugin.jelly Index: plugin.jelly === RCS file: /home/cvs/jakarta-commons-sandbox/periodicity/src/plugins-build/database/plugin.jelly,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- plugin.jelly 10 Oct 2002 22:43:08 - 1.1 +++ plugin.jelly 11 Oct 2002 03:31:35 - 1.2 @@ -1,8 +1,38 @@ ?xml version=1.0? -project +project xmlns:j=jelly:core goal name=database echoYou made it to the database plugin!!!/echo + /goal + + set var=dbType value=${periodicity.database.type}/ + + j:choose +j:when test=${dbType == '${periodicity.mysql.db.name}' + j:choose +j:otherwise + echoSetting db url for ${periodicity.database.type}/echo + property name=derived.db.url value=${periodicity.mysql.default.driver.scheme}://${periodicity.database.host}:${periodicity.database.port}/${periodicity.database.name}/ +/j:otherwise + /j:choose + j:otherwise +echoDatabase Type ${periodicity.database.type} is not yet supported/echo + /j:otherwise +/j:when + /j:choose + + + goal name=database:url + /goal + + goal name=database:connection + /goal + + goal
DBMessageResources - It's finally finished.
What is it? --- If you've followed recent discussions on the struts-user list. There has been a flurry of discussion over getting ApplicationResources messages from a database. I have finally finished a release of an implementation of MessageResources that grabs the key-value pairs from a database. It uses the popular (and FREE) O/R Mapping Tool OJB for the persistence layer, so if you are already using it, or considering it in the future, it will fit seemlessly into your project. Setup is easy and converting your current application should take no more than an hour. Most of the work is getting your .properties file into the database. Databases supported are only limited by what OJB supports. It currently supports every major vendor. What can it do? --- - As mentioned above, storing and retrieving your application resources from a RDBMS - Full support for Locale and Sub Application Modules - Configurable database mapping (OJB style) - Changes are immediately available to your application, when using OJB's persistence broker to modify them. (I will have samples of doing this soon.) Where can I get it? --- I've posted a zip file on my server which will extract into a buildable project that I've setup which is the struts-example (1.1b) modified to use this extension. For detailed setup, please read the readme.txt in the project-files folder. I have tested this on Tomcat 4.0.4, JBoss3.0.3 w/embedded Tomcat 4.1.12, and Tomcat 4.1.12 using MySql database. Full database scripts are provided. To download, go to: http://www.open-tools.org/struts-atlanta/downloads *If my DSL craps out on me, just shoot me an email, and I'll send it to you via e-mail. ToDo Items: --- - Convert the code to load as a struts plugin for better management and lifecycle support. - Administrative actions/jsp (possibly a subapp) for managing the data. - Conversion utility to parse a .properties file and create a .sql file. - Support for GlobalDebugMode, when this is enabled, all messages are returned as ### or some configurable value. This helps on large projects when, under pressure of time contraints, developers quickly (and without meaning to - Honest;) hard code values while cranking out code, and can assist in quickly determining if all messages are actually coming from the bundle. James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/httpclient/lib commons-logging.jar
sullis 2002/10/10 21:22:10 Modified:httpclient/lib commons-logging.jar Log: JAR file from Jakarta Commons Logging 1.0.2 Revision ChangesPath 1.3 +77 -73jakarta-commons/httpclient/lib/commons-logging.jar Binary file -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/logging/src/test/org/apache/commons/logging AbstractLogTest.java SimpleLogTest.java NoOpLogTest.java
sullis 2002/10/10 21:53:00 Added: logging/src/test/org/apache/commons/logging AbstractLogTest.java SimpleLogTest.java NoOpLogTest.java Log: unit test code Revision ChangesPath 1.1 jakarta-commons/logging/src/test/org/apache/commons/logging/AbstractLogTest.java Index: AbstractLogTest.java === /* * $Header: $ * $Revision: $ * $Date: $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. The end-user documentation included with the redistribution, if *any, must include the following acknowlegement: * This product includes software developed by the *Apache Software Foundation (http://www.apache.org/). *Alternately, this acknowlegement may appear in the software itself, *if and wherever such third-party acknowlegements normally appear. * * 4. The names The Jakarta Project, Commons, and Apache Software *Foundation must not be used to endorse or promote products derived *from this software without prior written permission. For written *permission, please contact [EMAIL PROTECTED] * * 5. Products derived from this software may not be called Apache *nor may Apache appear in their names without prior written *permission of the Apache Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * http://www.apache.org/. * */ package org.apache.commons.logging; import junit.framework.*; /** * * @author Sean C. Sullivan * @version $Revision: $ * */ public abstract class AbstractLogTest extends TestCase { public AbstractLogTest(String testName) { super(testName); } public static Test suite() { TestSuite suite = new TestSuite(); // todo suite.addTest(TestLogLevels.suite()); return suite; } /** * */ public static void main(String args[]) { String[] testCaseName = { AbstractLogTest.class.getName() }; junit.textui.TestRunner.main(testCaseName); } public abstract Log getLogObject(); public void testLoggingWithNullParameters() { Log log = this.getLogObject(); assertNotNull(log); log.debug(null); log.debug(null, null); log.error(null); log.error(null, null); log.fatal(null); log.fatal(null, null); log.info(null); log.info(null, null); log.trace(null); log.trace(null, null); log.warn(null); log.warn(null, null); } } 1.1 jakarta-commons/logging/src/test/org/apache/commons/logging/SimpleLogTest.java
cvs commit: jakarta-commons/logging/src/test/org/apache/commons/logging TestAll.java
sullis 2002/10/10 21:53:21 Modified:logging/src/test/org/apache/commons/logging TestAll.java Log: added test code Revision ChangesPath 1.3 +6 -6 jakarta-commons/logging/src/test/org/apache/commons/logging/TestAll.java Index: TestAll.java === RCS file: /home/cvs/jakarta-commons/logging/src/test/org/apache/commons/logging/TestAll.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestAll.java 17 Jan 2002 22:55:43 - 1.2 +++ TestAll.java 11 Oct 2002 04:53:21 - 1.3 @@ -86,8 +86,8 @@ public static Test suite() { TestSuite suite = new TestSuite(); -// don't have any tests anymore -//suite.addTest(TestLogLevels.suite()); +suite.addTest(SimpleLogTest.suite()); +suite.addTest(NoOpLogTest.suite()); return suite; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/logging/src/test/org/apache/commons/logging AbstractLogTest.java
sullis 2002/10/10 22:02:59 Modified:logging/src/test/org/apache/commons/logging AbstractLogTest.java Log: removed junk methods Revision ChangesPath 1.2 +0 -16 jakarta-commons/logging/src/test/org/apache/commons/logging/AbstractLogTest.java Index: AbstractLogTest.java === RCS file: /home/cvs/jakarta-commons/logging/src/test/org/apache/commons/logging/AbstractLogTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AbstractLogTest.java 11 Oct 2002 04:52:59 - 1.1 +++ AbstractLogTest.java 11 Oct 2002 05:02:59 - 1.2 @@ -78,22 +78,6 @@ } -public static Test suite() { -TestSuite suite = new TestSuite(); - -// todo suite.addTest(TestLogLevels.suite()); - -return suite; -} - -/** - * - */ -public static void main(String args[]) { -String[] testCaseName = { AbstractLogTest.class.getName() }; -junit.textui.TestRunner.main(testCaseName); -} - public abstract Log getLogObject(); public void testLoggingWithNullParameters() -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart FilePart.java
sullis 2002/10/10 22:16:32 Modified:httpclient/src/java/org/apache/commons/httpclient/methods MultipartPostMethod.java httpclient/src/java/org/apache/commons/httpclient/methods/multipart FilePart.java Log: applied patch from Mike (becke -at- u.washington.edu) Revision ChangesPath 1.2 +9 -3 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java Index: MultipartPostMethod.java === RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/MultipartPostMethod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultipartPostMethod.java 1 Oct 2002 19:13:41 - 1.1 +++ MultipartPostMethod.java 11 Oct 2002 05:16:32 - 1.2 @@ -148,6 +148,12 @@ parameters.add(param); } +/** + * Adds another part to this post. + */ +public void addPart( Part part ) { +parameters.add(part); +} protected void addRequestHeaders(HttpState state, HttpConnection conn) throws IOException, HttpException { 1.2 +55 -24 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java Index: FilePart.java === RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/methods/multipart/FilePart.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FilePart.java 1 Oct 2002 19:13:41 - 1.1 +++ FilePart.java 11 Oct 2002 05:16:32 - 1.2 @@ -68,6 +68,7 @@ import java.io.OutputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.security.InvalidParameterException; /** @@ -90,11 +91,13 @@ //TODO: make this configurable static int MAX_BUFF_SIZE = 1 * 1024 * 1024; // 1 MiBs +private InputStream fileStream; +private String fileName; +private long fileLength; + private String name; -private File file; private int buff_size; - - + /** * Constructor. * @@ -106,6 +109,9 @@ */ public FilePart(String name, File file) throws FileNotFoundException { + +this( name, new FileInputStream(file), file.getName(), file.length() ); + if (! file.isFile()) { throw new FileNotFoundException(File is not a normal file.); } @@ -113,11 +119,35 @@ if (! file.canRead()) { throw new FileNotFoundException(File is not readable.); } + +} +/** + * FilePart Constructor. + * + * @param name the name for this part + * @param fileInputStream an input stream for reading the file content + * @param fileName the name of the file + * @param fileLength the number of bytes contained in the file + */ +public FilePart( +String name, +InputStream fileInputStream, +String fileName, +long fileLength +) { + +if ( fileLength 0 ) { +throw new InvalidParameterException( fileLength must be = 0. ); +} + this.name = name; -this.file = file; +this.fileStream = fileInputStream; +this.fileName = fileName; +this.fileLength = fileLength; + } - + protected void sendHeader(OutputStream out) throws IOException { super.sendHeader(out); @@ -127,7 +157,7 @@ protected void sendFilename(OutputStream out) throws IOException { -String filename = ; filename=\ + file.getName() + \; +String filename = ; filename=\ + fileName + \; out.write(filename.getBytes()); } @@ -144,33 +174,34 @@ protected void sendData(OutputStream out) throws IOException { + byte[] buff; -if (lengthOfData() MAX_BUFF_SIZE) { +if ( lengthOfData() == 0 ) { + +// this file contains no data, so there is nothing to send. +// we don't want to create a zero length buffer as this will +// cause an infinite loop when reading. +return; + +} else if (lengthOfData() MAX_BUFF_SIZE) { buff = new byte[MAX_BUFF_SIZE]; } else { buff = new byte[(new Long(lengthOfData())).intValue()]; } -InputStream in; - -try { -in = new FileInputStream(file); -