Codebase list joda-convert / 234e70d
New upstream version 2.1.2 Emmanuel Bourg 1 year, 3 months ago
14 changed file(s) with 170 addition(s) and 73 deletion(s). Raw diff Collapse all Expand all
0
1 echo "## setup..."
2 git config --global user.name "Stephen Colebourne (CI)"
3 git config --global user.email "scolebourne@joda.org"
4 cd target
5
6 echo "## clone..."
7 git clone https://${GITHUB_TOKEN}@github.com/JodaOrg/jodaorg.github.io.git
8 cd jodaorg.github.io
9 git status
10
11 echo "## copy..."
12 rm -rf joda-convert/
13 cp -R ../site joda-convert/
14
15 echo "## update..."
16 git add -A
17 git status
18 git commit --message "Update joda-convert from Travis: Build $TRAVIS_BUILD_NUMBER"
19
20 echo "## push..."
21 git push origin master
22
23 echo "## done"
00 sudo: false
11 language: java
22 jdk:
3 - oraclejdk10
3 - openjdk11
44 - oraclejdk9
55 - oraclejdk8
66 cache:
1414 script:
1515 - mvn install site -e -B
1616 after_success:
17 - if [[ $TRAVIS_TAG =~ ^v.*$ ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk9" ]; then travis_wait 40 mvn clean install site-deploy -e -B --settings .github/maven-settings.xml; fi
17 - if [[ $TRAVIS_TAG =~ ^website.*$ ]] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk10" ]; then chmod +x ./.github/website.sh; .github/website.sh; fi
18 - if [[ $TRAVIS_TAG =~ ^v.*$ ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk10" ]; then chmod +x ./.github/website.sh; .github/website.sh; fi
1819 # secure keys for GITHUB_TOKEN
1920 env:
2021 global:
11 Copyright 2010-present Stephen Colebourne
22
33 This product includes software developed by
4 Joda.org (http://www.joda.org/).
4 Joda.org (https://www.joda.org/).
55
66
77 Joda-Convert includes code from Google Guava, which is licensed as follows:
1111 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
1212 in compliance with the License. You may obtain a copy of the License at
1313
14 http://www.apache.org/licenses/LICENSE-2.0
14 https://www.apache.org/licenses/LICENSE-2.0
1515
1616 Unless required by applicable law or agreed to in writing, software distributed under the License
1717 is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
3838 When Joda-Convert is asked to convert between an object and a String, if there is no registered converter
3939 then the annotations are checked. If they are found, then the methods are called by reflection.
4040
41 Joda-Convert is licensed under the business-friendly [Apache 2.0 licence](http://www.joda.org/joda-convert/license.html).
41 Joda-Convert is licensed under the business-friendly [Apache 2.0 licence](https://www.joda.org/joda-convert/licenses.html).
4242
4343
4444 ### Documentation
4545 Various documentation is available:
4646
47 * The [home page](http://www.joda.org/joda-convert/)
48 * The helpful [user guide](http://www.joda.org/joda-convert/userguide.html)
49 * The [Javadoc](http://www.joda.org/joda-convert/apidocs/index.html)
50 * The change notes for the [releases](http://www.joda.org/joda-convert/changes-report.html)
47 * The [home page](https://www.joda.org/joda-convert/)
48 * The helpful [user guide](https://www.joda.org/joda-convert/userguide.html)
49 * The [Javadoc](https://www.joda.org/joda-convert/apidocs/index.html)
50 * The change notes for the [releases](https://www.joda.org/joda-convert/changes-report.html)
5151
5252
5353 ### Releases
54 [Release 2.1.1](http://www.joda.org/joda-convert/download.html) is the current latest release.
54 [Release 2.1.2](https://www.joda.org/joda-convert/download.html) is the current latest release.
5555 This release is considered stable and worthy of the 2.x tag.
5656 The v2.x releases are compatible with v1.x releases, with the exception that the direct Guava dependency is removed.
5757 It depends on Java SE 6 or later.
5858
59 Available in the [Maven Central repository](http://search.maven.org/#artifactdetails|org.joda|joda-convert|2.1.1|jar)
59 Available in the [Maven Central repository](https://search.maven.org/search?q=g:org.joda%20AND%20a:joda-convert&core=gav)
6060
6161
6262 ### Support
44
55 The release runs on JDK 6 or later.
66
7 See http://www.joda.org/joda-convert/changes-report.html for changes
7 See https://www.joda.org/joda-convert/changes-report.html for changes
88
99 Joda-Convert is licensed under the business-friendly Apache License Version 2.
1010 This is the same license as all of Apache, plus other open source projects such as Spring.
77 <parent>
88 <groupId>org.joda</groupId>
99 <artifactId>joda-parent</artifactId>
10 <version>1.1.2</version>
10 <version>1.3.2</version>
1111 </parent>
1212 <modelVersion>4.0.0</modelVersion>
1313 <artifactId>joda-convert</artifactId>
1414 <packaging>jar</packaging>
1515 <name>Joda-Convert</name>
16 <version>2.1.1</version>
16 <version>2.1.2</version>
1717 <description>Library to convert Objects to and from String</description>
18 <url>http://www.joda.org/${joda.artifactId}/</url>
18 <url>https://www.joda.org/${joda.artifactId}/</url>
1919
2020 <!-- ==================================================================== -->
2121 <inceptionYear>2010</inceptionYear>
2323 <connection>scm:git:https://github.com/JodaOrg/${joda.artifactId}.git</connection>
2424 <developerConnection>scm:git:https://github.com/JodaOrg/${joda.artifactId}.git</developerConnection>
2525 <url>https://github.com/JodaOrg/${joda.artifactId}</url>
26 <tag>v2.1.1</tag>
26 <tag>v2.1.2</tag>
2727 </scm>
2828
2929 <!-- ==================================================================== -->
8181 </configuration>
8282 </execution>
8383 </executions>
84 <configuration>
85 <properties>
86 <property>
87 <name>usedefaultlisteners</name>
88 <value>false</value>
89 </property>
90 </properties>
91 </configuration>
9284 </plugin>
9385 </plugins>
9486 </build>
123115 </activation>
124116 <build>
125117 <plugins>
118 <!-- Additional jar file for systems too dozy to handle Java 9 -->
119 <plugin>
120 <groupId>org.apache.maven.plugins</groupId>
121 <artifactId>maven-jar-plugin</artifactId>
122 <executions>
123 <execution>
124 <id>classic</id>
125 <phase>package</phase>
126 <goals>
127 <goal>jar</goal>
128 </goals>
129 <configuration>
130 <classifier>classic</classifier>
131 <archive>
132 <manifestEntries>
133 <Automatic-Module-Name>${joda.module.name}</Automatic-Module-Name>
134 </manifestEntries>
135 </archive>
136 <excludes>
137 <exclude>module-info*</exclude>
138 </excludes>
139 </configuration>
140 </execution>
141 </executions>
142 </plugin>
126143 <!-- Create dist files -->
127144 <plugin>
128145 <groupId>org.apache.maven.plugins</groupId>
153170 <version>1.1.1</version>
154171 <configuration>
155172 <releaseName>Release v${project.version}</releaseName>
156 <description>See the [change notes](http://www.joda.org/${joda.artifactId}/changes-report.html) for more information.</description>
173 <description>See the [change notes](https://www.joda.org/${joda.artifactId}/changes-report.html) for more information.</description>
157174 <tag>v${project.version}</tag>
158175 <overwriteArtifact>true</overwriteArtifact>
159176 <fileSets>
192209 <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion>
193210 <maven.compiler.source>1.6</maven.compiler.source>
194211 <maven.compiler.target>1.6</maven.compiler.target>
212 <!-- Overrides -->
213 <maven-bundle-plugin.version>4.1.0</maven-bundle-plugin.version>
214 <maven-surefire-plugin.version>2.22.1</maven-surefire-plugin.version>
215 <maven-surefire-report-plugin.version>2.22.1</maven-surefire-report-plugin.version>
216 <bndlib.version>4.1.0</bndlib.version>
217 <checkstyle.version>8.14</checkstyle.version>
218 <jacoco-maven-plugin.version>0.8.2</jacoco-maven-plugin.version>
219 <spotbugs-maven-plugin.version>3.1.7</spotbugs-maven-plugin.version>
195220 </properties>
196221 </project>
66
77 <body>
88 <!-- types are add, fix, remove, update -->
9 <release version="2.1.1" date="2018-07-10" description="Version 2.1.2">
9 <release version="2.1.2" date="2018-10-23" description="Version 2.1.2">
10 <action dev="jodastephen" type="fix">
11 Fix `Renamed.ini` to avoid NPE during loading.
12 A null `RenameHandler.INSTANCE` could be observed if `Renamed.ini` referred to a class
13 with a static initializer that referred back to `RenameHandler`.
14 </action>
15 <action dev="jodastephen" type="fix">
16 Fix build to work on Java 11.
17 </action>
18 </release>
19 <release version="2.1.1" date="2018-07-10" description="Version 2.1.1">
1020 <action dev="jodastephen" type="add">
1121 Log startup issues when using renames by configuration.
12 Add `Renamed.ini` to configure renames more cleanly.
1322 </action>
1423 </release>
1524 <release version="2.1" date="2018-06-08" description="Version 2.1">
6262 * This is a singleton instance which is mutated.
6363 * It will be populated by the contents of the {@code Renamed.ini} configuration files.
6464 */
65 public static final RenameHandler INSTANCE;
65 public static final RenameHandler INSTANCE = create(false);
6666 static {
6767 // log errors to System.err, as problems in static initializers can be troublesome to diagnose
68 RenameHandler handler = new RenameHandler();
6968 try {
70 // don't just call loadFromClasspath() as that mutates and might leave an invalid state
71 handler = create(true);
69 // calling loadFromClasspath() is the best option even though it mutates INSTANCE
70 // only serious errors will be caught here, most errors will log from parseRenameFile()
71 INSTANCE.loadFromClasspath();
72
7273 } catch (IllegalStateException ex) {
7374 System.err.println("ERROR: " + ex.getMessage());
7475 ex.printStackTrace();
7980 System.err.println("ERROR: Failed to load Renamed.ini files: " + ex.getMessage());
8081 ex.printStackTrace();
8182 }
82 INSTANCE = handler;
8383 }
8484
8585 /**
105105 Long[] array = new Long[str.length() / 2 + 1];
106106 while (sep >= 0) {
107107 String split = str.substring(base, sep);
108 array[count++] = split.equals("-") ? null : new Long(split);
109 base = sep + 1;
110 sep = str.indexOf(',', sep + 1);
111 }
112 String split = str.substring(base, str.length());
113 array[count++] = split.equals("-") ? null : new Long(split);
108 array[count++] = split.equals("-") ? null : Long.valueOf(split);
109 base = sep + 1;
110 sep = str.indexOf(',', sep + 1);
111 }
112 String split = str.substring(base, str.length());
113 array[count++] = split.equals("-") ? null : Long.valueOf(split);
114114 return Arrays.copyOf(array, count);
115115 }
116116 @Override
147147 Integer[] array = new Integer[str.length() / 2 + 1];
148148 while (sep >= 0) {
149149 String split = str.substring(base, sep);
150 array[count++] = split.equals("-") ? null : new Integer(split);
151 base = sep + 1;
152 sep = str.indexOf(',', sep + 1);
153 }
154 String split = str.substring(base, str.length());
155 array[count++] = split.equals("-") ? null : new Integer(split);
150 array[count++] = split.equals("-") ? null : Integer.valueOf(split);
151 base = sep + 1;
152 sep = str.indexOf(',', sep + 1);
153 }
154 String split = str.substring(base, str.length());
155 array[count++] = split.equals("-") ? null : Integer.valueOf(split);
156156 return Arrays.copyOf(array, count);
157157 }
158158 @Override
189189 Short[] array = new Short[str.length() / 2 + 1];
190190 while (sep >= 0) {
191191 String split = str.substring(base, sep);
192 array[count++] = split.equals("-") ? null : new Short(split);
193 base = sep + 1;
194 sep = str.indexOf(',', sep + 1);
195 }
196 String split = str.substring(base, str.length());
197 array[count++] = split.equals("-") ? null : new Short(split);
192 array[count++] = split.equals("-") ? null : Short.valueOf(split);
193 base = sep + 1;
194 sep = str.indexOf(',', sep + 1);
195 }
196 String split = str.substring(base, str.length());
197 array[count++] = split.equals("-") ? null : Short.valueOf(split);
198198 return Arrays.copyOf(array, count);
199199 }
200200 @Override
231231 Double[] array = new Double[str.length() / 2 + 1];
232232 while (sep >= 0) {
233233 String split = str.substring(base, sep);
234 array[count++] = split.equals("-") ? null : new Double(split);
235 base = sep + 1;
236 sep = str.indexOf(',', sep + 1);
237 }
238 String split = str.substring(base, str.length());
239 array[count++] = split.equals("-") ? null : new Double(split);
234 array[count++] = split.equals("-") ? null : Double.valueOf(split);
235 base = sep + 1;
236 sep = str.indexOf(',', sep + 1);
237 }
238 String split = str.substring(base, str.length());
239 array[count++] = split.equals("-") ? null : Double.valueOf(split);
240240 return Arrays.copyOf(array, count);
241241 }
242242 @Override
273273 Float[] array = new Float[str.length() / 2 + 1];
274274 while (sep >= 0) {
275275 String split = str.substring(base, sep);
276 array[count++] = split.equals("-") ? null : new Float(split);
277 base = sep + 1;
278 sep = str.indexOf(',', sep + 1);
279 }
280 String split = str.substring(base, str.length());
281 array[count++] = split.equals("-") ? null : new Float(split);
276 array[count++] = split.equals("-") ? null : Float.valueOf(split);
277 base = sep + 1;
278 sep = str.indexOf(',', sep + 1);
279 }
280 String split = str.substring(base, str.length());
281 array[count++] = split.equals("-") ? null : Float.valueOf(split);
282282 return Arrays.copyOf(array, count);
283283 }
284284 @Override
66 Joda-Convert addresses this without getting caught up in the wider problem
77 of Object to Object transformation.
88
9 Joda-Convert is licensed under the business-friendly [Apache 2.0 licence](license.html).
9 Joda-Convert is licensed under the business-friendly [Apache 2.0 licence](licenses.html).
1010
1111
1212 ## <i></i> Features
7575
7676 ## <i></i> Releases
7777
78 [Release 2.1.1](download.html) is the current latest release.
78 [Release 2.1.2](download.html) is the current latest release.
7979 This release is considered stable and worthy of the 2.x tag.
8080 The v2.x releases are compatible with v1.x releases, with the exception that the direct Guava dependency is removed.
8181
8282 Joda-Convert requires Java SE 6 or later and has [no dependencies](dependencies.html).
8383
84 Available in [Maven Central](http://search.maven.org/#artifactdetails%7Corg.joda%7Cjoda-convert%7C2.1.1%7Cjar).
84 Available in [Maven Central](https://search.maven.org/search?q=g:org.joda%20AND%20a:joda-convert&core=gav).
8585
8686 ```xml
8787 <dependency>
8888 <groupId>org.joda</groupId>
8989 <artifactId>joda-convert</artifactId>
90 <version>2.1.1</version>
90 <version>2.1.2</version>
9191 </dependency>
9292 ```
9393
9898 <dependency>
9999 <groupId>org.joda</groupId>
100100 <artifactId>joda-convert</artifactId>
101 <version>2.1.1</version>
101 <version>2.1.2</version>
102102 <classifier>classic</classifier>
103103 </dependency>
104104 ```
3333 <toc>false</toc>
3434 <breadcrumbs>false</breadcrumbs>
3535 <markPageHeader>false</markPageHeader>
36 <protocolRelativeURLs>true</protocolRelativeURLs>
3637 <pages>
3738 <index>
3839 <sections>
6061 <body>
6162 <head>
6263 <![CDATA[
63 <link href="http://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet"/>
64 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"/>
6465 <link rel="author" href="https://plus.google.com/113137868744510231215"/>]]>
6566 </head>
6667
6869 <item name="Home" href="index.html"/>
6970 <item name="User guide" href="userguide.html"/>
7071 <item name="Javadoc" href="apidocs/index.html"/>
71 <item name="License" href="license.html"/>
72 <item name="License" href="licenses.html"/>
7273 </menu>
7374
7475 <menu name="Releases">
8485 </menu>
8586
8687 <menu name="Joda">
87 <item name="Home" href="http://www.joda.org"/>
88 <item name="Beans" href="http://www.joda.org/joda-beans/"/>
89 <item name="Money" href="http://www.joda.org/joda-money/"/>
90 <item name="Time" href="http://www.joda.org/joda-time/"/>
88 <item name="Home" href="https://www.joda.org"/>
89 <item name="Beans" href="https://www.joda.org/joda-beans/"/>
90 <item name="Money" href="https://www.joda.org/joda-money/"/>
91 <item name="Time" href="https://www.joda.org/joda-time/"/>
9192 </menu>
9293
9394 <menu name="Reports" ref="reports"/>
1515 package org.joda.convert;
1616
1717 import static org.junit.Assert.assertEquals;
18 import static org.junit.Assert.assertFalse;
1819 import static org.junit.Assert.assertTrue;
1920
2021 import java.io.ByteArrayOutputStream;
2122 import java.io.PrintStream;
23 import java.util.concurrent.atomic.AtomicBoolean;
2224
2325 import org.junit.Test;
2426
2628 * Test {@link RenameHandler}.
2729 */
2830 public class TestRenameHandler {
31
32 static final AtomicBoolean BAD_INIT = new AtomicBoolean();
2933
3034 @Test
3135 public void test_matchRenamedType() throws ClassNotFoundException {
8387 String logged = baos.toString("UTF-8");
8488 assertTrue(logged.startsWith("ERROR: Invalid Renamed.ini: "));
8589 assertTrue(logged.contains("org.joda.convert.ClassDoesNotExist"));
90 // ensure that the bad init class is loaded, and that it did not see a null RenameHandler
91 assertTrue(test.getTypeRenames().containsKey("com.foo.convert.TestRenameHandlerBadInit"));
92 assertFalse(BAD_INIT.get());
8693
8794 } finally {
8895 System.setErr(originalErr);
0 /*
1 * Copyright 2010-present Stephen Colebourne
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.joda.convert;
16
17 /**
18 * A class that spots bad initialization.
19 */
20 public class TestRenameHandlerBadInit {
21
22 static {
23 if (RenameHandler.INSTANCE == null) {
24 TestRenameHandler.BAD_INIT.set(true);
25 }
26 }
27
28 }
22 com.foo.Bar = org.joda.convert.Status
33 # this class does not exist and an error will be printed when running the tests
44 com.foo.Bar = org.joda.convert.ClassDoesNotExist
5 com.foo.convert.TestRenameHandlerBadInit = org.joda.convert.TestRenameHandlerBadInit
56
67 # Test renamed enums
78 [enums]