- Timestamp:
- 2014-12-21T01:30:50+01:00 (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r7838 r7867 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <classpath> 3 <classpathentry kind="src" path="src"/>3 <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"/> 4 4 <classpathentry kind="src" path="test/unit"/> 5 5 <classpathentry kind="src" path="test/functional"/> -
trunk/CONTRIBUTION
r7799 r7867 38 38 with Apache license version 2.0. 39 39 40 The Bzip2 code is from Keiron Liddle (Apache project)and licensed40 The Bzip2 code is from Apache Commons Compress and licensed 41 41 with Apache license version 2.0. 42 42 -
trunk/README
r7489 r7867 59 59 - CONTRIBUTION list of major code contributors 60 60 - data/ data files that will be included in the JOSM jar file 61 - *.gsb NTv2 grid files for projection support 61 - fonts/ font files used for map rendering 62 - projection/ projection files 63 - *.gsb NTv2 grid files for projection support 64 - epsg list of projection definitions 62 65 - *.lang translation data 63 66 - *.xsd xml schema files for validation of configuration files 64 - epsg list of projection definitions65 67 - help-browser.css CSS file for the help sites (HTML content is downloaded from the website 66 68 on demand, but displayed inside the programm in a Java web browser component.) 67 - ignoretags.cfg, tagchecker.cfg 68 data files used by the JOSM validator feature 69 - validator/ data files used by the JOSM validator feature 70 - *.cfg files designed for the old tagchecker, still used 71 - *.mapcss default validation rules for the new mapcss-based tagchecker 69 72 - data_nodist/ data files that are useful for development, but not distributed 70 73 - exif-direction-example.jpg … … 88 91 - images_nodist/ images, which are not for distribution, but may be useful later (e.g. high 89 92 resolution and vector versions) 90 - josm.jnlp Java Web Start launcher file (used on the website )91 - lib/ libraries (directory is empty at the moment)93 - josm.jnlp Java Web Start launcher file (used on the website for the tested version) 94 - josm-latest.jnlp Java Web Start launcher file (used on the website for the latest version) 92 95 - LICENSE the JOSM license terms 93 - macosx/ files needed to create the MacOS package 96 - linux/ files useful for Linux distributions, including Appdata files, .desktop 97 files, Debian/Ubuntu scripts, man pages, icons, etc. 98 - macosx/ files needed to create the MacOS X package 94 99 - netbeans/ preconfigured Netbeans project 95 100 - optimize-images short script to decrease size of PNG images 96 101 - patches/ patches for external libraries used in JOSM (see below) 97 102 - README this file 103 - resources/ resource files that will be included in the JOSM jar file 104 - scripts/ various scripts used by JOSM developers 98 105 - src/ the source code of the program 99 106 - start.html HTML page to run the applet version of JOSM … … 108 115 - unit/ unit tests (source code) 109 116 - tools/ libraries and tools that help in the development process 110 - animal-sniffer-ant-tasks-1. 8.jar117 - animal-sniffer-ant-tasks-1.11.jar 111 118 TODO: what is this? 112 119 - appbundler-1.0ea.jar used to build Mac OS X package for Oracle Java 7 113 120 - findbugs/ libs and config files for findbugs (automatically detects common bugs and potential 114 121 problems in source code); can be launched as an ant target in build.xml 122 - groovy-all-2.3.9.jar used for some unit tests and various scripts 115 123 - jacocoant.jar used to include coverage data into JUnit test reports 116 124 - javacc.jar used in the build process to generate some .java files from a javacc source file 117 125 (src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj) 118 126 - proguard.jar optimize final binary jar - see build.xml (not used in production so far) 127 - xmltask.jar used to edit XML files from Ant for the OSX package 128 - windows/ files needed to create the Windows installer 119 129 120 130 The 'patches' directory … … 133 143 Third party libraries 134 144 --------------------- 135 There are a couple ofthird party libraries which are directly included in the source code tree, in particular:145 There are some third party libraries which are directly included in the source code tree, in particular: 136 146 137 147 * jmapviewer: Java component to browse a TMS map 138 148 src/org/openstreetmap/gui (svn external) 139 149 -> http://svn.openstreetmap.org/applications/viewer/jmapviewer/ 140 * Apache Ant's bzip2: Support for bzip2 compression when opening files141 src/org/apache/tools/bzip2 (svn external)142 -> http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/bzip2143 150 * Apache commons codec: Better Base64 support 144 151 src/org/apache/commons/codec (svn external) 145 152 -> http://svn.apache.org/repos/asf/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec 153 * Apache commons compress: Support for bzip2 compression when opening files 154 src/org/apache/commons/compress/compressors (svn external) 155 -> http://svn.apache.org/repos/asf/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/compressors 146 156 * Apache commons validator: Improved validator routines 147 157 src/org/openstreetmap/josm/data/validation/routines -
trunk/src/org/openstreetmap/josm/io/Compression.java
r7119 r7867 13 13 import java.util.zip.ZipOutputStream; 14 14 15 import org.apache. tools.bzip2.CBZip2OutputStream;15 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream; 16 16 import org.openstreetmap.josm.tools.Utils; 17 17 … … 98 98 switch (this) { 99 99 case BZIP2: 100 out.write('B'); 101 out.write('Z'); 102 return new CBZip2OutputStream(out); 100 return new BZip2CompressorOutputStream(out); 103 101 case GZIP: 104 102 return new GZIPOutputStream(out); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7864 r7867 51 51 import java.util.zip.ZipInputStream; 52 52 53 import org.apache. tools.bzip2.CBZip2InputStream;53 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 54 54 import org.openstreetmap.josm.Main; 55 55 import org.openstreetmap.josm.data.Version; … … 159 159 160 160 /** 161 * Get minimum of 3 values 161 * Returns the minimum of three values. 162 * @param a an argument. 163 * @param b another argument. 164 * @param c another argument. 165 * @return the smaller of {@code a}, {@code b} and {@code c}. 162 166 */ 163 167 public static int min(int a, int b, int c) { … … 173 177 } 174 178 179 /** 180 * Returns the greater of four {@code int} values. That is, the 181 * result is the argument closer to the value of 182 * {@link Integer#MAX_VALUE}. If the arguments have the same value, 183 * the result is that same value. 184 * 185 * @param a an argument. 186 * @param b another argument. 187 * @param c another argument. 188 * @param d another argument. 189 * @return the larger of {@code a}, {@code b}, {@code c} and {@code d}. 190 */ 175 191 public static int max(int a, int b, int c, int d) { 176 192 return Math.max(Math.max(a, b), Math.max(c, d)); 177 193 } 178 194 195 /** 196 * Ensures a logical condition is met. Otherwise throws an assertion error. 197 * @param condition the condition to be met 198 * @param message Formatted error message to raise if condition is not met 199 * @param data Message parameters, optional 200 * @throws AssertionError if the condition is not met 201 */ 179 202 public static void ensure(boolean condition, String message, Object...data) { 180 203 if (!condition) … … 209 232 if (values == null) 210 233 return null; 211 if (values.isEmpty())212 return "";213 234 StringBuilder s = null; 214 235 for (Object a : values) { … … 222 243 } 223 244 } 224 return s .toString();245 return s != null ? s.toString() : ""; 225 246 } 226 247 … … 361 382 } 362 383 384 /** 385 * Copy data from source stream to output stream. 386 * @param source source stream 387 * @param destination target stream 388 * @return number of bytes copied 389 * @throws IOException if any I/O error occurs 390 */ 363 391 public static int copyStream(InputStream source, OutputStream destination) throws IOException { 364 392 int count = 0; … … 702 730 * Opens a connection to the given URL, sets the User-Agent property to JOSM's one, and decompresses stream if necessary. 703 731 * @param url The url to open 704 * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link CBZip2InputStream}732 * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link BZip2CompressorInputStream} 705 733 * if the {@code Content-Type} header is set accordingly. 706 734 * @return An stream for the given URL … … 729 757 * @return a Bzip2 input stream wrapping given input stream, or {@code null} if {@code in} is {@code null} 730 758 * @throws IOException if the given input stream does not contain valid BZ2 header 731 * @since 7 119732 */ 733 public static CBZip2InputStream getBZip2InputStream(InputStream in) throws IOException {759 * @since 7867 760 */ 761 public static BZip2CompressorInputStream getBZip2InputStream(InputStream in) throws IOException { 734 762 if (in == null) { 735 763 return null; 736 764 } 737 765 BufferedInputStream bis = new BufferedInputStream(in); 738 int b = bis.read(); 739 if (b != 'B') 740 throw new IOException(tr("Invalid bz2 file.")); 741 b = bis.read(); 742 if (b != 'Z') 743 throw new IOException(tr("Invalid bz2 file.")); 744 return new CBZip2InputStream(bis, /* see #9537 */ true); 766 return new BZip2CompressorInputStream(bis, /* see #9537 */ true); 745 767 } 746 768 … … 808 830 * Opens a connection to the given URL and sets the User-Agent property to JOSM's one. 809 831 * @param url The url to open 810 * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link CBZip2InputStream}832 * @param decompress whether to wrap steam in a {@link GZIPInputStream} or {@link BZip2CompressorInputStream} 811 833 * if the {@code Content-Type} header is set accordingly. 812 834 * @return An buffered stream reader for the given URL (using UTF-8) … … 929 951 * @since 6354 930 952 */ 931 public static String getDurationString(long elapsedTime) throws IllegalArgumentException{953 public static String getDurationString(long elapsedTime) { 932 954 if (elapsedTime < 0) { 933 955 throw new IllegalArgumentException("elapsedTime must be >= 0"); … … 1033 1055 if (result != null) { 1034 1056 Throwable cause = result.getCause(); 1035 while (cause != null && cause != result) {1057 while (cause != null && !cause.equals(result)) { 1036 1058 result = cause; 1037 1059 cause = result.getCause(); … … 1056 1078 /** 1057 1079 * If the string {@code s} is longer than {@code maxLength}, the string is cut and "..." is appended. 1080 * @param s String to shorten 1081 * @param maxLength maximum number of characters to keep (not including the "...") 1082 * @return the shortened string 1058 1083 */ 1059 1084 public static String shortenString(String s, int maxLength) {
Note:
See TracChangeset
for help on using the changeset viewer.