Commit Graph

1136 Commits

Author SHA1 Message Date
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 58f0b9a067 A test of some basic HsqldbLiaison behavior, which I added to test other
things, which ended up being infeasible. But I'll leave this test machinery
here as it may be useful in the future if we want to add more
com.samskivert.jdcb unit tests.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2880 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-10 23:48:48 +00:00
samskivert 8c54d3689c Link to the project page from the Javadocs.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2872 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-09 20:24:42 +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
samskivert 91e8240a48 Fiddling with persistent properties in tests is dangerous. Let's be sure that
our tests pass even when we haven't run them before. We were relying on
sub.sub3 having been set and persisted from a previous test invocation.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2848 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-09-08 18:35:08 +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
samskivert 22a849a5d4 Unit tests not needing the assertion imports seems like a bad sign. Let's
actually turn these "tests" into tests.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2843 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-30 18:33:09 +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
karma@deadmoose.com eb4f4dc2c5 Prune unused imports.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2841 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-30 17:24:16 +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 bd61c7a609 Let's turn this into an actual test.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2812 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-27 05:03:45 +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
ray.j.greenwell 3dcef4a00c Micro-optimization: don't test the array length if we just created it
at the right size.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2806 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-25 19:05:17 +00:00
ray.j.greenwell b78365ea6d - Fixed toArray(T[]) to terminate with null if the provided array has
room to spare, per the spec.
- Document that we do not support null elements.
- Increment modCount in our modifying methods, to take advantage of
  fail-fast iterators.
- A few small comments.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2805 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-25 19:00:38 +00:00
karma@deadmoose.com 500e107857 Annotate overrides
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2804 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-17 17:19:36 +00:00
andrzej@threerings.net 8a45193748 Don't do anything on clear if the set is already empty.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2803 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-17 04:48:13 +00:00
andrzej@threerings.net d1f5c4593f Added some explanatory comments.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2802 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-11 19:57:54 +00:00
andrzej@threerings.net 756c2f44ad Added a HashIntSet class that uses hashing with linear probing to get most of
the memory benefits of ArrayIntSet and better performance than a
HashSet<Integer> (presumably because of less boxing and better spatial
locality).  The downside is that you need to pick a sentinel value that can't
be stored in the set, but that's not a problem in any application for which
I've ever used an IntSet.  In some (admittedly simplistic) Google Caliper
testing, HashIntSet was 22% faster than ArrayIntSet and 73% faster than
HashSet for arrays of size N=10, 100% faster than ArrayIntSet and 69% faster
than HashSet for N=100, and 357% faster than ArrayIntSet and 74% faster than
HashSet for N=1000.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2801 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-08-11 05:20:43 +00:00
ray.j.greenwell 9ed1bfeedc Annotate both of these with a @ReplacedBy.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2800 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-19 21:02:10 +00:00
ray.j.greenwell 8d28d119db There's a perfectly valid replacement in java.util for this as of 1.5.
I haven't deprecated our version in CollectionUtil because it
copes with being passed a null array...


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2799 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-16 19:03:37 +00:00
ray.j.greenwell 0b6b97e8c0 Update this @ReplacedBy annotation to show that we'd need nullsLast().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2798 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-14 19:17:56 +00:00
ray.j.greenwell 1f9786d291 Use the char version of String.replace when possible.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2797 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-13 00:56:07 +00:00
ray.j.greenwell ca1141f3ca Correct error in last commit.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2796 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-13 00:45:45 +00:00
karma@deadmoose.com 83bfe030d8 It's deprecated, so don't use it.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2795 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-13 00:38:02 +00:00
ray.j.greenwell 591211a399 Deprecate this, String itself has a replace() method.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2794 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-08 23:48:20 +00:00
karma@deadmoose.com 32c1e824c5 Out, damned CRLFS! Out, I say!
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2793 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-06 17:54:54 +00:00
ray.j.greenwell 18ae646e57 Deprecate size(), add getSize().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2792 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-07-06 17:19:22 +00:00
samskivert b2b7e974a3 Added getCanonicalPathElements() and computeRelativePath().
From Dave.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2791 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:38:35 +00:00
samskivert d3631f82e3 Some import tidying courtesy of Mr. Hoover.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2790 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:37:42 +00:00
samskivert e13eb65866 Foreach loopification from Dave.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2789 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:36:51 +00:00
samskivert 21be29d478 Javadoc clarifications from Dave.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2788 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:36:29 +00:00
samskivert cc58b831d3 A javadoc fix from Dave. Javadoc apparently does not like generics.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2787 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:35:55 +00:00
samskivert 1626ca0d44 Typo and line wrapping from Dave.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2786 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-16 23:31:38 +00:00
samskivert b7d2aa2ef5 Have RecordIterator implement Iterator<E> to be clearer about its purpose in
life.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2785 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-13 18:21:50 +00:00
andrzej@threerings.net d931ccef0d Rather than letting the value determine the text field size, use a
fixed number of columns for easier editing.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2784 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-06-09 20:56:53 +00:00
ray.j.greenwell 634bacae14 Jamie Doornbos points out that I made a booboo here.
Our getOr() will skip the first argument if it is "blank"
(null, empty, or all whitespace), not just null.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2783 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-20 14:28:19 +00:00
ray.j.greenwell 668ad3ec55 - Fixed parsing of byte[]s to not parse them as strings and then
lose precision during the cast. Now it will freak out if the
  "byte" is out of range.
- A bit less hashing in our static initializer.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2782 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-20 01:50:37 +00:00
ray.j.greenwell edf86bdfec I won't deprecate replace() outright, but it's in String now.
(Although, the implementation builds a Pattern object, which
seems rather wasteful if the match sequence isn't found..)


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2781 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-20 01:43:56 +00:00
ray.j.greenwell ab062e7e95 Let's go ahead and unmarshall to all the wrapper types, not just Integer.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2780 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-17 00:06:43 +00:00
ray.j.greenwell 835f1268d0 This class can now accurately store null.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2779 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-16 01:13:36 +00:00
ray.j.greenwell 181eb3faf0 Gah! Gringos falling from the sky?
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2778 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-16 01:12:27 +00:00
ray.j.greenwell 40e36046d0 Whitespace patrol.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2777 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-16 00:57:08 +00:00
ray.j.greenwell 5fa1380c5c @ReplacedBy something in guava.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2776 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-16 00:56:39 +00:00
ray.j.greenwell 12c107bd29 Why is this <T extends Object>?
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2775 6335cc39-0255-0410-8fd6-9bcaacd3b74c
2010-04-16 00:56:06 +00:00