DO NOT REPLY [Bug 20571] - Validator doesn't pick up message replacement args
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=20571. 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=20571 Validator doesn't pick up message replacement args [EMAIL PROTECTED] changed: What|Removed |Added AssignedTo|struts- |commons- |[EMAIL PROTECTED] |[EMAIL PROTECTED] Component|Validator Framework |Validator Product|Struts |Commons Summary|Validation Error|Validator doesn't pick up ||message replacement args Version|Nightly Build |1.0 Alpha --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 06:04 --- This is actually a subtle commons-validator bug introduced during the refactoring. Moving to commons... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator Field.java
dgraham 2003/06/07 23:03:16 Modified:validator/src/share/org/apache/commons/validator Field.java Log: The new getArg(String, int) method did not meet the contract of the older getArg0(String) method. When the Arg for the given key is not found, it should try to return the default Arg at that position. PR# 20571 Revision ChangesPath 1.18 +22 -9 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.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Field.java8 Jun 2003 05:29:27 - 1.17 +++ Field.java8 Jun 2003 06:03:16 - 1.18 @@ -331,20 +331,33 @@ /** * Gets the default codeArg/code object at the given position. + * @return The default Arg or null if not found. */ public Arg getArg(int position) { return this.getArg(DEFAULT_ARG, position); } /** - * Gets the default codeArg/code object at the given position. + * Gets the default codeArg/code object at the given position. If the key + * finds a codenull/code value then the default value will try to be retrieved. + * @param key The name the Arg is stored under. If not found, the default Arg for + * the given position (if any) will be retrieved. + * @param position The Arg number to find. + * @return The Arg with the given name and position or null if not found. */ public Arg getArg(String key, int position) { -if (position = this.args.length) { -return null; -} + if ((position = this.args.length) || (this.args[position] == null)) { + return null; + } -return (args[position] == null) ? null : (Arg) args[position].get(key); + Arg arg = (Arg) args[position].get(key); + +// Didn't find default arg so exit, otherwise we would get into infinite recursion + if ((arg == null) key.equals(DEFAULT_ARG)) { + return null; + } + + return (arg == null) ? this.getArg(position) : arg; } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 20571] - Validator doesn't pick up message replacement args
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=20571. 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=20571 Validator doesn't pick up message replacement args [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 06:07 --- The newer getArg(String, int) method now meets the contract for the deprecated getArg0(String) method. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [math] proposed ordering for task list, scope of initial release
--- Phil Steitz [EMAIL PROTECTED] wrote: * Improve numerical accuracy of Univariate and BivariateRegression statistical computations. Encapsulate basic double[] |- double mean, variance, min, max computations using improved formulas and add these to MathUtils. (probably should add float[], int[], long[] versions as well.) Then refactor all univariate implementations that use stored values (including UnivariateImpl with finite window) to use the improved versions. -- Mark? I am chasing down the TAS reference to document the source of the _NR_ formula, which I will add to the docs if someone else does the implementation. I was starting to code the updating (storage-less) variance formula, based on the Stanford article you cited, as a patch. I believe the storage-using corrected two-pass algorithm is pretty trivial to code once we feel we're on solid ground with the reference to cite. OK. I finally got hold of the American Statistician article (had to resort to the old trundle down to local university library method) and Great! Thanks. found lots of good stuff in it -- including a reference to Hanson's recursive formula (from Stanford paper) and some empirical and theoretical results confirming that NR 14.1.8 is about the best that you can do for the stored case. There is a refinement mentioned in which pairwise summation is used (essentially splitting the sample in two and computing the recursive sums in parallel); but the value of this I was wondering what the pairwise method was, and whether it was another name for a technique we'd already discussed. Sounds sort of like Shell's sort or other recursive divide-and-occur algorithms. only kicks in for large n. I propose that we use NR 14.1.8 as is for all stored computations. Here is good text for the reference: Based on the icorrected two-pass algorithm/i for computing the sample variance, as described in Algorithms for Computing the Sample Variance: Analysis and Recommendations,Tony F Chan, Gene H. Golub and Randall J. LeVeque, iThe American Statitistician/i, 1983, Vol 37, No. 3. (Eq. (1.7) on page 243.) The empirical investigation that the authors do uses the following trick that I have thought about using to investigate the precision in our stuff: implement an algorithm using both floats and doubles and use the double computations to assess stability of the algorithm implemented using floats. Might want to play with this a little. Yes, I skimmed part of the Stanford article and noticed that test technique. It's interesting, and as you say, we may want to experiment with it to see what it can tell us. Al = Albert Davidson Chou Get answers to Mac questions at http://www.Mac-Mgrs.org/ . __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator Validator.java
dgraham 2003/06/08 00:11:25 Modified:validator/src/test/org/apache/commons/validator ValidatorTest.java validator/src/example/org/apache/commons/validator/example ValidateExample.java validator/src/share/org/apache/commons/validator Validator.java Log: Added Validator ability to only include failed fields in the ValidatorResults instead of all fields. ValidateExample demonstrates how to configure this setting and a test was added to ValidatorTest to prove it works. PR# 20267 Revision ChangesPath 1.14 +61 -30 jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTest.java Index: ValidatorTest.java === RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTest.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- ValidatorTest.java28 May 2003 04:28:00 - 1.13 +++ ValidatorTest.java8 Jun 2003 07:11:24 - 1.14 @@ -117,31 +117,11 @@ * method being tested returns an object (codenull/code will be considered an error). */ public void testManualObject() { - // property name of the method we are validating - String property = date; - // name of ValidatorAction - String action = date; - - ValidatorResources resources = new ValidatorResources(); - - ValidatorAction va = new ValidatorAction(); - va.setName(action); - va.setClassname(org.apache.commons.validator.ValidatorTest); - va.setMethod(formatDate); - va.setMethodParams(java.lang.Object,org.apache.commons.validator.Field); - - FormSet fs = new FormSet(); - Form form = new Form(); - form.setName(testForm); - Field field = new Field(); - field.setProperty(property); - field.setDepends(action); - form.addField(field); - fs.addForm(form); - - resources.addValidatorAction(va); - resources.addFormSet(fs); - resources.process(); + // property name of the method we are validating + String property = date; + // name of ValidatorAction + String action = date; +ValidatorResources resources = setupDateResources(property, action); TestBean bean = new TestBean(); bean.setDate(2/3/1999); @@ -183,8 +163,59 @@ fail(An exception was thrown while calling Validator.validate()); } - } + + public void testOnlyReturnErrors() throws ValidatorException { + // property name of the method we are validating + String property = date; + // name of ValidatorAction + String action = date; + ValidatorResources resources = setupDateResources(property, action); + + TestBean bean = new TestBean(); + bean.setDate(2/3/1999); + + Validator validator = new Validator(resources, testForm); + validator.setParameter(Validator.BEAN_PARAM, bean); + + ValidatorResults results = validator.validate(); + + assertNotNull(results); + +// Field passed and should be in results + assertTrue(results.getPropertyNames().contains(property)); + +// Field passed but should not be in results +validator.setOnlyReturnErrors(true); +results = validator.validate(); +assertFalse(results.getPropertyNames().contains(property)); + } + +private ValidatorResources setupDateResources(String property, String action) { + + ValidatorResources resources = new ValidatorResources(); + + ValidatorAction va = new ValidatorAction(); + va.setName(action); + va.setClassname(org.apache.commons.validator.ValidatorTest); + va.setMethod(formatDate); + va.setMethodParams(java.lang.Object,org.apache.commons.validator.Field); + + FormSet fs = new FormSet(); + Form form = new Form(); + form.setName(testForm); + Field field = new Field(); + field.setProperty(property); + field.setDepends(action); + form.addField(field); + fs.addForm(form); + + resources.addValidatorAction(va); + resources.addFormSet(fs); + resources.process(); + + return resources; +} /** * Verify that one value generates an error and the other passes. The validation 1.13 +10 -4 jakarta-commons/validator/src/example/org/apache/commons/validator/example/ValidateExample.java Index: ValidateExample.java === RCS file:
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator ValidatorResult.java
dgraham 2003/06/08 00:14:51 Modified:validator/src/share/org/apache/commons/validator ValidatorResult.java Log: Added note about unused field variable as mentioned in PR# 20267. Revision ChangesPath 1.6 +5 -4 jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResult.java Index: ValidatorResult.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/ValidatorResult.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ValidatorResult.java 24 May 2003 18:36:19 - 1.5 +++ ValidatorResult.java 8 Jun 2003 07:14:51 - 1.6 @@ -83,6 +83,7 @@ /** * codeField/code being validated. +* TODO This variable is not used. Need to investigate removing it. */ protected Field field = null; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 20267] - PATCH - add switch to Validator.java to allow filtering out success results
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=20267. 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=20267 PATCH - add switch to Validator.java to allow filtering out success results [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 07:19 --- Validator now has a setOnlyReturnErrors() method to configure the requested behavior. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 18905] - Couldn't get connection (Jdbc2PoolDataSource)
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=18905. 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=18905 Couldn't get connection (Jdbc2PoolDataSource) --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 08:12 --- Implementing getConnection( user, passwd ) is a complicated thing with a pooling DataSource. The difficulty is what to do in the following situation: 1) getConnection( foo, bar ); The database allowes user foo with password bar 2) The connection is returned to pool 3) getConnection( foo, baz ); What to do now? Basically there are three options: I) Use KeyedObjectPool and make the {user,passwd} the key. II) Consider that a user may have only one correct password and refuse the second getConnection() III) Always attempt to create a connection when a new password for a user is supplied. Keep tract of previously successfull passwords. (Last 100 for instance). Clearly I) is not very good. We may have 10 connectons ready for {foo,bar} and we will still create a new one for {foo, baz}. II) is very good, _if_ the assumption is correct III) has its own drawbacks: we will create connections even when we do not need to. - Also III) will require a rewrite to KeyedObjectPool, but this is an implementation issue. - It looks that before fixing JDBC2DataSource we should decide which of I), II), III) we want. - As additional remarks: the current code in JDBC2DataSource has caused some surprise from me: a) why use the master HashMap and an instaceId? Just to implement closeAll()? But that is done easier: have a pool in instance variable, like m_pool and chain all instance together via a LinkedList() or just via m_next pointer. b) why an ordianry, not keyed, ObjectPool is sometimes created? If we're enforcing (username, password) check, it is impossible to implement also getConnection() in the same DataSource! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[configuration] digester related issues on the todo list
henning recently posted a couple of high priority issues regarding digester in the todo list. (i was looking around after eric posted his request for an update to the website.) if i understood the problem a little better i might be able to point people in the direction of possible solutions. - robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[GUMP] Build Failure - commons-jxpath
This email is autogenerated from the output from: http://cvs.apache.org/builds/gump/2003-06-08/commons-jxpath.html Buildfile: build.xml check_available: init: [echo] jxpath 20030608 [echo] junit.jar = /home/rubys/jakarta/dist/junit/junit.jar [echo] jaxp.jaxp.jar = /home/rubys/jakarta/xml-xerces2/java/build/xmlParserAPIs.jar [echo] jaxp.xslt.jar = /home/rubys/jakarta/xml-xalan/java/build/xalan-unbundled.jar [echo] servlet.jar = ${servlet.jar} [echo] commons-beanutils.jar = ${commons-beanutils.jar} [echo] commons-collections.jar = ${commons-collections.jar} [echo] commons-logging.jar = ${commons-logging.jar} check.junit: check.jaxp.jaxp: check.jaxp.xslt: check.servlet: prepare: [mkdir] Created dir: /home/rubys/jakarta/jakarta-commons/jxpath/target [mkdir] Created dir: /home/rubys/jakarta/jakarta-commons/jxpath/target/classes [mkdir] Created dir: /home/rubys/jakarta/jakarta-commons/jxpath/target/conf [mkdir] Created dir: /home/rubys/jakarta/jakarta-commons/jxpath/target/tests static: [copy] Copying 1 file to /home/rubys/jakarta/jakarta-commons/jxpath/target/conf [copy] Replacing: @name@ - jxpath [copy] Replacing: @version@ - 20030608 compile: [javac] Compiling 153 source files to /home/rubys/jakarta/jakarta-commons/jxpath/target/classes [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespaceIterator.java:110: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] Element parent = element.getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:511: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] return ((Element) node).getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:514: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] return ((Text) node).getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:517: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] return ((CDATA) node).getParent(); [javac]^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:520: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] return ((ProcessingInstruction) node).getParent(); [javac]^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:523: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] return ((Comment) node).getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:667: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] Element parent = ((Element) node).getParent(); [javac]^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:692: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] parent = ((Text) node).getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:695: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] parent = ((CDATA) node).getParent(); [javac] ^ [javac] /home/rubys/jakarta/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNodePointer.java:715: incompatible types [javac] found : org.jdom.Parent [javac] required: org.jdom.Element [javac] Element parent = ((ProcessingInstruction) node).getParent(); [javac
Commons-Attributes (sandbox) and Jon Tirsén.
Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Commons-Attributes (sandbox) and Jon Tirsén.
i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re:_Commons-Attributes_(sandbox)_and_Jon_Tirsén.
Well I volunteer to help this get promoted out of sandbox. I've done work on it before (pairing with James Strachan - which he never committed - grumble grumble ;) Jon, that sound good to you ? - Paul --- robert burrell donkin [EMAIL PROTECTED] wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang NumberUtils.java
scolebourne2003/06/08 07:09:36 Modified:lang/src/java/org/apache/commons/lang NumberUtils.java Log: Tidy comments Revision ChangesPath 1.9 +16 -16 jakarta-commons/lang/src/java/org/apache/commons/lang/NumberUtils.java Index: NumberUtils.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/NumberUtils.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- NumberUtils.java 9 Apr 2003 01:04:47 - 1.8 +++ NumberUtils.java 8 Jun 2003 14:09:36 - 1.9 @@ -685,7 +685,7 @@ boolean hasDecPoint = false; boolean allowSigns = false; boolean foundDigit = false; -//Deal with any possible sign up front +// deal with any possible sign up front int start = (chars[0] == '-') ? 1 : 0; if (sz start + 1) { if (chars[start] == '0' chars[start + 1] == 'x') { @@ -693,7 +693,7 @@ if (i == sz) { return false; // str == 0x } -//Checking hex (it can't be anything else) +// checking hex (it can't be anything else) for (; i chars.length; i++) { if ((chars[i] '0' || chars[i] '9') (chars[i] 'a' || chars[i] 'f') @@ -704,11 +704,11 @@ return true; } } -sz--; //Don't want to loop to the last char, check it afterwords - //for type qualifiers +sz--; // don't want to loop to the last char, check it afterwords + // for type qualifiers int i = start; -//Loop to the next to last char or to the last char if we need another digit to -//make a valid number (e.g. chars[0..5] = 1234E) +// loop to the next to last char or to the last char if we need another digit to +// make a valid number (e.g. chars[0..5] = 1234E) while (i sz || (i sz + 1 allowSigns !foundDigit)) { if (chars[i] = '0' chars[i] = '9') { foundDigit = true; @@ -716,14 +716,14 @@ } else if (chars[i] == '.') { if (hasDecPoint || hasExp) { -//Two decimal points or dec in exponent +// two decimal points or dec in exponent return false; } hasDecPoint = true; } else if (chars[i] == 'e' || chars[i] == 'E') { -//We've already taken care of hex. +// we've already taken care of hex. if (hasExp) { -//Two E's +// two E's return false; } if (!foundDigit) { @@ -736,7 +736,7 @@ return false; } allowSigns = false; -foundDigit = false; //We need a digit after the E +foundDigit = false; // we need a digit after the E } else { return false; } @@ -744,11 +744,11 @@ } if (i chars.length) { if (chars[i] = '0' chars[i] = '9') { -//No type qualifier, OK +// no type qualifier, OK return true; } if (chars[i] == 'e' || chars[i] == 'E') { -//Can't have an E at the last byte +// can't have an E at the last byte return false; } if (!allowSigns @@ -760,12 +760,12 @@ } if (chars[i] == 'l' || chars[i] == 'L') { -//Not allowing L with an exponoent +// not allowing L with an exponoent return foundDigit !hasExp; } } -//allowSigns is true iff the val ends in 'E' -//Found digit it to make sure weird stuff like '.' and '1E-' doesn't pass +// allowSigns is true iff the val ends in 'E' +// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass return !allowSigns foundDigit; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang SystemUtils.java NumberRange.java StringUtils.java
scolebourne2003/06/08 07:10:55 Modified:lang/src/java/org/apache/commons/lang SystemUtils.java NumberRange.java StringUtils.java Log: Ensure javadoc is clear about when deprecated methods will be removed. Revision ChangesPath 1.16 +2 -2 jakarta-commons/lang/src/java/org/apache/commons/lang/SystemUtils.java Index: SystemUtils.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/SystemUtils.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- SystemUtils.java 31 May 2003 01:02:33 - 1.15 +++ SystemUtils.java 8 Jun 2003 14:10:54 - 1.16 @@ -645,7 +645,7 @@ * /ul * * @deprecated Use [EMAIL PROTECTED] #JAVA_VERSION_FLOAT} instead. - * Will be removed in Commons Lang 3.0. + * Method will be removed in Commons Lang 3.0. * @return the version, for example 1.31f for JDK 1.3.1 */ public static float getJavaVersion() { 1.8 +4 -2 jakarta-commons/lang/src/java/org/apache/commons/lang/NumberRange.java Index: NumberRange.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/NumberRange.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- NumberRange.java 9 Apr 2003 00:07:50 - 1.7 +++ NumberRange.java 8 Jun 2003 14:10:54 - 1.8 @@ -65,7 +65,9 @@ * @since 1.0 * @version $Revision$ $Date$ * - * @deprecated Use one of the Range classes in org.apache.commons.lang.math + * @deprecated Use one of the Range classes in org.apache.commons.lang.math. + * Class will be removed in Commons Lang 3.0. + * */ public final class NumberRange { 1.46 +8 -1 jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java Index: StringUtils.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringUtils.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -r1.45 -r1.46 --- StringUtils.java 30 May 2003 01:00:24 - 1.45 +++ StringUtils.java 8 Jun 2003 14:10:54 - 1.46 @@ -132,6 +132,7 @@ * @param str the String to check * @return the trimmed text (never codenull/code) * @deprecated Use the clearer named [EMAIL PROTECTED] #trimToEmpty(String)}. + * Method will be removed in Commons Lang 3.0. */ public static String clean(String str) { return (str == null ? : str.trim()); @@ -913,6 +914,7 @@ * @return String without chomped ending * @throws NullPointerException if str is codenull/code * @deprecated Use [EMAIL PROTECTED] #chomp(String)} instead. + * Method will be removed in Commons Lang 3.0. */ public static String chompLast(String str) { return chompLast(str, \n); @@ -926,6 +928,7 @@ * @return String without chomped ending * @throws NullPointerException if str or sep is codenull/code * @deprecated Use [EMAIL PROTECTED] #chomp(String,String)} instead. + * Method will be removed in Commons Lang 3.0. */ public static String chompLast(String str, String sep) { if (str.length() == 0) { @@ -949,6 +952,7 @@ * @return String chomped * @throws NullPointerException if str or sep is codenull/code * @deprecated Use [EMAIL PROTECTED] #sliceRemainder(String,String)} instead. + * Method will be removed in Commons Lang 3.0. */ public static String getChomp(String str, String sep) { int idx = str.lastIndexOf(sep); @@ -970,6 +974,7 @@ * @return String without chomped beginning * @throws NullPointerException if str or sep is codenull/code * @deprecated Use [EMAIL PROTECTED] #sliceFirstRemainder(String,String)} instead. + * Method will be removed in Commons Lang 3.0. */ public static String prechomp(String str, String sep) { int idx = str.indexOf(sep); @@ -989,6 +994,7 @@ * @return String prechomped * @throws NullPointerException if str or sep is codenull/code * @deprecated Use [EMAIL PROTECTED] #sliceFirst(String,String)} instead. + * Method will be removed in Commons Lang 3.0. */ public static String getPrechomp(String str, String sep) { int idx = str.indexOf(sep); @@ -1038,6 +1044,7 @@ * @return String without newline * @throws NullPointerException if str is codenull/code * @deprecated Use [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang NumberUtilsTest.java
scolebourne2003/06/08 07:14:01 Modified:lang/src/java/org/apache/commons/lang NumberUtils.java lang/src/test/org/apache/commons/lang NumberUtilsTest.java Log: Fix bug in NumberUtils where '12a' was treated as a number. bug 20538, reported/fix by Eric Pugh/Phil Steitz Revision ChangesPath 1.10 +5 -1 jakarta-commons/lang/src/java/org/apache/commons/lang/NumberUtils.java Index: NumberUtils.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/NumberUtils.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- NumberUtils.java 8 Jun 2003 14:09:36 - 1.9 +++ NumberUtils.java 8 Jun 2003 14:14:01 - 1.10 @@ -62,6 +62,8 @@ * @author a href=mailto:[EMAIL PROTECTED]Rand McNeely/a * @author Stephen Colebourne * @author a href=mailto:[EMAIL PROTECTED]Steve Downey/a + * @author Eric Pugh + * @author Phil Steitz * @since 1.0 * @version $Id$ */ @@ -763,6 +765,8 @@ // not allowing L with an exponoent return foundDigit !hasExp; } +// last character is illegal +return false; } // allowSigns is true iff the val ends in 'E' // found digit it to make sure weird stuff like '.' and '1E-' doesn't pass 1.7 +26 -2 jakarta-commons/lang/src/test/org/apache/commons/lang/NumberUtilsTest.java Index: NumberUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/NumberUtilsTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- NumberUtilsTest.java 21 May 2003 23:49:15 - 1.6 +++ NumberUtilsTest.java 8 Jun 2003 14:14:01 - 1.7 @@ -65,6 +65,9 @@ * * @author a href=mailto:[EMAIL PROTECTED]Rand McNeely/a * @author a href=mailto:[EMAIL PROTECTED]Ringo De Smet/a + * @author Eric Pugh + * @author Phil Steitz + * @author Stephen Colebourne * @version $Id$ */ public class NumberUtilsTest extends TestCase { @@ -493,13 +496,34 @@ val = 1234E5l; assertTrue(isNumber(String) 14 Neg failed, !NumberUtils.isNumber(val)); assertTrue(isNumber(String)/createNumber(String) 14 Neg failed, !checkCreateNumber(val)); +val = 11a; +assertTrue(isNumber(String) 15 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 15 Neg failed, !checkCreateNumber(val)); +val = 1a; +assertTrue(isNumber(String) 16 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 16 Neg failed, !checkCreateNumber(val)); +val = a; +assertTrue(isNumber(String) 17 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 17 Neg failed, !checkCreateNumber(val)); +val = 11g; +assertTrue(isNumber(String) 18 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 18 Neg failed, !checkCreateNumber(val)); +val = 11z; +assertTrue(isNumber(String) 19 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 19 Neg failed, !checkCreateNumber(val)); +val = 11def; +assertTrue(isNumber(String) 20 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 20 Neg failed, !checkCreateNumber(val)); +val = 11d11; +assertTrue(isNumber(String) 21 Neg failed, !NumberUtils.isNumber(val)); +assertTrue(isNumber(String)/createNumber(String) 21 Neg failed, !checkCreateNumber(val)); } private boolean checkCreateNumber(String val) { try { Object obj = NumberUtils.createNumber(val); -if(obj == null) { +if (obj == null) { return false; } return true; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bug report for Commons [2003/06/08]
+---+ | Bugzilla Bug ID | | +-+ | | Status: UNC=Unconfirmed NEW=New ASS=Assigned| | | OPN=ReopenedVER=Verified(Skipped Closed/Resolved) | | | +-+ | | | Severity: BLK=Blocker CRI=CriticalMAJ=Major | | | | MIN=Minor NOR=Normal ENH=Enhancement | | | | +-+ | | | | Date Posted | | | | | +--+ | | | | | Description | | | | | | | | 3893|Opn|Enh|2001-10-01|Multiple element body parts problem | | 6508|Ass|Enh|2002-02-17|HttpClient now supports proxyHost and proxyPort - | | 6826|Ass|Enh|2002-03-04|Need to have xml files validated against DTDs as p| | 6829|Ass|Enh|2002-03-04|Allow easier way of user specified tests | | 7069|Ass|Enh|2002-03-13|DTD and DOM Validators| | 7135|Opn|Enh|2002-03-14|Misleading error message when beaninfo class confl| | 7226|Opn|Enh|2002-03-19|Nested Bean Collection| | 7367|New|Nor|2002-03-22|ServiceManager not actually serializable | | 7465|New|Nor|2002-03-25|Need better 'dist' build | | 7981|Ver|Nor|2002-04-11|[codec][PATCH] add 2 new methods for encoding stri| | 8140|Ver|Nor|2002-04-16|Incorrect credentials loop infinitely | |10543|Ass|Enh|2002-07-08|generate ant task automatically from CLI | |10790|New|Enh|2002-07-15|Non-standards configuration and tracking | |10791|New|Enh|2002-07-15|HTTP Version configuration and tracking | |10792|New|Enh|2002-07-15|Plug-in authentication modules| |10793|New|Enh|2002-07-15|User definable default headers support| |10794|New|Enh|2002-07-15|User interaction for authentication | |10805|New|Enh|2002-07-15|UnderscoreIsDash http workaround | |10809|Ass|Enh|2002-07-15|Developer documentation | |10810|New|Enh|2002-07-15|Response handlers | |10813|New|Enh|2002-07-15|RFC 2965 Support (Port sensitive cookies) | |10815|New|Enh|2002-07-15|Instrumentation for Timings | |10816|New|Enh|2002-07-15|User/Developer Documentation | |10818|Opn|Enh|2002-07-15|Add method enter() and exit() methods to public Lo| |10930|New|Enh|2002-07-18|J2EE FORM authentication (also affects pluggable a| |10957|New|Nor|2002-07-18|Change Header/HeaderElement to handle a list as th| |11240|New|Min|2002-07-28|Cookies with ',' in the value string is not parsed| |12807|New|Nor|2002-09-19|[PATCH] x 2 Update build.xml to use commons-loggin| |12858|Ass|Nor|2002-09-20|Style variation in CVS $Header$ tag in embedded LI| |12916|New|Nor|2002-09-23|[PATCH] Fix javadoc in RequestImpl.java | |12997|Opn|Nor|2002-09-25|Call the method as soon as the last parameter is e| |13031|New|Enh|2002-09-26|Use regular expression (regex) pattern matching fo| |13098|Opn|Nor|2002-09-27|Digester Performance | |13370|New|Nor|2002-10-07|[sql] DDL for INTEGER data type incorrect | |13381|New|Enh|2002-10-07|[sql] commons-sql database.xml - OJB repository.x| |13390|New|Nor|2002-10-07|ResponseHeaderHandler and ResponseHeaderValidator | |13426|New|Enh|2002-10-08|[PATCH] xml-reference.xml responseHeader addition | |13743|Opn|Enh|2002-10-17|Need getPropertyType(Class theClass, String propNa| |14036|New|Enh|2002-10-29|MultipartPostMethod does not check for error messa| |14262|Opn|Maj|2002-11-05|SAXBeanWriter produces invalid XML| |14278|New|Enh|2002-11-05|add link/info for Struts Console to website | |14394|Ver|Nor|2002-11-08|Excessive exceptions log under security manager | |14409|New|Nor|2002-11-09|Add support for stuff like [target [target2 [targe| |14667|Ver|Maj|2002-11-19|PropertyUtils.copyProperties does not copy to Dyna| |15046|Opn|Nor|2002-12-04|MissingArgumentException: no argument for option| |15082|Ass|Enh|2002-12-04|elapsed time formatting utility method| |15127|New|Enh|2002-12-06|Tests should explicit about checking serialization| |15297|New|Enh|2002-12-12|[HttpClient] Authenticator() - ability to perform | |15435|New|Enh|2002-12-17|New Preferences Architecture | |15451|Opn|Enh|2002-12-17|Multiple mapped properties not possible / Direct m| |15519|Ver|Maj|2002-12-19|PropertyUtils.getPropertyType() for java.util.Coll|
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang/reflect ReflectionUtilsTestCase.java ScopeBean.java MethodUtilsTestCase.java
scolebourne2003/06/08 07:19:44 Modified:lang/src/test/org/apache/commons/lang/time DateUtilsTest.java CalendarUtilsTest.java lang/src/test/org/apache/commons/lang/math IntRangeTest.java RandomUtilsTest.java FloatRangeTest.java LongRangeTest.java DoubleRangeTest.java NumberRangeTest.java AbstractRangeTest.java lang/src/test/org/apache/commons/lang/reflect ReflectionUtilsTestCase.java ScopeBean.java MethodUtilsTestCase.java Log: Organize imports Revision ChangesPath 1.2 +0 -1 jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateUtilsTest.java Index: DateUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/DateUtilsTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DateUtilsTest.java18 Dec 2002 23:30:19 - 1.1 +++ DateUtilsTest.java8 Jun 2003 14:19:43 - 1.2 @@ -53,7 +53,6 @@ */ package org.apache.commons.lang.time; -import java.util.Date; import java.util.Calendar; import java.util.TimeZone; 1.2 +5 -4 jakarta-commons/lang/src/test/org/apache/commons/lang/time/CalendarUtilsTest.java Index: CalendarUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/time/CalendarUtilsTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CalendarUtilsTest.java18 Dec 2002 23:30:19 - 1.1 +++ CalendarUtilsTest.java8 Jun 2003 14:19:43 - 1.2 @@ -1,9 +1,7 @@ -package org.apache.commons.lang.time; - /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,9 +51,12 @@ * information on the Apache Software Foundation, please see * http://www.apache.org/. */ +package org.apache.commons.lang.time; import java.text.DateFormat; -import java.util.*; +import java.util.Calendar; +import java.util.Date; +import java.util.Iterator; import junit.framework.AssertionFailedError; import junit.framework.Test; 1.2 +2 -2 jakarta-commons/lang/src/test/org/apache/commons/lang/math/IntRangeTest.java Index: IntRangeTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/math/IntRangeTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IntRangeTest.java 22 Dec 2002 16:20:29 - 1.1 +++ IntRangeTest.java 8 Jun 2003 14:19:43 - 1.2 @@ -54,8 +54,8 @@ package org.apache.commons.lang.math; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; + /** * Test cases for the [EMAIL PROTECTED] IntRange} class. * 1.2 +3 -2 jakarta-commons/lang/src/test/org/apache/commons/lang/math/RandomUtilsTest.java Index: RandomUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/math/RandomUtilsTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- RandomUtilsTest.java 14 May 2003 02:41:26 - 1.1 +++ RandomUtilsTest.java 8 Jun 2003 14:19:43 - 1.2 @@ -53,10 +53,11 @@ */ package org.apache.commons.lang.math; +import java.util.Random; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import java.util.Random; /** * Test cases for the [EMAIL PROTECTED] RandomUtils} class. 1.2 +2 -2 jakarta-commons/lang/src/test/org/apache/commons/lang/math/FloatRangeTest.java Index: FloatRangeTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/math/FloatRangeTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FloatRangeTest.java 22 Dec 2002 16:20:29 - 1.1 +++ FloatRangeTest.java 8 Jun 2003 14:19:43 - 1.2 @@ -54,8 +54,8 @@ package org.apache.commons.lang.math; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite;
DO NOT REPLY [Bug 20538] - [lang] NumberUtils.isNumber allows illegal trailing characters
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=20538. 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=20538 [lang] NumberUtils.isNumber allows illegal trailing characters [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 14:22 --- Patch applied (minor changes) Thanks for spotting this one! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re:_Commons-Attributes_(sandbox)_and_Jon_Tirsén.
Fine by me. The code is pretty clean by now and I guess people are using it. Maybe remove the dependency on commons-logging and that's it. (I think QDox is the only other dependency...?) The code in Nanning looks quite a bit different but the only major changes I've done are using the lower-level API of QDox, incremental compilation and introducing a ClassAttributes-object (increases performance by a factor of at least 10 by caching the lookups instead of concatenating strings for each lookup). On Sun, 2003-06-08 at 11:11, Paul Hammant wrote: Well I volunteer to help this get promoted out of sandbox. I've done work on it before (pairing with James Strachan - which he never committed - grumble grumble ;) Jon, that sound good to you ? - Paul --- robert burrell donkin [EMAIL PROTECTED] wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [LANG] Possible bug on NumberUtils.isNumber()?
Fixed in CVS, thanks Stephen - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 1:59 PM Subject: RE: [LANG] Possible bug on NumberUtils.isNumber()? Here is a patch for Attached is a patch file for NumberUtilsTest. It just adds val = 1a; assertTrue(isNumber(String) 15 Neg failed, !NumberUtils.isNumber(val)); assertTrue(isNumber(String)/createNumber(String) 15 Neg failed, !checkCreateNumber(val)); to the isNumber testcase. Eric Pugh -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 05, 2003 8:47 AM To: [EMAIL PROTECTED] Subject: [LANG] Possible bug on NumberUtils.isNumber()? Hi all, I am checking whether 1b is a number, and NumberUtils.isNumber() says it is... Is the lowercase b mean binary or something? Here is my testcase: public void testNumberUtilsIsNumber() { String a = 1b; assertTrue(1b is not a number!, !NumberUtils.isNumber(a)); } And here is my error: Testcase: testNumberUtilsIsNumber took 0 sec FAILED 1b is not a number! junit.framework.AssertionFailedError: 1b is not a number! at com.upstate.commons.utils.comparators.NumberComparatorTestCase.testNumberUti lsIsNumber(NumberComparatorTestCase.java:319) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:231) Eric Pugh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Commons-Attributes (sandbox) and JonTirsén.
Oh, and there's no copyright issues on the code. I own the copyright, and will donate it to Apache. (After all, I donated the previous code to Apache too.) On Sun, 2003-06-08 at 11:04, robert burrell donkin wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] NestableDelegate
This one slipped by I think... I can see no reason why we can't make NestableDelegate have public methods and constructor. (Of course supplying a test class would help the process...) Any objections from anyone else? Stephen - Original Message - From: Arun Thomas [EMAIL PROTECTED] Hello I'm wondering if there's a reason that the NestableDelegate class in commons lang has only a package private constructor and delegation methods even though it is a public class. As far as I can see, the only reason for NestableDelegate to be public (rather than package private) is so that other implementations of Nestable could make use of it. However, the package private constructor/methods makes such use impossible. I would like to make use of it for enhancing new exceptions in a pre-existing inheritance heirarchy to implement the Nestable interface. Any chance the constructor and delegation methods could be made public? Cheers, -AMT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: _Commons-Attributes_(sandbox)_and_Jon_Tirsén.
I have e-mailed briefly with Mark Pollack of attrib4j.sourceforge.net. It seems some work needs to be done to support JSR175 for both commons-attributes and attrib4j. The main difference Jon and Mark have so far is the Attribute interface, where Mark would rather not have String properties for Name and Value. One interesting thing about attrib4j is that it stores its attributes in the class file instead of a separate properties file. I think that since the attribute storage mechanism is already abstracted in the current commons-attributes through the DefaultAttributeFinder and DefaultAttributeCompiler, it would make sense to agree on a common interface and create multiple implementations. I am currently a committer on ws.apache.org/xmlrpc. Can I help? -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net Paul Hammant wrote: Well I volunteer to help this get promoted out of sandbox. I've done work on it before (pairing with James Strachan - which he never committed - grumble grumble ;) Jon, that sound good to you ? - Paul --- robert burrell donkin [EMAIL PROTECTED] wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: _Commons-Attributes_(sandbox)_and_Jon_Tirsén.
On Sunday, June 8, 2003, at 03:48 PM, Ryan Hoegg wrote: snip I am currently a committer on ws.apache.org/xmlrpc. Can I help? like anyone else you can help out as a developer ;) i'm not an commons-attributes committer, so others will have to answer whether they'd be happy to have you on-board as a committer but i can probably give you an answer in theory: as a apache committer you can now request jakarta-commons-sandbox karma from the jakarta pmc (pmc at jakarta. apache.org) giving your reasons (maybe something like 'to help out on commons-attributes'). please supply your apache user name with the request (this makes things easier for infrastructure). - robert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: _Commons-Attributes_(sandbox)_and_
robert burrell donkin wrote: On Sunday, June 8, 2003, at 03:48 PM, Ryan Hoegg wrote: I am currently a committer on ws.apache.org/xmlrpc. Can I help? like anyone else you can help out as a developer ;) i'm not an commons-attributes committer, so others will have to answer whether they'd be happy to have you on-board as a committer but i can probably give you an answer in theory: as a apache committer you can now request jakarta-commons-sandbox karma from the jakarta pmc (pmc at jakarta. apache.org) giving your reasons (maybe something like 'to help out on commons-attributes'). please supply your apache user name with the request (this makes things easier for infrastructure). - robert Sounds good, first I suppose I should talk to the attributes committers. Before I jump in and start working on merging the codebases, I should make sure that the commons-attributes committers want that. In an e-mail from Jon to Mark Pollack and me, it seemed that he needed some convincing :) -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [lang] NestableDelegate
It seems quite reasonable to make these methods public. Gary -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Sunday, June 08, 2003 07:39 To: Jakarta Commons Developers List Cc: [EMAIL PROTECTED] Subject: Re: [lang] NestableDelegate This one slipped by I think... I can see no reason why we can't make NestableDelegate have public methods and constructor. (Of course supplying a test class would help the process...) Any objections from anyone else? Stephen - Original Message - From: Arun Thomas [EMAIL PROTECTED] Hello I'm wondering if there's a reason that the NestableDelegate class in commons lang has only a package private constructor and delegation methods even though it is a public class. As far as I can see, the only reason for NestableDelegate to be public (rather than package private) is so that other implementations of Nestable could make use of it. However, the package private constructor/methods makes such use impossible. I would like to make use of it for enhancing new exceptions in a pre-existing inheritance heirarchy to implement the Nestable interface. Any chance the constructor and delegation methods could be made public? Cheers, -AMT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: _Commons-Attributes_(sandbox)_and_Jon_Tirsén.
Why implement something that's JSR175-compliant? That's gonna be part of JDK1.5 anyway. Besides it's probably not doable since it requires a language-change. Attrib4J and JSR175 has tons of extra stuff where I've always seen commons-attributes (and Nanning) as extremely simplistic, ie named attributes whose values are strings. In my experience this has been very useful and for a very small price-tag (both when it comes to learning the API, and of course implementing it). I don't see the point of putting commons-attributes in this direction (but it's not my decision to make). Why not just do it in attrib4j which has that intent? If it necessarily has to be a Jakarta-project why not start another one? On Sun, 2003-06-08 at 14:48, Ryan Hoegg wrote: I have e-mailed briefly with Mark Pollack of attrib4j.sourceforge.net. It seems some work needs to be done to support JSR175 for both commons-attributes and attrib4j. The main difference Jon and Mark have so far is the Attribute interface, where Mark would rather not have String properties for Name and Value. One interesting thing about attrib4j is that it stores its attributes in the class file instead of a separate properties file. I think that since the attribute storage mechanism is already abstracted in the current commons-attributes through the DefaultAttributeFinder and DefaultAttributeCompiler, it would make sense to agree on a common interface and create multiple implementations. I am currently a committer on ws.apache.org/xmlrpc. Can I help? -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net Paul Hammant wrote: Well I volunteer to help this get promoted out of sandbox. I've done work on it before (pairing with James Strachan - which he never committed - grumble grumble ;) Jon, that sound good to you ? - Paul --- robert burrell donkin [EMAIL PROTECTED] wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/cli/src/test/org/apache/commons/cli ChildOptionTest.java AnonymousArgumentTest.java BugzillaTest.java
jkeyes 2003/06/08 11:16:02 Modified:cli/src/java/org/apache/commons/cli Tag: cli_1_x CommandLineParser.java ArgumentBuilder.java Option.java ArgumentImpl.java AnonymousArgumentImpl.java OptionBuilder.java OptionImpl.java cli/src/test/org/apache/commons/cli Tag: cli_1_x ChildOptionTest.java AnonymousArgumentTest.java BugzillaTest.java Log: o modified child Option support, to support Options, not just Option o made some changes to method parameters making them final definitions Revision ChangesPath No revision No revision 1.6.2.8 +40 -42 jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java Index: CommandLineParser.java === RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java,v retrieving revision 1.6.2.7 retrieving revision 1.6.2.8 diff -u -r1.6.2.7 -r1.6.2.8 --- CommandLineParser.java6 Jun 2003 22:25:34 - 1.6.2.7 +++ CommandLineParser.java8 Jun 2003 18:16:01 - 1.6.2.8 @@ -81,11 +81,11 @@ private int style = POSIX; private Properties props = new Properties(); -public void setStyle(int style) { +public void setStyle(final int style) { this.style = style; } -public CommandLine parse(Options options, String[] args) +public CommandLine parse(final Options options, final String[] args) throws UnknownOptionException, MissingValueException, AlreadySelectedException, ParseException { CommandLineCreator creator = new CommandLineImpl(); final List tokens = Arrays.asList(args); @@ -96,7 +96,7 @@ return line; } -private CommandLine parse(Options options, ListIterator iter, CommandLineCreator creator) +private CommandLine parse(final Options options, final ListIterator iter, final CommandLineCreator creator) throws UnknownOptionException, MissingValueException { while (iter.hasNext()) { String arg = iter.next().toString(); @@ -171,7 +171,7 @@ return (CommandLine)creator; } -private void processJavaProperty(String token) { +private void processJavaProperty(final String token) { int sep = token.indexOf('='); String key = null; @@ -188,11 +188,11 @@ } private void processOptionGroup( -Options options, -ListIterator iter, -CommandLineCreator creator, -String arg) -throws MissingValueException, UnknownOptionException { +final Options options, +final ListIterator iter, +final CommandLineCreator creator, +final String arg) +throws MissingValueException, UnknownOptionException { OptionGroup group = options.getOptionGroup(arg); Option option = group.getOption(arg); @@ -207,10 +207,10 @@ } private void processOption( -Options options, -ListIterator iter, -CommandLineCreator creator, -String arg) +final Options options, +final ListIterator iter, +final CommandLineCreator creator, +final String arg) throws UnknownOptionException, MissingValueException { Option option = options.getOption(arg); @@ -219,11 +219,11 @@ } private void processArgument( -Options options, -ListIterator iter, -CommandLineCreator creator, -String arg, -String value) +final Options options, +final ListIterator iter, +final CommandLineCreator creator, +final String arg, +final String value) throws MissingValueException, UnknownOptionException { Argument argument = options.getArgument(arg); @@ -243,10 +243,10 @@ // // private void burst( -Options options, -String token, -CommandLineCreator creator, -ListIterator iter) +final Options options, +final String token, +final CommandLineCreator creator, +final ListIterator iter) throws UnknownOptionException, MissingValueException { int tokenLength = token.length(); @@ -271,24 +271,22 @@ } private void processChildOptions( -Option option, -ListIterator iter, -CommandLineCreator cmdline) +final Option option, +final ListIterator iter, +final CommandLineCreator cmdline) throws UnknownOptionException,
Re: _Commons-Attributes_(sandbox)_and_Jon_Tirsén.
Jon, My aim would be to see a merge of both forks of your work. Granted we have done work here, but then so have you. JSK 1.5 is not somthing I'd stop work here for. Nor would I think it is compelling to merge all OSS attrtibutes efforts. As I think is you opinion, lets just go for a update to c-a with nanning's features. Diversity, and multiple choices are great. QDox and XDoclet both exist for different niches, and high respect for each other. - Paul --- Jon Tirsén [EMAIL PROTECTED] wrote: Why implement something that's JSR175-compliant? That's gonna be part of JDK1.5 anyway. Besides it's probably not doable since it requires a language-change. Attrib4J and JSR175 has tons of extra stuff where I've always seen commons-attributes (and Nanning) as extremely simplistic, ie named attributes whose values are strings. In my experience this has been very useful and for a very small price-tag (both when it comes to learning the API, and of course implementing it). I don't see the point of putting commons-attributes in this direction (but it's not my decision to make). Why not just do it in attrib4j which has that intent? If it necessarily has to be a Jakarta-project why not start another one? On Sun, 2003-06-08 at 14:48, Ryan Hoegg wrote: I have e-mailed briefly with Mark Pollack of attrib4j.sourceforge.net. It seems some work needs to be done to support JSR175 for both commons-attributes and attrib4j. The main difference Jon and Mark have so far is the Attribute interface, where Mark would rather not have String properties for Name and Value. One interesting thing about attrib4j is that it stores its attributes in the class file instead of a separate properties file. I think that since the attribute storage mechanism is already abstracted in the current commons-attributes through the DefaultAttributeFinder and DefaultAttributeCompiler, it would make sense to agree on a common interface and create multiple implementations. I am currently a committer on ws.apache.org/xmlrpc. Can I help? -- Ryan Hoegg ISIS Networks http://www.isisnetworks.net Paul Hammant wrote: Well I volunteer to help this get promoted out of sandbox. I've done work on it before (pairing with James Strachan - which he never committed - grumble grumble ;) Jon, that sound good to you ? - Paul --- robert burrell donkin [EMAIL PROTECTED] wrote: i'm against nominating committers for work on sandbox components. (apache committers should just be able to request karma and then check with the current committers that it's ok to join the fun.) if jon is an existing apache committer then he needs to post a request to the pmc cc'ing commons-dev giving some brief indications of his plans. we should then be able to sort out karma with infrastructure. IMHO if jon is not then the best solution would be for an existing apache committer to volunteer (yourself, maybe) to lead an effort to push attributes forward to a stage where it's ready for promotion to the common proper. BTW are there any copyright issues associated with the Nanning code? - robert On Sunday, June 8, 2003, at 11:33 AM, Paul Hammant wrote: Jon has been working on attributes inside Nanning's CVS. The code we have (which is really) good is an earlier fork of that. Is there any way we can get Jon commit provs here? The version in Nanning is much more advanced than the version he donated to us earlier. If we can get some consensus, I think a vote may be a good idea. Surely he must qualify on the multi-month patch donator principle? - Paul __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Yahoo! Plus - For a better Internet experience http://uk.promotions.yahoo.com/yplus/yoffer.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator CreditCardValidator.java
dgraham 2003/06/08 14:32:29 Modified:validator/src/share/org/apache/commons/validator CreditCardValidator.java Log: Added a null check and max length of 19 check. Updated reference to a better online source. Revision ChangesPath 1.7 +7 -7 jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java Index: CreditCardValidator.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CreditCardValidator.java 7 Jun 2003 19:13:21 - 1.6 +++ CreditCardValidator.java 8 Jun 2003 21:32:29 - 1.7 @@ -72,7 +72,8 @@ * configures the validator to only pass American Express and Visa cards. * /p * Reference Sean M. Burke's - * a href=http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl;script/a. + * a href=http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl;script/a. More information + * also available a href=http://www.merriampark.com/anatomycc.htm;here/a. * * @author David Winterfeldt * @author James Turner @@ -141,7 +142,7 @@ * @param card The card number to validate. */ public boolean isValid(String card) { - if (card.length() 13) { + if ((card == null) || (card.length() 13) || (card.length() 19)) { return false; } @@ -170,7 +171,6 @@ /** * Checks for a valid credit card number. - * * @param cardNumber Credit Card Number. */ protected boolean luhnCheck(String cardNumber) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator CreditCardValidatorTest.java ValidatorTestSuite.java
dgraham 2003/06/08 14:33:22 Modified:validator/src/test/org/apache/commons/validator ValidatorTestSuite.java Added: validator/src/test/org/apache/commons/validator CreditCardValidatorTest.java Log: Added test case for CreditCardValidator. Revision ChangesPath 1.10 +6 -6 jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTestSuite.java Index: ValidatorTestSuite.java === RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/ValidatorTestSuite.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ValidatorTestSuite.java 22 May 2003 02:52:07 - 1.9 +++ ValidatorTestSuite.java 8 Jun 2003 21:33:22 - 1.10 @@ -59,7 +59,6 @@ * */ - package org.apache.commons.validator; import junit.framework.Test; @@ -68,13 +67,13 @@ import org.apache.commons.validator.util.FlagsTest; - /** * Test suite for codeorg.apache.commons.validator/code * package. * * @author David Winterfeldt * @author James Turner + * @author David Graham * @version $Revision$ $Date$ */ public class ValidatorTestSuite extends TestCase { @@ -98,6 +97,7 @@ suite.addTest(DoubleTest.suite()); suite.addTest(TypeTest.suite()); suite.addTest(EmailTest.suite()); + suite.addTestSuite(CreditCardValidatorTest.class); suite.addTest(ValidatorTest.suite()); suite.addTest(LocaleTest.suite()); suite.addTestSuite(FlagsTest.class); 1.1 jakarta-commons/validator/src/test/org/apache/commons/validator/CreditCardValidatorTest.java Index: CreditCardValidatorTest.java === /* * $Header: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/CreditCardValidatorTest.java,v 1.1 2003/06/08 21:33:22 dgraham Exp $ * $Revision: 1.1 $ * $Date: 2003/06/08 21:33:22 $ * * * * The Apache Software License, Version 1.1 * * Copyright (c) 1999-2003 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; import
cvs commit: jakarta-commons/validator/src/share/org/apache/commons/validator CreditCardValidator.java
dgraham 2003/06/08 14:53:38 Modified:validator/src/share/org/apache/commons/validator CreditCardValidator.java Log: Fixed urls and made minor changes to luhnCheck. Revision ChangesPath 1.8 +11 -14 jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java Index: CreditCardValidator.java === RCS file: /home/cvs/jakarta-commons/validator/src/share/org/apache/commons/validator/CreditCardValidator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CreditCardValidator.java 8 Jun 2003 21:32:29 - 1.7 +++ CreditCardValidator.java 8 Jun 2003 21:53:38 - 1.8 @@ -71,9 +71,10 @@ * codeCreditCardValidator ccv = new CreditCardValidator(CreditCardValidator.AMEX + CreditCardValidator.VISA);/code * configures the validator to only pass American Express and Visa cards. * /p - * Reference Sean M. Burke's - * a href=http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl;script/a. More information - * also available a href=http://www.merriampark.com/anatomycc.htm;here/a. + * For a similar implementation in Perl, reference Sean M. Burke's + * a href=http://www.speech.cs.cmu.edu/~sburke/pub/luhn_lib.html;script/a. + * More information is also available + * a href=http://www.merriampark.com/anatomycc.htm;here/a. * * @author David Winterfeldt * @author James Turner @@ -176,7 +177,7 @@ protected boolean luhnCheck(String cardNumber) { // number must be validated as 0..9 numeric first!! int digits = cardNumber.length(); - int oddoeven = digits 1; + int oddOrEven = digits 1; long sum = 0; for (int count = 0; count digits; count++) { int digit = 0; @@ -187,7 +188,7 @@ return false; } - if (((count 1) ^ oddoeven) == 0) { // not + if (((count 1) ^ oddOrEven) == 0) { // not digit *= 2; if (digit 9) { digit -= 9; @@ -200,11 +201,7 @@ return false; } - if (sum % 10 == 0) { - return true; - } - - return false; + return (sum % 10 == 0); } /** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/validator/src/test/org/apache/commons/validator CreditCardValidatorTest.java
dgraham 2003/06/08 14:54:07 Modified:validator/src/test/org/apache/commons/validator CreditCardValidatorTest.java Log: Added more credit card tests. Revision ChangesPath 1.2 +9 -3 jakarta-commons/validator/src/test/org/apache/commons/validator/CreditCardValidatorTest.java Index: CreditCardValidatorTest.java === RCS file: /home/cvs/jakarta-commons/validator/src/test/org/apache/commons/validator/CreditCardValidatorTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CreditCardValidatorTest.java 8 Jun 2003 21:33:22 - 1.1 +++ CreditCardValidatorTest.java 8 Jun 2003 21:54:07 - 1.2 @@ -84,7 +84,13 @@ assertFalse(ccv.isValid()); assertFalse(ccv.isValid(123456789012)); // too short assertFalse(ccv.isValid(12345678901234567890)); // too long +assertFalse(ccv.isValid(4417123456789112)); +assertFalse(ccv.isValid(4417q23456w89113)); +assertTrue(ccv.isValid(4417123456789113)); +// disallow Visa so it should fail even with good number +ccv = new CreditCardValidator(CreditCardValidator.AMEX); +assertFalse(ccv.isValid(4417123456789113)); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 20592] New: - RandomStringUtils.randomAlpha methods omit 'z'
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=20592. 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=20592 RandomStringUtils.randomAlpha methods omit 'z' Summary: RandomStringUtils.randomAlpha methods omit 'z' Product: Commons Version: Nightly Builds Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Lang AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] RandomStringUtils.randomAlphabetic and randomAlphanumeric will never include the letter 'z' in a generated string. Similarly, randomAscii omits 127. The attached patch fixes this problem and also does the following: 1. Fixes an error in the javadoc description of random(int count, int start, int end, boolean letters, boolean numbers, char[] set) 2. Adds test cases to make sure that boundary characters ('0', 'a', 'Z', etc.) are included in generated strings. The test cases will fail with the current code, complaining that 'z' and 127 are never generated. 3. Changes the significance levels of the chi-square tests added earlier to RandomUtilsTest. The patch changes all significance levels to .001, which will reduce the incidence of random failure to 1 in 1000. They are currently all set at .01. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 20592] - RandomStringUtils.randomAlpha methods omit 'z'
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=20592. 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=20592 RandomStringUtils.randomAlpha methods omit 'z' --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 22:51 --- Created an attachment (id=6701) patches to RandomStringUtils, RandomStringUtilsTest, RandomUtilsTest - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 19364] - [Lang] time unit tests fail on Sundays
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=19364. 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=19364 [Lang] time unit tests fail on Sundays [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 23:18 --- All patches applied, plus many other changes in time package. Thanks for the patches. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 15082] - elapsed time formatting utility method
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=15082. 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=15082 elapsed time formatting utility method --- Additional Comments From [EMAIL PROTECTED] 2003-06-08 23:23 --- DurationFormatUtils created and added to CVS. Needs more work really though...All ideas/code welcomed. Current problems include not being able to specify which fields to output - day, hour, min, sec, ms. The two methods so far differ in this. Maybe the class should be package scoped for v2.0 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 20592] - [lang] RandomStringUtils.randomAlpha methods omit 'z'
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=20592. 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=20592 [lang] RandomStringUtils.randomAlpha methods omit 'z' [EMAIL PROTECTED] changed: What|Removed |Added Summary|RandomStringUtils.randomAlph|[lang] |a methods omit 'z' |RandomStringUtils.randomAlph ||a methods omit 'z' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Timeout in HTTP
Socket connect timeout is dependent on the OS. It is configurable since jdk1.4 through code by creating an unbound socket and using connect(SocketAddress, timeout) If one uses java.net.URLConnection there are also: sun.net.client.defaultConnectTimeout (default: -1) sun.net.client.defaultReadTimeout (default: -1) See http://java.sun.com/j2se/1.4.1/docs/guide/net/properties.html Quite so. I forgot this was added in 1.4. Adding support for native connect timeout in HttpClient will require an interface change I think, so it will have to wait until at least 2.1. As always other thoughts are welcome. Has anyone actually tried to contact a server that is down and received a timeout? In my experience, trying to interrupt a socket while it is trying to connect (as in the TimeoutController) does nothing until the actual OS timeout kicks in. I have and it seems to work. After a little investigation I agree with you. It seems that interrupting a thread blocked in Socket() does nothing. In our case though this is not really a problem since the socket is opened from a new thread. Once the timeout occurs the original thread interrupts the connect thread (which appears to do nothing) and then throws an exception. The timeout still occurs though it doesn't keep the socket from being opened. The only problem here is the possibility of an orphaned thread blocked in Socket(). Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]