Re: OrderedMapIterator and LRUMap

2007-07-13 Thread Stephen Colebourne

Hayden James wrote:
Now if I use synchronizedMap, which forces me to use the Map interface 
like:

Map map = Collections.synchronizedMap(new LRUMap());

which iterator from which function do I cast in order to get the same
behavior as above?
OrderedMapIterator iter = (OrderedMapIterator) map.entrySet().iterator();
or maybe
OrderedMapIterator iter = (OrderedMapIterator) map.keySet().iterator();

or perhaps something completely different.  The documentation is a little
vague on how to accomplish this.


Once you wrap the LRUMap in a synchronized map there is no way to obtain 
the ordered iterator.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can we optimize HashCodeBuilder.append(Object)?

2007-07-02 Thread Stephen Colebourne

Hi,
Have you got figures to show what difference the code change makes?

If so, perhaps you could raise a JIRA call so we can process this for 
[lang].


thanks
Stephen

Venkatesh Prasad Ranganath wrote:

Hi,

I am using HashCodeBuilder and I found that the use of Class.isArray()
method in append(Object) to be a bottleneck.  Following program and
jprof data illustrates the bottleneck along with a solution.  I was
curious if we can integrate the solution code in
OptimizedHashCodeBuilder.append(Object) into
HashCodeBuilder.append(Object) in the upcoming version 2.3 release of
Commons Lang.

CPU SAMPLES BEGIN (total = 71) Sat Jun 30 16:51:43 2007
rank   self  accum   count trace method
   1 45.07% 45.07%  32 300138 java.lang.Class.isArray
   2 14.08% 59.15%  10 300141 java.util.AbstractList.hashCode
   3 12.68% 71.83%   9 300142 java.util.AbstractList.hashCode
   4  4.23% 76.06%   3 300030
sun.nio.cs.UTF_8$Decoder.decodeArrayLoop   5  4.23% 80.28%   3
300144 java.util.AbstractList.hashCode
   6  2.82% 83.10%   2 300143 Test.run2
   7  2.82% 85.92%   2 300139 java.util.ArrayList.get
   8  1.41% 87.32%   1 300140 java.util.AbstractList.hashCode
   9  1.41% 88.73%   1 300145 java.util.AbstractList.hashCode
  10  1.41% 90.14%   1 300027 sun.nio.cs.UTF_8$Decoder.init
  11  1.41% 91.55%   1 300012 java.nio.DirectByteBuffer.init
  12  1.41% 92.96%   1 300089 sun.security.provider.Sun.clinit
  13  1.41% 94.37%   1 300132 sun.security.provider.Sun.init
  14  1.41% 95.77%   1 300071 java.lang.StringCoding.decode
  15  1.41% 97.18%   1 300031
sun.reflect.NativeConstructorAccessorImpl.newInstance  16  1.41%
98.59%   1 300048 java.net.URLClassLoader.defineClass
  17  1.41% 100.00%   1 300137
sun.net.www.ParseUtil.canonizeStringCPU SAMPLES END


import org.apache.commons.lang.builder.HashCodeBuilder;

public class Test {

  public static void main(String[] s) {
java.util.ArrayList o = new java.util.ArrayList();
o.add(Hello);
o.add(World);
run1(o);
run2(o);
  }

  static void run1(Object o) {
for (int i = 0; i  1; i++) {
  HashCodeBuilder h = new HashCodeBuilder();
  for (int k = 0; k  100; k++) {
h = h.append(o);
  }
}
  }

  static void run2(Object o) {
for (int i = 0; i  1; i++) {
  HashCodeBuilder h = new OptimizedHashCodeBuilder();
  for (int k = 0; k  100; k++) {
h = h.append(o);
  }
}
  }
}

class OptimizedHashCodeBuilder extends HashCodeBuilder {
public HashCodeBuilder append(final Object object) {
if (object == null) {
super.append(object);

} else {
// 'Switch' on type of array, to dispatch to
the correct handler// This handles multi
dimensional arrays
if (object instanceof long[]) {
append((long[]) object);
} else if (object instanceof int[]) {
append((int[]) object);
} else if (object instanceof short[]) {
append((short[]) object);
} else if (object instanceof char[]) {
append((char[]) object);
} else if (object instanceof byte[]) {
append((byte[]) object);
} else if (object instanceof double[]) {
append((double[]) object);
} else if (object instanceof float[]) {
append((float[]) object);
} else if (object instanceof boolean[]) {
append((boolean[]) object);
} else if (object instanceof Object[]) {
// Not an array of primitives
append((Object[]) object);
} else {
// the simple case, not an array, just
the elementappend(object.hashCode());
}
}
return this;
}
}



Venkatesh Prasad Ranganath
e-id: [EMAIL PROTECTED]
e-id: [EMAIL PROTECTED]
web: http://www.cis.ksu.edu/~rvprasad
blog: http://venkateshthinks.blogspot.com







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Instantiating Utility Classes

2007-05-31 Thread Stephen Colebourne
I doubt that they will be made non-public, as this reason still applies. If you 
would like, please raise a JIRA call to get the javadoc clarified further.

Stephen

- Original Message 
From: Keith Bennett [EMAIL PROTECTED]
Thanks for responding.  Is it safe for me to assume that these public
constructors will never become deprecated or nonpublic?  This is very
important to me.

Also, would it be possible for someone to amend the Javadoc to say
what you just said, so that other people will know it's ok to use it
for this purpose?

Thanks very much for your work.  I've benefited much from it on
several projects.

- Keith Bennett


On 5/30/07, Stephen Colebourne [EMAIL PROTECTED] wrote:
 Keith Bennett wrote:
  Recently I started using Velocity and JEXL for expression evaluation
  so that users can write templates that format the data the way they
  like.  I figured it would be really handy to give them access to
  StringUtils, WordUtils, DurationFormatUtils, etc.  But these
  templating tools require that you pass an instance into the context
  and call static methods via that instance reference; one cannot call
  ClassName.staticMethodName().
 
  Unfortunately, instantiating these utility classes is not recommended.
  The StringUtils constructor Javadoc at
  http://jakarta.apache.org/commons/lang/api-release/org/apache/commons/lang/StringUtils.html
 
  says StringUtils instances should NOT be constructed in standard
  programming.

 The only reason that the constructor is public at all is so it can be
 used in Velocity. So, go ahead and use it :-)
 Stephen


 
  Of course I could write my own object that delegates to every single
  method in the respective class, but that seems kind of silly.  Is
  there any reason why it would be a bad idea to support creating
  instances of the utility classes?  I realize that naive programmers
  use instances when it is better to use classes, but I think I have a
  legitimate need here.  Also, if the class were made final, then the
  confusion of static methods not following the same rules as nonstatic
  methods with inheritance could be avoided.
 
  How can I find out if there has already been discussion of this, or if
  not, how can I submit a request?  Do you have any suggestions how to
  deal with this issue?
 
  Thanks.
 
  - Keith Bennett
 
  -
  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: Instantiating Utility Classes

2007-05-30 Thread Stephen Colebourne

Keith Bennett wrote:

Recently I started using Velocity and JEXL for expression evaluation
so that users can write templates that format the data the way they
like.  I figured it would be really handy to give them access to
StringUtils, WordUtils, DurationFormatUtils, etc.  But these
templating tools require that you pass an instance into the context
and call static methods via that instance reference; one cannot call
ClassName.staticMethodName().

Unfortunately, instantiating these utility classes is not recommended.
The StringUtils constructor Javadoc at
http://jakarta.apache.org/commons/lang/api-release/org/apache/commons/lang/StringUtils.html 


says StringUtils instances should NOT be constructed in standard
programming.


The only reason that the constructor is public at all is so it can be 
used in Velocity. So, go ahead and use it :-)

Stephen




Of course I could write my own object that delegates to every single
method in the respective class, but that seems kind of silly.  Is
there any reason why it would be a bad idea to support creating
instances of the utility classes?  I realize that naive programmers
use instances when it is better to use classes, but I think I have a
legitimate need here.  Also, if the class were made final, then the
confusion of static methods not following the same rules as nonstatic
methods with inheritance could be avoided.

How can I find out if there has already been discussion of this, or if
not, how can I submit a request?  Do you have any suggestions how to
deal with this issue?

Thanks.

- Keith Bennett

-
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: Closure, Predicate, and Transformer Examples

2007-02-28 Thread Stephen Colebourne
Its an example of a class you'd write yourself. Although there are 
similar methods on commons-collections CollectionUtils.


Stephen


Paolo Viappiani wrote:

In which package is ModelUtils?

p*

On 2/26/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



 Vishist Mandapaka [EMAIL PROTECTED] wrote:
 Hi,
   Can anyone guide me with examples for Closure, Predicate, and
Transformer
 objects. I am unable to map it to any real world scenarios where these
 objects may be of use.


Closure:

I have a tree of Attribute objects, and for each one which has one or 
more
attached errors I want to add it to a list. I therefore have a method 
that

walks the tree of objects and for each node in the tree invokes a Closure
that is passed in as a parameter:

private List findErrors(AttributeGroup model) {
final List errors = new ArrayList(10);

Closure cb = new Closure() {
public void execute(Object input) {
Attribute attr = (Attribute) input;
List errList = attr.getErrorList();
if ((errList != null)  (errList.size()  0)) {
errors.add(attr);
}
}
};

ModelUtils.forEachAttr(model, cb);

return errors;
}

The tree-walking code (ModelUtils.forEachAttr) can then be reused with
Closure objects that do other types of things.


Predicate:
Given a list of Person objects, return only those whose country attribute
has a specific value (filtering).

Transformer:
Given a list of strings, return a list of JSF SelectItem objects that 
wrap

those strings, allowing the list to be displayed in a drop-down list in a
JavaServer Faces view. This same Transformer class can then be used to
generate wrappers for a list of colours, a list of countries, etc. Yes a
simple method can be written to do this, but with the Transformer 
approach a
Transformer instance can then be passed around as an object without 
the code

needing to know exactly *what* the Transformer will do.

-
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: [collections] Tree data structure

2007-02-13 Thread Stephen Colebourne
I would be happy for an experimental Tree based API being added to the 
generics branch. It would therefore have to be a generified tree API :-)


Stephen


Carlos Sanchez wrote:

Anyone knows of a tree implementation (not binary)? I read in old
threads (2002) somebody willing to contribute one but seems it didn't
make it to collections.
Is there any interest on having one?

Regards



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [IO] writeStringToFile( File, String, String ), when File does not exist

2006-12-28 Thread Stephen Colebourne

I've raised and fixed this as IO-107.

Stephen


Stephen Colebourne wrote:

Jamie Bisotti wrote:

As I mentioned in my original post...The JavaDoc for writeStringToFile()
says: Writes a String to a file creating the file if it does not exist.
That seems to imply that directories would be created, if need be; 
however,
that is not happening.  Is this a bug?  Or does the documentation just 
need

to be clarified?

It does not say anything about directories having to exist; it says 
the file
will be created if it does not exist. 

  [snip]
  Is this a bug or

an incomplete comment, in need of clarification?


It isn't a bug, but a reasonable enhancement. (At the minimum the 
javadoc should be improved).


Please raise a JIRA call. We'd also welcome a fix and test case if you 
have time.


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]



Re: [lang] Can I create date with jakarta commons

2006-10-07 Thread Stephen Colebourne

There is no such function at present. Feel free to add a request in JIRA.
Stephen

[EMAIL PROTECTED] wrote:

Good day!

I need sometimes to create concrete Date object. I have the function to do
it now:

  public static Date createDate(int year, int month, int day){
Calendar calendar = Calendar.getInstance();

calendar.set(year, month, day, 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);

return calendar.getTime();
  }

Is there such function in commons?

Thanks!

_
With best regards,
Vitaly Baranovsky


-
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: [io] new ThresholdingOutputStream implementation

2006-09-09 Thread Stephen Colebourne
Sounds interesting. Can you raise a JIRA call for this (enhancement) and 
attach the changes to it? That way we won't lose it. Thanks

Stephen

Michele Mazzucco wrote:

Hi all,

I've extended the ThresholdingOutputStream class with a new class which
behaves different from DeferredFileOutputStream:
- when the stream is closed, the content stored in memory is *always*
flushed to disk (in DeferredFileOutputStream, instead, if the treshold
is not reached data is lost)
- DeferredFileOutputStream maintains data in memory only until the
treshold value has been reached, then it immediately writes every byte
to disk. Mine implementation, instead, caches treshold bytes in memory,
and every time that value is reached (that is, treshold, 2 * threshold,
etc), it flushes data to disk. In other words it acts as a cache.

Please find attached the class together with the unit test.



Best regards,
Michele




/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the License); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an AS IS BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.commons.io.output;

import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

import junit.framework.TestCase;

/**
 * JUnit test case for [EMAIL PROTECTED] DeferredPeriodicOutputStream}.
 * 
 * @author a href=mailto:[EMAIL PROTECTED]Michele Mazzucco/a

 *
 */
public class DeferredPeriodicOutputStreamTest extends TestCase {


/**
 * The test data as a string (which is the simplest form).
 */
private String testString = 0123456789;

/**
 * The test data as a byte array, derived from the string.
 */
private byte[] testBytes = testString.getBytes();


/**
 * Standard JUnit test case constructor.
	 * 
	 * @param name

 *The name of the test case.
 */
public DeferredPeriodicOutputStreamTest(String name) {
super(name);
}


/**
 * Tests the case where the amount of data falls below the threshold, 
and is
 * therefore confined to memory.
 */
public void testBelowThreshold() {
File testFile = getTestFile(testBelowTreshold.dat);

DeferredPeriodicOutputStream dpos =
new DeferredPeriodicOutputStream(testBytes.length + 42, 
testFile);
try {
dpos.write(testBytes, 0, testBytes.length);
dpos.close();
} catch (IOException e) {
fail(Unexpected IOException);
}

byte[] resultBytes = dpos.getData();
assertEquals(0, resultBytes.length);

verifyResultFile(testFile);

}


/**

 * Tests the case where the amount of data is exactly the same as the
 * threshold. The behavior should be the same as that for the amount of
 * data being below (i.e. not exceeding) the threshold.
 */
public void testAtThreshold() {
File testFile = getTestFile(testAtThreshold.dat);

DeferredPeriodicOutputStream dpos =
new DeferredPeriodicOutputStream(testBytes.length, testFile);
try
{
dpos.write(testBytes, 0, testBytes.length);
dpos.close();
}
catch (IOException e) {
fail(Unexpected IOException);
}

byte[] resultBytes = dpos.getData();
assertEquals(0, resultBytes.length);
verifyResultFile(testFile);
}

/**

 * Tests the case where the amount of data exceeds the threshold, and is
 * therefore written to disk. The actual data written to disk is verified,
 * as is the file itself.
 */
public void testAboveThreshold() {
File testFile = getTestFile(testAboveThreshold.dat);

DeferredFileOutputStream dfos =

new DeferredFileOutputStream(testBytes.length - 5, testFile);
try
{
dfos.write(testBytes, 0, testBytes.length);
dfos.close();
}
catch (IOException e) {
fail(Unexpected IOException);
}

Re: [collections] Problem with buffer serialization (posible bug?)

2006-08-04 Thread Stephen Colebourne
This sounds like a bug. It would be best to raise a JIRA report with a 
small test case (not involving xstream)


Stephen


Huertas Fernández wrote:

Hi all, I'm having problems with serialization/deserialization of a Buffer. My 
idea is to implement a persistent queue using the UnboundedFifoBuffer (well, I 
want synchronized access, so I use SynchronizedBuffer too):

 


private Buffer queue = BufferUtils.synchronizedBuffer(new 
UnboundedFifoBuffer());

 


When I serialize the queue to disk an it has elements, all works ok, but when I 
serialize an empty queue I have some problems when I create a new object using 
the serialized file(BTW, I'm using XStream 1.1.3 to produce the XML).

 


org.apache.commons.collections.buffer.SynchronizedBuffer

  collection class=org.apache.commons.collections.buffer.UnboundedFifoBuffer 
serialization=custom

org.apache.commons.collections.buffer.UnboundedFifoBuffer

  default/

  int0/int

/org.apache.commons.collections.buffer.UnboundedFifoBuffer

  /collection

  lock class=org.apache.commons.collections.buffer.SynchronizedBuffer 
reference=../

/org.apache.commons.collections.buffer.SynchronizedBuffer

 


When I deserialize the queue it has a 'buffer' with size 1 (with null content), 
'tail' and 'head' fields are 0 (they are declared transient). So, when I try to 
add a new object to the queue, the sentence:

 


Object[] tmp = new Object[((buffer.length - 1) * 2) + 1];

 

Is executed in the add() method to increase the buffer length, but the buffer remains with the same size! (buffer.length = 1 -- (1 - 1) * 2 + 1 = 1). So, the object is added and when the tail is going to be incremented, it is reset to 0!! 

 


private int increment(int index) {

index++;

if (index = buffer.length) {

index = 0;

}

return index;

}

 


So it is impossible to add new elements after an empty queue has been 
serialized / deserialized.

 


I have solved it just not saving empty queues but deleting the file instead, 
but I wanted to write to the list to know if this is a bug in the 
UnboundedFifoBuffer or maybe is caused by the way Xtream serializes (but I 
don't think so).

 


Thanks in advance,

 


Jose Luis.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [VFS] Snapshot timestamped version has disappeared from the m1 snapshot repo!

2006-07-27 Thread Stephen Colebourne

Vincent Massol wrote:

No, quite the opposite. Working with thinner slices is always easier than
working with bulk. Saying it differently, it's much easier to do regular
releases than longer ones because less has changed. Take the example of
Maven again. Releasing a plugin is really a breeze, including the votes. The
same would be true of VFS. The core might require lots of thoughts as it's
critical but the providers would be real easy to release.


This whole debate is a matter of perspective - cargo and vfs have very 
different perspectives on two points:

- community
- ease of release

Cargo, and hence maven, comes to the table with a decent-sized community 
and the full knowledge and use of maven. Together these two points 
probably do make releasing a plugin 'a breeze'.


However vfs is effectively a single person project (at present), and 
does not heavily use maven. (Commons does use maven, but does not have 
the background knowledge, desire, etc to commit fully to it, in 
particular maven version 2). Together, these points make it virtually 
inconceivable to release lots of small jars, one per filesystem.


To further complicate this, commons rules currently effectively require 
every release to be manually checked by every voter. Or to put it 
another way, there is no trust of the releasable artifacts, maven 
generated or not. (In fact, I typically raise more issues with a maven 
generated release than a non maven generated release.)



My point here is that IMHO the 'correct' solution is a single core jar, 
plus one jar per filsystem, together with an 'all' jar for users who 
want everything in one go. But such a solution is unfortunately not 
viable in the commons of today. Which is one reason why commons does not 
release early release often.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] key Value Pair allowing duplicates

2006-07-20 Thread Stephen Colebourne

Look at the MultiMap interface and the MultiValueMap implementation (v3.2).

Stephen


Rajat Sharma wrote:

HI all,

 


Let's say I have a view in the DB which send me back the following
values

 


CUSTNAME  IPADDRESS

A  1

A  2

A  1

B  5

B  5

 


This table is present in the resultSet I get back from the Database.
But, I wanted the above to be put into some kind of collection (which
would also allow duplicates). 

 


Now, most of the collections do not allow duplicate keys. I want a way
where I am doing something like MyCollection.getListByKey(CUSTNAME).

 


The result is returned into a list.

 

What's the best way to achieve this ? 

 

Thanks 


Raj







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[collections] Re: Why doesn't Bag have a get() method?

2006-07-13 Thread Stephen Colebourne
Get what? What method signature are you expecting? What is your use case?
Stephen

- Original Message 
From: Timo Nentwig [EMAIL PROTECTED]
To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Thursday, 13 July, 2006 2:39:59 PM
Subject: Why doesn't Bag have a get() method?

Hi!

Well, see subject: why doesn't Bag have a get() method? Doesn't make sense, 
does it?

Timo

-
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: [collections] Re: Why doesn't Bag have a get() method?

2006-07-13 Thread Stephen Colebourne

Nentwig, Timo wrote:

Stephen Colebourne wrote:


Get what? What method signature are you expecting? What is your use case?


Well, get what I did add(). Get that what contains() is checking for. 
Get what getCount() is counting.


I believe that you want the method:
  public Object get(Object);
that would return the object within the Bag that is equal to the object 
you pass in.


This has been discussed before as a deficiency in the Java Collections 
Framework wrt the Set interface. At present, the workaround in Java is 
to use a Map where the key and value are the same object.


As to your question, why doesn't Bag have such a method, the answer is 
because the original coders didn't see the need for it. And since its an 
interface, there is no way for us to change it now. It is also very 
difficult to implement as the Java Collections Framework doesn't provide 
such a method.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [collections] IteratorChain(Iterator) should be meta!

2006-07-02 Thread Stephen Colebourne
IteratorChain is the right class, but the constructor just adds the one 
iterator.


You could use the Iterator(Collection) constructor which adds a 
collection of Iterators. Perhaps use IteratorUtils.toList to create the 
list?


Alternatively, you could patch IteratorChain to add a factory method 
that takes an iterator and does what you wanted.


Stephen

Paul Libbrecht wrote:


Hello,

only after a looong quest I realized that new IteratorChain(Iterator) 
will only iterate through the elements of the given iterator instead of 
expecting that each element is an iterator itself through which one 
iterates.


Am I blurred to expect such ?
I suppose that changing this behaviour would be a too strong API 
change... so should one do an IteratorThroughIterators?? I can offer a 
class... if wished.


paul


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [IO] - Wildcard filter for directories

2006-06-23 Thread Stephen Colebourne
I am looking to handle this behaviour by reworking the filter. See also 
http://issues.apache.org/jira/browse/IO-81


Stephen


Heiko wrote:

Hallo,

two questions concerning the org.apache.commons.io.filefilter package:

- I would like to have wildcard filtering for directories, but WildcardFilter 
works only for plain files. So I just implemented a class 
DirectoryWildcardFilter. Could that class be of interest to the commons-io 
package?


- I would have assumed that the wildcard matching is done via 
org.apache.commons.io.FilenameUtils.wildcardMatchOnSystem, but is isn't. I'm 
not sure if 
* the existing WildcardFilter should be extended by a useMatchOnSystem method 
or likewise,

* a new WildcardOnSystemFilter would be better
* ...

Sorry if i ask a already answered question but I couldn't find it in the more 
recent list archives.


Greetings
Heiko Blau

-
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: [collections] Question about ClosureUtils.invokerClosure paramTypes parameter

2006-06-22 Thread Stephen Colebourne
Your wrapped code does not handle null arguments. And
that is why [collections] doesn't do it that way.
Stephen


--- Nikita Zhuk [EMAIL PROTECTED] wrote:
 Hello,
 
 I have a question about Commons Collections' (v 3.2)
 invokerClosure()  
 method of ClosureUtils class. Currently the method
 signature is:
 
 public static Closure invokerClosure(String
 methodName, Class[]  
 paramTypes, Object[] args)
 
 I would like to know why there has to be explicit
 paramTypes  
 parameter, i.e. is there something wrong in calling
 .getClass() on  
 each argument (which returns actual class of an
 object due of  
 polymorfism)? In my code I've wrapped that call as
 following:
 
  public static Closure invokerClosure(String
 methodName, Object[]  
 args)
  {
  Class[] paramTypes = new
 Class[args.length];
 
  for(int i = 0; i  args.length; i++)
  {
  paramTypes[i] = args[i].getClass();
  }
 
  return
 ClosureUtils.invokerClosure(methodName, paramTypes, 
 
 args);
  }
 
 
 - Nikita Zhuk
 

-
 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: ListOrderedMap vs. LinkedHashMap

2006-06-21 Thread Stephen Colebourne
ListOrderedMap is a decorator. It can wrap _any_ type of map and make it 
ordered.


Stephen

[EMAIL PROTECTED] wrote:

Hello All -

Apologies if this has already been covered.  I couldn't find an easy way to
search through this mailing list's archives.

What is the difference between
org.apache.commons.collections.map.ListOrderedMap (from
commons-collections-3.2)
and
java.util.LinkedHashMap (Java 1.5)?

It seems to me that they both implement a map while retaining order.  Am I
missing something?

Thanks!

-Marc


-
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: LRUMap NullpointerException

2006-06-18 Thread Stephen Colebourne

Can you also check all loops of the map are synchronized correctly:

synchronied (map) {
  Iterator it = mpap.keySet().iterator();
  while (it.hasNext()) {
..
  }
}

and so on. The synchronized MUST be around the whole looping.

Stephen


Thilko Richter wrote:

Hi there,

we used Version 3.2 and synchronized all access to LRUMap. WE get this 
IllegalStateException. Can you reproduce this behauviour?





2006-06-14 00:26:22,359 [ERROR] BaseDataLoggerGate.com.sunreader.sr2.gate.BaseDataLoggerGate.doPost:  
java.lang.IllegalStateException: Entry.next=null, data[removeIndex]=ObjectId:TblStatusstatus=ins=org.objectstyle.cayenne.DataRo..f1d2ce[values={description=inserted, status=ins}, version=-9223372036854491432, replaces=-9223372036854775808] previous=ObjectId:TblEffBlockDataeffBlockDataId=24455598[EMAIL PROTECTED], efficiencyValue=1.0761, effBlockDataId=24455598, energyValue=8.16, efficiencyBlockId=767, status=ins, irradiationValue=673.98, earnings=4.4064, importEffBlockDataId=1042169, dataDate=Mon Jun 12 11:30:00 CEST 2006, co2Saving=6.12}, version=-9223372036854494908, replaces=-9223372036854495032] key=ObjectId:TblLoggerloggerId=923 [EMAIL PROTECTED], newSerialNumber=null, commChannelType=analog, loggerProductId=1, loggerId=923, serialNumber=DL-NE101-01331, commChannelManufacturer=Conergy}, version=-9223372036854491407, replaces=-9223372036854775808] size=1 maxSize=1000
0 
Please check that your keys are immutable, and that you have used synchronization properly. If so, then please report this to commons-de..akarta.apache.org as a bug. 
at org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:300) 
at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:266) 
at org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:283) 
at org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621) 
at org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575) 
at org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314) 
at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159) 
at org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134) 
at org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375) 
at org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151) 
at org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765) 
at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253) 
at org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90) 
at org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422) 
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411) 
at com.conergy.sunreader.sr2.back.dao.ProductDAO.isLoggerAlreadyAvailable(Unknown Source) 



Thanks a lot,

Thilko



After extensive testing, we can only reproduce this when the map has not 
been correctly synchronized, or a mutable key has been used (as opposed 
to an immutable one).


If you upgrade to collections v3.2 you will get extra logging which may 
help diagnose the problem.


Stephen

Thilko Richter wrote:


Hi all,

I am working with Cayenne and I ´ve get the following Exception:

Caused by: java.lang.NullPointerException
at 
org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:272)
at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:243)
at 
org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)
at 
org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621)
at 
org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575)
at 
org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314)
at 
org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159)
at 
org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134)
at 
org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375)
at 
org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
at 
org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765)
at 
org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
at 
org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
at 
org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
at 
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
at 

Re: [collections] LRUMap NullpointerException

2006-06-16 Thread Stephen Colebourne
After extensive testing, we can only reproduce this when the map has not 
been correctly synchronized, or a mutable key has been used (as opposed 
to an immutable one).


If you upgrade to collections v3.2 you will get extra logging which may 
help diagnose the problem.


Stephen

Thilko Richter wrote:

Hi all,

I am working with Cayenne and I ´ve get the following Exception:

Caused by: java.lang.NullPointerException
at 
org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:272)
at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:243)
at 
org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)
at 
org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621)
at 
org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575)
at 
org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314)
at 
org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159)
at 
org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134)
at 
org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375)
at 
org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
at 
org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765)
at 
org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
at 
org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
at 
org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
at 
org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
at 
org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.doResolveFault(DataContextFaults.java:144)
at 
org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.resolveFault(DataContextFaults.java:117)
at 
org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:245)
at com.conergy.sunreader.sr2.back.auto._TblAccount.getTblPerson(Unknown 
Source)
at 
com.conergy.sunreader.sr2.back.dao.UserDAO.setAccountPersonData(Unknown Source)
at com.conergy.sunreader.sr2.back.dao.UserDAO.getUser(Unknown Source)
at com.conergy.sunreader.sr2.back.dao.UserDAO.login(Unknown Source)
at com.conergy.sunreader.sr2.back.proxy.CayenneProxy.login(Unknown 
Source)
at com.conergy.sunreader.sr2.back.BusinessFacade.login(Unknown Source)
at 
com.conergy.sunreader.sr2.struts.actions.Sr2BaseAction.loginUser(Unknown Source)
... 31 more


We have posted this exception in cayenne newsgroup before and we found out, 
that the caller of LRUMap is responsible for the thread safety. We´ve changed 
some methods calls in caeynne temporarily, but we still get this exception. 
Could anyone help us and tell, waht was going wrong here?

We using commons-collection v.3.1

This behauvior occurs when the machine is under heavy load and a lot threads 
access are created.

Thanks in advance,

Thilko


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] Bag sorted by count

2006-06-08 Thread Stephen Colebourne

Paul Dlug wrote:

I'm happy to provide a patch since I already have an implementation
completed. The best way I can think of to take this is to provide two
methods to AbstractMapBag:

public Object[] getSortedCount();

public Object[] getSortedCount(Comparator c);

Please let me know if List() is preferable to Object[], from the research
I've done so far it appears that a Set must be copied into a List or Array
in order to sort it. It seems to me that better performance would be
achieved with Set.toArray() and Arrays.sort()

The second method would be used to provide a second level comparator (first
sort by count, if there's a tie sort by Comparator). This is useful to do
something like sorting categories by count and then alphabetically.

This could alternatively be placed in BagUtils but I think it's cleaner to
have it as an instance method on the Bag itself.


Hmmm. I've just taken a look at the code, and its not as simple as I 
thought. I believe that we could take your methods as you propose and it 
would work, however, I'm not sure thats the best way.


My problem is that the methods involve copying the data to another list 
(List not Object[]) to return it. It feels like a core bag competancy.


Really, this would seem to be a SortedBag (TreeBag) where the comparator 
checks the count. But it could be hard to write a TreeBag comparator 
that does this (I haven't really checked). Thus the whole bag is kept 
sorted by count, and normal bag methods can then be directly used to 
extract the data.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [IO] writeStringToFile( File, String, String ), when File does not exist

2006-06-07 Thread Stephen Colebourne

Jamie Bisotti wrote:

As I mentioned in my original post...The JavaDoc for writeStringToFile()
says: Writes a String to a file creating the file if it does not exist.
That seems to imply that directories would be created, if need be; however,
that is not happening.  Is this a bug?  Or does the documentation just need
to be clarified?

It does not say anything about directories having to exist; it says the 
file
will be created if it does not exist. 

 [snip]
 Is this a bug or

an incomplete comment, in need of clarification?


It isn't a bug, but a reasonable enhancement. (At the minimum the 
javadoc should be improved).


Please raise a JIRA call. We'd also welcome a fix and test case if you 
have time.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] Bag sorted by count

2006-06-07 Thread Stephen Colebourne

Paul Dlug wrote:

Hopefully a simple question...

Is there an implementation of Bag that returns its elements sorted by their
count? I can't seem to find an elegant way to implement this (it seems like
the comparator would need a reference to the Bag it is comparing elements
for to do this with a TreeBag).


We have no such implementation. Its not a bad idea though.

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [collections] removeAll(Collection collection, Collection remove)

2006-05-25 Thread Stephen Colebourne

Why not download the source and take a look?
Stephen

Lazarte, Ivan wrote:

How exactly does this method remove one from the other?  Object identity
or equality?  We instantiated two different sets which should have
overlapping objects in terms of values, but when we tried to remove one
from the other, nothing happened.

-
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: [collections] removeAll(Collection collection, Collection remove)

2006-05-25 Thread Stephen Colebourne
I would always advise having the source to hand. If you have collections 
3.2 there's a source zip ready to attach to an IDE in the binary download.


I haven't checked because I'm lazy, but I'd expect this to match using 
.equals() as with all other Java Collections Framework matchling.


Stephen


Lazarte, Ivan wrote:

Yes, but I'm laaazy (meaning I'm getting tired of 60 hour weeks) :) I'll
take a crack at it later I suppose...

-Original Message-
From: Stephen Colebourne [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 25, 2006 6:41 PM

To: Jakarta Commons Users List
Subject: Re: [collections] removeAll(Collection collection, Collection
remove)

Why not download the source and take a look?
Stephen

Lazarte, Ivan wrote:


How exactly does this method remove one from the other?  Object


identity


or equality?  We instantiated two different sets which should have
overlapping objects in terms of values, but when we tried to remove


one


from the other, nothing happened.

-
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]



[ANNOUNCE] Commons Collections 3.2 released

2006-05-15 Thread Stephen Colebourne
The Commons Collections team is pleased to announce the release of 
commons-collections-3.2.


Commons Collections is a library that builds upon the Java Collection 
Framework. It provides additional Map, List and Set implementations and 
utilities. It also builds on the framework by providing new interfaces 
and implementations.


This release fixes numerous bugs, and adds a limited number of 
enhancements, including:

- MultiValueMap - A flexible MultiMap implementation
- DefaultedMap - A map that returns a default value when the key is not 
found
- GrowthList - A list where set and add expand the list rather than 
throw IndexOutOfBoundsException

- LoopingListIterator - A never-ending list iterator
- CollectionUtils.addIgnoreNull - Adds to the collection if the value 
being added is not null

- isEmpty - Checks maps and collections for empty or null
- BlockingBuffer - Add timeout handling to any buffer implementation
- ListOrderedMap - additional list-style methods

This release is binary and source compatible with 3.1 according to our 
tests. There are two new deprecations, see the release notes for 
details. We recommend all users of commons-collections to upgrade to 3.2 
to pickup the bug fixes.


Commons Collections Website:
http://jakarta.apache.org/commons/collections/

Release notes:
http://jakarta.apache.org/commons/collections/release_3_2.html

Download:
http://jakarta.apache.org/site/downloads/downloads_commons-collections.cgi

Enjoy!
The Commons Collections Team

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [collections] ReversePredicate

2006-04-28 Thread Stephen Colebourne

This looks like NotPredicate to me ;-)

Stephen


Lazarte, Ivan wrote:

I didn't see a reverse predicate object in the 3.1 api, so I wrote one
quickly.  Enjoy!

 


package your.package.goes.here.dude;

 


import org.apache.commons.collections.Predicate;

 


/**

 * Take a predicate as a value and reverse the sign.

 */

 


public class ReversePredicate implements Predicate {

 


Predicate predicate;




public ReversePredicate(Predicate predicate) {

this.predicate = predicate;

}

 


public boolean evaluate(Object object) {

return (predicate.evaluate(object) == true) ?
false : true;

}

}

 


Ivan Lazarte
Web Application Developer
The Away Network
(p) 202.654.8046
(f)  202.654.8081
1001 G St. NW
Suite 725W
Washington, DC 20001
| Away.com | Outside Online | GORP.com |

 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [commons-net] listFiles failing to parse Apr 26 02:45 like dates

2006-04-27 Thread Stephen Colebourne

David Waitzman wrote:

The fix I made was to force the FTP timezone to be UTC using:
   FTPClientConfig conf = new FTPClientConfig(FTPClientConfig.SYST_UNIX);
   conf.setServerTimeZoneId(UTC);
   ftpClient.configure(conf);
The UTC timezone has no daylight savings time so all the times are valid.
I'd rather keep my default timezone but turn off daylight savings time 
transitions, but I don't know how to do that.  (Any suggestions?)


The only way to turn off time zone transitions is to:
a) pick either summer or winter time (usually the one without daylight 
savings)

b) find out the offset
c) use the offset as a fixed offset, eg 'GMT+02:00'
Of course the time will only be accurate half the year...

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Compatability between Commons-Collections 2.1.1 and 3.1

2006-03-22 Thread Stephen Colebourne
Versions 2.1.1 and 3.1 are fully compatible so long as Hibernate does 
not utilise any method or class that is deprecated in v2.1.1. Figuring 
out whether that is true or not probably involves downloading the source 
for Hibernate and cross referencing the collections imports.


The problems only affected a tiny area of code, so you may just find it 
works anyway.


See http://jakarta.apache.org/commons/collections/compatibility.html for 
some more info.


Stephen

[EMAIL PROTECTED] wrote:

Hello,

I am currently using Hibernate 3.1 which depends on Commons-Collections
2.1.1. I am now adding Quartz 1.5.2 to my project, but it uses
Commons-Collections 3.1. I have read the history of this project and it
seems to indicate that I would be able to use Commons-Collections 3.1 and it
would have no reprecusion to how Hibernate 3.1 works. However, I would like
to get a verification from those in the know about Commons-Collections.

thanks,

Courtney B. Arnold




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Predicate

2006-03-22 Thread Stephen Colebourne
Your problems may be due to the fact that two arrays with the same 
contents are not equal (the equals() method doesn't return true). This 
is a historic oddity in Java.


If you change each of your collection elements to be a List instead of 
an array I expect that the predicate would work.


Stephen


Carlos Chavez wrote:

Hello people,

I have a collection where each items is a array of object( object[] ),
I want to use UniquePredicate to filter each item based on two items in the
array (object[])

But, i can't figure out how the UniquePredicate work. the docs says:
Evaluates the predicate returning true if the input object hasn't been
received yet.
I want to extend this for my object[], but i don't know at wich moment this
predicate indicate that the element exist in the collection.

any help are welcome.

Cheers.
--
Carlos Chávez



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[ANNOUNCE] Commons IO 1.2 released

2006-03-19 Thread Stephen Colebourne

The Commons IO team is pleased to announce the release of commons-io-1.2.

Commons IO is a library of utility, file filter, endian and stream
classes that aim to make working with IO much more pleasant. Many of
these classes probably should be in the JDK itself.

This release fixes a few bugs (notably LockableFileWriter), and adds
various enhancements, including:
- LineIterator - Allows you to work through a file using an iterator
style API
- AgeFileFilter - Filter files by their age
- SizeFileFilter - Filter files by their size
- FileSystemUtils - Obtain the free space on a drive in kb (improves on
previous version of the method by normalizing operating systems to kb)
- FileUtils method to iterate of a list of matched files

This release is binary and source compatible with 1.1 according to our
tests. There are no new deprecations. We recommend all users
of commons-io-1.1 upgrade to 1.2 to pickup the bug fixes.

Commons IO Website:
http://jakarta.apache.org/commons/io/

Release notes:
http://jakarta.apache.org/commons/io/upgradeto1_2.html

Download:
http://jakarta.apache.org/site/downloads/downloads_commons-io.cgi

Enjoy!
The Commons-IO Team

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: upload file [FileUpload]

2006-03-12 Thread Stephen Colebourne

Typo: enctypetype

Stephen

Marc Collin wrote:

Le Dimanche 12 Mars 2006 02:08, Brian K. Wallace a écrit :


Marc -

 Make sure you're using POST, not GET on your form.

Brian




i use post


form action=Upload method=POST enctypetype=multipart/form-data
  input type=file name=file
  input type=SUBMIT name=button value=Envoie
/form

-
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: [Collections] Facing Design Issue

2006-03-02 Thread Stephen Colebourne

Think about what is most important, then next important and so on.

It seems that time is most important to you.
Then the grouping by id.
But its not clear what kind of qery you will make

There doesn't seem to be one collection that will fit.

Try looking at
- MultiHashMap to hold a list of objects against a single key
- MultiKeyMap to use multiple keys to lookup a single value
- MultiKey or an array to hold multiple objects as one object
- TreeMap to keep the keys sorted

Stephen

Rajat Sharma wrote:

Hi,

I have the following stringswhich are currently in an arraylist. 


Instance Date   TimeVar-1   Var-2
65793 	02/24/2006 00:00:00 	1 	1 
66049 	02/24/2006 00:00:00 	1 	1 
66305 	02/24/2006 00:00:00 	0 	0 
66561 	02/24/2006 00:00:00 	1 	3 
66817 	02/24/2006 00:00:00 	7 	4 
67073 	02/24/2006 00:00:00 	0 	0 
67329 	02/24/2006 00:00:00 	9 	16 
68353 	02/24/2006 00:00:00 	1 	1 
66817 	02/24/2006 00:02:30 	2 	2 
67073 	02/24/2006 00:02:30 	0 	0 
67329 	02/24/2006 00:02:30	 9 	9 
68353 	02/24/2006 00:02:30 	1	 1 
68609 	02/24/2006 00:02:30	 7 	7 
68865 	02/24/2006 00:02:30 	0 	0 
69121 	02/24/2006 00:02:30 	0 	0 
69377 	02/24/2006 00:02:30 	1 	1 
69633 	02/24/2006 00:02:30 	0	 0 
65793 	02/24/2006 00:03:00 	1 	0 


One thing unique in the above table is the time on a per instance basis. Var-1, 
and Var-2 are the attributes of the instance at any given time.

What I need is a very clean way to wrap these under collections framework, 

a) Such that all the instances having the same ID are in their own Collections 
b) Most importantly, I could sort them with time. 


So all the unique instances help create separate tables each having the same 
ID, which can then be sorted on Date\Time such that sub-lists could be created 
which fall under the range of time given.

I am almost a beginner in collections and don't know if this is possible. 
Please note that, the above is not simly key-pair values but key-value-value

Could someone help me.

Regards,
Raj

-
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: [collections] Regex Map?

2006-01-06 Thread Stephen Colebourne

Eric Savage wrote:

I have a need for a map that has regex patterns as the key.  I didn't
see anything in collections (or anywhere else) that does this.  Could
someone confirm that?  If it doesn't exist, I'll have to write it, and
I would be happy to contribute it if its desired.


We don't have such a thing at present.

Its a little difficult to know how you'll create it as the key of a 
hashmap needs to be distinct, unique and immutable.


Since [collections] depends on JDK1.2 and no other jar files, including 
a regexp map in [collections] isn't possible ATM. Feel free to submit a 
bugzilla request with your code if you wish, as it may benefit some user 
indirectly.


Stephen



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [COMMONS-CODEC]

2005-12-29 Thread Stephen Colebourne
Are you able to supply a small test case to demonstrate the bug? That is 
the most useful item. If so, can you create a bugzilla bug call, thanks.


Stephen


Alex wrote:

Hello, i think i have found a bug in class Base64, the method
(isBase64(byte octet)). I say because i have passed a X509Certificate in
DEREncoded (so none Base64 byte[]). This method returns an
IndexOutOfBoundsException: -128. I think that the problem is in line
(base64Alphabet[octect] == -1) because it is the line where it crash and
also because it is the only place where an array is referenced. Im so
sure that the byte octet is the -128 value, so index out of bounds are
throwed. I have modified that class, i suppose that i would have to
upload some place, but i don't know where. Can anybody told me if im
correct and where i could send the class?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Commons Collections and generics?

2005-12-20 Thread Stephen Colebourne

Calum MacLean wrote:

I'm using Java 5.0, and I was wondering what the latest is on Commons 
Collections support for generics.

I'm aware that there have been a couple of different efforts to do this:
http://sourceforge.net/projects/collections, 
http://larvalabs.com/collections/
http://collections15.sourceforge.net/, 
http://sourceforge.net/projects/collections15
However, it's not clear what the status of these efforts is - how complete they 
are.

It's also not clear what the official Commons Collections stance is on creating 
a generics implementation of Commons Collections, or on these 2 efforts in 
particular.
Does anyone have more info?

Also, does the apparent lack of interest in a generics implementation of 
Commons Collections suggest that hardly anyone is actually using Java 5.0...?


http://collections15.sourceforge.net/ has seemed to be the most active 
project. The main issue is lack of developers at commons to host the 
code here.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] When to use a Predicate?

2005-12-19 Thread Stephen Colebourne

Bernard, Shawn wrote:

Under what circumstanes would one use a Predicate to encase conditional logic?  
I know it's a rather broad question, but I was looking at them and they seem 
pretty powerful, but I wouldn't want to use them incorrectly.


If you like the functor style of programming then go ahead and use it!

There is a potential downside in terms of extra classes and object 
instantiation, but on modern JVMs thats not really a big issue.


Stephen



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [commons-lang] Xml escaping

2005-12-08 Thread Stephen Colebourne

Have you got a specification link that you believe we are breaking?

Stephen


Milosh Milosavljevic wrote:

Hi,
 I am not sure why StringEscapeUtils.escapeXml always tries to escape 
high ascii characters together with xml entities. In case that this is 
just an issue connected to HTML escaping, I would suggest to make a flag 
for high ascii escaping. I did that flag in my local branch of 
commons-lang and I can send it to you if there is a need.


 Thanks,
 Milosh

-
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: is collections 3.x code compatible with collections 2.x

2005-11-30 Thread Stephen Colebourne
v3.x is fully source compatible with v2.1, with the
exception that any methods or classes that were
deprecated in v2.x were removed.

v3.x is binary compatible EXCEPT for IteratorUtils.
See
http://jakarta.apache.org/commons/collections/compatibility.html
for full details of the chosen workaround.

Obviously we recommend using v3.1 as opposed to v3.0.
Also note that we are working towards v3.2 at the
moment.

Stephen


--- [EMAIL PROTECTED] wrote:
 I just want to know that whether collections 3.x
 code compatible with collections 2.x . Do i have to
 make some changes in my code if i switch from 2.x to
 3.x
  
 please kindly reply as soon as possible 
  
 with regards,
 Rishi Mishra
 Accenture Services Pvt. Ltd.
 Mumbai-79 
 
  
 
 
 This message is for the designated recipient only
 and may contain privileged, proprietary, or
 otherwise private information.  If you have received
 it in error, please notify the sender immediately
 and delete the original.  Any other use of the email
 by you is prohibited.
 
 
-
 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: is JDK1.3 commpatible with Commons collection3.0

2005-11-18 Thread Stephen Colebourne
Yes. [collections] runs on JDK1.2 or later.

Please note however that collections 3.1 was released
some time ago, and you shoud use that if at all
possible.

Stephen

--- [EMAIL PROTECTED] wrote:
 please answer whether with jdk1.3 can we use commons
 collection 3.0
  
 with regards,
 Rishi Mishra
 Accenture Services Pvt. Ltd.
 Mumbai-79 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Id] Help getting started

2005-11-15 Thread Stephen Colebourne

Try
http://cvs.apache.org/builds/jakarta-commons/nightly/commons-id/
and
http://jakarta.apache.org/commons/discovery/

Stephen

Rakesh Patel wrote:
i was looking for some code that generates a unique value that i could 
use as a token when establishing sessions in web services.


I came across the Commons Id component and it looked like what i needed.

However, I'm not sure how to get hold of it. I use the eclipse cvs plug 
in. I managed to download the commons id code but it didn't work because 
of dependencies with discovery. When i went to find that, the directory 
structure was there (with an additional services sub dir for some 
reason) but no source files.


Normally, I download jars and get going. Not sure how to use this code. 
Can anyone help?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] MultiKeyMap vs concatenating keys that are strings

2005-10-21 Thread Stephen Colebourne

The short answer is to say, this is open source, so look at the source ;-)

The longer answer is that MultiKeyMap uses specially optimised data 
structures internally to store the key parts. This avoids any hacky (and 
slow) string concatenation. Given a choice, I would always use a 
MultiKeyMap for a multiply-keyed map.


Stephen



Mark Shifman wrote:

Hi:

If I am building a map with a compound key composed of say 3 strings , 
is there any advantage to using MultiKeyMap over a regular Hash(ed)Map

with the key = key1+_+key2+_+key3;

speed?..elegance??

thanks in advance
mas

-
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]



[ANNOUNCEMENT] Commons IO 1.1 released

2005-10-10 Thread Stephen Colebourne

The Commons IO team is pleased to announce the release of commons-io-1.1.

Commons IO is a library of utility, file filter, endian and stream classes
that aim to make working with IO much more pleasant. Many of these classes
probably should be in the JDK itself.

This release fixes all open bugs, and adds various enhancements, including:
- FilenameUtils - A static utility class for working with filenames 
without File objects
- FileSystemUtils - A static utility class that allows you to get the 
free space on a drive

- IOUtils/FileUtils - read and write files line by line into a List
- WildcardFilter - A new filter that can match using wildcard file names

This release is binary and source compatible with 1.0 according to our 
tests.

There are some minor semantic changes caused by bug fixes which should not
affect the vast majority of 1.0 users - please check the release notes 
for full details.
To simplify the API, there has also been a deprecation - please check 
the release notes.
We recommend all users of commons-io-1.0 upgrade to 1.1 to pickup the 
numerous bugs fixes.


Commons IO Website:
http://jakarta.apache.org/commons/io/

Release notes:
http://jakarta.apache.org/commons/io/upgradeto1_1.html

Download:
http://jakarta.apache.org/site/downloads/downloads_commons-io.cgi

Enjoy!
The Commons-IO Team

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: MultiMap?

2005-09-14 Thread Stephen Colebourne
--- Andrei Polushin [EMAIL PROTECTED] wrote:
 The classes in 2nd-level packages (like in 
 org.apache.commons.collections.map) are
 'decorators'. They are not 
 interfaces (like MultiMap), and not self-contained
 implementations (like 
 MultiHashMap).

Sorry, but this isn't entirely correct. There are
concrete implementations in the
org.apache.commons.collections.map package, such as
HashedMap, LinkedMap and LRUMap.

There are also the implementations of the decorators.
Personally, I would recommend using the decorators
directly via their decorate() static factory methods
rather than via MapUtils.

The interfaces are in the base package and will remain
there.

(Note this all refers to v3.0 and onwards of
collections)

Why is MultiHashMap not in the map package? Because
there wasn't time to rewrite it for v3.0 (or 3.1). A
new class - MultiValueMap - will exist in the map
package for v3.2, and will replace MultiHashMap.

Stephen



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Basic questions about VFS

2005-09-07 Thread Stephen Colebourne
--- Mario Ivankovits [EMAIL PROTECTED] wrote:
 The main problem is the lack of support in the
 underlaying libraries.
 Even for local files we might need a native library
 (I hate native 
 libraries) to set permissions as there is no real
 support in java.io.file.

See [io] FileSystemUtils for an example of using the
command line from Java to get the free space on the
drive. You could extend this [io] class to add file
permissions.

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [email] Commons-Email -- not J2EE 1.3?

2005-09-06 Thread Stephen Colebourne

Asleson, Ryan wrote:

Hello,

I just tried using Commons-Email RC5 on WebLogic 8.1. When using the 
Email.addTo method, I receive a NoSuchMethodError.

It appears that the Email class is attempting to use 
InternetAddress.validate(), which is part of J2EE 1.4, not 1.3.  Since I'm 
using WebLogic 8.1, which is only J2EE 1.3, it looks like I'm stuck.

Is there any way around this?


This sounds like something that should be fixed. Not sure what the 
alternative to this method is though...


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [POLL][VFS] how to resolve relative filenames

2005-08-20 Thread Stephen Colebourne

Mario Ivankovits wrote:
I would like to know how you think VFS should resolve filenames relative 
to another filename.


There is a request to change VFS's current behaviour.

Consider the following root: file:///my/root/file and this relative 
filename any/child/file


currently VFS resolve it to file:///my/root/file/any/child/file


In FilenameUtils in [io] we use the same as above:
  assertEquals(a + SEP + b + SEP + f,
   FilenameUtils.concat(a/b/, f/));
  assertEquals(a + SEP + b + SEP + f,
   FilenameUtils.concat(a/b, f));



[ ] Use URI style
[X] Keep current behaviour
[ ] Minimum jdk 1.4
[X] Minimum jdk 1.3


Too many people (including large corporations) still use JDK1.3

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [feedparser] Is an easy way to obtain the source code?

2005-08-16 Thread Stephen Colebourne

Vernon wrote:

Since there isn't a download version neither a working
CVS URL, is an easy way to obtain the source code? 


btw, I don't the status of this project. The last
change was this February. Is it an active project?


This project is in a strange state. Its now in commons-proper, but the 
website is in commons-sandbox. And I don't remember any recent emails on 
the component.


CVS is no more, use SVN instead
http://svn.apache.org/viewcvs.cgi/jakarta/commons/proper/feedparser/trunk/?rev=233041

Probably should be demoted back to the sandbox.

Stephen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Collections] MultiHashMap - retrieving values in the order in which they were added

2005-08-12 Thread Stephen Colebourne

Alice Boxhall wrote:

Just a quick question re MultiHashMap:
For my current project I need to be able to ensure that if I do

map.put(foo, a);
map.put(foo, b);
((Collection)map.get(foo)).iterator();

I will get a and b back in that order. Obviously with the current 
implementation this will be the case, but I was wondering if there was 
some way that I could ensure that in case the implementation changes.


If not, no big deal, I can easily work around it.


1) there are no plans to change this.

2) IIRC there is a protected method in MultiHahsMap that returns the new 
collection (so you can subclass and force it)


3) You might want to try the new and improved MultiValueMap in the map 
subpackage (not released yet). It allows you much greater control over 
this type of class, and is the designated replacement for MultiHashMap.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Exception handlers

2005-08-11 Thread Stephen Colebourne
commons-lang exception package is worth checking out, notably 
ExceptionUtils.


Stephen

[EMAIL PROTECTED] wrote:

 I wonder what package in jakarta commons 'handles' exceptions (no pun intended)

 I need to be able to get as a String all the info thrown by the baseline JVM,
JDBC or JMX drivers, or programmatically generated like this:

(throw new Exception(Testing thrown Exception))

 So which package should I use

 THanks
 Albretch



-
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: [Collections] performance results?

2005-08-03 Thread Stephen Colebourne

amol k wrote:

I am looking for any performance related statistics for the collections package.

Particularly interested in knowing how the various methods in
CollectionUtils perfom under very large data sets and problems, if
any, that any of us may have encountered while managing large
collections using the calls in CollectionUtils.


Unfortunately, I am unaware of any performance testing of [collections], 
other than of individual classes:


- TreeList is faster than LinkedList, and can for some cases be faster 
than an Arraylist

- Flat3Map is faster than a HashMap at size 3 or less

If anyone did any more performance testing, hopefully they can share 
their results with the list.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [Commons, Collections, JXPath] Looking for more to read, pros/cons of filtering methods

2005-07-20 Thread Stephen Colebourne

Bernard, Shawn wrote:

For the record, my initial post on this topic had a subject line of:

[Collections, JXPath] advantages/disadvantages

My question was:

[W]hat are the advantages/disadvantages of using

 Predicate/Closure's to filter Collections of beans as
 opposed to using JXPath?

JXPath (or EL/JEXL) is simply a way of getting a piece of data from a 
complex structure (XML or Bean).


Functors can be used for this purpose too (and might perform slightly 
faster as the code is real, not interpretted from a parsed string).


However, functors are really intended for deeper problems, specifically 
actually performing processing. See 
http://www.onjava.com/pub/a/onjava/2004/12/22/jakarta-gems-1.html?page=last 
for a good example.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [collections] Name that data structure

2005-07-14 Thread Stephen Colebourne

Wendy Smoak wrote:

I put together a simple example that demonstrates the problem:
http://wiki.wendysmoak.com/cgi-bin/wiki.pl?CircularFifoBuffer

Bug?  Surely I'm not doing anything wrong by calling remove(...) on a
Collection?  (Inefficient though it may be, first I just want to see it
work.)


Your wiki indicates that this is solved in SVN. Is this the case?



Meanwhile, is there another way I can get the buffer to be in the correct
LRU order?  The LRUMap did work, but it's ugly having to put  the empty
String into the Map, when I don't need key/value pairs.


Our only LRU implementation is LRUMap at present.

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [codec] experience with phonetical encoders in other languages ?

2005-07-07 Thread Stephen Colebourne


Resending to correct project - [codec]

Paul Libbrecht wrote:


Hi,

I would like to know wether the phonetical encoders found in commons-io 
have been used by someone with different langauges than English.
I'm pretty sure they fail for Chinese at least but I'd like to know if 
Soundex and Metaphone have a chance for, say, european languages...


thanks


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Expressions, Collections, Filtering oh my..

2005-07-05 Thread Stephen Colebourne

Poppe, Troy wrote:

I've got a collection of a JavaBeans, it could be a plain-old-Java collection or
a Commons-Collection... Not really a concern...

I'm trying to find a way to provide the ability to write a JEXL-like expression
that would be applied against the collection of JavaBeans, and be able to
retrieve all of the JavaBeans that match that JEXL-like expression.

So far, looking at JEXL, it looks like it requires a JexlContext, but I don't 
see
or know how I would adapt my JavaBean properties to this.

Is there an out-of-the-binary way of filtering through my JavaBeans, and giving
me access to those that match some expression?


With commons-collections, the best approach is to write a Predicate 
instance (typcially an inner class), and use CollectionUtils.filter or 
PredicateCollection to do the filtering. No specific JEXL handling though.


Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [functor] Still maintained?

2005-04-08 Thread Stephen Colebourne
 paul womack wrote:
  I'm confused. Do you mean the rather wonderful
 stuff in
  org.apache.commons.collections.functors?
 
 Sorry. the OP (who's message I didn't get, BTW)
 obviously meant
 http://jakarta.apache.org/commons/sandbox/functor/
 and not

http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_1/org/apache/commons/collections/functors/package-summary.html
 
 The existence (and overlap) of these 2 packages is
 itself a Bad Thing.

Not necessarily. The commons charter encourages
alternate implementations. The [functor] project
exists because the original author couldn't refactor
the original code in [collections].

Stephen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AbstractHashedMap deserialization

2005-04-01 Thread Stephen Colebourne
Can you raise this in Bugzilla, it definitely sounds
like a bug.

thanks
Stephen


--- Marcos César de Oliveira
[EMAIL PROTECTED] wrote:
 I start using the MultiKeyMap in a application of
 mine, including the
 serialization of the maps.
 Since then, this application grew very much in heap
 usage, and after
 profiling the application, I see that the main
 offender is the
 AbstracHashedMap class as stated bellow:
 
  rank   self  accum bytes objs bytes  objs
 trace name
 1 63.92% 63.92% 1344801924 134480192 4
 305914

org.apache.commons.collections.map.AbstractHashedMap$HashEntry[]
 2 31.93% 95.85%  67180256   74  6724580875
 305860

org.apache.commons.collections.map.AbstractHashedMap$HashEntry[]
 3  0.69% 96.53%   1447176 49316   1449480 49395
 305471 char[]
 4  0.56% 97.10%   1183584 49316   1185480 49395
 305470 java.lang.String
 5  0.50% 97.60%   1053032  279   2693600   656
 302432 byte[]
 (continues...)
 
 After some debug, I realized the cause is the
 following:
 
 In the method AbstractHashMap#doReadObject, the
 method call threshold =
 calculateThreshold(data.length, loadFactor); is
 after the put(key,
 value);.
 The put method uses the threshold to check the
 capacity of the data array.
 In this checking, the threshold is zero, leading to
 a resize of the data
 array.
 At each serialization/deserialization the size of
 the data array doubles.
 
 The question is:
 I'm missing something, or this is a bug in
 deserialization of the
 AbstractHashMap?
 
 Thanks in advance. 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [commons-collections]: how to do reverse iteration in TreeBidiMap

2005-03-30 Thread Stephen Colebourne
There is no direct way to iterate over the 10 largest
values. However you can do the following:

TreeBidiMap map;
Object last = map.lastKey();
Object oneBefore = map.previousKey(last);
Object oneBeforeThat = map.previousKey(oneBefore);

Note that these are methods directly on TreeBidiMap.


The alternative is to use a reverse comparator.
BidiMap map;
Collection coll = map.values();
Set reversed = new HashSet(coll,
Collections.reverseOrder());

Stephen

--- rinke hoekstra [EMAIL PROTECTED] wrote:
 Hi list, 
 
 maybe a stupid question, or maybe I am missing
 something, but I cannot sort out how to 
 do a reverse iteration over the values of a
 TreeBidiMap, and couldn't find much about it 
 on the web.
 I want to retrieve the 10 greatest values from a
 HashMap, and thought it best to use a 
 TreeBidiMap for it.
 
 I have this:
 
 TreeBidiMap bidiMap = new TreeBidiMap(myHashMap);
 OrderedBidiMap invMap =
 bidiMap.inverseOrderedBidiMap(); //creates inversed
 map
 OrderedMapIterator oit =
 invMap.orderedMapIterator();
 while (oit.hasPrevious()) {
   Float value = (Float)oit.previous();
   .
 }
 
 
 The iterator however seems to be initialized at the
 first element, so hasPrevious() is 
 usually false, and the loop isn't run. 
 
 How to initialize the iterator at the last element,
 so you can start iterating using 
 hasPrevious()? 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [jxpath] regular expressions in XSLT string operations

2005-03-30 Thread Stephen Colebourne
Apologies in advance for MY brevity:
- Read the mailing list guidelines.
- Add [jxpath] to the subject.
- Remember that we don't get paid for this.
- Generally, if you want it, you may have to help do it.
Stephen
depub2 wrote:
Apologies in advance for my brevity: I did not ask for a workaround - I know
workarounds exist.
I ASKED: Is there a PLAN for commons/jx-path to support at least some of
the XPATH 2.0 features such as regex (fn:matches, fn:replaces, fn:tokenize)
and other really helpful string operations?
IS THERE A PLAN?
IS THERE A ROUGH DATE OF COMPLETION?
This planning information will help me determine if I should put a
work-around in place.
Thank You,
David


Hi David,
  I'm just a JXPath user.  Maybe you could implement fn:replaces,
fn:matches and fn:tokenize as custom functions in JXPath.
Check out
http://jakarta.apache.org/commons/jxpath/users-guide.html#Custom%20Extension
%20Functions
  Cheers,
Adrian P.J.
depub2 wrote:

fn:replaces provides for regular expression based string match/substitution
within xslt. Is there a plan for commons/jx-path to support at least some
of
the XPATH 2.0 features such as regex (fn:matches, fn:replaces, fn:tokenize)
and other really helpful string operations? I am using cocoon and could
*really* use these string functions!
David


Best Regards,
David E. Epperly
Engineering Services
Inflection Technologies Corp.
Tel#: (310) 523-2817
Cel#: (310) 780-2817
Fax#: (310) 329-0781
IWeb: http://www.inflectech.com
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: [Math] [Collections] time-based window statistics

2005-03-21 Thread Stephen Colebourne
- Original Message - 
From: Paul Smith [EMAIL PROTECTED]
We have the need to track things in a data-rate format, like indexes 
operations/second etc and stats similar to what is reported via the 
'uptime' command, with averages over a 1 minute, 5 minute, 15 minutes etc.
Now I'm sure creating my own little API is not that hard, but it occured 
to me that this or something similar has to have been done so many times 
that someone has released a utility API to help.   There doesn't appear to 
be any window-style collections in Jakarta Collections, and the 
DescriptiveStats class in Math is very useful, but there's nothing 
natively in there to do with time-based windows.
The closest I can come to help you is with Joda-Time 
http://joda-time.sourceforge.net. We have an Interval class with a contains 
method that would be useful in identifying whether an event was in a 
particular interval or not. We don't have any collections though.

Stephen
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [Collections] What collection fits my problem?

2005-03-15 Thread Stephen Colebourne
You describe the correct behaviour of SortedBag, and collections in general. 
Most collections use .equals() comparisons.

You have two choices:
a) Write a sorted collection that uses == for comparison instead of .equals
b) Use a TreeSet, but wrap each of your objects in an inner class style 
wrapper, eg:
public class Wrapper {
 public Object realData;
}

Stephen
- Original Message - 
From: Mike Zatko [EMAIL PROTECTED]
FYI, I did try a sorted bag which appeared to be what I was looking for. 
But, for some reason if you add 2 identical objects (deep copied) and add 
them to the bag, it will merely overwrites the first objects reference 
with the second objects reference. To me, this seems like it would be a 
bug, but I could be wrong. Any thoughts?

Mike Zatko wrote:
I need a sorted collection that also allows deep copied duplicate objects 
(exact same object, different memory addresses). Is there a collection 
that fits that requirement? I've been having difficulty finding one 
myself. Thanks for any help.

-
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: [IO] Commons IO 1.1RC1 ?

2005-03-08 Thread Stephen Colebourne
Code-wise its pretty close. But I'm not sure if we have a release manager 
who wants to push it through. So, if I gave you a date I might just 
disappoint you ;-)

Stephen
- Original Message - 
From: Lukas Bradley [EMAIL PROTECTED]
Is there a release date set for 1.1 RC1 or Final?
The API as shown on 
http://jakarta.apache.org/commons/io/apidocs/index.html is the 1.1-dev 
version.  Some users (such as myself) might browse it for needed 
functionality, find what they are looking for, but not notice it is 
missing from the 1.0 version.

In short, when will a release candidate be available?
-
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] Bugs of StringEscapeUtils.escapeHtml()?

2005-03-08 Thread Stephen Colebourne
Is that a problem?
Stephen
- Original Message - 
From: Carfield Yim [EMAIL PROTECTED]
Other than escapeHTML entities like space and  , all multibyte
Characters like Chinese, Japanese and Russian will escaped.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: camel case string

2005-03-08 Thread Stephen Colebourne
Don't misunderstand me. I'd like the code to be attached to the bugzilla 
call too, plus tests.
Stephen

From: Henry Voyer [EMAIL PROTECTED]
Sorry but i beleive that this is not the way to go.
This is an easy programming task. He could take 30 minutes to program it, 
do
a junit and deliver the result to the community.

A+
-Original Message-
From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
Sent: Monday, March 07, 2005 8:00 PM
To: Jakarta Commons Users List
Subject: Re: camel case string
I would recommend raising a bugzilla call (RFE) against [lang]. This
suggestion has come up before.
Stephen
- Original Message -
From: Anthony Perritano [EMAIL PROTECTED]
is there api to split camel case strings into separate words? for example
i want the ability to split stepListFirst into step List First.
Thanks,
Anthony Perritano
-
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: camel case string

2005-03-07 Thread Stephen Colebourne
I would recommend raising a bugzilla call (RFE) against [lang]. This 
suggestion has come up before.

Stephen
- Original Message - 
From: Anthony Perritano [EMAIL PROTECTED]
is there api to split camel case strings into separate words? for example 
i want the ability to split stepListFirst into step List First.

Thanks,
Anthony Perritano
-
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: [collections] Transition to Generics

2005-02-22 Thread Stephen Colebourne
See the http://collections15.sourceforge.net project
Stephen
- Original Message - 
From: Simon Kitching [EMAIL PROTECTED]
To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Tuesday, February 22, 2005 8:56 PM
Subject: Re: [collections] Transition to Generics


On Mon, 2005-02-21 at 20:46 -0800, Mark Fairchild wrote:
I'm curious if there are any plans as to when and how
commons-collections will begin to leverage features from Java 1.5, such
as generics and typesafe enums.  Is this underway in an experimental
branch?  Are volunteers needed to work on such thing?  And if not, is
there a timeframe for when the transition will start?
This has been discussed here before. The current state appears to be
that a few people are interested in working on this, but none of them
are commons committers. And that makes it difficult to work on this
within the commons project.
It has been suggested that those people interested could work initially
on sourceforge.
See the mail archives for more info...
Regards,
Simon

-
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: [collections] MultiHashIdentityMap ?

2005-02-17 Thread Stephen Colebourne
There has been demand before for MultiHashMap to extend 
AbstractMapDecorator.

I support the concept of MultiMaps produced by decoration, however we cannot 
change the existing MultiHashMap class.

Should you, or anyone else, implement a MultiMap based on 
AbstractMapDecorator, with test cases, attached to a bugzilla call, then I 
would like to add it to [collections].

Stephen
- Original Message - 
From: paul womack [EMAIL PROTECTED]
I *really* like the MultiMap concept; I have many
uses for it within my app.
However, I have quite a lot of well defined
pools of objects.
These are often used as keys to java.util.Maps; since
I *KNOW* I'm OK, I use java.util.IdentityMaps
for performance reasons.
I would very much like to have the same option with MultiHashMap.
MultiHashMap is already carefully designed to allow
the underlying multi-ness to be implmented by the
Collection of my choice, by over-riding createCollection();
However, MultiHashMap extends HashMap, which means my request
is no trivial to implement.
If (I suggest :-) it extended AbstractMapDecorator, the underlying
Map could be similarly versatile.
BugBear
-
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: FastMultiHashMap, BidiMultiHashMap

2005-02-13 Thread Stephen Colebourne
From: [EMAIL PROTECTED]
This probably rather belongs to the developer's mailing list but is there 
any
particular reason why there is no FastMultiHashMap
because the Fast* classes are in general thought to be of dubious value due 
to the double checked locking problem, see comments in the class

and no BidiMultiHashMap?
because writing Bidi maps is fiendishly complicated, and there are many 
other possible bidi maps that _coul_ be created (thus only the simple basic 
ones are provided)

Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [io] Should I buffered streams when using commons io?

2005-02-09 Thread Stephen Colebourne
The javadoc tells you the answer
 The copy methods use an internal buffer when copying. It is therefore 
advisable not to deliberately wrap the stream arguments to the copy methods 
in Buffered* streams 

Stephen
- Original Message - 
From: Carfield Yim [EMAIL PROTECTED]
To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Wednesday, February 09, 2005 2:16 PM
Subject: Should I buffered streams when using commons io?


Should I buffered streams when using commons io myself, like
CopyUtils.copy(new BufferedInputStream(new FileInputStream(file)), new
BufferedOutputStream(res.getOutputStream()));
instead of
CopyUtils.copy(new FileInputStream(file)), res.getOutputStream());
Or CopyUtil, IOUtil proper probably inside the API?
-
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: count/delete/contains elements of collection using iterator,

2005-02-09 Thread Stephen Colebourne
[collections] generally deals with iterators by asking you to convert them 
to a collection, for which we provide a method. Have a scan of 
CollectionUtils to see if that helps.

Stephen
- Original Message - 
From: Peter Billen [EMAIL PROTECTED]
I was wondering if there are functions to count in a collection using the
iterator, checking if an element is contained in a collection using the
iterator, deleting etc. I know these are simple while-loops, but I was
wondering if they were already avaiable in the library. I couldn't find
anything in the API docs.
thanks,
--
Peter


-
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: [dbcp][pool] Bug or incompatibility?

2005-01-25 Thread Stephen Colebourne
org/apache/commons/collections/CursorableLinkedList was deprecated in 
collections 3.0/3.1 but still exists, so you shouldn't get a 
NoClassDefFoundError. Hopefully the dbcp/pool developers can comment more 
about the dependency.

Stephen
- Original Message - 
From: Stefan Burkard [EMAIL PROTECTED]
i just started an eclipse-project in which i use commons-dbcp, and pool to 
establish a db-connection-pool. by the way i use jTDS as driver for 
mssqlserver.

if i run my code i get a java.lang.NoClassDefFoundError: 
org/apache/commons/collections/CursorableLinkedList

when i add the actual commons-collections-3.1 to my lib-dir i get the same 
error. if i take the collections-jar from tomcat 5, the error is gone.

1. question: is collections needed to work with dbcp and pool?
2. question: is the above a bug or an incompatibility?
greetings
stefan
-
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] lang.Validate

2005-01-21 Thread Stephen Colebourne
Thanks for the response.  Where is the proper place to discuss such a
proposal?  The commons-dev list?
Yes, for proposed code changes commons-dev is better.
commons-user is for usage queries.
Stephen
- Original Message - 
From: Briniest Mark [EMAIL PROTECTED]
To: Jakarta Commons Users List commons-user@jakarta.apache.org
Sent: Friday, January 21, 2005 2:32 AM
Subject: Re: [lang] lang.Validate


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [lang] lang.Validate

2005-01-20 Thread Stephen Colebourne
The Validate class is intended to be used to validate entry to methods at 
runtime, similar to the assert keyword in JDK1.4. It is not intended to be a 
general purpose validation class.


What I'm wondering is, are there are any plans to increase the scope of 
Validate's tests?  And if there aren't any such plans, would the 
maintainers be open to someone else (me, for example) submitting patches 
that expand the functionality of Validate?
There are no plans at present. Specific ideas are welcomed, as are patches. 
Patches should be submitted to bugzilla with test cases using the correct 
patch format (see pages on website)


I can think of quite a few tests that could be standardized by Validate. 
For example:
A regex matching test; Validate.matches(param, [1-9][0-9]*);
A numerical range test; Validate.inRange(param, new IntRange(0, null));
A test for asserting a predicate over an array collection:
Validate.forAll(myList, myPredicate);
Even a simple nonNegative test for the integral and floating point 
primitives would be great.
Any enhancement suggestions will be judged based on whether they fit the 
intent of the class, and whether they are JDK1.2 compatible (regexp isn't 
for example).

Of your suggestions, I believe that numeric range validations could probably 
be added, but regexp and predicate based classes would not.

I also suggest discussing particular proposals before going to the effort of 
implementation.

Hope this helps.
Stephen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: commons functors project status

2005-01-08 Thread Stephen Colebourne
The lead developer Rodney Waldorf has rather disappeared from the commons 
list, thusthe project never proceeded to a release. I would not incorporate 
this code in [collections] as collections is already at about its maximum 
viable size.

Stephen
- Original Message - 
From: Brian Lee [EMAIL PROTECTED]
Is the commons functors project dead? If not, will this project and the 
commons collection project combine / collaborate?

Brian
-
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: ToStringBuilder : print only first elements of array

2004-12-22 Thread Stephen Colebourne
Create a new subclass of ToStringStyle and override the method
protected void appendDetail(StringBuffer buffer, String fieldName, Object[] 
array)

Stephen
- Original Message - 
From: [EMAIL PROTECTED]
To: commons-user@jakarta.apache.org
Sent: Tuesday, December 21, 2004 3:48 PM
Subject: ToStringBuilder : print only first elements of array


Hi,
I use ToStringBuilder to print arrays but sometime these arrays have
hundreds of elements, so the log file becomes unreadable
I would like to print only the first 5 elements
Is it possible with ToStringBuilder ?
Thanks


This message and any attachments (the message) is
intended solely for the addressees and is confidential.
If you receive this message in error, please delete it and
immediately notify the sender. Any use not in accord with
its purpose, any dissemination or disclosure, either whole
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message.
BNP PARIBAS (and its subsidiaries) shall (will) not
therefore be liable for the message if modified.
   -
Ce message et toutes les pieces jointes (ci-apres le
message) sont etablis a l'intention exclusive de ses
destinataires et sont confidentiels. Si vous recevez ce
message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce
message non conforme a sa destination, toute diffusion
ou toute publication, totale ou partielle, est interdite, sauf
autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce
message, dans l'hypothese ou il aurait ete modifie.
-
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: AW: [collections] Modify getter result

2004-12-21 Thread Stephen Colebourne
What you realy need is a DefaultedMap class. I have
most of one coded on my PC, but I never seem to have
the time to commit it. (I also had questions as to
whether to make it a flag on LazyMap, or a new class.)

Anyway, for now, if LazyMap is not good enough, then
you will need to write your own class, it is simplest
to just copy LazyMap and remove the line that adds to
the map.

Stephen

 --- Nentwig, Timo [EMAIL PROTECTED] wrote:

 When the get(Object) method is called with a key
 that does not exist in the map, the factory is used
 to create the object. The created object will be
 added to the map using the requested key.
 
 Well, this would do the trick but isn't quite what I
 am looking it though.
 
 After calling
 
   currency.get(AB);
   currency.get(BC);
 
 I would have two new item in the HashMap, AB and BC.
 
 Consider this:
 
 Factory factory = new Factory() {
  public Object create() {
  LOG.error(non-existing object was requested at
  + System.currentTimeMillis());
  return new Date();
  }
  }
  Map lazy = Lazy.map(new HashMap(), factory);
  Object obj = lazy.get(AB);
  wait();
  Object obj2 = lazy.get(BC);
  wait();
  Object obj = lazy.get(AB);
 
 Getting AB the second time would actually return the
 object created in first instance. Consider that the
 Map may likely be filled by data from a persistence
 store which likely must be updated manually and
 cannot or must not be done in create().
 
 -Ursprüngliche Nachricht-
 Von: Stephen Colebourne
 [mailto:[EMAIL PROTECTED] 
 Gesendet: Montag, 20. Dezember 2004 21:17
 An: Jakarta Commons Users List
 Betreff: Re: [collections] Modify getter result
 
 See LazyMap.
 Stephen
 
 - Original Message -
 From: Nentwig, Timo [EMAIL PROTECTED] I'm
 not sure whether this can be done with
 commons-collections. 
 
 I need to hook in a collection and return a default
 value when the requested key does not exist in the
 collection. E.g.
 
 Map currency = new HashMap()
 {
 {
 put(DE, EUR);
 put(US, USD);
 }
 };
 
 And currency.get(XY) is supposed to return a
 default value (this may require additional logic and
 e.g. may write to the logger that an yet unsupported
 ISOCODE was requested).
 
 Can this be done?
 
 Kind regards
 Timo
 

-
 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: [OT] Request an app test (free beer!)

2004-12-21 Thread Stephen Colebourne
Maybe a google search would serve your needs:

http://lopica.sourceforge.net/os.html

Stephen


 --- Ben Souther [EMAIL PROTECTED] wrote: 
 FC2 returns:
 Linux
 
 
 
 On Tue, 2004-12-21 at 09:11, Jason Vinson wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
  
  $ java Test
  Mac OS X
  
  For OSX obviously  :)
  Jason
  
  Frank W. Zammetti wrote:
  
  | I was informed last OT post I made that the
 subject should always
  | include the word beer.  I added the free to
 get your attention
  | :)
  |
  | I'm working on something for which I need to
 know what the os.name
  |  property on various OS's is.  I would greatly
 appreciate it if
  | some folks could try the following:
  |
  | public class test { public static void
 main(String[] args) {
  |
 System.out.println(System.getProperty(os.name)); }
 }
  |
  | I'm particularly interested in various *nix
 variants, Linux, Mac
  | and such.  Windows I already have answers for
 (although some
  | verification to be sure nothing fishy is going
 on wouldn't hurt).
  |
  | If you could just post your OS and what the
 result was, I would
  | greatly appreciate it.  Thanks in advance!
  |
  
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v1.2.4 (GNU/Linux)
  Comment: Using GnuPG with Thunderbird -
 http://enigmail.mozdev.org
  
 

iD8DBQFByC8gAQ71cZOfvEQRAvmTAJsH/HPRTrDYR+XgByCuEbaPvZq11gCghhN0
  Ic+qTea8RWeWoeKBw4wNepU=
  =dtlR
  -END PGP SIGNATURE-
  
  
 

-
  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: [collections] Modify getter result

2004-12-20 Thread Stephen Colebourne
See LazyMap.
Stephen
- Original Message - 
From: Nentwig, Timo [EMAIL PROTECTED]
I'm not sure whether this can be done with commons-collections. 

I need to hook in a collection and return a default value when the
requested key does not exist in the collection. E.g.
Map currency = new HashMap()
{
{
put(DE, EUR);
put(US, USD);
}
};
And currency.get(XY) is supposed to return a default value (this may
require additional logic and e.g. may write to the logger that an yet
unsupported ISOCODE was requested).
Can this be done?
Kind regards
Timo
-
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: about LRUMap usage...

2004-12-14 Thread Stephen Colebourne
This MAY be due to the treeMap.put(). You are not
allowed to change a map object while you are iterating
over it except via the setValue() method on the
iterator.

Stephen

 --- Alp Şehiç [EMAIL PROTECTED] wrote: 
 Hi there,
 
 at the time I'm facing with a problem on the usage
 of LRUMap, so in the 
 code below;
 
 final MapIterator mapIt = map.mapIterator(); // map
 is a LRUMap instance...
 final TreeMap treeMap = new TreeMap();
 while (mapIt.hasNext())
 {
 if 

(mapIt.next().toString().endsWith(_DEPARTMENT_NAME))
 // EXCEPTION IS 
 THROWN RIGHT HERE...
 {
 int temp =
 Integer.parseInt(

 mapIt.getKey().toString().substring(0, 4));
 if (temp = getFirstNo()  temp
 = getLastNo())
 {
 treeMap.put(mapIt.getKey(),
 mapIt.getValue());
 }
 }
 }
 
 I'm getting :
 
 java.lang.ExceptionInInitializerError: 
 java.util.ConcurrentModificationException
 at 

org.apache.commons.collections.map.AbstractLinkedMap$LinkIterator.nextEntry(AbstractLinkedMap.java:555)
 at 

org.apache.commons.collections.map.AbstractLinkedMap$LinkMapIterator.next(AbstractLinkedMap.java:367)
 at Support.initParameters(Support.java:486)
 at Support.clinit(Support.java:72)
 at Store..clinit(Magaza.java:52)
 
 so is there something wrong with my usage ? 
 thanx in advance...
 
 
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Iterator problems collections

2004-12-10 Thread Stephen Colebourne
I can't see anything wrong with what you've sent, but I don't have the 
complete code. I suggest you break your task down into parts and check 
whether you really are converting the objects, or whether perhaps you are 
converting them at the wrong time in your logic.
Stephen
- Original Message - 
From: Jörg Herbst [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 10, 2004 6:05 PM
Subject: Iterator problems collections


Hi folks,
I've got a problem with the CollecionUtils.filter method and
the Iterator wrappers. I've written a custom Collections class
which stores a tree data structure (based on DefaultMutableTreenode).
I want to hide the implementation (the usage of
DefaultMutableTreeNode) and provided an iterator() methods which
should return my user objects:
   /**
* Gets an iterator with all user objects
*/
   public Iterator iterator() {
   Iterator it = new EnumerationIterator(
   root.breadthFirstEnumeration(),this);
   Iterator tranformedIt =
   IteratorUtils.transformedIterator(it,
   new TreeNodeToUserObjectTransformer());
   return tranformedIt;
   }
   /**
* Internal Transformer class for converting a TreeNode
* to it's user object
*/
   private class TreeNodeToUserObjectTransformer implements Transformer {
   public Object transform(Object o) {
   DefaultMutableTreeNode node = (DefaultMutableTreeNode) o;
   return node.getUserObject();
   }
  }
Now I'm calling CollectionUtils.filter(myCollection,myPredicate)
and suspected to get my user objects passed to the removed(Object o)
method. But instead of getting the userObjects, I get
DefaultMutableTreeNOdes. Can anybody tell me what I'm doing wrong?
Thx
Joerg
-
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: NPE: map.LRUMap.reuseMapping(LRUMap.java:272)

2004-12-07 Thread Stephen Colebourne
This looks like a bug. Could you please add it to
bugzilla. It would help greatly, and speed a fix, if
you can identify a small test case that causes the
problem.
Thanks
Stephen


 --- [EMAIL PROTECTED] wrote: 
 Hello,
 
 I'm using Collections 3.1 and just found this NPE in
 my logs:
 
 java.lang.NullPointerException
 at

org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:272)
 at

org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:243)
 at

org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)
 
 
 This looks like a bug.  Is this a known issue?
 I instantiated LRUMap like this:
 
   LRUMap map = new LRUMap(31);
 
 And from there on, I use it like I'd use any Map,
 putting things into
 it, and so on.  Maybe I'm not using LRUMap
 correctly?  My _guess_ is
 that this occurs when the Map is full, but I am not
 certain.
 
 I am wrapping the LRUMap in my own Maps as follows,
 but I think they're
 not the culprit:
 
   LRUMap map = new LRUMap(31);
 _userSessions = new ExpiringMap(map,
new TimerTTLReferenceHolder(180), //
 ttl=30min
30);  //
 purge frequency=5min
 
 
 I checked Bugzilla and I checked the CVS log for
 LRUMap, but I don't
 see any mentions of relevant bug fixes.  The only
 similar thing I found
 is:

http://issues.apache.org/bugzilla/show_bug.cgi?id=28887
 
 And it looks like that was fixed before 3.1 release.
 
 I'm seeing this error in production (
 http://www.simpy.com ), so any
 help would be mucho appreciated.
 
 Thanks,
 Otis
 P.S.
 If it helps, I can put this in Bugzilla.
 
 

-
 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: [primitives] what would it take for a 1.1 release?

2004-12-07 Thread Stephen Colebourne
I believe it just needs someone with the time and will to make the release 
;-)

Stephen
- Original Message - 
From: Alex Karasulu [EMAIL PROTECTED]
Hi,
Everything in primitives looks really good to me and its been sitting 
there at 1.1-dev for a while now.  Wondering what others are thinking 
about releasing primitives 1.1?

Alex
-
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: [primitives] what would it take for a 1.1 release?

2004-12-07 Thread Stephen Colebourne
There is only Bugzilla, I know no more!
Stephen
- Original Message - 
From: Alex Karasulu [EMAIL PROTECTED]
To: Jakarta Commons Users List [EMAIL PROTECTED]
Sent: Tuesday, December 07, 2004 9:29 PM
Subject: Re: [primitives] what would it take for a 1.1 release?


Stephen Colebourne wrote:
I believe it just needs someone with the time and will to make the 
release ;-)

Stephen, I just want to estimate the amount of energy need to push it 
through.  Can you provide a list of items you think need to be fullfilled? 
If the work is not that much then I can commit to pushing 1.1 to a 
release.

Alex
Stephen
- Original Message - From: Alex Karasulu [EMAIL PROTECTED]
Hi,
Everything in primitives looks really good to me and its been sitting 
there at 1.1-dev for a while now.  Wondering what others are thinking 
about releasing primitives 1.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]


Re: [collections] plans to make PriorityBuffer serializable?

2004-11-11 Thread Stephen Colebourne
I currently have no plans to make PrioityBuffer serializable. However, if a
patch were added to Bugzilla, with the serializable test handling added then
it would stand a fair chance of being done ;-)

Stephen

- Original Message -
From: Steve Phelps [EMAIL PROTECTED]
 Are there any plans to make the collections.buffer.PriorityBuffer class
 implement the java.io.Serializable interface in the next release of the
 Jakarta commons collections package?

 (Apologies if this has been answered before; the archives are down at
 the moment but a google search did not yield anything).

 -
 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: [Clazz] Is anybody maintaining this?

2004-09-03 Thread Stephen Colebourne
There are no current maintainers of [clazz]. It was partly my idea, but was
mainly implemented by another. The reality is that I don't have the time to
be able to focus on this project :-(

Stephen

- Original Message -
From: Ihab Awad [EMAIL PROTECTED]
 I posted a question re commons Clazz a while ago and got no reply. Is
 anyone working on this? It sure seems like a worthwhile project

 The question was whether there are plans for adding multiple
 inheritance support to Clazz-es, or whether that's a Bad Idea [TM].
 Multiple inheritance would be great for stuff like modeling Bean
 property patterns and method signatures that are declared in Java
 interfaces.

 Thanks a lot  peace,

 Ihab

 -
 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: [collections] LinkedMap and ListOrderedMap

2004-08-19 Thread Stephen Colebourne
Both are provided to give you a choice of implementation.

IIRC, ListOrderedMap allows you to get a List object of keys, and also
allows you to choose your Map implementation (if you want something
unusual)..

To choose, the best answer is to performance test both in your application.
Bear in mind, the JDK implementation is like LinkedMap, so that might
suggest that is the better choice.

Stephen

- Original Message -
From: Koji Sekiguchi [EMAIL PROTECTED]
 These classes resemble each other, don't they?
 Are there any explanation/condition for choosing one of them
 whan I use ordered map in my application?



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: commons compress question

2004-08-06 Thread Stephen Colebourne
- Original Message -
From: Laat, Harm de [EMAIL PROTECTED]
 I pulled compress out of the CVS tree and created a jar. I found some test
 files in the CVS source. But I don't see a simple zip / unzip example
there.


 Is there something like that available?

commons compress has a current status of classes unreleased and without
community. AFAIN, there are no examples available.

Stephen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [collections] Point based map

2004-07-26 Thread Stephen Colebourne
Unfortunately this implementation would be unsuitable for [collections],
primarily on the grounds of it being very specific to the Point and
Rectangle classes.

Stephen

- Original Message -
From: Simone Pierazzini [EMAIL PROTECTED]
 I looked for a Java quad-tree implementation but I didn't find any free
(ie.
 open source) or compatible with the JDK Collections Framework.
 So I decided to develop one myself.
 I've developed a Map extension: this Map is a specialized version whose
keys
 are Point (java.awt.Point). Basically it is a standard Map that contains
an
 extra method to retrieve all entries contained in a Rectangle passed as a
 parameter to the method:
 The Syntax for the new Method is:

   Iterator get (Rectangle r);

 I've developed a quad-tree based implementation, and a junit test case
(not
 completed yet).
 My question is: are you interested in including these classes in
 commons-collections?

 thanks,
 Simone Pierazzini


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [commons-io] CopyUtils

2004-07-13 Thread Stephen Colebourne
commons-io does not have another method for the task you describe.

At present I would say that commons-io would recommend that in truly
performance/scalability critical tasks it would be adbisable to code your
own io code for this kind of task.

Stephen

- Original Message -
From: Robert Taylor [EMAIL PROTECTED]
 Greetings, I would like to use CopyUtils.copy(InputStream is, OutpuStream
os) to manually
 server (read from input stream and write to output stream) up large binary
files to web clients (browsers).

 After reading the documentation which indicates it does not flush the
buffer in the method,
 I'm concerned that this would result in OutOfMemoryErrors under large
loads.

 I was under the assumption that it would be prudent to flush the buffer
after a certain number
 of reads to reduce the amount of resident memory used.

 Is there a another utility to perform such a common task?

 robert



 -
 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: ApacheCon talks

2004-07-10 Thread Stephen Colebourne
If there is more than 1 hours material, perhaps split the talks into two1
hours by the narrow interface/broad interface categorisation.
ie.
Collections/Lang/Codec/IO/... have broad shallow API
Betwixt/JXPath/Digester/... have narrow deep API

That way you could include the sandbox ones with the relevant group. There
still may not be enough material though.

Stephen

- Original Message -
From: Eric Pugh [EMAIL PROTECTED]
 I agree w/ the 3 hour thing..  to be honest, I don't think I can keep my
 interest up in anything for 3 hours unless there is a handson component..
I
 agree though that raising the visibility of commons would be nice..  Often
 people don't know about all the great libraries available and how they can
 help them!

 Eric

  -Original Message-
  From: Torsten Curdt [mailto:[EMAIL PROTECTED]
  Sent: Friday, July 09, 2004 8:14 AM
  To: Jakarta Commons Users List
  Subject: Re: ApacheCon talks
 
 
  Henri,
 
   I'm pondering the idea of giving one/two talks at the ApacheCon in
   November.
 
  Not sure how many people a talk about the sandbox
  would attract ...but IMO commons would be a good
  thing to talk about. Actually I thought about
  submitting a proposal myself.
 
  But IMHO 3 hours (wow!) is way to much ...I know
  there is much to talk about - but I doubt you can
  keep people interested in a set of libraries for
  more than an hour.
 
  My 2 cents
 
  cheers
  --
  Torsten
 
 
  -
  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: [math] Eliminating [lang] dependency

2004-07-09 Thread Stephen Colebourne
I disagree, use getCause(). Users should see the class as similar to the JDK
as much as possible.

See
http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_1/org/ap
ache/commons/collections/FunctorException.html

http://cvs.apache.org/viewcvs.cgi/jakarta-commons/collections/src/java/org/a
pache/commons/collections/FunctorException.java?rev=1.6view=auto


Stephen

- Original Message -
From: Henri Yandell [EMAIL PROTECTED]
 Is using the same name as Throwable for getCause() wise?

 Won't this lead to times when you can compile on 1.3, and the code won't
 run on 1.4? (unsure, but it seems likely to me).

 I'd suggest getThrowable as with Lang. You know it's supported by the
 reflection Utils in Lang if someone puts them together, and it keeps
 things standard.

 Hen

 On Fri, 9 Jul 2004, Mark R. Diggory wrote:

  I suspect that would just look like this, is this adequate for our
needs?
 
  -Mark
 
  /**
* A generic exception indicating problems in the math package.
* @version $Revision: 1.16 $ $Date: 2004/06/02 00:05:28 $
*/
  public class MathException extends Exception implements Serializable {
 
   /** Serializable version identifier */
   static final long serialVersionUID = -8594613561393443827L;
 
   private Throwable cause = null;
 
   /**
* Constructs a MathException
*/
   public MathException() {
   super();
   }
 
   /**
* Create an exception with a given error message.
* @param message message describing the problem
*/
   public MathException(final String message) {
   super(message);
   }
 
   /**
* Create an exception with a given error message and root cause.
* @param message message describing the problem
* @param throwable caught exception causing this problem
*/
   public MathException(final String message, final Throwable
throwable) {
   super(message, throwable);
   this.cause = throwable;
   }
 
   /**
* Create an exception with a given root cause.
* @param throwable caught exception causing this problem
*/
   public MathException(final Throwable throwable) {
   super();
   this.cause = throwable;
   }
 
 
   /* (non-Javadoc)
* @see java.lang.Throwable#getCause()
*/
   public Throwable getCause() {
   return cause;
   }
 
   /* (non-Javadoc)
* @see java.lang.Throwable#printStackTrace()
*/
   public void printStackTrace() {
   super.printStackTrace();
 
   if(cause != null)
   cause.printStackTrace();
   }
 
   /* (non-Javadoc)
* @see java.lang.Throwable#printStackTrace(java.io.PrintStream)
*/
   public void printStackTrace(PrintStream s) {
   super.printStackTrace(s);
 
   if(cause != null){
   s.print(\n\nCaused By:\n\n);
   cause.printStackTrace(s);
   }
   }
 
   /* (non-Javadoc)
* @see java.lang.Throwable#printStackTrace(java.io.PrintWriter)
*/
   public void printStackTrace(PrintWriter s) {
   super.printStackTrace(s);
 
   if(cause != null){
   s.print(\n\nCaused By:\n\n);
   cause.printStackTrace(s);
   }
   }
 
  }
 
 
 
 
  Henri Yandell wrote:
   Seems to me that all you need is to add a getParentException method to
   your Exception and Throwable to your constructors. Unsure just how
much
   you're inlining.
  
   Doing all the stuff Lang's exception stuff does seems unnecessary for
   Math. Probably nothing new in this opinion :)
  
   Hen
  
  
   On Thu, 8 Jul 2004, Phil Steitz wrote:
  
  
  I agree with both of you.  The patch (though more testing has shown it
  is bugged) tries to bake all functionality of NestableException into
  MathException.  It includes code from NestableDelegate and
  ExceptionUtils as well as NestableException.  The simplest would be to
  copy and rename all of these classes, but I agree with Stephen's
  suggestion that it would be better to just borrow (er... I mean steal)
  the implementation code.  The practical question is do we really need
  all of the functionality in the o.a.c.l.e.Nestable interface?  I am
  travelling now, but when I get back this weekend if there are no
  objections I will commit a fixed version with more and better test
cases
  and we can decide what, if anything, we can drop.
  
  Phil
  
   -Original Message-
   From: J.Pietschmann [mailto:[EMAIL PROTECTED]
   Sent: Thu 7/8/2004 3:19 AM
   To: Jakarta Commons Users List
   Cc:
   Subject: Re: [math] Eliminating [lang] dependency
  
  
  
   Mark R. Diggory wrote:
The only other alternative I can think of that may make things
easier if
anything changes in the future would be to just copy
NestableException
into the math package hierarchy under something like

Re: [Collections] Add Object to Collection if not null

2004-07-09 Thread Stephen Colebourne
I quite like this idea, as it is simple and does cover a case I can see
people finding.

It might be worth opening a bugzilla entry for it so it is kept track of.

Stephen

- Original Message -
From: Rafael U. C. Afonso [EMAIL PROTECTED]
I was looking for a method that adds a object in a Collection
if this object is not null, but I did not find it in
Collections. I thought that this method would be useful in
CollectionUtils class. Is there a method like this? If it
does not exist I would like suggest this. It could be
implemented like this:

public static boolean addNotNull(Collection c, Object o) {
   return (o != null)? c.add(o): false;
}

Like Collection.add(Object) returns boolean, this method will
boolean too.
What is your opinion?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[ANNOUNCEMENT] Commons Collections 3.1 released

2004-06-28 Thread Stephen Colebourne
The Commons Collections team is pleased to announce the release of Commons
Collections 3.1. Commons Collections provides additional interfaces and
implementations based on, and inspired by, the Java Collections Framework
(Collection, List, Set, Map).

This release fixes a number of bugs in v3.0 and is fully compatible. Release
v3.1 is also compatible with v2.1.1 enabling a workaround of previous
compatability issues in IteratorUtils. In addition to bug fixes, this
release adds various new features including:
* TreeList - A new list implementation that is faster than ArrayList in
certain use cases
* MultiKeyMap - A dedicated map implementation to support combined keys
mapping to a value
* ReferenceIdentityMap - An identity based map whose keys/values can be
garbage collected
* Many more Serializable classes

Read the Release notes:
http://www.apache.org/dist/jakarta/commons/collections/RELEASE-NOTES.html

Download the binary distribution:
http://jakarta.apache.org/site/binindex.cgi#commons-collections

Download the source distribution:
http://jakarta.apache.org/site/sourceindex.cgi#commons-collections

Browse the collections website:
http://jakarta.apache.org/commons/collections/index.html

Please direct any feedback on issues or bugs to
[EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[ANOUNCEMENT] Commons Collections 3.1-RC1 and 2.1.1 released

2004-06-12 Thread Stephen Colebourne
The Commons Collections team announces the release of Commons Collections
3.1-RC1. This is a preview of v3.1 to enable users to test the release
against their own code. We advise waiting for the formal 3.1 release before
putting the code into production. Please direct any feedback on issues or
bugs to [EMAIL PROTECTED]

Read the release notes -
http://www.apache.org/~scolebourne/coll31/RELEASE-NOTES.html
Download the distribution - http://www.apache.org/~scolebourne/coll31/


The Commons Collections team also announces the release of Commons
Collections 2.1.1. This is a patch release to v2.1 to enable a workaround of
issues in IteratorUtils v3.0. If you are still using v2.1 please upgrade to
v2.1.1, especially if you run an Open Source project. See the release notes
for full details of the patch and why it was produced.

Read the release notes -
http://www.apache.org/dist/jakarta/commons/collections/RELEASE-NOTES-2.1.1.h
tml
Download the binary distribution -
http://jakarta.apache.org/site/binindex.cgi#commons-collections
Download the source distribution -
http://jakarta.apache.org/site/sourceindex.cgi#commons-collections

Stephen Colebourne
http://jakarta.apache.org/commons/collections/index.html



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[collections] To all collections users, version 3.1 compatibility

2004-05-06 Thread Stephen Colebourne
Collections 3.1 is currently under development. At present there are two
binary incompatible changes proposed relative to 3.0. This mail is to
advertise these changes and give people a chance to complain ;-)


1) ReferenceMap (map package) now extends AbstractReferenceMap and
AbstractHashedMap whereas previously it extended AbstractMap. This was done
to gain lots of new functionality.

This is binary incompatible if you previously cast a ReferenceMap to an
AbstractMap. I can think of no good reason why you would have made this
cast, but does anyone out there have an objection?


2) FixedSizeSortedMap now extends FixedSizeMap whereas previously it
extended AbstractSortedMapDecorator. This was done to share more code.

This is binary incompatible if you previously cast a FixedSizeSortedMap to
an AbstractSortedMapDecorator. I can think of no good reason why you would
have made this cast, but does anyone out there have an objection?


Stephen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [io] have I found a bug? should I tell to anyone?

2004-04-20 Thread Stephen Colebourne
Yes, write the junit test to prove the problem, then solve it if you can
(take advice from the mailing list if not), finally post patches to bugzilla
(use cvs diff -u format).

Stephen

- Original Message -
From: Jörg Schaible [EMAIL PROTECTED]
 Hi,

 I suspect I met a bug in org.apache.commons.io.FileUtils:
 what should I do?
(3)  *- AND should I go to the bugs tracking apps in apache.org?
(1)  *- AND should I write a junit class showing the point?
(2)  *- AND else write a patch?
 *- or instead keep it for myself?

 Please tell me ASAP.

In the order above.

-- Jörg

-
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: [collections] Array based int keyed map

2004-03-23 Thread Stephen Colebourne
At the moment, I would say that this is a specialised collection, presumably
to solve a particular problem you have. As such it doesn't feel right for
inclusion in [collections].
Stephen

- Original Message -
From: Joel Shellman [EMAIL PROTECTED]
 Stephen Colebourne wrote:
  A little confused ;-) Are you proposing a class that implements Map, or
  List, or Collection?

 The required operations are:

 int add(Object newObject);
 // Add new object to end of array or fill in a whole
 // Returns the new int key for it (which is the index
 // in the array)

 void set(int key, Object newObject);
 // Set the value at a specific index

 Object get(int key);
 // Return value at index

 So yeah, it doesn't fit List or Map.

 It is an int to Object Map, but looking at primitives, it doesn't appear
 to have anything like that in their currently.

 As for the advantage over ArrayList. ArrayList does not give you a
 lookup mechanism, which is the whole point of what I'm after. Let's say
 you add two items in an ArrayList. Even if kept track of which index
 they were at, if you removed the first one, the second one's index would
 change, so you can't use that.

 -joel shellman


  If its an int to Object Map, then [primitives] would be the place for it
to
  go. If its a List, then the implementation you describe would violate
the
  List interface. If its a Collection, then it might work, but I can't
really
  see the advantage over an ArrayList style implementation.
 
  Stephen
 
  - Original Message -
  From: Joel Shellman [EMAIL PROTECTED]
 
 At least I think that describes it.
 
 Here's the application: I have a very large collection of objects that
 has an int key. Structural changes (add/remove) occur extremely seldom.
 
 Wouldn't it be useful to have a data structure such that accessing it by
 that key is simply an array lookup?
 
 myObject = myArray[key];
 
 Removal support could be handled by setting that index to null and
 holding on to a stack of unused indexes. Adding new values use up the
 unused indexes before appending to the end.
 
 I have already written a simple initial implementation of this. I'm
 wondering:
 
 1) Do others think this is generally useful?
 2) Is this functionality already available in the commons-collections
 and I missed it?
 3) Would it be useful to include this in commons-collections?
 
 Thank you,
 
 Joel Shellman
 
 -
 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: [collections] collections size

2004-03-23 Thread Stephen Colebourne
Although I can't quite see the use case (simply casting to Collection would
give you an iterator...), adding a size(Object) method to CollectionUtils is
not unreasonable. To achieve this I would need a patch with unit tests
attached to a bugzilla entry ;-)

Stephen

- Original Message -
From: Melzer, Steven [EMAIL PROTECTED]
my reason for the code is because the IteratorUtils methods return iterators
of arbitrary objects and i really don't want the underlying collection.  i
just want to set up some array sizes based on the list size, but i am not
going to perform any operation on the list itself, just iterate through it.

my specific example is an html table with an database resultset (returned as
a Collection) as its backing.  i have a 'select all' button for the table.
i want to load an array with the selected items.  i use the IteratorUtils
class to rip through a Collection that is the data to look for checked
items.  so all i ever see is an iterator, i never get the collection itself,
and i don't need to either.  but, if the 'select all' button is pressed, i
need to load the array with defaults for the entire size of the Collection.
i am not going to use the Collection, i just want to know how big it is so i
can create a loop and populate an array.

it is an obscure issue i agree, but i cannot see a reason not to support the
functionality either.  if you rely on the IteratorUtil class for arbitrary
list iteration, you need something like this (and actually several other
Collection methods) to allow arbitrary lists to be as robust as a typical
Collection.  it seems reasonable to add functionality to a common API even
for less common uses.

steve

-Original Message-
From: Janek Bogucki [mailto:[EMAIL PROTECTED]
Sent: Friday, March 19, 2004 6:21 PM
To: Jakarta Commons Users List
Subject: Re: [collections] collections size


On Fri, 2004-03-19 at 19:26, matthew.hawthorne wrote:
 I understand the underlying idea behind your suggestion, but I don't
 quite get the use case.  Why create conditional llogic to get the size
 of an arbitrary list, when you'd then have to implement the same
 conditional logic to get the items out of the list?

 If your goal is to treat all lists in a similar way, I think you'd be
 better of doing something like:

 public static Collection toCollection(Object list) {
if(list instanceof Collection)
  return list
else if (list instanceof Map)
  return ((Map)list).entrySet()
else
  return Arrays.asList(list)
 }

While I agree with the idea of using a Collection view of the object
when you want to do Collection things on the object, there is a
precedent for this sort of approach in o.a.c.collections in the form of
CollectionUtils.get(Object, int). This could be used to get the items
out of the 'list' although performance would suffer in some cases.

Edited JavaDoc:

 Returns the index-th value in object.

 Supports:

 Map
 List
 Object Array
 Collection
 Iterator or Enumeration

 public static Object get(Object object, int index)

-Janek

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Learn more about Paymentech's payment processing services at
www.paymentech.com
THIS MESSAGE IS CONFIDENTIAL.  This e-mail message and any attachments are
proprietary and confidential information intended only for the use of the
recipient(s) named above.  If you are not the intended recipient, you may
not print, distribute, or copy this message or any attachments.  If you have
received this communication in error, please notify the sender by return
e-mail and delete this message and any attachments from your computer.
~2

-
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: [collections] Iterator Exception behaviour

2004-01-08 Thread Stephen Colebourne
Fixed in CVS, and the upcoming 3.0
Stephen

- Original Message - 
From: Janek Bogucki [EMAIL PROTECTED]
To: Jakarta Commons Users List [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 8:58 PM
Subject: Re: [collections] Iterator Exception behaviour


 On Thu, 2004-01-08 at 10:36, pwomack wrote:
  I assert that the second version should be as equivalent
  as possible to this first; in short I believe that
  the Exception should not be thrown.
  
BugBear
 
 I agree.
 
 -Janek
 
 -
 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: Broken link to Commons API docs

2003-12-11 Thread Stephen Colebourne
This is a recuring problem :-( , we'll take a look. Thanks
Stephen


- Original Message - 
From: Wendy Smoak [EMAIL PROTECTED]
On this page 
http://jakarta.apache.org/commons/collections/

There's a link to the API docs:
http://jakarta.apache.org/commons/collections/collections/api/index.html

The link is broken, it should be:
http://jakarta.apache.org/commons/collections/api/index.html
(only one /collections, not two).

I know, I know... Open a bug, create a patch... 

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

-
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]



  1   2   >