Re: [lang] Proposal (2): isEmpty
Hmm. It wasn't in 1.0.1 javadocs. One thing we're lacking now I look at the source are javadoc @since tags. http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/StringUtils.html Hen On Sun, 20 Jul 2003, Stephen Colebourne wrote: isWhitespace() still exists, but returns false for null. This is compliant with the other character test methods such as isAlpha(). Empty checks: isEmpty() - or null isBlank() - whitespace only, or null Character checks: isWhitespace() - whitespace or isAlpha() - alpha or etc. Thus, using isBlank avoids changing the functionality of the 1.0 isWhitespace. Stephen - Original Message - From: Henri Yandell [EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] Sent: Sunday, July 20, 2003 1:37 AM Subject: RE: [lang] Proposal (2): isEmpty Ack. It would help if isWhitespace existed. I thought it did as a part of our isAlpha etc methods. I need to check my assumptions more. I still think isWhitespace is a bit better as it matches the naming/functionality of Character.isWhitespace (as char's cannot be null) and the StringUtils general functionality of trying to do the obvious/quietest thing on null, but it's not that important. Hen On Sat, 19 Jul 2003, Gary Gregory wrote: I like the blank version as it is more expressive. Does this version isBlank trim? Gary -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Saturday, July 19, 2003 13:13 To: Jakarta Commons Developers List Subject: Re: [lang] Proposal (2): isEmpty From: Henri Yandell [EMAIL PROTECTED] It isn't. My preference is now for isEmpty() - or null isBlank() - whitespace only, or null Could just tell people to do isWhitespace isEmpty ? :) I feel isBlank() is more expressive than isWhitespace(). It just feels more inclusive of null and empty. if (isNotBlank()) { ...process data } OR if (isNotWhitespace()) { ...process data } Then again isWhitespace follows our naming definitions. --- isEmptyTrimmed() - trim() then or null I'm not sure there's any need for this. I wonder how much of the chars less than 32 count as whitespace? But it seems that isWhitespace is for most people's usage a superset of isEmptyTrimmed. Yeh, I'm happy to miss it out. --- (plus isNotEmpty, isNotBlank, isEmptyNN, isBlankNN) Still hard to decide how far to go with all these. isEmptyNN is a single-atom method. isNotEmpty just replaces a ! sign etc etc. The Nots are very useful for these cases as they are so frequent. --- Does anyone actually want isEmptyNN, or is it just that people are unhappy with the null-handling in StringUtils? In which case I think the NN is the wrong solution, we need to be thinking about an ability to create a StringUtils with a strategy or having an underlying hidden class and 3 facade's for the different strategies. All 3.0. +1. Leave out NN for now. Its a bit of a hack. Stephen - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/modeler/src/test/org/apache/commons/modeler RegistryTestCase.java
ggregory2003/07/20 00:25:58 Modified:modeler/src/test/org/apache/commons/modeler RegistryTestCase.java Log: Organize Imports. Revision ChangesPath 1.7 +6 -6 jakarta-commons/modeler/src/test/org/apache/commons/modeler/RegistryTestCase.java Index: RegistryTestCase.java === RCS file: /home/cvs/jakarta-commons/modeler/src/test/org/apache/commons/modeler/RegistryTestCase.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RegistryTestCase.java 27 Jan 2003 19:57:07 - 1.6 +++ RegistryTestCase.java 20 Jul 2003 07:25:58 - 1.7 @@ -64,9 +64,8 @@ import java.io.FileInputStream; -import java.util.EmptyStackException; import java.util.List; -import java.util.Map; + import javax.management.Descriptor; import javax.management.MBeanConstructorInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo; @@ -74,6 +73,7 @@ import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanNotificationInfo; import javax.management.modelmbean.ModelMBeanOperationInfo; + import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler/mbeans MBeanProxy.java SimpleRemoteConnector.java
ggregory2003/07/20 00:35:14 Modified:modeler/src/java/org/apache/commons/modeler/modules MbeansSource.java MbeansDescriptorsSerSource.java ModelerSource.java MbeansDescriptorsDynamicMBeanSource.java MbeansSourceMBean.java MbeansDescriptorsIntrospectionSource.java MbeansDescriptorsDOMSource.java MbeansDescriptorsDigesterSource.java modeler/src/java/org/apache/commons/modeler BaseAttributeFilter.java ConstructorInfo.java AttributeInfo.java BaseModelMBean.java RegistryMBean.java FixedNotificationFilter.java ParameterInfo.java Registry.java ManagedBean.java JndiJmx.java FeatureInfo.java NotificationInfo.java BaseNotificationBroadcaster.java OperationInfo.java Main.java modeler/src/java/org/apache/commons/modeler/util IntrospectionUtils.java DomUtil.java modeler/src/java/org/apache/commons/modeler/ant RegistryTask.java JmxInvoke.java JmxSet.java MLETTask.java ServiceTask.java ModelerTask.java modeler/src/java/org/apache/commons/modeler/mbeans MBeanProxy.java SimpleRemoteConnector.java Log: Organzie import statements. Revision ChangesPath 1.13 +19 -16 jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java Index: MbeansSource.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- MbeansSource.java 14 Apr 2003 01:01:55 - 1.12 +++ MbeansSource.java 20 Jul 2003 07:35:12 - 1.13 @@ -1,25 +1,28 @@ package org.apache.commons.modeler.modules; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.apache.commons.modeler.util.DomUtil; -import org.apache.commons.modeler.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import javax.management.*; -import javax.management.loading.MLet; -import javax.xml.transform.TransformerException; -import java.io.InputStream; -import java.io.FileOutputStream; import java.io.FileNotFoundException; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; +import java.io.FileOutputStream; +import java.io.InputStream; import java.net.URL; import java.util.ArrayList; -import java.util.List; import java.util.HashMap; +import java.util.List; + +import javax.management.Attribute; +import javax.management.MBeanServer; +import javax.management.ObjectName; +import javax.management.loading.MLet; +import javax.xml.transform.TransformerException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.modeler.AttributeInfo; +import org.apache.commons.modeler.BaseModelMBean; +import org.apache.commons.modeler.ManagedBean; +import org.apache.commons.modeler.Registry; +import org.apache.commons.modeler.util.DomUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Node; /** This will create mbeans based on a config file. 1.5 +5 -8 jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsSerSource.java Index: MbeansDescriptorsSerSource.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsSerSource.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MbeansDescriptorsSerSource.java 26 Feb 2003 22:17:32 - 1.4 +++ MbeansDescriptorsSerSource.java 20 Jul 2003 07:35:12 - 1.5 @@ -1,18 +1,15 @@ package org.apache.commons.modeler.modules; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.apache.commons.modeler.util.DomUtil; -import org.apache.commons.modeler.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import java.io.InputStream; import java.io.ObjectInputStream; -import java.io.EOFException; import java.net.URL; import java.util.ArrayList; import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.modeler.ManagedBean; +import org.apache.commons.modeler.Registry; public class MbeansDescriptorsSerSource extends ModelerSource 1.6 +6
cvs commit: jakarta-commons/modeler/src/test/org/apache/commons/modeler/demo Demo.java
ggregory2003/07/20 00:35:45 Modified:modeler/src/test/org/apache/commons/modeler/demo Demo.java Log: Organzie import statements. Revision ChangesPath 1.2 +6 -4 jakarta-commons/modeler/src/test/org/apache/commons/modeler/demo/Demo.java Index: Demo.java === RCS file: /home/cvs/jakarta-commons/modeler/src/test/org/apache/commons/modeler/demo/Demo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Demo.java 30 Apr 2002 20:58:52 - 1.1 +++ Demo.java 20 Jul 2003 07:35:45 - 1.2 @@ -68,6 +68,7 @@ import java.io.InputStream; import java.net.URL; import java.util.Iterator; + import javax.management.Attribute; import javax.management.Descriptor; import javax.management.MBeanAttributeInfo; @@ -83,6 +84,7 @@ import javax.management.ObjectName; import javax.management.modelmbean.ModelMBean; import javax.management.modelmbean.ModelMBeanInfo; + import org.apache.commons.modeler.ManagedBean; import org.apache.commons.modeler.Registry; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [modeler] cleanup imports
Hello, I've taken the liberty to organize the [modeler] imports. FYI, I did not apply the patch but simply used Eclipse's Organize Imports feature. Also, FYI, here are the other compiler warnings noted by Eclispe: SeverityDescription ResourceIn Folder Location Creation Time Read access to enclosing field DomUtil.log is emulated by a synthetic accessor method. Increasing its visibility will improve your performance DomUtil.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/utilline 252 July 20, 2003 12:27:46 AM Read access to enclosing field DomUtil.log is emulated by a synthetic accessor method. Increasing its visibility will improve your performance DomUtil.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/utilline 253 July 20, 2003 12:27:46 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 321July 20, 2003 12:35:28 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 391July 20, 2003 12:35:28 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 392July 20, 2003 12:35:28 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 479July 20, 2003 12:35:28 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 648July 20, 2003 12:35:28 AM Superfluous semicolon BaseModelMBean.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 733July 20, 2003 12:35:28 AM Superfluous semicolon ManagedBean.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 522July 20, 2003 12:35:28 AM The field AttributeInfo.serialVersionUID is hiding a field from type FeatureInfo AttributeInfo.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 84 July 20, 2003 12:35:28 AM The field ConstructorInfo.serialVersionUID is hiding a field from type FeatureInfoConstructorInfo.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 84 July 20, 2003 12:35:28 AM The field JndiJmx.attributes is hiding a field from type BaseModelMBean JndiJmx.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler line 160July 20, 2003 12:27:00 AM The field MbeansDescriptorsDigesterSource.location is hiding a field from type ModelerSource MbeansDescriptorsDigesterSource.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 79 July 20, 2003 12:27:46 AM The field MbeansDescriptorsDigesterSource.source is hiding a field from type ModelerSource MbeansDescriptorsDigesterSource.javaApache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 81 July 20, 2003 12:27:46 AM The field MbeansDescriptorsDOMSource.location is hiding a field from type ModelerSource MbeansDescriptorsDOMSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 87 July 20, 2003 12:27:46 AM The field MbeansDescriptorsDOMSource.source is hiding a field from type ModelerSource MbeansDescriptorsDOMSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 89 July 20, 2003 12:27:46 AM The field MbeansDescriptorsDynamicMBeanSource.location is hiding a field from type ModelerSource MbeansDescriptorsDynamicMBeanSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 35 July 20, 2003 12:27:46 AM The field MbeansDescriptorsDynamicMBeanSource.source is hiding a field from type ModelerSource MbeansDescriptorsDynamicMBeanSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 37 July 20, 2003 12:27:46 AM The field MbeansDescriptorsIntrospectionSource.location is hiding a field from type ModelerSource MbeansDescriptorsIntrospectionSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 26 July 20, 2003 12:27:46 AM The field MbeansDescriptorsIntrospectionSource.source is hiding a field from type ModelerSource MbeansDescriptorsIntrospectionSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 28 July 20, 2003 12:27:46 AM The field MbeansDescriptorsSerSource.location is hiding a field from type ModelerSource MbeansDescriptorsSerSource.java Apache Jakarta Commons/modeler/src/java/org/apache/commons/modeler/modules line 19 July 20, 2003 12:27:46 AM
[lang] How should StringUtils.indexOfAny handle in search string?
Currently, StringUtils.indexOfAny(str, searchStrings) returns 0 if searchStrings contains , but we return -1 if it contains null. Is this the way we want it to work? We should add javadoc in any case. One more thing. I really like the examples in the javadoc, but in some cases they might be clearer/more complete if we used * to indicate *any* value (i.e., null, , , abc, etc). For example, StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny(*, null) = -1 I am preparing a patch fixing a few small typos/omissions in the StringUtils javadoc. Is it OK if I use this notation? Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] StringUtils isEmpty summary(2)
I think that the basic request here is for a version of StringUtils that throws NPE on null input. This seems perfectly acceptable as a requirement, but it is different to the main StringUtils requirement of quiet null handling. For a 2.1/3.0 release, I would be happy to see a StringUtilsNPE (or similar name) added to [lang]. It would have most of the same methods as StringUtils, but handle nulls by NPE. Stephen - Original Message - From: [EMAIL PROTECTED] To: 'Jakarta Commons Developers List' [EMAIL PROTECTED] Sent: Sunday, July 20, 2003 2:55 AM Subject: RE: [lang] StringUtils isEmpty summary(2) d) The isXxxOrNull() naming is disliked as too long even though its clear. I don't agree with this. I'm very much in favor of precise, intention-revealing names. IMHO, isEmpty is unambiguous and should only mean that there's no content in the referenced String (that is, string.length() == 0). Empty means that there's some container that _could_ hold something, but null means that there's no container there at all (in a sense, string.length() == N/A). So, isEmptyOrNull() seems very straightforward and would remove all doubt that it's checking for null. e) Similarly isEmptyTrimmed() naming is too long. I don't mind the length, but then I'm not sure here if it's checking for nulls. f) More people want isEmpty() to be true for null than false. I can't disagree with that. While I for sure don't want isEmpty() to return true for a null (it's not empty, there's no 'it' there to check!), I'm not sure I like isEmpty() returning false for a null either, so a NPE would be appropriate. I would say that my most common usage is a replacement for: if ( ( string == null ) || ( string.length() == 0 ) ) So I'd be using isEmptyOrNull( string ). However, there certainly are times that I don't want a null to silently return false (such as when there's a contract with the rest of the code that nulls should not exist for this variable) and I'd use isEmpty( string ) in that case, fully expecting that if string == null, then a NPE would be thrown and I'd have the underlying bug fixed. ;ted - 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] How should StringUtils.indexOfAny handle in search string?
- Original Message - From: Phil Steitz [EMAIL PROTECTED] Currently, StringUtils.indexOfAny(str, searchStrings) returns 0 if searchStrings contains , but we return -1 if it contains null. Is this the way we want it to work? We should add javadoc in any case. I guess it has to be. String.indexOf() returns 0. So this just matches that behaviour. One more thing. I really like the examples in the javadoc, but in some cases they might be clearer/more complete if we used * to indicate *any* value (i.e., null, , , abc, etc). For example, StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny(*, null) = -1 I think I'm OK with it. The downside is it involves learning a convention. But I think its probably obvious enough. Any other views? Stephen I am preparing a patch fixing a few small typos/omissions in the StringUtils javadoc. Is it OK if I use this notation? Phil - 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/07/20 03:24:49 Modified:lang/src/java/org/apache/commons/lang NumberUtils.java Log: Fix wrong javadoc Revision ChangesPath 1.12 +3 -3 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.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- NumberUtils.java 24 Jun 2003 21:14:50 - 1.11 +++ NumberUtils.java 20 Jul 2003 10:24:49 - 1.12 @@ -416,7 +416,7 @@ * @param a value 1 * @param b value 2 * @param c value 3 - * @return the largest of the values + * @return the smallest of the values */ public static long minimum(long a, long b, long c) { if (b a) { @@ -434,7 +434,7 @@ * @param a value 1 * @param b value 2 * @param c value 3 - * @return the largest of the values + * @return the smallest of the values */ public static int minimum(int a, int b, int c) { if (b a) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
scolebourne2003/07/20 03:29:22 Modified:lang/src/test/org/apache/commons/lang StringUtilsTest.java lang/src/java/org/apache/commons/lang StringUtils.java Log: Add new method center(String, int, char) to complete API Rework padding internals Example javadoc difference()/differenceAt() Remove dependency on NumberUtils Revision ChangesPath 1.32 +225 -186 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java Index: StringUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- StringUtilsTest.java 20 Jul 2003 00:17:29 - 1.31 +++ StringUtilsTest.java 20 Jul 2003 10:29:21 - 1.32 @@ -279,7 +279,7 @@ assertEquals(a, res[0]); } -public void testSplit() { +public void testSplit_StringString_StringStringInt() { assertEquals(null, StringUtils.split(null, .)); assertEquals(null, StringUtils.split(null, ., 3)); @@ -298,47 +298,43 @@ } private void innerTestSplit(char separator, String sepStr, char noMatch) { -try { -final String str = a + separator + b + separator + separator + noMatch + c; -String[] res; -// (str, sepStr) -res = StringUtils.split(str, sepStr); -assertEquals(3, res.length); -assertEquals(a, res[0]); -assertEquals(b, res[1]); -assertEquals(noMatch + c, res[2]); - -final String str2 = separator + a + separator; -res = StringUtils.split(str2, sepStr); -assertEquals(1, res.length); -assertEquals(a, res[0]); - -res = StringUtils.split(str, sepStr, -1); -assertEquals(3, res.length); -assertEquals(a, res[0]); -assertEquals(b, res[1]); -assertEquals(noMatch + c, res[2]); - -res = StringUtils.split(str, sepStr, 0); -assertEquals(3, res.length); -assertEquals(a, res[0]); -assertEquals(b, res[1]); -assertEquals(noMatch + c, res[2]); - -res = StringUtils.split(str, sepStr, 1); -assertEquals(1, res.length); -assertEquals(str, res[0]); - -res = StringUtils.split(str, sepStr, 2); -assertEquals(2, res.length); -assertEquals(a, res[0]); -assertEquals(str.substring(2), res[1]); - -} catch (AssertionFailedError ex) { -System.out.println(Failed on separator hex( + Integer.toHexString(separator) + - ), noMatch hex( + Integer.toHexString(noMatch) + ), sepStr( + sepStr + )); -throw ex; -} +String msg = Failed on separator hex( + Integer.toHexString(separator) + +), noMatch hex( + Integer.toHexString(noMatch) + ), sepStr( + sepStr + ); + +final String str = a + separator + b + separator + separator + noMatch + c; +String[] res; +// (str, sepStr) +res = StringUtils.split(str, sepStr); +assertEquals(msg, 3, res.length); +assertEquals(msg, a, res[0]); +assertEquals(msg, b, res[1]); +assertEquals(msg, noMatch + c, res[2]); + +final String str2 = separator + a + separator; +res = StringUtils.split(str2, sepStr); +assertEquals(msg, 1, res.length); +assertEquals(msg, a, res[0]); + +res = StringUtils.split(str, sepStr, -1); +assertEquals(msg, 3, res.length); +assertEquals(msg, a, res[0]); +assertEquals(msg, b, res[1]); +assertEquals(msg, noMatch + c, res[2]); + +res = StringUtils.split(str, sepStr, 0); +assertEquals(msg, 3, res.length); +assertEquals(msg, a, res[0]); +assertEquals(msg, b, res[1]); +assertEquals(msg, noMatch + c, res[2]); + +res = StringUtils.split(str, sepStr, 1); +assertEquals(msg, 1, res.length); +assertEquals(msg, str, res[0]); + +res = StringUtils.split(str, sepStr, 2); +assertEquals(msg, 2, res.length); +assertEquals(msg, a, res[0]); +assertEquals(msg, str.substring(2), res[1]); } public void testDeleteSpace_String() { @@ -433,7 +429,7 @@ } catch (IndexOutOfBoundsException ex) {} } -public void testRepeat() { +public void testRepeat_StringInt() { assertEquals(null, StringUtils.repeat(null, 2)); assertEquals(,
RE: [lang] StringUtils isEmpty summary(2)
-Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED] I think that the basic request here is for a version of StringUtils that throws NPE on null input. How about either: * StringUtils becomes an instance class that is configured at construction time: StringUtils utils = new StringUtils(someConfigurationObject); ...where the configuration object tells the new instance whether to throw NullPointerExceptions, whether to treat zero-length strings and all-whitespace strings in the same manner, etc., etc. * StringUtils has a static method on it that configures the class in one fell swoop (like above, but instead of a constructor) * StringUtils has many fine-grained static configuration methods, so you might do this: StringUtils.setThrowNullPointerExceptions(true); StringUtils.setTrimBeforeTests(true); StringUtils.setSomethingElseContentious(true); Cheers, Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [lang] StringUtils isEmpty summary(2)
-Original Message- From: Laird J. Nelson [mailto:[EMAIL PROTECTED] How about either: (First of all, let me also say that I am merely a lurker on this issue and am throwing out ideas for the fun of it, not because I want to hold up anything, or cause trouble. :-)) * StringUtils becomes an instance class that is configured at construction time: As counter as this is at the moment to the whole Jakarta *Utils philosophy (as it is currently burned into code--static, stateless utility classes), and as much as I disliked this idea even as I was suggesting it, the more I think about it the more I think this (or a singleton-based approach) is the right way to go. Many projects will have, say, two different libraries, both of which will need to use StringUtils in the same VM, so static configuration options probably aren't (an option, that is). Laird - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bug report for Commons [2003/07/20]
+---+ | 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|[unspecified] ServiceManager not actually serializ| | 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 | |10319|New|Enh|2002-06-28|Instantiate property if null in form bean | |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 | |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| |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|[lang] 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| |15534|New|Nor|2002-12-19|Inadequate HTTP proxy server support in HttpClient|
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
scolebourne2003/07/20 07:47:29 Modified:lang/src/test/org/apache/commons/lang StringUtilsTest.java lang/src/java/org/apache/commons/lang StringUtils.java Log: Add summary javadoc section to StringUtils class Rename reverseDelimitedString to reverseDelimited Revision ChangesPath 1.33 +7 -7 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java Index: StringUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsTest.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- StringUtilsTest.java 20 Jul 2003 10:29:21 - 1.32 +++ StringUtilsTest.java 20 Jul 2003 14:47:29 - 1.33 @@ -704,12 +704,12 @@ assertEquals(sdrawkcab, StringUtils.reverse(backwards) ); } -public void testReverseDelimitedString_StringChar() { -assertEquals(null, StringUtils.reverseDelimitedString(null, '.') ); -assertEquals(, StringUtils.reverseDelimitedString(, '.') ); -assertEquals(c.b.a, StringUtils.reverseDelimitedString(a.b.c, '.') ); -assertEquals(a b c, StringUtils.reverseDelimitedString(a b c, '.') ); -assertEquals(, StringUtils.reverseDelimitedString(, '.') ); +public void testReverseDelimited_StringChar() { +assertEquals(null, StringUtils.reverseDelimited(null, '.') ); +assertEquals(, StringUtils.reverseDelimited(, '.') ); +assertEquals(c.b.a, StringUtils.reverseDelimited(a.b.c, '.') ); +assertEquals(a b c, StringUtils.reverseDelimited(a b c, '.') ); +assertEquals(, StringUtils.reverseDelimited(, '.') ); } public void testReverseDelimitedString_StringString() { 1.72 +54 -8 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.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- StringUtils.java 20 Jul 2003 10:29:22 - 1.71 +++ StringUtils.java 20 Jul 2003 14:47:29 - 1.72 @@ -60,6 +60,51 @@ /** * pCommon codeString/code manipulation routines that are * codenull/code safe./p + * + * ul + * libIsEmpty/IsBlank/b + * - checks if a String contains text + * libTrim/Strip/b + * - remove leading and trailing whitespace + * libEquals/b + * - compare two strings null-safe + * libIndexOf/LastIndexOf/Contains/b + * - null-safe index of checks + * libIndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut/b + * - index of any of a set of Strings + * libContainsOnly/ContainsNone/b + * - does String contain only/none of these characters + * libSubString/Left/Right/Mid/b + * - null-safe substring extraction + * libSplit/b + * - splits a String into an array of subtrings based on a separator + * libJoin/Concatenate/b + * - joins an array of Strings into one with optional separator + * libReplace/Delete/Overlay/b + * - Searches a String and replaces one String with another + * libChomp/Chop/Slice/b + * - searches a String and returns the substring before/after the separator + * libLeftPad/RightPad/Center/Repeat/b + * - pads a String + * libUpperCase/LowerCase/SwapCase/Capitalise/Uncapitalise/b + * - change the case of a String + * libNestedString/b + * - returns a substring nested within other Strings + * libCountMatches/b + * - counts the number of occurrances of one String in another + * libIsAlpha/IsNumeric/IsWhitespace/b + * - checks the characters in a String + * libDefaultString/b + * - protects against a null input String + * libReverse/ReverseDelimited/b + * - reverses a String + * libAbbreviate/b + * - abbreviates a string using ellipsis + * libDifference/b + * - compares two Strings and reports on their differences + * libLevensteinDistance/b + * - the number of changes needed to change one String into another + * /ul * * pThe codeStringUtils/code class defines certain words related to * String handling./p @@ -67,8 +112,9 @@ * ul * linull - codenull/code * liempty - a zero-length string (code/code) - * lispace - the space character (code' '/code)(32) + * lispace - the space character (code' '/code)(char 32) * liwhitespace - the characters defined by [EMAIL PROTECTED] Character#isWhitespace(char)} + * litrim - the characters lt;= 32 as in [EMAIL PROTECTED] String#trim(String)} * /ul * * pcodeStringUtils/code handles codenull/code input Strings quietly. @@
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
scolebourne2003/07/20 08:29:45 Modified:lang/src/test/org/apache/commons/lang StringUtilsSubstringTest.java lang/src/java/org/apache/commons/lang StringUtils.java Log: Add more javadoc example code Ensure empty string behaviour documented in example code Revision ChangesPath 1.6 +9 -5 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java Index: StringUtilsSubstringTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- StringUtilsSubstringTest.java 18 Jul 2003 02:06:23 - 1.5 +++ StringUtilsSubstringTest.java 20 Jul 2003 15:29:44 - 1.6 @@ -207,17 +207,21 @@ StringUtils.countMatches(, ooo)); } -public void testGetNestedString() { +public void testGetNestedString_StringString() { assertEquals(null, StringUtils.getNestedString(null, tag)); +assertEquals(, StringUtils.getNestedString(, )); +assertEquals(null, StringUtils.getNestedString(, abc)); +assertEquals(, StringUtils.getNestedString(, )); assertEquals(null, StringUtils.getNestedString(abc, null)); assertEquals(, StringUtils.getNestedString(abc, )); assertEquals(null, StringUtils.getNestedString(abc, a)); assertEquals(bc, StringUtils.getNestedString(abca, a)); assertEquals(bc, StringUtils.getNestedString(abcabca, a)); -assertEquals(, StringUtils.getNestedString(, )); -assertEquals(, StringUtils.getNestedString(, )); assertEquals(bar, StringUtils.getNestedString(\nbar\n, \n)); - +} + +public void testGetNestedString_StringStringString() { +assertEquals(null, StringUtils.getNestedString(null, , )); assertEquals(, StringUtils.getNestedString(, , )); assertEquals(, StringUtils.getNestedString(, , )); assertEquals(bar, StringUtils.getNestedString(foobar/foo, foo, /foo) ); 1.73 +177 -52 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.72 retrieving revision 1.73 diff -u -r1.72 -r1.73 --- StringUtils.java 20 Jul 2003 14:47:29 - 1.72 +++ StringUtils.java 20 Jul 2003 15:29:44 - 1.73 @@ -297,10 +297,10 @@ * * pre * StringUtils.clean(null) = + * StringUtils.clean()= * StringUtils.clean(abc) = abc * StringUtils.clean(abc) = abc * StringUtils.clean( ) = - * StringUtils.clean()= * /pre * * @see java.lang.String#trim() @@ -327,10 +327,10 @@ * * pre * StringUtils.trim(null) = null + * StringUtils.trim()= + * StringUtils.trim( ) = * StringUtils.trim(abc) = abc * StringUtils.trim(abc) = abc - * StringUtils.trim( ) = - * StringUtils.trim()= * /pre * * @param str the String to be trimmed, may be null @@ -351,10 +351,10 @@ * * pre * StringUtils.trimToNull(null) = null + * StringUtils.trimToNull()= null + * StringUtils.trimToNull( ) = null * StringUtils.trimToNull(abc) = abc * StringUtils.trimToNull(abc) = abc - * StringUtils.trimToNull( ) = null - * StringUtils.trimToNull()= null * /pre * * @param str the String to be trimmed, may be null @@ -377,10 +377,10 @@ * * pre * StringUtils.trimToEmpty(null) = + * StringUtils.trimToEmpty()= + * StringUtils.trimToEmpty( ) = * StringUtils.trimToEmpty(abc) = abc * StringUtils.trimToEmpty(abc) = abc - * StringUtils.trimToEmpty( ) = - * StringUtils.trimToEmpty()= * /pre * * @param str the String to be trimmed, may be null @@ -487,6 +487,7 @@ * * pre * StringUtils.strip(null, null) = null + * StringUtils.strip(, null) = * StringUtils.strip(abc, null) = abc * StringUtils.strip( abc, null)= abc * StringUtils.strip(abc , null)= abc @@ -515,12 +516,14 @@ * stripped as defined by [EMAIL PROTECTED]
RE: [lang] How should StringUtils.indexOfAny handle in search string?
The convention could perhaps also bracket template like things with itemplate/i, as in: /** * Blah Blah codeFoo.bar(iinputValue/i);/code Blah Blah. */ Gary -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Sunday, July 20, 2003 02:21 To: Jakarta Commons Developers List Subject: Re: [lang] How should StringUtils.indexOfAny handle in search string? - Original Message - From: Phil Steitz [EMAIL PROTECTED] Currently, StringUtils.indexOfAny(str, searchStrings) returns 0 if searchStrings contains , but we return -1 if it contains null. Is this the way we want it to work? We should add javadoc in any case. I guess it has to be. String.indexOf() returns 0. So this just matches that behaviour. One more thing. I really like the examples in the javadoc, but in some cases they might be clearer/more complete if we used * to indicate *any* value (i.e., null, , , abc, etc). For example, StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny(*, null) = -1 I think I'm OK with it. The downside is it involves learning a convention. But I think its probably obvious enough. Any other views? Stephen I am preparing a patch fixing a few small typos/omissions in the StringUtils javadoc. Is it OK if I use this notation? Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] StringUtils.isEmpty summary (3)
On 7/20/03 12:25 PM, [EMAIL PROTECTED] wrote: For a 2.1/3.0 release a StringUtilsNPE could be added to provide the harsh null behaviour (null input - NPE) I'd like to note that if one wants NPEs, one can usually write code like str.length() == 0 instead of StringUtilsNPE.isEmpty() I for one find the null-handling behavior of StringUtils to be its primary benefit, so I don't have to write if ((str != null)(...)) all the time. Of course, since one of my primary Coding Values is that my code be clear, unambiguous, and non-misleading, I still must gripe that the proposed use of isEmpty is blatently misleading. But since it seems like there is nothing close to consensus on this issue, my non-vote on the names would be a 0 rather than a -1. .T. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21633] - [CODEC] IndexOutOfBoundsException when encoding non-ASCII 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=21633. 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=21633 [CODEC] IndexOutOfBoundsException when encoding non-ASCII characters [EMAIL PROTECTED] changed: What|Removed |Added Summary|IndexOutOfBoundsException |[CODEC] |when encoding non-ASCII |IndexOutOfBoundsException |characters |when encoding non-ASCII ||characters --- Additional Comments From [EMAIL PROTECTED] 2003-07-20 18:30 --- Hi Oleg, No worries. +1 for me as well. Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [lang] StringUtils.isEmpty summary (3)
Hello All, This as been quite a topic! I am starting to think that we could perhaps consider: (1) Release 2.0 with as little change as possible in this area, in particular make sure we are backwards compatible. (I am not looking forward to checking the logic of all my senders of isEmpty, etc...) if the behavior is indeed changed. (2) Propose a *new* class which can be instantiated and configured WRT to allowing nulls and trimming for the next release. Gary -Original Message- From: Todd Jonker [mailto:[EMAIL PROTECTED] Sent: Sunday, July 20, 2003 11:19 To: Jakarta Commons Developers List Subject: Re: [lang] StringUtils.isEmpty summary (3) On 7/20/03 12:25 PM, [EMAIL PROTECTED] wrote: For a 2.1/3.0 release a StringUtilsNPE could be added to provide the harsh null behaviour (null input - NPE) I'd like to note that if one wants NPEs, one can usually write code like str.length() == 0 instead of StringUtilsNPE.isEmpty() I for one find the null-handling behavior of StringUtils to be its primary benefit, so I don't have to write if ((str != null)(...)) all the time. Of course, since one of my primary Coding Values is that my code be clear, unambiguous, and non-misleading, I still must gripe that the proposed use of isEmpty is blatently misleading. But since it seems like there is nothing close to consensus on this issue, my non-vote on the names would be a 0 rather than a -1. .T. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang/math RandomUtilsTest.java
ggregory2003/07/20 11:58:46 Modified:lang/src/test/org/apache/commons/lang/math RandomUtilsTest.java Log: Severity Description ResourceIn Folder Location Creation Time Superfluous semicolon RandomUtilsTest.javaApache Jakarta Commons/lang/src/test/org/apache/commons/lang/math line 315July 18, 2003 8:21:31 PM Revision ChangesPath 1.4 +2 -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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- RandomUtilsTest.java 9 Jun 2003 21:36:03 - 1.3 +++ RandomUtilsTest.java 20 Jul 2003 18:58:46 - 1.4 @@ -312,7 +312,7 @@ RandomUtils.JVM_RANDOM.setSeed(1000); fail(expecting UnsupportedOperationException); } catch (UnsupportedOperationException ex) { -; +// empty } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/base64 Base64.java
ggregory2003/07/20 12:09:03 Modified:codec/src/java/org/apache/commons/codec/base64 Base64.java Log: Javadoc typo. Revision ChangesPath 1.4 +455 -455 jakarta-commons/codec/src/java/org/apache/commons/codec/base64/Base64.java Index: Base64.java === RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/base64/Base64.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Base64.java 18 Jun 2003 18:43:56 - 1.3 +++ Base64.java 20 Jul 2003 19:09:02 - 1.4 @@ -1,455 +1,455 @@ -/* - * - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 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, HttpClient, 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.codec.base64; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; - -/** - * pBase64 encoder and decoder./p - * p - * This class provides encoding/decoding methods for - * the Base64 encoding as defined by RFC 2045, - * N. Freed and N. Borenstein. -y * RFC 2045: Multipurpose Internet Mail Extensions (MIME) - * Part One: Format of Internet Message Bodies. Reference - * 1996. Available at: http://www.ietf.org/rfc/rfc2045.txt - * /p - * @author Jeffrey Rodriguez - * @version $Revision$ $Date$ - * - * @deprecated This class has been replaced by - * [EMAIL PROTECTED] org.apache.commons.codec.binary.Base64} - */ -public final class Base64 { - -/** - * The default character encoding - */ -protected static final String DEFAULT_CHAR_ENCODING = ISO-8859-1; - -/** - * The bsae length - */ -static final int BASELENGTH = 255; - -/** - * Lookup length - */ -static final int LOOKUPLENGTH = 64; - -/** - * Used to calculate the number of bits in a byte. - */ -static final int EIGHTBIT = 8; - -/** - * Used when encoding something which has fewer than 24 bits - */ -static final int SIXTEENBIT = 16; - -/** - * Constant used to determine how many bits data contains - */ -
DO NOT REPLY [Bug 21748] New: - BasicDataSource.close() throws NPE
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=21748. 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=21748 BasicDataSource.close() throws NPE Summary: BasicDataSource.close() throws NPE Product: Commons Version: 1.0 Final Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Dbcp AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If a BasicDataSource is closed without having been used, the connectionPool will not have been initialised and a NPE will be thrown in line 486. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21750] New: - [lang] StringUtils javadoc and test enhancements
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=21750. 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=21750 [lang] StringUtils javadoc and test enhancements Summary: [lang] StringUtils javadoc and test enhancements Product: Commons Version: Nightly Builds Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Lang AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The attached patch fixes some javadoc typos and adds some more examples and test cases for StringUtils. It does include one code change -- isNotBlank is changed to return !isBlank instead of including the negated search logic. Apologies if the intention is not for isNotBlank - !isBlank. The examples, tests and docs suggest that this should be true now. Of course, it is possible that I am missing something. I also introduced (with no explanation) the * notation discussed on the list to make the examples more expressive. I will submit a replacement patch if we don't want to use this. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21750] - [lang] StringUtils javadoc and test enhancements
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=21750. 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=21750 [lang] StringUtils javadoc and test enhancements --- Additional Comments From [EMAIL PROTECTED] 2003-07-20 22:28 --- Created an attachment (id=7409) Patches for StringUtils and tests - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DO NOT REPLY [Bug 21748] New: - BasicDataSource.close() throws NPE
This is an easy fix, but since it would be my first commit to this project, I just want to see what the group preference is. The basic problem is this: public void close() throws SQLException { GenericObjectPool oldpool = connectionPool; connectionPool = null; dataSource = null; try { oldpool.close(); } catch(SQLException e) { throw e; } catch(RuntimeException e) { throw e; } catch(Exception e) { throw new SQLException(e.toString()); } } The oldpool variable is null, and unlike other places in the code, there is no check. The minimal change would be to change that one line by adding an if check. My preference would be to follow the pattern is used elsewhere in the code for checking. So the final code would be: public void close() throws SQLException { dataSource = null; if (connectionPool != null) { GenericObjectPool oldpool = connectionPool; connectionPool = null; try { oldpool.close(); } catch(SQLException e) { throw e; } catch(RuntimeException e) { throw e; } catch(Exception e) { throw new SQLException(e.toString()); } } } Any objections? --- Noel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] How should StringUtils.indexOfAny handle in search string?
Phil Steitz wrote: Currently, StringUtils.indexOfAny(str, searchStrings) returns 0 if searchStrings contains , but we return -1 if it contains null. Is this the way we want it to work? We should add javadoc in any case. One more thing. I really like the examples in the javadoc, but in some cases they might be clearer/more complete if we used * to indicate *any* value (i.e., null, , , abc, etc). For example, StringUtils.indexOfAny(null, *) = -1 StringUtils.indexOfAny(*, null) = -1 I am preparing a patch fixing a few small typos/omissions in the StringUtils javadoc. Is it OK if I use this notation? Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I just submitted a patch that includes the * notation here http://issues.apache.org/bugzilla/show_bug.cgi?id=21750 The patch is mostly fixes for other minor javadoc things and addition of more test cases/examples. I can resubmit with the * stuff removed if the consensus is not to do this. I agree with Stephen that handling in indexOfAny should stay as is. I just clarified it in the javadoc. Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
scolebourne2003/07/20 16:57:26 Modified:lang/src/test/org/apache/commons/lang StringUtilsEqualsIndexOfTest.java StringUtilsTest.java StringUtilsSubstringTest.java lang/src/java/org/apache/commons/lang StringUtils.java Log: Update Javadoc and tests bug 21750, from Phil Steitz Revision ChangesPath 1.4 +41 -3 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java Index: StringUtilsEqualsIndexOfTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsEqualsIndexOfTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- StringUtilsEqualsIndexOfTest.java 19 Jul 2003 23:29:06 - 1.3 +++ StringUtilsEqualsIndexOfTest.java 20 Jul 2003 23:57:26 - 1.4 @@ -63,6 +63,7 @@ * * @author a href=mailto:[EMAIL PROTECTED]Stephen Colebourne/a * @author a href=mailto:[EMAIL PROTECTED]Ringo De Smet/a + * @author Phil Steitz * @version $Id$ */ public class StringUtilsEqualsIndexOfTest extends TestCase { @@ -142,6 +143,7 @@ assertEquals(0, StringUtils.indexOf(aabaabaa, a)); assertEquals(2, StringUtils.indexOf(aabaabaa, b)); assertEquals(1, StringUtils.indexOf(aabaabaa, ab)); +assertEquals(0, StringUtils.indexOf(aabaabaa, )); } public void testIndexOf_StringInt() { @@ -163,6 +165,7 @@ assertEquals(5, StringUtils.indexOf(aabaabaa, b, 3)); assertEquals(-1, StringUtils.indexOf(aabaabaa, b, 9)); assertEquals(2, StringUtils.indexOf(aabaabaa, b, -1)); +assertEquals(2,StringUtils.indexOf(aabaabaa, , 2)); } //--- @@ -183,12 +186,15 @@ assertEquals(2, StringUtils.lastIndexOf(aabaabaa, 'b', 3)); assertEquals(5, StringUtils.lastIndexOf(aabaabaa, 'b', 9)); assertEquals(-1, StringUtils.lastIndexOf(aabaabaa, 'b', -1)); +assertEquals(0, StringUtils.lastIndexOf(aabaabaa, 'a', 0)); } public void testLastIndexOf_String() { assertEquals(-1, StringUtils.lastIndexOf(null, null)); assertEquals(-1, StringUtils.lastIndexOf(, null)); +assertEquals(-1, StringUtils.lastIndexOf(, a)); assertEquals(0, StringUtils.lastIndexOf(, )); +assertEquals(8, StringUtils.lastIndexOf(aabaabaa, )); assertEquals(7, StringUtils.lastIndexOf(aabaabaa, a)); assertEquals(5, StringUtils.lastIndexOf(aabaabaa, b)); assertEquals(4, StringUtils.lastIndexOf(aabaabaa, ab)); @@ -213,19 +219,23 @@ assertEquals(2, StringUtils.lastIndexOf(aabaabaa, b, 3)); assertEquals(5, StringUtils.lastIndexOf(aabaabaa, b, 9)); assertEquals(-1, StringUtils.lastIndexOf(aabaabaa, b, -1)); +assertEquals(-1, StringUtils.lastIndexOf(aabaabaa, b, 0)); +assertEquals(0, StringUtils.lastIndexOf(aabaabaa, a, 0)); } //--- -public void contains_char() { +public void testContainsChar() { assertEquals(false, StringUtils.contains(null, ' ')); assertEquals(false, StringUtils.contains(, ' ')); +assertEquals(false, StringUtils.contains(,null)); +assertEquals(false, StringUtils.contains(null,null)); assertEquals(true, StringUtils.contains(abc, 'a')); assertEquals(true, StringUtils.contains(abc, 'b')); assertEquals(true, StringUtils.contains(abc, 'c')); assertEquals(false, StringUtils.contains(abc, 'z')); } -public void contains_String() { +public void testContainsString() { assertEquals(false, StringUtils.contains(null, null)); assertEquals(false, StringUtils.contains(null, )); assertEquals(false, StringUtils.contains(null, a)); @@ -246,7 +256,15 @@ assertEquals(-1, StringUtils.indexOfAny(FOOBAR, null)); assertEquals(2, StringUtils.indexOfAny(FOOBAR, FOOBAR_SUB_ARRAY)); assertEquals(-1, StringUtils.indexOfAny(FOOBAR, new String[0])); +assertEquals(-1, StringUtils.indexOfAny(null, new String[0])); +assertEquals(-1, StringUtils.indexOfAny(, new String[0])); assertEquals(-1, StringUtils.indexOfAny(FOOBAR, new String[] {})); +assertEquals(0, StringUtils.indexOfAny(FOOBAR, new String[] {})); +assertEquals(0, StringUtils.indexOfAny(, new String[] {})); +assertEquals(-1, StringUtils.indexOfAny(, new String[] {a})); +assertEquals(-1, StringUtils.indexOfAny(, new String[] {null})); +assertEquals(-1, StringUtils.indexOfAny(FOOBAR, new String[] {null})); +
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang StringUtils.java
scolebourne2003/07/20 17:41:13 Modified:lang/src/test/org/apache/commons/lang StringUtilsSubstringTest.java lang/src/java/org/apache/commons/lang StringUtils.java Log: Update Javadoc examples Change mid() to accept invalid startPos Revision ChangesPath 1.8 +20 -47 jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java Index: StringUtilsSubstringTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/StringUtilsSubstringTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- StringUtilsSubstringTest.java 20 Jul 2003 23:57:26 - 1.7 +++ StringUtilsSubstringTest.java 21 Jul 2003 00:41:13 - 1.8 @@ -127,7 +127,8 @@ assertEquals(null, StringUtils.substring(null,1,2)); } -public void testLeft() { +public void testLeft_String() { +assertSame(null, StringUtils.left(null, -1)); assertSame(null, StringUtils.left(null, 0)); assertSame(null, StringUtils.left(null, 2)); assertSame(, StringUtils.left(, 0)); @@ -135,18 +136,14 @@ assertEquals(, StringUtils.left(FOOBAR, 0)); assertEquals(FOO, StringUtils.left(FOOBAR, 3)); assertSame(FOOBAR, StringUtils.left(FOOBAR, 80)); -} - -public void testLeftEx() { try { StringUtils.left(FOOBAR, -1); -} catch (IllegalArgumentException ex) { -return; -} -fail(); +fail(); +} catch (IllegalArgumentException ex) {} } - -public void testRight() { + +public void testRight_String() { +assertSame(null, StringUtils.right(null, -1)); assertSame(null, StringUtils.right(null, 0)); assertSame(null, StringUtils.right(null, 2)); assertSame(, StringUtils.right(, 0)); @@ -154,18 +151,15 @@ assertEquals(, StringUtils.right(FOOBAR, 0)); assertEquals(BAR, StringUtils.right(FOOBAR, 3)); assertSame(FOOBAR, StringUtils.right(FOOBAR, 80)); -} - -public void testRightEx() { try { StringUtils.right(FOOBAR, -1); -} catch (IllegalArgumentException ex) { -return; -} -fail(); +fail(); +} catch (IllegalArgumentException ex) {} } - -public void testMid() { + +public void testMid_String() { +assertSame(null, StringUtils.mid(null, -1, 0)); +assertSame(null, StringUtils.mid(null, 0, -1)); assertSame(null, StringUtils.mid(null, 3, 0)); assertSame(null, StringUtils.mid(null, 3, 2)); assertSame(, StringUtils.mid(, 0, 0)); @@ -176,36 +170,15 @@ assertEquals(BAR, StringUtils.mid(FOOBAR, 3, 3)); assertEquals(FOOBAR, StringUtils.mid(FOOBAR, 0, 80)); assertEquals(BAR, StringUtils.mid(FOOBAR, 3, 80)); -} - -public void testMidEx1() { +assertEquals(, StringUtils.mid(FOOBAR, 9, 3)); +assertEquals(FOO, StringUtils.mid(FOOBAR, -1, 3)); try { StringUtils.mid(FOOBAR, 0, -1); -} catch (IllegalArgumentException ex) { -return; -} -fail(); -} - -public void testMidEx2() { -try { -StringUtils.mid(FOOBAR, -1, 3); -} catch (IndexOutOfBoundsException ex) { -return; -} -fail(); +fail(); +} catch (IllegalArgumentException ex) {} } - -public void testMidEx3() { -try { -StringUtils.mid(FOOBAR, 7, 3); -} catch (IndexOutOfBoundsException ex) { -return; -} -fail(); -} - -public void testCountMatches() { + +public void testCountMatches_String() { assertEquals(0, StringUtils.countMatches(null, null)); assertEquals(0, StringUtils.countMatches(blah, null)); assertEquals(0, StringUtils.countMatches(null, DD)); 1.76 +90 -83 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.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- StringUtils.java 20 Jul 2003 23:57:26 - 1.75 +++ StringUtils.java 21 Jul 2003 00:41:13 - 1.76 @@ -125,6 +125,9 @@ * pA side effect of the codenull/code handling is that a * NullPointerException should be considered a bug in codeStringUtils/code. * (Except
DO NOT REPLY [Bug 21750] - [lang] StringUtils javadoc and test enhancements
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=21750. 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=21750 [lang] StringUtils javadoc and test enhancements [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2003-07-21 00:45 --- Patch applied, thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21750] - [lang] StringUtils javadoc and test enhancements
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=21750. 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=21750 [lang] StringUtils javadoc and test enhancements [EMAIL PROTECTED] changed: What|Removed |Added Status|RESOLVED|CLOSED - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[lang] 2.0 RC2?
Well I'm done. - StringUtils and other classes are sorted with respect to null handling (absorbing as many as possible). - IsEmpty/IsBlank is coded and present. And highlighted in release notes. - Javadoc code examples have been put into most StringUtils methods. There are a few left if someone wants to add them. In fact Javadoc all over has been improved through this hiatus. I suggest that we should try a RC2. And see how people like it. Hopefully a release towards the end of the week. Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [DBCP] AbandonedTrace - Connection Recovery
Noel J. Bergman wrote: It appears clear that there are two camps, each with fairly strong views. Personally, I believe that both camps can be accomodated in a way that should satisfy both. DBCP should focus on core pooling behavior related to connections and prepared statements, and leave policy issues to specialized subclasses. If DBCP is clean, without any reclaiming of connections and properly setup to be subclassed, including subclassing a delegating connection, then whomever needs a specialized connection pool that reclaims connections based upon some policy can do so. DelegatingConnection, and the rest of the core objects should be pure and focused only on the necessary behavior to implement connection pooling. DBCP should focus on what has to happen when a connection is requested or returned. Behavior, not policy, should be the watch word. There is enough behavior to deal with related to connection pooling, including ensuring the proper state of pooled connections. Some of the AbandonedTrace behavior is still necessary to implement the JDBC specification. Connections still need to track outstanding statements and results sets, which are closed by Connection.close(). However, the abandoned semantic is not in the specification. It is perfectly permissible to leave a ResultSet or Statement open, and expect the connection to close it. Nor is it necessary for DBCP to track leaks, regardless of whether or not it is implementing recovery. Both of that behavior can be implemented by specialized subclasses. DBCP may wish to provide abstract classes that facilitate specialization. I fess up, I am the guilty party who added the ability to trace abandoned connections and recover them. ;-) Sorry to jump in late on this. I have been busy with other things. The motivation behind this was to allow a servlet container to continue operating normally even if you have customers who either wrote crappy code themselves or hired consultants who wrote crappy code. This helps improve servlet container availability in these situations and logs information which can help track down the problem. The only solution when crappy code causes problems with exhausting the connection pool is to stop and restart the container. I don't know about you, but I don't like getting paged in the evening or on weekends due to someone elses crappy code. I can appreciate the arguments for a cleaner DBCP implementation. And refactoring its design to clean it up can be a good thing. But the ability to track and close abandoned db connections is vital from my perspective. I strongly urge that the ability to do this be retained in DBCP. If the refactored core of DBCP allows this by subclasssing it, great. But those sub classes to support this should be released with DBCP. Regards, Glenn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Resources] When is the next release?
Unless I did something wrong, my search for issues on bugzilla turns up nothing, and I'm not sure what to make of issueTrackingUrl in project.xml. Does it mean that we should be using http://nagoya.apache.org/scarab/servlet/scarab/ or is it something that was just carried over when someone was creating this file? Using Maven to build and run the tests on this project fails. * Running ant test (with appropriate build.properties) will compile and test fine. * Running maven will compile fine, but does not copy the required .properties and .xml files needed by the tests. I don't know enough about Maven to determine whether this is configuration issue or a bug. So, with that out of the way, what exactly is stopping us from releasing commons-resources? Do we need more tests? Is there a checklist somewhere that I'm missing? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 678-910-8017 AIM:jmitchtx - Original Message - From: Steve Peterson [EMAIL PROTECTED] To: Struts Developers List [EMAIL PROTECTED] Sent: Saturday, July 19, 2003 5:16 PM Subject: RE: When is the next release? What needs to happen to get commons-resources out of the sandbox? I may have some time in the next week or two to contribute. Steve \At 05:05 PM 7/14/2003 -0700, David Graham wrote: --- James Turner [EMAIL PROTECTED] wrote: David Graham wrote: The plan all along was that 1.2.0 would include a move to commons-resources and no other major changes. However, commons-resources is still in the sandbox so I suggest we postpone that move to the next release. I've committed all of my interesting changes for 1.2.0 so I'd like to hear the status on the nested and tiles bugs plus the one Martin has assigned to himself. Also, is the validwhen vaildation working? Well, validWhen is checked into the release, and it's the same code I'm using on a live customer site, so my belief is that it is. We won't know how well it works until more users try it out and find bugs, but that's the nice thing about more frequent release cycles, right? I was just making sure there wasn't more to be done on it before a release. Hopefully it will help alleviate all the questions on requiredif :-). David James __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - 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]
DO NOT REPLY [Bug 21758] New: - [lang] lang.builder classes javadoc edits (mostly typo fixes)
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=21758. 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=21758 [lang] lang.builder classes javadoc edits (mostly typo fixes) Summary: [lang] lang.builder classes javadoc edits (mostly typo fixes) Product: Commons Version: 2.0 Alpha 1 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Lang AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 21758] - [lang] lang.builder classes javadoc edits (mostly typo fixes)
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=21758. 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=21758 [lang] lang.builder classes javadoc edits (mostly typo fixes) --- Additional Comments From [EMAIL PROTECTED] 2003-07-21 04:18 --- Created an attachment (id=7413) [PATCH] fixes typos in the javadocs for lang.builder classes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/modeler/src/java/org/apache/commons/modeler/util IntrospectionUtils.java
craigmcc2003/07/20 21:43:17 Modified:modeler/src/java/org/apache/commons/modeler BaseModelMBean.java modeler/src/java/org/apache/commons/modeler/modules MbeansSource.java ModelerSource.java modeler/src/java/org/apache/commons/modeler/util IntrospectionUtils.java Log: Cosmetic changes only, to clean up Javadoc warnings under 1.4.2. Revision ChangesPath 1.24 +5 -7 jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java Index: BaseModelMBean.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/BaseModelMBean.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- BaseModelMBean.java 20 Jul 2003 07:35:12 - 1.23 +++ BaseModelMBean.java 21 Jul 2003 04:43:16 - 1.24 @@ -918,7 +918,7 @@ * this MBean. * * @param listener The listener to be removed - * @param name The attribute name for which no more events are required + * @param attributeName The attribute name for which no more events are required * @param handback Handback object to be sent along with event * notifications * @@ -1313,8 +1313,6 @@ /** Set the type of the mbean. This is used as a key to locate * the description in the Registry. - * - * @param type the type of classname of the modeled object */ protected void createResource() { try { 1.14 +0 -2 jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java Index: MbeansSource.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansSource.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- MbeansSource.java 20 Jul 2003 07:35:12 - 1.13 +++ MbeansSource.java 21 Jul 2003 04:43:16 - 1.14 @@ -81,8 +81,6 @@ /** Return the list of mbeans created by this source. * It can be used to implement runtime services. - * - * @return */ public List getMBeans() { return mbeans; 1.7 +0 -1 jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/ModelerSource.java Index: ModelerSource.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/ModelerSource.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ModelerSource.java20 Jul 2003 07:35:12 - 1.6 +++ ModelerSource.java21 Jul 2003 04:43:16 - 1.7 @@ -24,7 +24,6 @@ * @param location * @param type * @param source Introspected object or some other source - * @return * @throws Exception */ public List loadDescriptors( Registry registry, String location, 1.5 +3 -3 jakarta-commons/modeler/src/java/org/apache/commons/modeler/util/IntrospectionUtils.java Index: IntrospectionUtils.java === RCS file: /home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/util/IntrospectionUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IntrospectionUtils.java 20 Jul 2003 07:35:13 - 1.4 +++ IntrospectionUtils.java 21 Jul 2003 04:43:16 - 1.5 @@ -659,10 +659,10 @@ /** * add elements from the classpath icp/i to a Vector * ijars/i as file URLs (We use Vector for JDK 1.1 compat). - * p - * @param bcp/b a String classpath of directory or jar file + * + * @param jars A vector of URLs + * @param cp a String classpath of directory or jar file *elements separated by path.separator delimiters. - * @return a Vector of URLs. */ public static void addJarsFromClassPath(Vector jars, String cp) throws IOException,MalformedURLException - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl CollectionResourcesBase.java PropertyResources.java PropertyResourcesFactory.java ResourceBundleResources.java ResourceBundleResourcesFactory.java WebappPropertyResources.java WebappPropertyResourcesFactory.java WebappXMLResources.java WebappXMLResourcesFactory.java XMLResources.java XMLResourcesFactory.java
craigmcc2003/07/20 21:57:22 Modified:resources/src/java/org/apache/commons/resources/impl CollectionResourcesBase.java PropertyResources.java PropertyResourcesFactory.java ResourceBundleResources.java ResourceBundleResourcesFactory.java WebappPropertyResources.java WebappPropertyResourcesFactory.java WebappXMLResources.java WebappXMLResourcesFactory.java XMLResources.java XMLResourcesFactory.java Log: Cosmetic changes only -- add import declarations that are needed only to satisfy [EMAIL PROTECTED] directives in the Javadocs, to avoid warnings from the Javadoc tool in JDK 1.4.2. (If checkstyle wants to complain about this, I've got a nice friendly bit bucket to show it :-). Revision ChangesPath 1.5 +5 -5 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java Index: CollectionResourcesBase.java === RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/CollectionResourcesBase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CollectionResourcesBase.java 19 Apr 2003 18:38:35 - 1.4 +++ CollectionResourcesBase.java 21 Jul 2003 04:57:21 - 1.5 @@ -69,7 +69,7 @@ import java.util.Locale; import java.util.Map; import java.util.TimeZone; - +import org.apache.commons.resources.Resources; import org.apache.commons.resources.ResourcesException; import org.apache.commons.resources.ResourcesKeyException; 1.5 +5 -4 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResources.java Index: PropertyResources.java === RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResources.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PropertyResources.java19 Apr 2003 18:31:16 - 1.4 +++ PropertyResources.java21 Jul 2003 04:57:21 - 1.5 @@ -73,6 +73,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.resources.Resources; /** 1.3 +5 -4 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResourcesFactory.java Index: PropertyResourcesFactory.java === RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/PropertyResourcesFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PropertyResourcesFactory.java 28 Feb 2003 02:50:22 - 1.2 +++ PropertyResourcesFactory.java 21 Jul 2003 04:57:21 - 1.3 @@ -65,6 +65,7 @@ import org.apache.commons.resources.Resources; import org.apache.commons.resources.ResourcesException; +import org.apache.commons.resources.ResourcesFactory; /** 1.7 +5 -4 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java Index: ResourceBundleResources.java === RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResources.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ResourceBundleResources.java 28 Feb 2003 02:50:22 - 1.6 +++ ResourceBundleResources.java 21 Jul 2003 04:57:21 - 1.7 @@ -75,6 +75,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.commons.resources.Resources; import org.apache.commons.resources.ResourcesException; import org.apache.commons.resources.ResourcesKeyException; 1.6 +5 -4 jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResourcesFactory.java Index: ResourceBundleResourcesFactory.java === RCS file: /home/cvs/jakarta-commons-sandbox/resources/src/java/org/apache/commons/resources/impl/ResourceBundleResourcesFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ResourceBundleResourcesFactory.java 28 Feb 2003 02:50:22 - 1.5 +++ ResourceBundleResourcesFactory.java 21 Jul 2003 04:57:21 - 1.6 @@ -65,6 +65,7 @@ import
DO NOT REPLY [Bug 21758] - [lang] lang.builder classes javadoc edits (mostly typo fixes)
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=21758. 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=21758 [lang] lang.builder classes javadoc edits (mostly typo fixes) [EMAIL PROTECTED] changed: What|Removed |Added Version|2.0 Alpha 1 |Nightly Builds - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [DBCP] AbandonedTrace - Connection Recovery
I fess up, I am the guilty party who added the ability to trace abandoned connections and recover them. ;-) Sorry to jump in late on this. I have been busy with other things. The motivation behind this was to allow a servlet container to continue operating normally even if you have customers who either wrote crappy code themselves or hired consultants who wrote crappy code. This helps improve servlet container availability in these situations and logs information which can help track down the problem. The only solution when crappy code causes problems with exhausting the connection pool is to stop and restart the container. I don't know about you, but I don't like getting paged in the evening or on weekends due to someone elses crappy code. I can appreciate the arguments for a cleaner DBCP implementation. And refactoring its design to clean it up can be a good thing. But the ability to track and close abandoned db connections is vital from my perspective. I strongly urge that the ability to do this be retained in DBCP. If the refactored core of DBCP allows this by subclasssing it, great. But those sub classes to support this should be released with DBCP. I strongly disagree. You getting paged due to someone's poor coding abilities is outside the scope of DBCP. There are much more effective ways of preventing pages than by developing a library that covers up coding mistakes so that they persist indefinitely. DBCP should be designed in a way that allows behaviors to be plugged in which includes grabbing abandoned connections. This should absolutely not be shipped with DBCP because there is no reasonable way for it to know what is abandoned in every situation. David Regards, Glenn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Image downloads...
Hey guys (and ladies), quick question. I've been using HttpClient for about 4 months now. I feel pretty comfortable with using it to do many things. My question is a simple one. If I have an image I need to download (www.SomeProvider.com/PICTURES/somePic.jpg), how do I get it? I've had to get images from providers using POST, I've used the GET method with a query string, but this have no query string. I get a file which has the size I expect, but yet when I try to view it, it says that file does not exist. I'm doing something wrong I just don't know what. Here's what I use for code: int nBuffSize = 1024*5; int readBytes = 0; long fileSize = 0; String szUrl = http://www.someURL.com/PICTURES/; + fileName; try{ //szFileName is the local path File f = new File(szFileName); if (f.exists()){ f.delete(); } f.createNewFile(); java.io.FileOutputStream fio = new FileOutputStream(f); BufferedOutputStream bos = new BufferedOutputStream( fio ,nBuffSize); //XTBrowser is my object which uses HttpClient. XTBrowser browser = new XTBrowser(szUrl, null, CAT); browser.openConnection(); browser.setHeaderPairs(Host,www.someURL.com); browser.configMethod(true, true); browser.getMethod(GET).setPath(/PICTURES/+fileName); InputStream instream = browser.executeMethodStream(browser.getMethod(GET)); CAT.debug(GetImage Writing Image! -- creating file: + szFileName); byte[] buffer = new byte[nBuffSize]; while (true){ if ((readBytes = instream.read(buffer)) == -1) break; else bos.write(buffer, 0 , readBytes); } bos.flush(); bos.close(); instream.close(); browser.closeConnection(); So what am I doing wrong? I just want to save the image to disk. Thanks in advance. Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Image downloads... - Nevermind
Sorry, I didn't realize the fileName I was passing in had several spaces tacked on the end of it. Guess that causes goofy things to happen. Thanks anyways. Jan Jan Gonsalves wrote: Hey guys (and ladies), quick question. I've been using HttpClient for about 4 months now. I feel pretty comfortable with using it to do many things. My question is a simple one. If I have an image I need to download (www.SomeProvider.com/PICTURES/somePic.jpg), how do I get it? I've had to get images from providers using POST, I've used the GET method with a query string, but this have no query string. I get a file which has the size I expect, but yet when I try to view it, it says that file does not exist. I'm doing something wrong I just don't know what. Here's what I use for code: int nBuffSize = 1024*5; int readBytes = 0; long fileSize = 0; String szUrl = http://www.someURL.com/PICTURES/; + fileName; try{ //szFileName is the local path File f = new File(szFileName); if (f.exists()){ f.delete(); } f.createNewFile(); java.io.FileOutputStream fio = new FileOutputStream(f); BufferedOutputStream bos = new BufferedOutputStream( fio ,nBuffSize); //XTBrowser is my object which uses HttpClient. XTBrowser browser = new XTBrowser(szUrl, null, CAT); browser.openConnection(); browser.setHeaderPairs(Host,www.someURL.com); browser.configMethod(true, true); browser.getMethod(GET).setPath(/PICTURES/+fileName); InputStream instream = browser.executeMethodStream(browser.getMethod(GET)); CAT.debug(GetImage Writing Image! -- creating file: + szFileName); byte[] buffer = new byte[nBuffSize]; while (true){ if ((readBytes = instream.read(buffer)) == -1) break; else bos.write(buffer, 0 , readBytes); } bos.flush(); bos.close(); instream.close(); browser.closeConnection(); So what am I doing wrong? I just want to save the image to disk. Thanks in advance. Jan - 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]
DO NOT REPLY [Bug 21754] - NullPointerException when releasing connection
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=21754. 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=21754 NullPointerException when releasing connection --- Additional Comments From [EMAIL PROTECTED] 2003-07-21 05:34 --- Hello Chris, is there a particular reason why you are trying to manage the connection yourself? I suggest the following changes to your code: - remove your getConnection() method - use HttpClient.setTimeout(int) to specify the timeout - use HttpClient.executeMethod(...) rather than HttpMethod.execute(...), so you don't need to allocate and release the connection explicitly - use HttpMethod.releaseConnection() to release the connection You'll have to keep a single instance of HttpClient, which itself keeps the references to the connection manager and state that are currently in your class. I know this doesn't explain the behaviour you observed, but it might help you to resolve the issue. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]