Commit Graph

119 Commits

Author SHA1 Message Date
ray.j.greenwell 5cbde1b456 Created an addAll() that folds a supplied Iterable of Collections
into the starter collection using addAll. Certain Collections, like
guava's Multiset have optimized addAll() methods that recognize
other Multisets.
There is also a putAll() equivalent for Maps.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2891 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-21 02:11:03 +00:00
samskivert ace6b104e2 Utilities!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2890 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-20 22:31:02 +00:00
karma@deadmoose.com 8c9adfd8f8 Ray rolled back the bit that needed this one.
And SVN is being super pokey so I'm swimming against molasses and
that wasn't showing yet. Argh.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2889 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:54:40 +00:00
ray.j.greenwell 590be465d7 Why are we silently ignoring the last argument if someone passes in an odd number?
Instead, let's log:
  message [name1=value1, name2=<toString failure: ArrayIndexOutOfBoundsException>]


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2888 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:53:00 +00:00
karma@deadmoose.com ef34b921b2 Need to import those to use them.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2887 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:47:54 +00:00
ray.j.greenwell 42e4c4138d Reverted r2884.
If someone wants to use StringUtil.toString(), let them get
the openBox/closeBox/separators they were expected.

Gee, I hope r2885 didn't beak any Log parsing code...


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2886 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:45:56 +00:00
ray.j.greenwell 0dc4418fd2 Do not use StringUtil.toString() to log any arguments.
As detailed in my last checkin.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2885 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:44:22 +00:00
ray.j.greenwell 7dba599509 Just call toString() on a Collection rather than iterating over it ourselves.
This is an incomplete fix and brings up a larger issue that I'll explain
below. Also, this breaks the customization of openBox/closeBox/separator
Strings.

First off, I know of no Collection that doesn't have a decent toString()
implementation. The java.util.Abstract* classes all do something
reasonable and most Collections are built from those.

Guava's Multiset has a defined way of representing itself as a String.
An example would be "[value1, value2 x 100]". This fix is mainly
addressed at fixing that, as this class would do the very dumb thing
if provided with a Multiset.

Do we really customize the openBox/closeBox/separator values? Should we?


The second issue comes from the way Log uses StringUtil to evaluate
the var-args it is passed. Check out the following code.

Iterator<Thing> it = Iterables.concat(_staticThings, newThings).iterator();
log.debug("About to iterate", "user", user, "request", req, "iterator", it);
while (it.hasNext()) {
    ...


If the logging level is above debug, this works fine. However if one day
you lower your logging level, the message will be logged and the Iterator
will be passed to String.toString(), which will suck all the elements out of it.

That's a problem.

Actually, perhaps the right thing to do is simply to change the Log class
to avoid using this, and instead just call String.valueOf() on all objects
except arrays, which can instead be String'd with the methods added to
java.util.Arrays in 1.5.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2884 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-17 20:23:41 +00:00
ray.j.greenwell 8e33cc2cd7 Shareable references to common 0-length arrays.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2883 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-14 00:40:05 +00:00
ray.j.greenwell 62c86b38f7 Append the final "]" using the StringBuilder.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2882 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-13 19:50:22 +00:00
samskivert e68daada41 Properly configure javadoc in our POM build. The POM is now approaching the
line count of the build.xml file, but I suppose that's just because XML is
absurdly verbose (and Maven annoyingly chose to do things like
<quiet>true</quiet> instead of a quiet="true" attribute). I wonder if there's a
Maven plugin that allows you to specify your pom.xml in YAML or some less
verbose format and which automatically converts it to XML. That'd probably cut
the line count by 2/3.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2853 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-08 19:04:33 +00:00
samskivert baef3bccb1 Put our non-source resources into src/main/resources to comply with the
standard Maven layout.

I'm not a huge fan of that separation, particularly now that it's de rigueur to
ship your sources with your class files. In such circumstances, one could
imagine just copying the entire contents of src/main/java into target/classes
and being done with it. Class files, XML files, propert files, etc. are all
packaged up together into one happy jar file of goodness. Then you don't have
extra files off in src/main/resources being demure and hard to notice.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2849 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-08 18:41:41 +00:00
charlie.groves 39f3b63dbe I broke this in 2845; probably want to check the values in the bucket, not just the bucket. Thanks, Mr. Hoover
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2846 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-02 20:50:37 +00:00
charlie.groves 087dbd0e9b Remove unecessary import and implementation
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2845 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-31 01:13:11 +00:00
karma@deadmoose.com 86f49a05a5 Speeling
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2842 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-30 17:34:26 +00:00
samskivert 65b4ca226e Javadoc fix.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2820 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-27 08:46:59 +00:00
samskivert 08fa16d2d8 Handle test resources in a more standard way as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2810 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-27 00:51:49 +00:00
samskivert 83e1c95c34 Converted all tests to JUnit 4. Nixed vestigial Velocity-related test class.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2809 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-27 00:34:13 +00:00
samskivert b03237ee4d Though it's perhaps not exactly as I'd prefer, a consensus has formed on where
to put your source and test source code for Java projects. I'm going to toe the
line here because I want to use SBT to publish samskivert to the centralized
Maven repositories.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2807 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-27 00:08:06 +00:00