New upstream version 2.1.2
Emmanuel Bourg
1 year, 3 months ago
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" |
0 | 0 | sudo: false |
1 | 1 | language: java |
2 | 2 | jdk: |
3 | - oraclejdk10 | |
3 | - openjdk11 | |
4 | 4 | - oraclejdk9 |
5 | 5 | - oraclejdk8 |
6 | 6 | cache: |
14 | 14 | script: |
15 | 15 | - mvn install site -e -B |
16 | 16 | 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 | |
18 | 19 | # secure keys for GITHUB_TOKEN |
19 | 20 | env: |
20 | 21 | global: |
1 | 1 | Copyright 2010-present Stephen Colebourne |
2 | 2 | |
3 | 3 | This product includes software developed by |
4 | Joda.org (http://www.joda.org/). | |
4 | Joda.org (https://www.joda.org/). | |
5 | 5 | |
6 | 6 | |
7 | 7 | Joda-Convert includes code from Google Guava, which is licensed as follows: |
11 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
12 | 12 | in compliance with the License. You may obtain a copy of the License at |
13 | 13 | |
14 | http://www.apache.org/licenses/LICENSE-2.0 | |
14 | https://www.apache.org/licenses/LICENSE-2.0 | |
15 | 15 | |
16 | 16 | Unless required by applicable law or agreed to in writing, software distributed under the License |
17 | 17 | is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
38 | 38 | When Joda-Convert is asked to convert between an object and a String, if there is no registered converter |
39 | 39 | then the annotations are checked. If they are found, then the methods are called by reflection. |
40 | 40 | |
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). | |
42 | 42 | |
43 | 43 | |
44 | 44 | ### Documentation |
45 | 45 | Various documentation is available: |
46 | 46 | |
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) | |
51 | 51 | |
52 | 52 | |
53 | 53 | ### 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. | |
55 | 55 | This release is considered stable and worthy of the 2.x tag. |
56 | 56 | The v2.x releases are compatible with v1.x releases, with the exception that the direct Guava dependency is removed. |
57 | 57 | It depends on Java SE 6 or later. |
58 | 58 | |
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) | |
60 | 60 | |
61 | 61 | |
62 | 62 | ### Support |
4 | 4 | |
5 | 5 | The release runs on JDK 6 or later. |
6 | 6 | |
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 | |
8 | 8 | |
9 | 9 | Joda-Convert is licensed under the business-friendly Apache License Version 2. |
10 | 10 | This is the same license as all of Apache, plus other open source projects such as Spring. |
7 | 7 | <parent> |
8 | 8 | <groupId>org.joda</groupId> |
9 | 9 | <artifactId>joda-parent</artifactId> |
10 | <version>1.1.2</version> | |
10 | <version>1.3.2</version> | |
11 | 11 | </parent> |
12 | 12 | <modelVersion>4.0.0</modelVersion> |
13 | 13 | <artifactId>joda-convert</artifactId> |
14 | 14 | <packaging>jar</packaging> |
15 | 15 | <name>Joda-Convert</name> |
16 | <version>2.1.1</version> | |
16 | <version>2.1.2</version> | |
17 | 17 | <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> | |
19 | 19 | |
20 | 20 | <!-- ==================================================================== --> |
21 | 21 | <inceptionYear>2010</inceptionYear> |
23 | 23 | <connection>scm:git:https://github.com/JodaOrg/${joda.artifactId}.git</connection> |
24 | 24 | <developerConnection>scm:git:https://github.com/JodaOrg/${joda.artifactId}.git</developerConnection> |
25 | 25 | <url>https://github.com/JodaOrg/${joda.artifactId}</url> |
26 | <tag>v2.1.1</tag> | |
26 | <tag>v2.1.2</tag> | |
27 | 27 | </scm> |
28 | 28 | |
29 | 29 | <!-- ==================================================================== --> |
81 | 81 | </configuration> |
82 | 82 | </execution> |
83 | 83 | </executions> |
84 | <configuration> | |
85 | <properties> | |
86 | <property> | |
87 | <name>usedefaultlisteners</name> | |
88 | <value>false</value> | |
89 | </property> | |
90 | </properties> | |
91 | </configuration> | |
92 | 84 | </plugin> |
93 | 85 | </plugins> |
94 | 86 | </build> |
123 | 115 | </activation> |
124 | 116 | <build> |
125 | 117 | <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> | |
126 | 143 | <!-- Create dist files --> |
127 | 144 | <plugin> |
128 | 145 | <groupId>org.apache.maven.plugins</groupId> |
153 | 170 | <version>1.1.1</version> |
154 | 171 | <configuration> |
155 | 172 | <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> | |
157 | 174 | <tag>v${project.version}</tag> |
158 | 175 | <overwriteArtifact>true</overwriteArtifact> |
159 | 176 | <fileSets> |
192 | 209 | <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion> |
193 | 210 | <maven.compiler.source>1.6</maven.compiler.source> |
194 | 211 | <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> | |
195 | 220 | </properties> |
196 | 221 | </project> |
6 | 6 | |
7 | 7 | <body> |
8 | 8 | <!-- 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"> | |
10 | 20 | <action dev="jodastephen" type="add"> |
11 | 21 | Log startup issues when using renames by configuration. |
12 | Add `Renamed.ini` to configure renames more cleanly. | |
13 | 22 | </action> |
14 | 23 | </release> |
15 | 24 | <release version="2.1" date="2018-06-08" description="Version 2.1"> |
62 | 62 | * This is a singleton instance which is mutated. |
63 | 63 | * It will be populated by the contents of the {@code Renamed.ini} configuration files. |
64 | 64 | */ |
65 | public static final RenameHandler INSTANCE; | |
65 | public static final RenameHandler INSTANCE = create(false); | |
66 | 66 | static { |
67 | 67 | // log errors to System.err, as problems in static initializers can be troublesome to diagnose |
68 | RenameHandler handler = new RenameHandler(); | |
69 | 68 | 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 | ||
72 | 73 | } catch (IllegalStateException ex) { |
73 | 74 | System.err.println("ERROR: " + ex.getMessage()); |
74 | 75 | ex.printStackTrace(); |
79 | 80 | System.err.println("ERROR: Failed to load Renamed.ini files: " + ex.getMessage()); |
80 | 81 | ex.printStackTrace(); |
81 | 82 | } |
82 | INSTANCE = handler; | |
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
+30
-30
105 | 105 | Long[] array = new Long[str.length() / 2 + 1]; |
106 | 106 | while (sep >= 0) { |
107 | 107 | 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); | |
114 | 114 | return Arrays.copyOf(array, count); |
115 | 115 | } |
116 | 116 | @Override |
147 | 147 | Integer[] array = new Integer[str.length() / 2 + 1]; |
148 | 148 | while (sep >= 0) { |
149 | 149 | 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); | |
156 | 156 | return Arrays.copyOf(array, count); |
157 | 157 | } |
158 | 158 | @Override |
189 | 189 | Short[] array = new Short[str.length() / 2 + 1]; |
190 | 190 | while (sep >= 0) { |
191 | 191 | 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); | |
198 | 198 | return Arrays.copyOf(array, count); |
199 | 199 | } |
200 | 200 | @Override |
231 | 231 | Double[] array = new Double[str.length() / 2 + 1]; |
232 | 232 | while (sep >= 0) { |
233 | 233 | 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); | |
240 | 240 | return Arrays.copyOf(array, count); |
241 | 241 | } |
242 | 242 | @Override |
273 | 273 | Float[] array = new Float[str.length() / 2 + 1]; |
274 | 274 | while (sep >= 0) { |
275 | 275 | 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); | |
282 | 282 | return Arrays.copyOf(array, count); |
283 | 283 | } |
284 | 284 | @Override |
6 | 6 | Joda-Convert addresses this without getting caught up in the wider problem |
7 | 7 | of Object to Object transformation. |
8 | 8 | |
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). | |
10 | 10 | |
11 | 11 | |
12 | 12 | ## <i></i> Features |
75 | 75 | |
76 | 76 | ## <i></i> Releases |
77 | 77 | |
78 | [Release 2.1.1](download.html) is the current latest release. | |
78 | [Release 2.1.2](download.html) is the current latest release. | |
79 | 79 | This release is considered stable and worthy of the 2.x tag. |
80 | 80 | The v2.x releases are compatible with v1.x releases, with the exception that the direct Guava dependency is removed. |
81 | 81 | |
82 | 82 | Joda-Convert requires Java SE 6 or later and has [no dependencies](dependencies.html). |
83 | 83 | |
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). | |
85 | 85 | |
86 | 86 | ```xml |
87 | 87 | <dependency> |
88 | 88 | <groupId>org.joda</groupId> |
89 | 89 | <artifactId>joda-convert</artifactId> |
90 | <version>2.1.1</version> | |
90 | <version>2.1.2</version> | |
91 | 91 | </dependency> |
92 | 92 | ``` |
93 | 93 | |
98 | 98 | <dependency> |
99 | 99 | <groupId>org.joda</groupId> |
100 | 100 | <artifactId>joda-convert</artifactId> |
101 | <version>2.1.1</version> | |
101 | <version>2.1.2</version> | |
102 | 102 | <classifier>classic</classifier> |
103 | 103 | </dependency> |
104 | 104 | ``` |
33 | 33 | <toc>false</toc> |
34 | 34 | <breadcrumbs>false</breadcrumbs> |
35 | 35 | <markPageHeader>false</markPageHeader> |
36 | <protocolRelativeURLs>true</protocolRelativeURLs> | |
36 | 37 | <pages> |
37 | 38 | <index> |
38 | 39 | <sections> |
60 | 61 | <body> |
61 | 62 | <head> |
62 | 63 | <![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"/> | |
64 | 65 | <link rel="author" href="https://plus.google.com/113137868744510231215"/>]]> |
65 | 66 | </head> |
66 | 67 | |
68 | 69 | <item name="Home" href="index.html"/> |
69 | 70 | <item name="User guide" href="userguide.html"/> |
70 | 71 | <item name="Javadoc" href="apidocs/index.html"/> |
71 | <item name="License" href="license.html"/> | |
72 | <item name="License" href="licenses.html"/> | |
72 | 73 | </menu> |
73 | 74 | |
74 | 75 | <menu name="Releases"> |
84 | 85 | </menu> |
85 | 86 | |
86 | 87 | <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/"/> | |
91 | 92 | </menu> |
92 | 93 | |
93 | 94 | <menu name="Reports" ref="reports"/> |
15 | 15 | package org.joda.convert; |
16 | 16 | |
17 | 17 | import static org.junit.Assert.assertEquals; |
18 | import static org.junit.Assert.assertFalse; | |
18 | 19 | import static org.junit.Assert.assertTrue; |
19 | 20 | |
20 | 21 | import java.io.ByteArrayOutputStream; |
21 | 22 | import java.io.PrintStream; |
23 | import java.util.concurrent.atomic.AtomicBoolean; | |
22 | 24 | |
23 | 25 | import org.junit.Test; |
24 | 26 | |
26 | 28 | * Test {@link RenameHandler}. |
27 | 29 | */ |
28 | 30 | public class TestRenameHandler { |
31 | ||
32 | static final AtomicBoolean BAD_INIT = new AtomicBoolean(); | |
29 | 33 | |
30 | 34 | @Test |
31 | 35 | public void test_matchRenamedType() throws ClassNotFoundException { |
83 | 87 | String logged = baos.toString("UTF-8"); |
84 | 88 | assertTrue(logged.startsWith("ERROR: Invalid Renamed.ini: ")); |
85 | 89 | 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()); | |
86 | 93 | |
87 | 94 | } finally { |
88 | 95 | 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 | } |
2 | 2 | com.foo.Bar = org.joda.convert.Status |
3 | 3 | # this class does not exist and an error will be printed when running the tests |
4 | 4 | com.foo.Bar = org.joda.convert.ClassDoesNotExist |
5 | com.foo.convert.TestRenameHandlerBadInit = org.joda.convert.TestRenameHandlerBadInit | |
5 | 6 | |
6 | 7 | # Test renamed enums |
7 | 8 | [enums] |