Index: /trunk/.classpath
===================================================================
--- /trunk/.classpath	(revision 7866)
+++ /trunk/.classpath	(revision 7867)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="src"/>
+	<classpathentry excluding="org/apache/commons/compress/compressors/lzma/|org/apache/commons/compress/compressors/xz/|org/apache/commons/compress/compressors/CompressorStreamFactory.java|org/apache/commons/compress/compressors/deflate/|org/apache/commons/compress/compressors/gzip/|org/apache/commons/compress/compressors/lzw/|org/apache/commons/compress/compressors/pack200/|org/apache/commons/compress/compressors/snappy/|org/apache/commons/compress/compressors/z/" kind="src" path="src"/>
 	<classpathentry kind="src" path="test/unit"/>
 	<classpathentry kind="src" path="test/functional"/>
Index: /trunk/CONTRIBUTION
===================================================================
--- /trunk/CONTRIBUTION	(revision 7866)
+++ /trunk/CONTRIBUTION	(revision 7867)
@@ -38,5 +38,5 @@
 with Apache license version 2.0.
 
-The Bzip2 code is from Keiron Liddle (Apache project) and licensed
+The Bzip2 code is from Apache Commons Compress and licensed
 with Apache license version 2.0.
 
Index: /trunk/README
===================================================================
--- /trunk/README	(revision 7866)
+++ /trunk/README	(revision 7867)
@@ -59,12 +59,15 @@
 - CONTRIBUTION              list of major code contributors
 - data/                     data files that will be included in the JOSM jar file
-    - *.gsb                 NTv2 grid files for projection support
+    - fonts/                font files used for map rendering
+    - projection/           projection files
+      - *.gsb               NTv2 grid files for projection support
+      - epsg                list of projection definitions
     - *.lang                translation data
     - *.xsd                 xml schema files for validation of configuration files
-    - epsg                  list of projection definitions
     - help-browser.css      CSS file for the help sites (HTML content is downloaded from the website
                             on demand, but displayed inside the programm in a Java web browser component.)
-    - ignoretags.cfg, tagchecker.cfg
-                            data files used by the JOSM validator feature
+    - validator/            data files used by the JOSM validator feature
+      - *.cfg               files designed for the old tagchecker, still used
+      - *.mapcss            default validation rules for the new mapcss-based tagchecker
 - data_nodist/              data files that are useful for development, but not distributed
     - exif-direction-example.jpg
@@ -88,12 +91,16 @@
 - images_nodist/            images, which are not for distribution, but may be useful later (e.g. high
                             resolution and vector versions)
-- josm.jnlp                 Java Web Start launcher file (used on the website)
-- lib/                      libraries (directory is empty at the moment)
+- josm.jnlp                 Java Web Start launcher file (used on the website for the tested version)
+- josm-latest.jnlp          Java Web Start launcher file (used on the website for the latest version)
 - LICENSE                   the JOSM license terms
-- macosx/                   files needed to create the MacOS package
+- linux/                    files useful for Linux distributions, including Appdata files, .desktop
+                            files, Debian/Ubuntu scripts, man pages, icons, etc.
+- macosx/                   files needed to create the MacOS X package
 - netbeans/                 preconfigured Netbeans project
 - optimize-images           short script to decrease size of PNG images
 - patches/                  patches for external libraries used in JOSM (see below)
 - README                    this file
+- resources/                resource files that will be included in the JOSM jar file
+- scripts/                  various scripts used by JOSM developers
 - src/                      the source code of the program
 - start.html                HTML page to run the applet version of JOSM
@@ -108,13 +115,16 @@
     - unit/                 unit tests (source code)
 - tools/                    libraries and tools that help in the development process
-    - animal-sniffer-ant-tasks-1.8.jar
+    - animal-sniffer-ant-tasks-1.11.jar
                             TODO: what is this?
     - appbundler-1.0ea.jar  used to build Mac OS X package for Oracle Java 7
     - findbugs/             libs and config files for findbugs (automatically detects common bugs and potential
                             problems in source code); can be launched as an ant target in build.xml
+    - groovy-all-2.3.9.jar  used for some unit tests and various scripts
     - jacocoant.jar         used to include coverage data into JUnit test reports 
     - javacc.jar            used in the build process to generate some .java files from a javacc source file
                             (src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj)
     - proguard.jar          optimize final binary jar - see build.xml (not used in production so far)
+    - xmltask.jar           used to edit XML files from Ant for the OSX package
+- windows/                  files needed to create the Windows installer
 
 The 'patches' directory
@@ -133,15 +143,15 @@
 Third party libraries
 ---------------------
-There are a couple of third party libraries which are directly included in the source code tree, in particular:
+There are some third party libraries which are directly included in the source code tree, in particular:
 
 * jmapviewer: Java component to browse a TMS map
     src/org/openstreetmap/gui (svn external)
     -> http://svn.openstreetmap.org/applications/viewer/jmapviewer/
-* Apache Ant's bzip2: Support for bzip2 compression when opening files
-    src/org/apache/tools/bzip2 (svn external)
-    -> http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/bzip2
 * Apache commons codec: Better Base64 support
     src/org/apache/commons/codec (svn external)
     -> http://svn.apache.org/repos/asf/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec
+* Apache commons compress: Support for bzip2 compression when opening files
+    src/org/apache/commons/compress/compressors (svn external)
+    -> http://svn.apache.org/repos/asf/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors
 * Apache commons validator: Improved validator routines
     src/org/openstreetmap/josm/data/validation/routines
Index: /trunk/src/org/openstreetmap/josm/io/Compression.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 7866)
+++ /trunk/src/org/openstreetmap/josm/io/Compression.java	(revision 7867)
@@ -13,5 +13,5 @@
 import java.util.zip.ZipOutputStream;
 
-import org.apache.tools.bzip2.CBZip2OutputStream;
+import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
 import org.openstreetmap.josm.tools.Utils;
 
@@ -98,7 +98,5 @@
         switch (this) {
             case BZIP2:
-                out.write('B');
-                out.write('Z');
-                return new CBZip2OutputStream(out);
+                return new BZip2CompressorOutputStream(out);
             case GZIP:
                 return new GZIPOutputStream(out);
Index: /trunk/src/org/openstreetmap/josm/tools/Utils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7866)
+++ /trunk/src/org/openstreetmap/josm/tools/Utils.java	(revision 7867)
@@ -51,5 +51,5 @@
 import java.util.zip.ZipInputStream;
 
-import org.apache.tools.bzip2.CBZip2InputStream;
+import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.Version;
@@ -159,5 +159,9 @@
 
     /**
-     * Get minimum of 3 values
+     * Returns the minimum of three values.
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @param   c   another argument.
+     * @return  the smaller of {@code a}, {@code b} and {@code c}.
      */
     public static int min(int a, int b, int c) {
@@ -173,8 +177,27 @@
     }
 
+    /**
+     * Returns the greater of four {@code int} values. That is, the
+     * result is the argument closer to the value of
+     * {@link Integer#MAX_VALUE}. If the arguments have the same value,
+     * the result is that same value.
+     *
+     * @param   a   an argument.
+     * @param   b   another argument.
+     * @param   c   another argument.
+     * @param   d   another argument.
+     * @return  the larger of {@code a}, {@code b}, {@code c} and {@code d}.
+     */
     public static int max(int a, int b, int c, int d) {
         return Math.max(Math.max(a, b), Math.max(c, d));
     }
 
+    /**
+     * Ensures a logical condition is met. Otherwise throws an assertion error.
+     * @param condition the condition to be met
+     * @param message Formatted error message to raise if condition is not met
+     * @param data Message parameters, optional
+     * @throws AssertionError if the condition is not met
+     */
     public static void ensure(boolean condition, String message, Object...data) {
         if (!condition)
@@ -209,6 +232,4 @@
         if (values == null)
             return null;
-        if (values.isEmpty())
-            return "";
         StringBuilder s = null;
         for (Object a : values) {
@@ -222,5 +243,5 @@
             }
         }
-        return s.toString();
+        return s != null ? s.toString() : "";
     }
 
@@ -361,4 +382,11 @@
     }
 
+    /**
+     * Copy data from source stream to output stream.
+     * @param source source stream
+     * @param destination target stream
+     * @return number of bytes copied
+     * @throws IOException if any I/O error occurs
+     */
     public static int copyStream(InputStream source, OutputStream destination) throws IOException {
         int count = 0;
@@ -702,5 +730,5 @@
      * Opens a connection to the given URL, sets the User-Agent property to JOSM's one, and decompresses stream if necessary.
      * @param url The url to open
-     * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link CBZip2InputStream}
+     * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link BZip2CompressorInputStream}
      *                   if the {@code Content-Type} header is set accordingly.
      * @return An stream for the given URL
@@ -729,18 +757,12 @@
      * @return a Bzip2 input stream wrapping given input stream, or {@code null} if {@code in} is {@code null}
      * @throws IOException if the given input stream does not contain valid BZ2 header
-     * @since 7119
-     */
-    public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException {
+     * @since 7867
+     */
+    public static BZip2CompressorInputStream getBZip2InputStream(InputStream in) throws IOException {
         if (in == null) {
             return null;
         }
         BufferedInputStream bis = new BufferedInputStream(in);
-        int b = bis.read();
-        if (b != 'B')
-            throw new IOException(tr("Invalid bz2 file."));
-        b = bis.read();
-        if (b != 'Z')
-            throw new IOException(tr("Invalid bz2 file."));
-        return new CBZip2InputStream(bis, /* see #9537 */ true);
+        return new BZip2CompressorInputStream(bis, /* see #9537 */ true);
     }
 
@@ -808,5 +830,5 @@
      * Opens a connection to the given URL and sets the User-Agent property to JOSM's one.
      * @param url The url to open
-     * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link CBZip2InputStream}
+     * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link BZip2CompressorInputStream}
      *                   if the {@code Content-Type} header is set accordingly.
      * @return An buffered stream reader for the given URL (using UTF-8)
@@ -929,5 +951,5 @@
      * @since 6354
      */
-    public static String getDurationString(long elapsedTime) throws IllegalArgumentException {
+    public static String getDurationString(long elapsedTime) {
         if (elapsedTime < 0) {
             throw new IllegalArgumentException("elapsedTime must be >= 0");
@@ -1033,5 +1055,5 @@
         if (result != null) {
             Throwable cause = result.getCause();
-            while (cause != null && cause != result) {
+            while (cause != null && !cause.equals(result)) {
                 result = cause;
                 cause = result.getCause();
@@ -1056,4 +1078,7 @@
     /**
      * If the string {@code s} is longer than {@code maxLength}, the string is cut and "..." is appended.
+     * @param s String to shorten
+     * @param maxLength maximum number of characters to keep (not including the "...")
+     * @return the shortened string
      */
     public static String shortenString(String s, int maxLength) {
