Re: Bean property comparator
Brian S O'Neill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] An alternative BeanComparator, that runs even faster is available in the TeaTrove project. http://teatrove.sourceforge.net/javadoc/com/go/trove/util/BeanComparator.html It relies on a builder patterm that auto-generates bytecode to avoid reflection calls and rule interpretation overhead. I have looked into it, and it is just cool... Thanks. Attila. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [beanutils] Indexed/Mapped DynaProperty
I'd like to add some remarks/questions: - in fact, the javadoc for the method DynaBean#get(String name) says Return the value of a simple property with the specified name and I though it was not allowed to call it on an indexed/mapped property without throwing an IllegalArgumentException - indexed properties always reference array or List types but what for Collection in a more general way ? Is there a restriction with this interface (except the fact that a collection does not always contain indexed element) ? Your solution would suit me perfectly if it could be extended to the Collection type. - I think another useful addition to the API would be iterator(property). This addition depends on the fact that we are able to work directly with collection or not... - why the signature of the method DynaBean#get(String name, String key) is not rather get(String name, Object key) ? Anyway, thanks for your replies, Guillaume. -Message d'origine- De : Niall Pemberton [mailto:[EMAIL PROTECTED] Envoyé : vendredi 13 février 2004 02:21 À : Jakarta Commons Developers List Objet : Re: [beanutils] Indexed/Mapped DynaProperty Shouldn't it be though - if you look at DynaProperty it has an isIndexed() method which checks if the type is either an array or a List and it has an isMapped() method which checks if the type is a Map. Doesn't that imply that these define the types for mapped and indexed properties? Obviously an implementation could ignore that and set/get values to other types (WrapDynaBean being an example that could break that rule). Interesting enough BasicDynaBean doesn't bother using these methods, but duplicates the code and I guess if the standard implementation ignores them, it doesn't give them much weight. Also, maybe my solution would suit Guillaume - because perhaps he knows all his mapped/indexed properties are backed by Maps, Lists and arrays and he can live with that - mine are and I don't think thats much of a restriction as they are only types and not implementations. Don't get me wrong, I'm not arguing against an API change - I think size(property) and keySet(property) methods would be v. useful additions to the API - less getting and casting - making code neater and simpler. Niall - Original Message - From: robert burrell donkin [EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] Sent: Thursday, February 12, 2004 10:43 PM Subject: Re: [beanutils] Indexed/Mapped DynaProperty i think that the issue is that though the property acts like a map, there is actually no guarantee that it will actually be backed by a map. a DynaBean is quite at liberty to use something different - for example, instances of an enumeration class. that's why i think an addition to the API would be needed which would allow the underlying implementation to be supply the information required. - robert On 10 Feb 2004, at 23:22, Niall Pemberton wrote: I don't understand what the issue is, if you want the keyset fro example then... Map myMap = (Map)myDynaBean.get(myMapPropertyName); Set myKeySet = myMap.keySet() Niall - Original Message - From: robert burrell donkin [EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] Cc: Jakarta Commons Users List [EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 10:26 PM Subject: Re: [beanutils] Indexed/Mapped DynaProperty hmmm bit of a tough one this. i think that it'd involve an addition to the DynaBean's API. this is question probably belongs on the dev list so i'd suggest that we take it there. (if you're unwilling to process - by filtering - the torrent of mail that is commons-dev then you might like to subscribe through the news bridge at gname, i think.) - robert On 6 Feb 2004, at 09:07, [EMAIL PROTECTED] wrote: Hi, is it possible to have the length/keyset of an indexed/mapped dynaproperty ? My wish is to copy a dynaproperty from a dynabean to another, any other solution will be appreciated... TIA, Guillaume. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [beanutils] Indexed/Mapped DynaProperty
I agree it could be read that way, with the word simple implying that. But then the same author (Craig McClanahan) also wrote the standard BasicDynaBean implementation - it has a single HashMap storing all values - simple, indexed and mapped. The get(property) does return values.get(name) The get(property, index) does either return ((List)values.get(name)).get(index) or return Array.get(values.get(name), index) The get(name, key) does return ((Map)values.get(name)).get(key) And it works perfectly well in BasicDynaBean (not throwing an IllegalArgumentException) if you do set(name, List) (List)get(name) get(name, index) set(name, index) It would be wrong for an implementation to use Collection for its indexed properties because, as you say, there is no concept of an index in the Collection interface - so how could it determine which value to return for get(name, index) or where to store it in set(name, index)? Maybe you could bodge something together which would work for some Collection implementations (e.g. List), but you couldn't gurantee it would work for all, so it would be wrong. I think the same kind of logic goes for Robert's argument that mapped properties could be backed by an Enumeration - there is no concept of a key in an Enumeration, so how could an implemtation of DynaBean be written based on that? I think most people would understand that they are called Mapped properties because they are backed by a Map. If the other things you are asking for were added to the API, then I think iterator(property) would be redundant. I think the reason that get(String name, String key) takes a String for the key is that DynaBeans represent properties - and properties have String names. A mapped property should be just that - a map containing properties and therefore those properties should have String names. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:27 AM Subject: RE: [beanutils] Indexed/Mapped DynaProperty I'd like to add some remarks/questions: - in fact, the javadoc for the method DynaBean#get(String name) says Return the value of a simple property with the specified name and I though it was not allowed to call it on an indexed/mapped property without throwing an IllegalArgumentException - indexed properties always reference array or List types but what for Collection in a more general way ? Is there a restriction with this interface (except the fact that a collection does not always contain indexed element) ? Your solution would suit me perfectly if it could be extended to the Collection type. - I think another useful addition to the API would be iterator(property). This addition depends on the fact that we are able to work directly with collection or not... - why the signature of the method DynaBean#get(String name, String key) is not rather get(String name, Object key) ? Anyway, thanks for your replies, Guillaume. -Message d'origine- De : Niall Pemberton [mailto:[EMAIL PROTECTED] Envoyé : vendredi 13 février 2004 02:21 À : Jakarta Commons Developers List Objet : Re: [beanutils] Indexed/Mapped DynaProperty Shouldn't it be though - if you look at DynaProperty it has an isIndexed() method which checks if the type is either an array or a List and it has an isMapped() method which checks if the type is a Map. Doesn't that imply that these define the types for mapped and indexed properties? Obviously an implementation could ignore that and set/get values to other types (WrapDynaBean being an example that could break that rule). Interesting enough BasicDynaBean doesn't bother using these methods, but duplicates the code and I guess if the standard implementation ignores them, it doesn't give them much weight. Also, maybe my solution would suit Guillaume - because perhaps he knows all his mapped/indexed properties are backed by Maps, Lists and arrays and he can live with that - mine are and I don't think thats much of a restriction as they are only types and not implementations. Don't get me wrong, I'm not arguing against an API change - I think size(property) and keySet(property) methods would be v. useful additions to the API - less getting and casting - making code neater and simpler. Niall - Original Message - From: robert burrell donkin [EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] Sent: Thursday, February 12, 2004 10:43 PM Subject: Re: [beanutils] Indexed/Mapped DynaProperty i think that the issue is that though the property acts like a map, there is actually no guarantee that it will actually be backed by a map. a DynaBean is quite at liberty to use something different - for example, instances of an enumeration class. that's why i think an addition to the API would be needed which would allow the underlying implementation to be supply the information required. - robert On 10 Feb 2004, at 23:22, Niall
Re: new HashedSet + WeakHashedSet classes
Hi, probably some one can help. I am trying to unsubscribe from this mailing list for couple of months and have written twice to [EMAIL PROTECTED] writing unsubscribe in subject. Please help. Abhishek From: Henry Story [EMAIL PROTECTED] Reply-To: Jakarta Commons Developers List [EMAIL PROTECTED] To: Jakarta Commons Developers List [EMAIL PROTECTED] CC: [EMAIL PROTECTED], Stephen Colebourne [EMAIL PROTECTED] Subject: Re: new HashedSet + WeakHashedSet classes Date: Fri, 13 Feb 2004 11:29:37 +0100 The source is now available online under the src directory as well as the original changes.tar file. http://bblfish.net/java/collections/src Henry On 13 Feb 2004, at 10:06, Henry Story wrote: I have now finished the two new classes HashedSet and WeakHashedSet. I have added some tests for them, though I should add a lot more. To make this work I needed to make a few changes to AbstractHashedMap. These changes had a few repercussions on other classes. But they now run all the tests successfully. They classes with UML diagrams and some explanations are available on my web site at: http://bblfish.net/java/collections/ Please let me know if this is the wrong place to post this. Thanks, Henry Story - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ MSN Hotmail now on your Mobile phone. http://server1.msn.co.in/sp03/mobilesms/ Click here. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [beanutils] Indexed/Mapped DynaProperty
You're right, get(name, index)/set(name, index) could not apply to the Collection interface directly because the order is not guaranteed. But this means that Collection/Set are not treated by the current API in a neat way. Instead of dynabean.set(name, ((Collection) dynabean.get(name)).add(value)); I'd prefer to write dynabean.add(name, value); and then the iterator(property) would be useful to iterate on the collection items like a isCollection() on a dynaproperty... But maybe that's not the philosophy of the API and in this case I agree with you it would be redundant if the other methods would be added. Guillaume. -Message d'origine- De : Niall Pemberton [mailto:[EMAIL PROTECTED] Envoyé : vendredi 13 février 2004 11:54 À : Jakarta Commons Developers List Objet : Re: [beanutils] Indexed/Mapped DynaProperty I agree it could be read that way, with the word simple implying that. But then the same author (Craig McClanahan) also wrote the standard BasicDynaBean implementation - it has a single HashMap storing all values - simple, indexed and mapped. The get(property) does return values.get(name) The get(property, index) does either return ((List)values.get(name)).get(index) or return Array.get(values.get(name), index) The get(name, key) does return ((Map)values.get(name)).get(key) And it works perfectly well in BasicDynaBean (not throwing an IllegalArgumentException) if you do set(name, List) (List)get(name) get(name, index) set(name, index) It would be wrong for an implementation to use Collection for its indexed properties because, as you say, there is no concept of an index in the Collection interface - so how could it determine which value to return for get(name, index) or where to store it in set(name, index)? Maybe you could bodge something together which would work for some Collection implementations (e.g. List), but you couldn't gurantee it would work for all, so it would be wrong. I think the same kind of logic goes for Robert's argument that mapped properties could be backed by an Enumeration - there is no concept of a key in an Enumeration, so how could an implemtation of DynaBean be written based on that? I think most people would understand that they are called Mapped properties because they are backed by a Map. If the other things you are asking for were added to the API, then I think iterator(property) would be redundant. I think the reason that get(String name, String key) takes a String for the key is that DynaBeans represent properties - and properties have String names. A mapped property should be just that - a map containing properties and therefore those properties should have String names. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:27 AM Subject: RE: [beanutils] Indexed/Mapped DynaProperty I'd like to add some remarks/questions: - in fact, the javadoc for the method DynaBean#get(String name) says Return the value of a simple property with the specified name and I though it was not allowed to call it on an indexed/mapped property without throwing an IllegalArgumentException - indexed properties always reference array or List types but what for Collection in a more general way ? Is there a restriction with this interface (except the fact that a collection does not always contain indexed element) ? Your solution would suit me perfectly if it could be extended to the Collection type. - I think another useful addition to the API would be iterator(property). This addition depends on the fact that we are able to work directly with collection or not... - why the signature of the method DynaBean#get(String name, String key) is not rather get(String name, Object key) ? Anyway, thanks for your replies, Guillaume. -Message d'origine- De : Niall Pemberton [mailto:[EMAIL PROTECTED] Envoyé : vendredi 13 février 2004 02:21 À : Jakarta Commons Developers List Objet : Re: [beanutils] Indexed/Mapped DynaProperty Shouldn't it be though - if you look at DynaProperty it has an isIndexed() method which checks if the type is either an array or a List and it has an isMapped() method which checks if the type is a Map. Doesn't that imply that these define the types for mapped and indexed properties? Obviously an implementation could ignore that and set/get values to other types (WrapDynaBean being an example that could break that rule). Interesting enough BasicDynaBean doesn't bother using these methods, but duplicates the code and I guess if the standard implementation ignores them, it doesn't give them much weight. Also, maybe my solution would suit Guillaume - because perhaps he knows all his mapped/indexed properties are backed by Maps, Lists and arrays and he can live with that - mine are and I don't think thats much of a restriction as they are only types and not implementations. Don't get me wrong, I'm not arguing against an API change - I
Re: new HashedSet + WeakHashedSet classes
Henry Story wrote: I have now finished the two new classes HashedSet and WeakHashedSet. I have added some tests for them, though I should add a lot more. To make this work I needed to make a few changes to AbstractHashedMap. These changes had a few repercussions on other classes. But they now run all the tests successfully. They classes with UML diagrams and some explanations are available on my web site at: http://bblfish.net/java/collections/ You don't need to cross post. Since your talking about new classes and submitting patches, this discussion probably belongs on the developer list, not the user list. And Stephen is subscribed to the list, so you shouldn't need to email him directly. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26918] New: - Cannot populate Stirng[][] properties with beanutils
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=26918. 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=26918 Cannot populate Stirng[][] properties with beanutils Summary: Cannot populate Stirng[][] properties with beanutils Product: Commons Version: 1.6 Final Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Bean Utilities AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hello, It seems that BeanUtils.populate(bean,map) cannot populate properties whose type is double (or triple, or quadruple...) arrays. The following testCase seems to prove this : / package fr.factory.test.commons; import java.util.HashMap; import junit.framework.TestCase; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Class TestBeanUtils * @author lmaitre */ public class TestBeanUtils extends TestCase { private Log log = LogFactory.getLog(TestBeanUtils.class); /** * Constructor for TestBeanUtils. * @param name */ public TestBeanUtils(String name) { super(name); } public static void main(String[] args) { junit.textui.TestRunner.run(TestBeanUtils.class); } final public void testPopulate() { SampleBean bean = new SampleBean(); String[][] sampleValue = { { toto,titi }, { tata,tutu } }; HashMap properties = new HashMap(); properties.put(doubleArrayProperty,sampleValue); try { BeanUtils.populate(bean,properties); assertTrue(bean.getDoubleArrayProperty()==sampleValue); } catch (Exception e) { log.debug(Exception : + e.getMessage()); e.printStackTrace(); } } private class SampleBean { private String[][] doubleArrayProperty; /** * Method getDoubleArrayProperty * @return String[][] */ public String[][] getDoubleArrayProperty() { return doubleArrayProperty; } /** * Method setDoubleArrayProperty * @return void */ public void setDoubleArrayProperty(String[][] strings) { doubleArrayProperty= strings; } } } // this give the following stack trace : java.lang.reflect.InvocationTargetException: Cannot set doubleArrayProperty at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1022) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) at fr.factory.test.commons.TestBeanUtils.testPopulate(TestBeanUtils.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)17:40:16 TestBeanUtils: Exception :Cannot set doubleArrayProperty at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167) Caused by: java.lang.NoSuchMethodException: Property 'doubleArrayProperty' has no setter method at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1782) at
DO NOT REPLY [Bug 26922] New: - public static boolean DateUtils.equals(Date dt1, Date dt2) ?
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=26922. 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=26922 public static boolean DateUtils.equals(Date dt1, Date dt2) ? Summary: public static boolean DateUtils.equals(Date dt1, Date dt2) ? Product: Commons Version: 2.0 Final Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Lang AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] Hello, In org.apache.commons.lang.StringUtils, we can find StringUtils.equals(?,?). org.apache.commons.lang.time.DateUtils should have the same. Like this : /** * pCompares two Dates, returning codetrue/code if they are equal./p * * pcodenull/codes are handled without exceptions. Two codenull/code * references are considered to be equal./p * * pre * DateUtils.equals(null, null) = true * DateUtils.equals(null, abc) = false * DateUtils.equals(abc, null) = false * DateUtils.equals(abc, abc) = true * DateUtils.equals(abc, ABC) = false * /pre * * @see java.util.Date#equals(Object) * @param dt1 the first Date, may be null * @param dt2 the second Date, may be null * @return codetrue/code if the Dates are equal or both codenull/code */ public static boolean equals(Date dt1, Date dt2) { return (dt1 == null ? dt2 == null : dt1.equals(dt2)); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26922] - public static boolean DateUtils.equals(Date dt1, Date dt2) ?
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=26922. 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=26922 public static boolean DateUtils.equals(Date dt1, Date dt2) ? --- Additional Comments From [EMAIL PROTECTED] 2004-02-13 18:55 --- Other than the stronger typed method signature, how is what you propose any different than the equals method in ObjectUtils? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26926] New: - distinction between required arguments in help formatter
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=26926. 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=26926 distinction between required arguments in help formatter Summary: distinction between required arguments in help formatter Product: Commons Version: 1.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] It would be nice if you could optionally break up the output of the help formatter into required arguments and optional arguments. The average user on a lot of applications only cares about the required arguments, so it would be nice if those showed up first and it was clear that the arguments below them were optional. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26928] New: - the ability to add validate to options that spanned multiple options
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=26928. 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=26928 the ability to add validate to options that spanned multiple options Summary: the ability to add validate to options that spanned multiple options Product: Commons Version: 1.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I see two types of validation that would be helpful. First, the ability to validate an option based on the presence of other options. For instance, you might want option y to be required but only if option x is specified. Second, the ability to validate values for an option. For instance, you might have a File type option, but the file must exist in order for it to be valid. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26929] New: - the ability to have long options that only use one hyphen
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=26929. 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=26929 the ability to have long options that only use one hyphen Summary: the ability to have long options that only use one hyphen Product: Commons Version: 1.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] This may break some of the parsers and\or some other conventions, but I think it would be nice if you could have multi character options that only require one hyphen. On programs that have several options, the single hyphen options don't seem to be very intuitive. It would be less of an issue if you could hide the single hyphen options when you use the help formatter, but as it is now the user has to view all of these single hyphen commands that don't really mean much to the user. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26922] - public static boolean DateUtils.equals(Date dt1, Date dt2) ?
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=26922. 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=26922 public static boolean DateUtils.equals(Date dt1, Date dt2) ? --- Additional Comments From [EMAIL PROTECTED] 2004-02-13 19:22 --- I was going to comment on this, but this actually answers the comment by Brent. I suggest DateUtils.equals would test the getTime() method. long now = System.currentTimeMillis(); java.util.Date date = new java.util.Date(now); java.util.Date timestamp = new java.sql.Timestamp(now); DateUtils.equals(date, timestamp) = true however ObjectUtils.equals(date, timestamp) = false - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26930] New: - better exception messages when validating required fields
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=26930. 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=26930 better exception messages when validating required fields Summary: better exception messages when validating required fields Product: Commons Version: 1.0 Final Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] If the exception messages when required fields aren't found were worded a bit better, it would prevent users of this API from having to regenerate messages to their users on what went wrong. As it is now, the exception message just states the names of the options that were not found. If this message contained some phrase stating something like: The following required fields were not found: -r, -g., then we could just pass the exception message on to the user. A better way to approach the problem might be some sort of way to customize common error messages as long as it was done in a way that would reduce the amount of coding needed by the user of the API. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26931] New: - CommandLine.hasOption type method that takes argument name
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=26931. 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=26931 CommandLine.hasOption type method that takes argument name Summary: CommandLine.hasOption type method that takes argument name Product: Commons Version: 1.0 Alpha Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: Other Component: CLI AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] The CommandLine.hasOption method seems to require you specify the single character option value which in a lot of cases is rather meaningless. It would be nice if you could pass in the argument name which probably has much more meaning. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Request for getLog(Object) method
Title: Request for getLog(Object) method As part of implementing JCL, we need to be able to obtain Log objects based on the referring object, basically using a custom Log and Factory implementations to inspect an object to determine the appropriate name to use for logging. I can clarify this further if necessary. In order to do this, I'm proposing these changes: * a new overloaded version of the static method getLog that accepts an Object be added to LogFactory * a new overloaded version of the instance method getInstance that accepts an Object be added to LogFactory * a new default implementation of getInstance(Object) be added to LogFactoryImpl that uses the object's class name as the log name. Attached is a diff file representing these changes. This is my first time doing this, so please let me know (in a nice way) if I've done something incorrect. I did not post this directly to bugzilla under the theory that there may need to be some discussion of this request. Justin Edelson Software Developer MTVi object_method.diff - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Request for getLog(Object) method
As part of implementing JCL, we need to be able to obtain Log objects based on the referring object, basically using a custom Log and Factory implementations to inspect an object to determine the appropriate name to use for logging. I can clarify this further if necessary. In order to do this, I'm proposing these changes: * a new overloaded version of the static method getLog that accepts an Object be added to LogFactory * a new overloaded version of the instance method getInstance that accepts an Object be added to LogFactory * a new default implementation of getInstance(Object) be added to LogFactoryImpl that uses the object's class name as the log name. Attached is a diff file representing these changes. This is my first time doing this, so please let me know (in a nice way) if I've done something incorrect. I did not post this directly to bugzilla under the theory that there may need to be some discussion of this request. Justin Edelson Software Developer MTVi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang][proposal] SystemUtils property out of sync problem; add set methods.
From: Gary Gregory [EMAIL PROTECTED] snip Certainly, adding javadoc to say that the values are set when the class is class loaded is a good idea. snip How about: * p * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value * will be out of sync with that System property. * /p +1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang][proposal] SystemUtils property out of sync problem; add set methods.
From: Gary Gregory [EMAIL PROTECTED] Do people really change these values? (other than in tests, which kinda don't count...) My feeling is that is does not matter what /kind/ of call site uses (for example) SystemUtils, whether it is application code or unit test code. My application, in general terms, is the client/customer. What matters is that [lang] provides the services that make my job of writing code easier/better/faster. The point I'm really driving at is where the limits of [lang] lie. There is no technical difficulty (other than its a bit boring) of adding get and set methods for each system property in addition to the constants. The question is whether it serves a big enough need. Maybe there is a large need to change environment variables, but I just feel a little unconvinced. Consider me -0 I guess. Stephen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DateUtils.equals(d1, d2)
There was a bugzilla issue opened about this, and a brief discussion about such, but I wanted to move it to the list for better visibility. Basically if you have 2 date objects (e.g., java.util.Date and java.sql.Timestamp), ObjectUtils.equals() will return that they are not equal even if they represent the same point in time. Unless someone objects, I was going to add DateUtils.equals(Date d1, Date d2) and the equality check will be what's returned from each date's getTime(). Just as an example: long now = System.currentTimeMillis(); Date date = new java.util.Date(now); Date ts = new java.sql.Timestamp(now); ObjectUtils.equals(date, ts) = false; (as of 2.1) DateUtils.equals(date, ts) = true; Anyone have a different idea or think this is a bad idea? -- Serge Knystautas President Lokitech software . strategy . design http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang/enum EnumTest.java
scolebourne2004/02/13 15:17:45 Modified:lang/src/test/org/apache/commons/lang/enum EnumTest.java Log: Handle broken test actually working on Linux Sun JDK 1.4.1 Revision ChangesPath 1.15 +11 -5 jakarta-commons/lang/src/test/org/apache/commons/lang/enum/EnumTest.java Index: EnumTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/enum/EnumTest.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- EnumTest.java 12 Feb 2004 01:00:05 - 1.14 +++ EnumTest.java 13 Feb 2004 23:17:45 - 1.15 @@ -62,6 +62,7 @@ import java.util.List; import java.util.Map; +import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; @@ -432,10 +433,15 @@ public void testNestedBroken() { List list = new ArrayList(NestBroken.ColorEnum.getEnumList()); -assertEquals(0, list.size()); // no enums!!! -// this is BROKEN because the enum constants are defined in a DIFFERENT -// class from getEnumList(). Once NestBroken class is referenced, -// and thus class loaded with its enum constants, the getEnumList works: +try { +assertEquals(0, list.size()); // no enums!!! +// this is BROKEN because the enum constants are defined in a DIFFERENT +// class from getEnumList(). Once NestBroken class is referenced, +// and thus class loaded with its enum constants, the getEnumList works: +} catch (AssertionFailedError ex) { +// this actually works and isn't broken on Linux SunJDK1.4.1, so... +assertEquals(3, list.size()); +} new NestBroken(); list = new ArrayList(NestBroken.ColorEnum.getEnumList()); assertEquals(3, list.size()); // all is well!!! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] build fails on JDK 1.4.1, okay on JDK 1.3.1
Change made, hopefully that will sort it, but ideally Janek needs to test - Original Message - From: Phil Steitz [EMAIL PROTECTED] Gary Gregory wrote: There has been some discussion on this list in the past WRT broken enum tests on 1.4 vs 1.3. I am not sure what was decided... Unfortunately, we did not come to a conclusion. IIRC, this is a platform-specific problem, or actually more accurately put a platform-specific failure to fail. On Sun Linux JDK 1.4.x, testNestedBroken fails to illustrate the initialization problem that occurs on other platforms. I suggested that we remove this test, but we never got consensus. I think we should remove it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [lang][proposal] SystemUtils property out of sync problem; ad d set methods.
I'm not too strongly convinced either :-P it seems like a usability edge case I suppose. If you are going to set a System property we wrap, just beware. Gary -Original Message- From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 15:12 To: Jakarta Commons Developers List Subject: Re: [lang][proposal] SystemUtils property out of sync problem; add set methods. From: Gary Gregory [EMAIL PROTECTED] Do people really change these values? (other than in tests, which kinda don't count...) My feeling is that is does not matter what /kind/ of call site uses (for example) SystemUtils, whether it is application code or unit test code. My application, in general terms, is the client/customer. What matters is that [lang] provides the services that make my job of writing code easier/better/faster. The point I'm really driving at is where the limits of [lang] lie. There is no technical difficulty (other than its a bit boring) of adding get and set methods for each system property in addition to the constants. The question is whether it serves a big enough need. Maybe there is a large need to change environment variables, but I just feel a little unconvinced. Consider me -0 I guess. Stephen - 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
scolebourne2004/02/13 15:32:39 Modified:lang/src/java/org/apache/commons/lang StringUtils.java Log: Add comment about new Tokenizer class in split method Revision ChangesPath 1.123 +7 -4 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.122 retrieving revision 1.123 diff -u -r1.122 -r1.123 --- StringUtils.java 24 Dec 2003 01:33:30 - 1.122 +++ StringUtils.java 13 Feb 2004 23:32:39 - 1.123 @@ -1984,7 +1984,8 @@ * Whitespace is defined by [EMAIL PROTECTED] Character#isWhitespace(char)}./p * * pThe separator is not included in the returned String array. - * Adjacent separators are treated as one separator./p + * Adjacent separators are treated as one separator. + * For more control over the split use the Tokenizer class./p * * pA codenull/code input String returns codenull/code./p * @@ -2008,7 +2009,8 @@ * This is an alternative to using StringTokenizer./p * * pThe separator is not included in the returned String array. - * Adjacent separators are treated as one separator./p + * Adjacent separators are treated as one separator. + * For more control over the split use the Tokenizer class./p * * pA codenull/code input String returns codenull/code./p * @@ -2064,7 +2066,8 @@ * This is an alternative to using StringTokenizer./p * * pThe separator is not included in the returned String array. - * Adjacent separators are treated as one separator./p + * Adjacent separators are treated as one separator. + * For more control over the split use the Tokenizer class./p * * pA codenull/code input String returns codenull/code. * A codenull/code separatorChars splits on whitespace./p - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] split join
Done Stephen - Original Message - From: Gary Gregory [EMAIL PROTECTED] To: 'Jakarta Commons Developers List' [EMAIL PROTECTED] Sent: Friday, February 13, 2004 5:49 AM Subject: RE: [lang] split join Would adding a Javadoc pointer to Tokenizer be helpful? Gary -Original Message- From: Inger, Matthew [mailto:[EMAIL PROTECTED] Sent: Thursday, February 12, 2004 10:34 To: 'Jakarta Commons Developers List' Subject: RE: [lang] split join Look at the new Tokenizer class. It will handle CSV records, and has the following options: treat empty tokens as null values, ignore empty/null tokens, along with some other stuff. -Original Message- From: Emmanuel Bourg [mailto:[EMAIL PROTECTED] Sent: Thursday, February 12, 2004 12:27 PM To: Jakarta Commons Developers List Subject: [lang] split join Hi, i noticed that the split method in StringUtils is not the reverse operation of join, is this intended ? The split method treats adjacent separators as one separator unlike the Perl and JDK 1.4 split functions. That means it's not possible to join an array and then split the result to get a similar array, that's quite annoying when manipulating CSV records. For example: String[] tab1 = new String[] { a, b, , d }; String[] tab2 = StringUtils.split(StringUtils.join(tab1, ';'), ';'); here tab2 = { a, b, d }, the 3rd element of tab1 is lost. That may be nice to have a flag on the split methods indicating if the separators must be merged, or a new set of methods (slice()?) with the same signatures and handling empty elements. Emmanuel Bourg - 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/lang/src/java/org/apache/commons/lang SystemUtils.java
ggregory2004/02/13 16:23:50 Modified:lang/src/java/org/apache/commons/lang SystemUtils.java Log: Javadoc and added some system properties. Revision ChangesPath 1.31 +305 -7 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.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- SystemUtils.java 12 Feb 2004 01:58:33 - 1.30 +++ SystemUtils.java 14 Feb 2004 00:23:50 - 1.31 @@ -107,6 +107,12 @@ * pDefaults to codenull/code if the runtime does not have * security access to read this property or the property does not exist./p * + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * * @since 2.1 */ public static final String AWT_TOOLKIT = getSystemProperty(awt.toolkit); @@ -118,8 +124,14 @@ * pDefaults to codenull/code if the runtime does not have * security access to read this property or the property does not exist./p * + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * * @since 2.0 - * @since Java 1.2. + * @since Java 1.2 */ public static final String FILE_ENCODING = getSystemProperty(file.encoding); @@ -130,17 +142,77 @@ * pDefaults to codenull/code if the runtime does not have * security access to read this property or the property does not exist./p * - * @since Java 1.1. + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * + * @since Java 1.1 */ public static final String FILE_SEPARATOR = getSystemProperty(file.separator); /** + * pThe codejava.awt.fonts/code System Property./p + * + * pDefaults to codenull/code if the runtime does not have + * security access to read this property or the property does not exist./p + * + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * + * @since 2.1 + */ +public static final String JAVA_AWT_FONTS = getSystemProperty(java.awt.fonts); + +/** + * pThe codejava.awt.graphicsenv/code System Property./p + * + * pDefaults to codenull/code if the runtime does not have + * security access to read this property or the property does not exist./p + * + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * + * @since 2.1 + */ +public static final String JAVA_AWT_GRAPHICSENV = getSystemProperty(java.awt.graphicsenv); + +/** + * pThe codejava.awt.printerjob/code System Property./p + * + * pDefaults to codenull/code if the runtime does not have + * security access to read this property or the property does not exist./p + * + * p + * This value is initialized when the class is loaded. If [EMAIL PROTECTED] System#setProperty(String,String)} + * or [EMAIL PROTECTED] System#setProperties(java.util.Properties)} is called after this class is loaded, the value + * will be out of sync with that System property. + * /p + * + * @since 2.1 + */ +public static final String JAVA_AWT_PRINTERJOB = getSystemProperty(java.awt.printerjob); + +/** * pThe codejava.class.path/code System Property. Java class path./p * * pDefaults to codenull/code if the runtime does not have * security access to read this
DO NOT REPLY [Bug 26877] - [lang] Add SystemUtils.AWT_TOOLKIT and others.
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=26877. 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=26877 [lang] Add SystemUtils.AWT_TOOLKIT and others. [EMAIL PROTECTED] changed: What|Removed |Added Summary|[lang] Add |[lang] Add |SystemUtils.AWT_TOOLKIT.|SystemUtils.AWT_TOOLKIT and ||others. --- Additional Comments From [EMAIL PROTECTED] 2004-02-14 00:25 --- Added JAVA_AWT_FONTS, JAVA_AWT_GRAPHICSENV, JAVA_AWT_PRINTERJOB, JAVA_UTIL_PREFS_PREFERENCES_FACTORY, USER_TIMEZONE. Not a system property per se, but IS_OS_UNIX is new to 2.1. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang Tokenizer.java
scolebourne2004/02/13 16:31:55 Modified:lang/src/test/org/apache/commons/lang TokenizerTest.java lang/src/java/org/apache/commons/lang Tokenizer.java Log: Improve Tokenizer with CSV and TSV plus change default to StringTokenizer like includes code from Matthew Inger Revision ChangesPath 1.2 +136 -3 jakarta-commons/lang/src/test/org/apache/commons/lang/TokenizerTest.java Index: TokenizerTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/TokenizerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TokenizerTest.java17 Nov 2003 23:02:18 - 1.1 +++ TokenizerTest.java14 Feb 2004 00:31:55 - 1.2 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002-2003 The Apache Software Foundation. All rights + * Copyright (c) 2003-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,6 +90,9 @@ String input = a;b;c;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); +tok.setIgnoredMatcher(Tokenizer.TRIM_MATCHER); +tok.setIgnoreEmptyTokens(false); String tokens [] = tok.getAllTokens(); String expected[] = new String[] @@ -120,7 +123,9 @@ String input = a;b;c ;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); tok.setIgnoredMatcher(Tokenizer.NONE_MATCHER); +tok.setIgnoreEmptyTokens(false); String tokens [] = tok.getAllTokens(); String expected[] = new String[] @@ -151,7 +156,9 @@ String input = a;b; c;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); tok.setIgnoredMatcher(Tokenizer.NONE_MATCHER); +tok.setIgnoreEmptyTokens(false); String tokens [] = tok.getAllTokens(); String expected[] = new String[] @@ -182,6 +189,8 @@ String input = a;b; c;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); +tok.setIgnoredMatcher(Tokenizer.TRIM_MATCHER); tok.setIgnoreEmptyTokens(true); String tokens [] = tok.getAllTokens(); @@ -210,6 +219,9 @@ String input = a;b; c;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); +tok.setIgnoredMatcher(Tokenizer.TRIM_MATCHER); +tok.setIgnoreEmptyTokens(false); tok.setEmptyTokenAsNull(true); String tokens [] = tok.getAllTokens(); @@ -241,6 +253,9 @@ String input = a;b; c;\d;\\e\;f; ; ;; Tokenizer tok = new Tokenizer(input); tok.setDelimiterChar(';'); +tok.setQuoteChar(''); +tok.setIgnoredMatcher(Tokenizer.TRIM_MATCHER); +tok.setIgnoreEmptyTokens(false); //tok.setTreatingEmptyAsNull(true); String tokens [] = tok.getAllTokens(); @@ -285,7 +300,8 @@ String input = a b c \d e\ f ; Tokenizer tok = new Tokenizer(input); -tok.setDelimiterMatcher(Tokenizer.SPACES_MATCHER); +tok.setDelimiterMatcher(Tokenizer.SPACE_MATCHER); +tok.setQuoteMatcher(Tokenizer.DOUBLE_QUOTE_MATCHER); tok.setIgnoredMatcher(Tokenizer.NONE_MATCHER); tok.setIgnoreEmptyTokens(false); String tokens [] = tok.getAllTokens(); @@ -317,7 +333,8 @@ String input = a b c \d e\ f ; Tokenizer tok = new Tokenizer(input); -tok.setDelimiterMatcher(Tokenizer.SPACES_MATCHER); +tok.setDelimiterMatcher(Tokenizer.SPACE_MATCHER); +tok.setQuoteMatcher(Tokenizer.DOUBLE_QUOTE_MATCHER); tok.setIgnoredMatcher(Tokenizer.NONE_MATCHER); tok.setIgnoreEmptyTokens(true); String tokens [] = tok.getAllTokens(); @@ -341,4 +358,120 @@ } +public void testBasic1() { +String input = a b c; +Tokenizer tok = new Tokenizer(input); +assertEquals(a, tok.next()); +assertEquals(b, tok.next()); +assertEquals(c, tok.next()); +} + +public void testBasic2() { +String input = a \nb\fc; +Tokenizer tok = new Tokenizer(input); +assertEquals(a, tok.next()); +assertEquals(b, tok.next()); +assertEquals(c, tok.next()); +} + +
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang ValidateTest.java
scolebourne2004/02/13 16:48:20 Modified:lang/src/java/org/apache/commons/lang Validate.java lang/src/test/org/apache/commons/lang ValidateTest.java Log: Add validate methods for all elements same type bug 25683, from Norm Deane Revision ChangesPath 1.9 +51 -1 jakarta-commons/lang/src/java/org/apache/commons/lang/Validate.java Index: Validate.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/Validate.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Validate.java 11 Feb 2004 23:33:23 - 1.8 +++ Validate.java 14 Feb 2004 00:48:19 - 1.9 @@ -71,6 +71,7 @@ * @author a href=mailto:[EMAIL PROTECTED]Ola Berg/a * @author Stephen Colebourne * @author Gary Gregory + * @author Norm Deane * @since 2.0 * @version $Id$ */ @@ -527,6 +528,55 @@ throw new IllegalArgumentException(The validated collection contains null element at index: + i); } } +} + +/** + * pValidate an argument, throwing codeIllegalArgumentException/code + * if the argument collection is codenull/code or has elements that + * are not of type codeclazz/code./p + * + * pre + * Validate.allElementsOfClass(collection, String.class, Collection has invalid elements); + * /pre + * + * @param collection the collection to check + * @param clazz the codeClass/code which the collection's elements are expected to be + * @param message the exception message if the codeCollection/code has elements not of type codeclazz/code + * @since 2.1 + */ +public static void allElementsOfClass(Collection collection, Class clazz, String message) { + Validate.notNull(collection); + for (Iterator it = collection.iterator(); it.hasNext(); ) { + if ((it.next().getClass().equals(clazz)) == false) { + throw new IllegalArgumentException(message); + } + } +} + +/** + * pValidate an argument, throwing codeIllegalArgumentException/code + * if the argument collection is codenull/code or has elements that are not of + * type codeclazz/code./p + * + * pre + * Validate.allElementsOfClass(collection, String.class); + * /pre + * + * pThe message in the exception is 'The validated collection contains an element not of type clazz at index: './p + * + * @param collection the collection to check + * @param clazz the codeClass/code which the collection's elements are expected to be + * @since 2.1 + */ +public static void allElementsOfClass(Collection collection, Class clazz) { + Validate.notNull(collection); + int i = 0; + for (Iterator it = collection.iterator(); it.hasNext(); i++) { + if ((it.next().getClass().equals(clazz)) == false) { + throw new IllegalArgumentException(The validated collection contains an element not of type ++ (clazz == null ? null : clazz.getName()) + at index: + i); + } + } } } 1.4 +21 -1 jakarta-commons/lang/src/test/org/apache/commons/lang/ValidateTest.java Index: ValidateTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/ValidateTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ValidateTest.java 19 Aug 2003 02:32:16 - 1.3 +++ ValidateTest.java 14 Feb 2004 00:48:20 - 1.4 @@ -67,6 +67,7 @@ * Unit tests [EMAIL PROTECTED] org.apache.commons.lang.util.Validate}. * * @author Stephen Colebourne + * @author Norm Deane * @version $Id$ */ public class ValidateTest extends TestCase { @@ -395,4 +396,23 @@ } //--- +public void testAllElementsOfClass() { + List coll = new ArrayList(); + coll.add(a); + coll.add(b); + Validate.allElementsOfClass(coll, String.class, MSG); + try { + Validate.allElementsOfClass(coll, Integer.class, MSG); + fail(Expecting IllegalArgumentException); + } catch (IllegalArgumentException ex) { + assertEquals(MSG, ex.getMessage()); + } + coll.set(1, Boolean.FALSE); + try { + Validate.allElementsOfClass(coll, String.class); + fail(Expecting IllegalArgumentException); + } catch (IllegalArgumentException ex) { + assertEquals(The validated collection contains an element not of type java.lang.String at index: 1,
DO NOT REPLY [Bug 25683] - [lang] Add method that validates Collection elements are a certain type
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=25683. 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=25683 [lang] Add method that validates Collection elements are a certain type [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2004-02-14 00:48 --- Patch applied, thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-commons/lang/src/test/org/apache/commons/lang ArrayUtilsTest.java
scolebourne2004/02/13 17:15:20 Modified:lang/src/java/org/apache/commons/lang ArrayUtils.java lang/src/test/org/apache/commons/lang ArrayUtilsTest.java Log: Add getLength method bug 26594, from Maarten Coene Revision ChangesPath 1.41 +53 -12 jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java Index: ArrayUtils.java === RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- ArrayUtils.java 3 Feb 2004 22:14:24 - 1.40 +++ ArrayUtils.java 14 Feb 2004 01:15:19 - 1.41 @@ -80,6 +80,7 @@ * @author Pete Gieser * @author Gary Gregory * @author a href=mailto:[EMAIL PROTECTED]Ashwin S/a + * @author Maarten Coene * @since 2.0 * @version $Id$ */ @@ -955,6 +956,56 @@ return true; } +//--- +/** + * pReturns the length of the specified array. + * This method can deal with codeObject/code arrays and with primitive arrays./p + * + * pIf the input array is codenull/code, code0/code is returned./p + * + * pre + * ArrayUtils.getLength(null)= 0 + * ArrayUtils.getLength([]) = 0 + * ArrayUtils.getLength([null]) = 1 + * ArrayUtils.getLength([true, false]) = 2 + * ArrayUtils.getLength([1, 2, 3]) = 3 + * ArrayUtils.getLength([a, b, c]) = 3 + * /pre + * + * @param array the array to retrieve the length from, may be null + * @return The length of the array, or code0/code if the array is codenull/code + * @throws IllegalArgumentException if the object arguement is not an array. + */ +public static int getLength(final Object array) { +if (array == null) { +return 0; +} else { +return Array.getLength(array); +} +} + +/** + * Returns the last index of the given array or -1 if empty or null. + * This method can deal with codeObject/code arrays and with primitive arrays. + * This value is one less than the size since arrays indices are 0-based./p + * + * pre + * ArrayUtils.lastIndex(null)= -1 + * ArrayUtils.lastIndex([]) = -1 + * ArrayUtils.lastIndex([null]) = 0 + * ArrayUtils.lastIndex([true, false]) = 1 + * ArrayUtils.lastIndex([1, 2, 3]) = 2 + * ArrayUtils.lastIndex([a, b, c]) = 2 + * /pre + * + * @param array the array to return the last index for, may be null + * @return the last index, -1 if empty or null + * @throws IllegalArgumentException if the object arguement is not an array. + */ +public static int lastIndex(final Object array) { +return ArrayUtils.getLength(array) - 1; +} + /** * pChecks whether two arrays are the same type taking into account * multi-dimensional arrays./p @@ -3052,17 +3103,6 @@ } /** - * Returns the last index of the given array. This value is one less than the size since - * arrays indices are 0-based. - * - * @param array The array to return the last index for, must not be codenull/code. - * @return The last index - */ -public static int lastIndex(final Object array) { -return Array.getLength(array) - 1; -} - -/** * pInserts the specified element at the specified position in the array. * Shifts the element currently at that position (if any) and any subsequent * elements to the right (adds one to their indices)./p @@ -3111,4 +3151,5 @@ } return (Object[]) result; } + } 1.25 +118 -1 jakarta-commons/lang/src/test/org/apache/commons/lang/ArrayUtilsTest.java Index: ArrayUtilsTest.java === RCS file: /home/cvs/jakarta-commons/lang/src/test/org/apache/commons/lang/ArrayUtilsTest.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- ArrayUtilsTest.java 3 Feb 2004 22:14:24 - 1.24 +++ ArrayUtilsTest.java 14 Feb 2004 01:15:20 - 1.25 @@ -75,6 +75,7 @@ * @author a href=mailto:[EMAIL PROTECTED]Ashwin S/a * @author Fredrik Westermarck * @author Gary Gregory + * @author Maarten Coene * @version $Id$ */ public class ArrayUtilsTest extends TestCase { @@ -2362,4 +2363,120 @@ assertEquals(true, ArrayUtils.isEmpty(emptyBooleanArray)); assertEquals(false, ArrayUtils.isEmpty(notEmptyBooleanArray)); } +
cvs commit: jakarta-commons/lang project.xml
scolebourne2004/02/13 17:16:24 Modified:lang project.xml Log: Add Maarten Coene Revision ChangesPath 1.28 +3 -0 jakarta-commons/lang/project.xml Index: project.xml === RCS file: /home/cvs/jakarta-commons/lang/project.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- project.xml 10 Feb 2004 19:15:05 - 1.27 +++ project.xml 14 Feb 2004 01:16:24 - 1.28 @@ -135,6 +135,9 @@ nameGreg Coladonato/name /contributor contributor + nameMaarten Coene/name +/contributor +contributor nameJustin Couch/name /contributor contributor - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DO NOT REPLY [Bug 26594] - [lang] add getLength() method to ArrayUtils
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=26594. 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=26594 [lang] add getLength() method to ArrayUtils [EMAIL PROTECTED] changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED --- Additional Comments From [EMAIL PROTECTED] 2004-02-14 01:16 --- Patch applied, thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[lang][proposal] Clover for Maven builds
Can we turn on Clover for Maven builds? Gary
DO NOT REPLY [Bug 26918] - Cannot populate Stirng[][] properties with beanutils
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=26918. 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=26918 Cannot populate Stirng[][] properties with beanutils [EMAIL PROTECTED] changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID --- Additional Comments From [EMAIL PROTECTED] 2004-02-14 02:28 --- Oups, sorry, i have declared the class in the test case as private... so reflection api cannot find the methods. My problem in struts (using String[][] for populating html:multibox) should have another cause. I hope that nobody had wasting time to solve this problem. Sorry! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [lang] build fails on JDK 1.4.1, okay on JDK 1.3.1
Stephen Colebourne wrote: Change made, hopefully that will sort it, but ideally Janek needs to test Nice fix. Works4me (Sun Linux JDK 1.4.2) Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
new HashedSet + WeakHashedSet classes
I have now finished the two new classes HashedSet and WeakHashedSet. I have added some tests for them, though I should add a lot more. To make this work I needed to make a few changes to AbstractHashedMap. These changes had a few repercussions on other classes. But they now run all the tests successfully. They classes with UML diagrams and some explanations are available on my web site at: http://bblfish.net/java/collections/ Please let me know if this is the wrong place to post this. Thanks, Henry Story - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HttpClient 2.0 final release in February?
I agree. The time seems right. Mike On Feb 13, 2004, at 6:24 AM, Kalnichevski, Oleg wrote: Folks, I feel it is time we cut the final release. I am convinced we should get the long overdue HttpClient 2.0 release out and fully concentrate on getting HttpClient 3.0 ready for the first alpha release. Simultaneously we should pursue the promotion to the Jakarta level, which will require quite a bit of efforts. The time is right IMO. Does anyone see any reasons to wait with the final release? Oleg - 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: HttpClient 2.0 final release in February?
Fine with me. Kalnichevski, Oleg wrote: I feel it is time we cut the final release. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question on Timeouts
You seem to be using threads and so I assume you are using the MultithreadedConnectionManager (you definitely should be!). Oleg just fixed a bug regarding this issue: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26500 Using the current CVS HEAD (or nightly build) could fix your problem. Odi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Question on Timeouts
Hi there, Timeout settings in your code appear correct. Basically socket reads _should_ timeout, provided the value of transferTimeout is sane. For the lack of better ideas I can only recommend you: (1) upgrade to 2.0rc3 release. Better yet, upgrade to the latest CVS HTTPCLIENT_2_0_BRANCH snapshot (which is quite likely to be the 2.0 final). We've just recently fixed a minor bug with socket timeouts in persistent connections. I do not think you are affected by this bug, but just to be on the safe side (2) Try setting timeout to a ridiculously low value just to see whether read timeouts work at all in your environment. (3) Give JVM 1.4.2 a shot to see if that makes any difference (especially if you are using SSL. Older JSSE implementations seem to have an issue with socket timeouts) (4) Please introduce yourself. I kind of dislike 'hi there' greetings ;-) Oleg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 15:06 To: Commons HttpClient Project Subject: Re: Question on Timeouts Hello, Thank you for your e-mail...I'm confused a bit, though, as you said: quote Try specifying an SO_TIMEOUT in milliseconds via HttpClient.setTimeOut() method. /quote But, we're already doing this, no? client.setTimeout (transferTimeout * 1000); And we're still seeing threads hung indefinitely in socketRead.now, someone else responded saying that I should also include this: quote HttpClient().getHostConfiguration().setHost(HOSTNAME, 80,http ); where hostname is something like that www.blabla.com /quote I'm going to try that, but any other thoughts on why this is hanging indefinitely? Thanks!! Jesus M. Salvo Jr. To: Commons HttpClient Project [EMAIL PROTECTED] [EMAIL PROTECTED] cc: asia.combcc: Subject: Re: Question on Timeouts 02/12/2004 08:20 PM Please respond to Commons HttpClient Project [EMAIL PROTECTED] wrote: Hello, I'm using your product for an application that we're building (that fetches some HTTP content) and I'm running into an issue where it isn't timing out ..snip... --This is how we're connecting - HttpClient client = new HttpClient(); client.setConnectionTimeout (connectionTimeout * 1000); client.setTimeout (transferTimeout * 1000); HttpMethod method = new GetMethod(url); try { statusCode = client.executeMethod(method); } Try specifying an SO_TIMEOUT in milliseconds via HttpClient.setTimeOut() method. Otherwise, it will default to whatever is the default SO_TIMEOUT on your platform. BTW, does anyone have a compilation / list of the defautl SO_TIMEOUT values for each platform ? - 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: Question on Timeouts
Kalnichevski, Oleg wrote: (1) upgrade to 2.0rc3 release. Better yet, upgrade to the latest CVS HTTPCLIENT_2_0_BRANCH snapshot (which is quite likely to be the 2.0 final). We've just recently fixed a minor bug with socket timeouts in persistent connections. I do not think you are affected by this bug, but just to be on the safe side Regarding my previous posting: nightly builds are NOT from the 2.0 branch. So you need to checkout latest HTTPCLIENT_2_0_BRANCH - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Question on Timeouts
Hi ... Apologies for the lack of an introduction. My name is Mike Coffey (if you didn't already catch that part) and I'm currently working at CMP Media on a website project. CMP is a publishing company (we publish DDJ, Information Week, etc. -- a bunch of technology magazines, as well as some in other fields). The project that we're working on is to standardize our website infrastructure (over 100 sites) onto a common Java platform. Me personally -- I've been working with Java for a couple of years (formerly from a software company called ATG), but am now more of a technical project manager. You can quickly see the need for us to do HTTP type content grabs from other feed/content syndication sources. We turned to the project here because why build something that's already done well... I really appreciate your feedback in the e-mail. Interestingly enough, sometimes we see the timeouts work appropriately and sometimes the thread the thread hangs indefinitelyfigures it's one of those problems...sigh ! 1. We will update to the latest CVS branch, this is something I had in progress anyway given the problems we're seeing. 2. Setting it very low does produce accurate timeouts (at least in development a few months back) -- I will retest. 3. No SSL hereunfortunately, although this issue is probably significantly alleviated in 1.4 or higher, we're on a commercial app server that isn't supporing 1.4 for a few months. 4. See above :) Thank you again, I really appreciate the info., it's an issue that does seem a little odd to me, was hoping that someone had seen something similar. Mike Coffey CMP Media LLC Phone: 781-839-1227 Kalnichevski, Oleg [EMAIL PROTECTED] To: Commons HttpClient Project [EMAIL PROTECTED] gpoint.com cc: bcc: 02/13/2004 09:22 AM Subject: RE: Question on Timeouts Please respond to Commons HttpClient Project Hi there, Timeout settings in your code appear correct. Basically socket reads _should_ timeout, provided the value of transferTimeout is sane. For the lack of better ideas I can only recommend you: (1) upgrade to 2.0rc3 release. Better yet, upgrade to the latest CVS HTTPCLIENT_2_0_BRANCH snapshot (which is quite likely to be the 2.0 final). We've just recently fixed a minor bug with socket timeouts in persistent connections. I do not think you are affected by this bug, but just to be on the safe side (2) Try setting timeout to a ridiculously low value just to see whether read timeouts work at all in your environment. (3) Give JVM 1.4.2 a shot to see if that makes any difference (especially if you are using SSL. Older JSSE implementations seem to have an issue with socket timeouts) (4) Please introduce yourself. I kind of dislike 'hi there' greetings ;-) Oleg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 15:06 To: Commons HttpClient Project Subject: Re: Question on Timeouts Hello, Thank you for your e-mail...I'm confused a bit, though, as you said: quote Try specifying an SO_TIMEOUT in milliseconds via HttpClient.setTimeOut() method. /quote But, we're already doing this, no? client.setTimeout (transferTimeout * 1000); And we're still seeing threads hung indefinitely in socketRead.now, someone else responded saying that I should also include this: quote HttpClient().getHostConfiguration().setHost(HOSTNAME, 80,http ); where hostname is something like that www.blabla.com /quote I'm going to try that, but any other thoughts on why this is hanging indefinitely? Thanks!! Jesus M. Salvo Jr. To: Commons HttpClient Project
RE: Question on Timeouts
Mike, I wish I could be of more help but I personally have never come across with such a (mis)behavior, nor do I remember anyone reporting it on this mailing list. 3. No SSL hereunfortunately, although this issue is probably significantly alleviated in 1.4 or higher, we're on a commercial app server that isn't supporing 1.4 for a few months. Are you using Websphere Appserver 4.0.x or 5.0.x by any chance? If yes, please make sure you have the latest fixpack applied (4.0.6 and 5.0.2.2 respectively). There have been numerous reports of several java.net.Socket related bugs in IBM JDK 1.3.x implementations. If not, getting all your software up to the latest service is still your best bet. Cheers, Oleg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 16:08 To: Commons HttpClient Project Cc: Commons HttpClient Project Subject: RE: Question on Timeouts Hi ... Apologies for the lack of an introduction. My name is Mike Coffey (if you didn't already catch that part) and I'm currently working at CMP Media on a website project. CMP is a publishing company (we publish DDJ, Information Week, etc. -- a bunch of technology magazines, as well as some in other fields). The project that we're working on is to standardize our website infrastructure (over 100 sites) onto a common Java platform. Me personally -- I've been working with Java for a couple of years (formerly from a software company called ATG), but am now more of a technical project manager. You can quickly see the need for us to do HTTP type content grabs from other feed/content syndication sources. We turned to the project here because why build something that's already done well... I really appreciate your feedback in the e-mail. Interestingly enough, sometimes we see the timeouts work appropriately and sometimes the thread the thread hangs indefinitelyfigures it's one of those problems...sigh ! 1. We will update to the latest CVS branch, this is something I had in progress anyway given the problems we're seeing. 2. Setting it very low does produce accurate timeouts (at least in development a few months back) -- I will retest. 3. No SSL hereunfortunately, although this issue is probably significantly alleviated in 1.4 or higher, we're on a commercial app server that isn't supporing 1.4 for a few months. 4. See above :) Thank you again, I really appreciate the info., it's an issue that does seem a little odd to me, was hoping that someone had seen something similar. Mike Coffey CMP Media LLC Phone: 781-839-1227 Kalnichevski, Oleg [EMAIL PROTECTED] To: Commons HttpClient Project [EMAIL PROTECTED] gpoint.com cc: bcc: 02/13/2004 09:22 AM Subject: RE: Question on Timeouts Please respond to Commons HttpClient Project Hi there, Timeout settings in your code appear correct. Basically socket reads _should_ timeout, provided the value of transferTimeout is sane. For the lack of better ideas I can only recommend you: (1) upgrade to 2.0rc3 release. Better yet, upgrade to the latest CVS HTTPCLIENT_2_0_BRANCH snapshot (which is quite likely to be the 2.0 final). We've just recently fixed a minor bug with socket timeouts in persistent connections. I do not think you are affected by this bug, but just to be on the safe side (2) Try setting timeout to a ridiculously low value just to see whether read timeouts work at all in your environment. (3) Give JVM 1.4.2 a shot to see if that makes any difference (especially if you are using SSL. Older JSSE implementations seem to have an issue with socket timeouts) (4) Please introduce yourself. I kind of dislike 'hi there' greetings ;-) Oleg
Re: HttpClient 2.0 final release in February?
The time seems right. I see no reason to wait! -Eric. Kalnichevski, Oleg wrote: Folks, I feel it is time we cut the final release. I am convinced we should get the long overdue HttpClient 2.0 release out and fully concentrate on getting HttpClient 3.0 ready for the first alpha release. Simultaneously we should pursue the promotion to the Jakarta level, which will require quite a bit of efforts. The time is right IMO. Does anyone see any reasons to wait with the final release? Oleg - 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: DO NOT REPLY [Bug 26060] - Log level for message should be debug instead of error.
Folks, Any objections to committing this one? Note the patch breaks 2.0 API compatibility Oleg On Mon, 2004-02-09 at 16:18, [EMAIL PROTECTED] wrote: 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=26060. 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=26060 Log level for message should be debug instead of error. --- Additional Comments From [EMAIL PROTECTED] 2004-02-09 15:18 --- Created an attachment (id=10279) Patch (take 1) - 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]
No cookie.. Proxy realm.. limit setFollowRedirects
Hi all, I have 3 questions : 1) How can I reject all cookies ? (code please) 2) How can I limit number of redirections for setFollowRedirects() method ? (code please) 3) How can I skip entering proxy realm ? I mean : Forexample for simple authentication, to skip the realm, we use setAuthenticationPreemptive(true) method first. Is there something similar to this for proxy servers? Any help will be greatly appreciated. Thanx in advance!
Re: No cookie.. Proxy realm.. limit setFollowRedirects
Thanx very much Oleg for your answers, I have a few things to say : 1) How can I reject all cookies ? (code please) This feature is only available in the development version of HttpClient (3.0, which is currently in pre-alpha development stage). There's no straight-forward way to automatically reject all the cookies in the stable version (2.0 branch) of HttpClient While waiting for the upcoming release, we can solve this problem temporarily by : setting up a very old date in purgeExpiredCookies(Date) method. I didn't try it. But I think it may work... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No cookie.. Proxy realm.. limit setFollowRedirects
On Fri, 2004-02-13 at 21:27, Emre Sokullu wrote: Thanx very much Oleg for your answers, I have a few things to say : 1) How can I reject all cookies ? (code please) This feature is only available in the development version of HttpClient (3.0, which is currently in pre-alpha development stage). There's no straight-forward way to automatically reject all the cookies in the stable version (2.0 branch) of HttpClient While waiting for the upcoming release, we can solve this problem temporarily by : setting up a very old date in purgeExpiredCookies(Date) method. I didn't try it. But I think it may work... That should work indeed. Alternatively you can remove unwanted cookies manually using methods of the HttpState class Hope this helps, Cheers, Oleg - 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: No cookie.. Proxy realm.. limit setFollowRedirects
Hi Oleg, I have visited the link that you have given to me for the setFollowRedirects() problem: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21216 At this link, I've read that httpclient follows redirections for 100 times by default. So I've thought that if I knew the instance that determines thi limit, and its class in the source code of httpclient, I can change it for me to a smaller number. So if you know, or if anybody else knows it, can you tell me what instance and what class determines the limit of redirections (100 by default) Thanx again for your helps... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No cookie.. Proxy realm.. limit setFollowRedirects
On Fri, 2004-02-13 at 22:19, Emre Sokullu wrote: Hi Oleg, I have visited the link that you have given to me for the setFollowRedirects() problem: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21216 At this link, I've read that httpclient follows redirections for 100 times by default. So I've thought that if I knew the instance that determines thi limit, and its class in the source code of httpclient, I can change it for me to a smaller number. So if you know, or if anybody else knows it, can you tell me what instance and what class determines the limit of redirections (100 by default) Here it is http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpMethodBase.java?content-type=text%2Fplainrev=1.159.2.22 Just look for the following line private static final int MAX_FORWARDS = 100; Oleg Thanx again for your helps... - 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]
Automatic form log in
Hello, I am trying to uses the FormLoginDemo.java example to log on to automate logging in to a website. There are couple of parameters that I have set in the program static final String LOGON_SITE = http://www.imdb.com/register/login;; static final intLOGON_PORT = 80; The other parameters that I set were the NameValuepairs NameValuePair action = new NameValuePair(action, login); NameValuePair url = new NameValuePair(url, /index.html); NameValuePair userid = new NameValuePair(login, user); NameValuePair password = new NameValuePair(password, passwd); where instead of user and passwd I used my own username and password. The program throws a java.net.UnknownHostException: www.imdb.com/register/login Please do let me know if I am doing something wrong. thanks in advance, --Kaushik __ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]