Skip to content
Commits on Source (8)
# This file enables the Travis continuous integration system, which
# automatically builds and tests joda-time for each GitHub commit or
# pull request on three separate JDKs.
#
# For more information, see https://travis-ci.org
# build does not work on Java 9 or later as Java 5 is not a valid target
sudo: false
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
cache:
directories:
- "$HOME/.m2/repository"
......@@ -18,9 +14,9 @@ before_cache:
install:
- mvn --version
script:
- mvn install -e -B
- mvn install site -e -B
after_success:
- if [[ $TRAVIS_TAG =~ ^v.*$ ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]; then travis_wait 40 mvn site-deploy -e -B --settings .github/maven-settings.xml; fi
- if [[ $TRAVIS_TAG =~ ^v.*$ ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_JDK_VERSION" == "oraclejdk8" ]; then travis_wait 40 mvn clean install site-deploy -e -B --settings .github/maven-settings.xml; fi
# secure keys for GITHUB_TOKEN
env:
global:
......
......@@ -46,24 +46,24 @@ Various documentation is available:
### Releases
[Release 2.9.9](http://www.joda.org/joda-time/download.html) is the current latest release.
[Release 2.10](http://www.joda.org/joda-time/download.html) is the current latest release.
This release is considered stable and worthy of the 2.x tag.
It depends on JDK 1.5 or later.
Available in the [Maven Central repository](http://search.maven.org/#artifactdetails|joda-time|joda-time|2.9.9|jar)
Available in the [Maven Central repository](http://search.maven.org/#artifactdetails|joda-time|joda-time|2.10|jar)
**Maven configuration:**
```xml
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
<version>2.10</version>
</dependency>
```
**Gradle configuration:**
```groovy
compile 'joda-time:joda-time:2.9.9'
compile 'joda-time:joda-time:2.10'
```
### Related projects
......@@ -89,6 +89,7 @@ Historically, the project was at [Sourceforge](https://sourceforge.net/projects/
* Update version (pom.xml, README.md, index.md, MANIFEST.MF, changes.xml)
* Commit and push
* Ensure on Java SE 8
* `mvn clean deploy -Doss.repo -Dgpg.passphrase=""`
* Release project in [Nexus](https://oss.sonatype.org)
* Website will be built and released by Travis
libjoda-time-java (2.10-1) unstable; urgency=medium
* New upstream release
* Standards-Version updated to 4.1.4
* Use salsa.debian.org Vcs-* URLs
* Switch to debhelper level 11
* Removed debian/orig-tar.sh
-- Emmanuel Bourg <ebourg@apache.org> Mon, 04 Jun 2018 23:34:40 +0200
libjoda-time-java (2.9.9-1) unstable; urgency=medium
* New upstream release
......
......@@ -2,9 +2,12 @@ Source: libjoda-time-java
Section: java
Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: Torsten Werner <twerner@debian.org>, Varun Hiremath <varun@debian.org>,
Uploaders:
Torsten Werner <twerner@debian.org>,
Varun Hiremath <varun@debian.org>,
Emmanuel Bourg <ebourg@apache.org>
Build-Depends: debhelper (>= 10),
Build-Depends:
debhelper (>= 11),
default-jdk,
default-jdk-doc,
junit,
......@@ -14,9 +17,9 @@ Build-Depends: debhelper (>= 10),
libmaven-exec-plugin-java,
libmaven-javadoc-plugin-java,
maven-debian-helper (>= 2.0)
Standards-Version: 3.9.8
Vcs-Git: https://anonscm.debian.org/git/pkg-java/libjoda-time-java.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/libjoda-time-java.git
Standards-Version: 4.1.4
Vcs-Git: https://salsa.debian.org/java-team/libjoda-time-java.git
Vcs-Browser: https://salsa.debian.org/java-team/libjoda-time-java
Homepage: http://www.joda.org/joda-time
Package: libjoda-time-java
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Joda time
Upstream-Contact: Stephen Colebourne as Lead developer
Brian S O'Neill as Senior Developer
......@@ -21,7 +21,7 @@ Upstream-Contact: Stephen Colebourne as Lead developer
Source: http://www.joda.org/joda-time
Files: *
Copyright: 2002-2016, Joda.org
Copyright: 2002-2018, Joda.org
License: Apache-2.0
Files: debian/*
......
target/apidocs/* usr/share/doc/libjoda-time-java/api
......@@ -3,6 +3,7 @@ com.github.github site-maven-plugin * * * *
org.apache.maven.plugins maven-assembly-plugin * * * *
org.apache.maven.plugins maven-checkstyle-plugin * * * *
org.apache.maven.plugins maven-deploy-plugin * * * *
org.apache.maven.plugins maven-enforcer-plugin * * * *
org.apache.maven.plugins maven-jxr-plugin * * * *
org.apache.maven.plugins maven-project-info-reports-plugin * * * *
org.apache.maven.plugins maven-repository-plugin * * * *
......
#!/bin/sh -e
# called by uscan with '--upstream-version' <version> <file>
VERSION=$2
TAR=../libjoda-time-java_$VERSION.orig.tar.xz
DIR=joda-time-$VERSION
# clean up the upstream tarball
tar zxvf $3
rm $3
XZ_OPT=--best tar -cJf $TAR --exclude '*.jar' $DIR
rm -rf $DIR
# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
. .svn/deb-layout
mv $TAR $origDir && echo "moved $TAR to $origDir"
fi
......@@ -7,6 +7,3 @@ export JAVA_HOME := /usr/lib/jvm/default-java
override_dh_installchangelogs:
dh_installchangelogs RELEASE-NOTES.txt
get-orig-source:
uscan --download-current-version --force-download --no-symlink
version=3
https://github.com/JodaOrg/joda-time/releases \
/JodaOrg/joda-time/archive/v([0-9].+)\.tar\.gz debian debian/orig-tar.sh
version=4
opts="repack,compression=xz" \
https://github.com/JodaOrg/joda-time/tags .*/archive/v([0-9].+)\.tar\.gz
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!-- Build does not work on Java 9 or later as Java 5 is not a valid target -->
<modelVersion>4.0.0</modelVersion>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<packaging>jar</packaging>
<name>Joda-Time</name>
<version>2.9.9</version>
<version>2.10</version>
<description>Date and time library to replace JDK date handling</description>
<url>http://www.joda.org/joda-time/</url>
......@@ -19,14 +18,6 @@
<url>https://github.com/JodaOrg/joda-time/issues</url>
</issueManagement>
<inceptionYear>2002</inceptionYear>
<mailingLists>
<mailingList>
<name>Joda Interest list</name>
<subscribe>https://lists.sourceforge.net/lists/listinfo/joda-interest</subscribe>
<unsubscribe>https://lists.sourceforge.net/lists/listinfo/joda-interest</unsubscribe>
<archive>http://sourceforge.net/mailarchive/forum.php?forum_name=joda-interest</archive>
</mailingList>
</mailingLists>
<!-- ==================================================================== -->
<developers>
......@@ -61,6 +52,10 @@
<contributor>
<name>Guy Allard</name>
</contributor>
<contributor>
<name>Mikey Austin</name>
<url>https://github.com/mikey-austin</url>
</contributor>
<contributor>
<name>Oren Benjamin</name>
<url>https://github.com/oby1</url>
......@@ -104,6 +99,10 @@
<name>emopers</name>
<url>https://github.com/emopers</url>
</contributor>
<contributor>
<name>Michael Ernst</name>
<url>https://github.com/mernst</url>
</contributor>
<contributor>
<name>Jeroen van Erp</name>
</contributor>
......@@ -128,6 +127,10 @@
<name>haguenau</name>
<url>https://github.com/haguenau</url>
</contributor>
<contributor>
<name>Michael Hausegger</name>
<url>https://github.com/TheRealHaui</url>
</contributor>
<contributor>
<name>Kaj Hejer</name>
<url>https://github.com/kajh</url>
......@@ -155,6 +158,10 @@
<contributor>
<name>Ashish Katyal</name>
</contributor>
<contributor>
<name>Kurt Alfred Kluever</name>
<url>https://github.com/kluever</url>
</contributor>
<contributor>
<name>Martin Kneissl</name>
<url>https://github.com/mkneissl</url>
......@@ -235,9 +242,17 @@
<contributor>
<name>Ryan Propper</name>
</contributor>
<contributor>
<name>Zhanbolat Raimbekov</name>
<url>https://github.com/janbolat</url>
</contributor>
<contributor>
<name>Mike Schrag</name>
</contributor>
<contributor>
<name>Albert Scotto</name>
<url>https://github.com/alb-i986</url>
</contributor>
<contributor>
<name>Hajime Senuma</name>
<url>https://github.com/hajimes</url>
......@@ -296,6 +311,7 @@
<connection>scm:git:https://github.com/JodaOrg/joda-time.git</connection>
<developerConnection>scm:git:git@github.com:JodaOrg/joda-time.git</developerConnection>
<url>https://github.com/JodaOrg/joda-time</url>
<tag>HEAD</tag>
</scm>
<organization>
<name>Joda.org</name>
......@@ -322,6 +338,27 @@
</resources>
<!-- define build -->
<plugins>
<!-- Enforce Maven 3.5.0 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.5.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!-- Compile TZDB -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
......@@ -364,6 +401,7 @@
</arguments>
</configuration>
</plugin>
<!-- Setup testing -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
......@@ -374,6 +412,7 @@
<!--argLine>-Djava.security.manager -Djava.security.policy=${basedir}/src/test/resources/java.policy</argLine-->
</configuration>
</plugin>
<!-- Setup Jar file manifest entries -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
......@@ -386,6 +425,7 @@
<manifestEntries>
<Time-Zone-Database-Version>${tz.database.version}</Time-Zone-Database-Version>
<Implementation-Title>org.joda.time</Implementation-Title>
<Automatic-Module-Name>org.joda.time</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
......@@ -419,6 +459,7 @@
</archive>
</configuration>
</plugin>
<!-- Setup Javadoc jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
......@@ -444,6 +485,7 @@
</execution>
</executions>
</plugin>
<!-- Setup source jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
......@@ -477,6 +519,7 @@
</excludes>
</configuration>
</plugin>
<!-- Setup site with reflow maven skin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
......@@ -496,7 +539,8 @@
</dependency>
</dependencies>
</plugin>
<plugin><!-- invoke with mvn site-deploy -->
<!-- Setup to deploy site to GitHub, invoked with mvn site-deploy -->
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
......@@ -519,6 +563,7 @@
<branch>refs/heads/master</branch>
</configuration>
</plugin>
<!-- Compatibility check -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
......@@ -569,6 +614,11 @@
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
......@@ -644,6 +694,18 @@
<artifactId>maven-toolchains-plugin</artifactId>
<version>${maven-toolchains-plugin.version}</version>
</plugin>
<!-- Setup release -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
<arguments>-Doss.repo</arguments>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>v@{project.version}</tagNameFormat>
<localCheckout>true</localCheckout>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
......@@ -669,7 +731,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
......@@ -681,9 +743,6 @@
</build>
<!-- ==================================================================== -->
<prerequisites>
<maven>3.0.4</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.joda</groupId>
......@@ -703,6 +762,7 @@
<!-- ==================================================================== -->
<reporting>
<plugins>
<!-- Setup standard project info reports -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
......@@ -714,7 +774,6 @@
<report>dependency-info</report>
<report>issue-tracking</report>
<report>license</report>
<report>mailing-list</report>
<report>project-team</report>
<report>scm</report>
<report>summary</report>
......@@ -722,6 +781,7 @@
</reportSet>
</reportSets>
</plugin>
<!-- Setup Javadoc report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
......@@ -734,6 +794,7 @@
</reportSet>
</reportSets>
</plugin>
<!-- Setup Surefire report -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
......@@ -742,6 +803,7 @@
<showSuccess>true</showSuccess>
</configuration>
</plugin>
<!-- Setup changes (release notes) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
......@@ -777,46 +839,38 @@
<!-- ==================================================================== -->
<profiles>
<!-- Need earlier surefire plugin for Java 5 support -->
<profile>
<id>java5to7</id>
<activation>
<jdk>[1.5,1.8]</jdk>
</activation>
<properties>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
</properties>
</profile>
<!-- Add doclint -->
<profile>
<id>java8</id>
<id>java8plus</id>
<activation>
<jdk>1.8</jdk>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
</profile>
<!-- Base deployment profile, activated by -Doss.repo -->
<!-- Release should be performed using a Java 8 JVM -->
<profile>
<id>repo-sign-artifacts</id>
<activation>
<property>
<name>oss.repo</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<!-- Use Java 5 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>1.5</version>
<vendor>sun</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
<!-- Sign artifacts -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......@@ -882,10 +936,23 @@
</execution>
</executions>
</plugin>
<!-- Use nexus plugin to directly release -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<serverId>sonatype-joda-staging</serverId>
<description>Releasing ${project.groupId}:${project.artifactId}:${project.version}</description>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<additionalparam></additionalparam>
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
</properties>
</profile>
<profile>
......@@ -929,28 +996,31 @@
<properties>
<!-- Plugin version numbers -->
<build-helper-maven-plugin.version>1.12</build-helper-maven-plugin.version>
<maven-assembly-plugin.version>2.5.5</maven-assembly-plugin.version>
<maven-changes-plugin.version>2.11</maven-changes-plugin.version>
<maven-checkstyle-plugin.version>2.16</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>2.6.1</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
<maven-assembly-plugin.version>3.1.0</maven-assembly-plugin.version>
<maven-changes-plugin.version>2.12.1</maven-changes-plugin.version>
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
<maven-dependency-plugin.version>3.0.2</maven-dependency-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
<maven-javadoc-plugin.version>2.10.3</maven-javadoc-plugin.version>
<maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
<maven-jxr-plugin.version>2.5</maven-jxr-plugin.version>
<maven-plugin-plugin.version>3.4</maven-plugin-plugin.version>
<maven-pmd-plugin.version>3.5</maven-pmd-plugin.version>
<maven-project-info-reports-plugin.version>2.8</maven-project-info-reports-plugin.version>
<maven-plugin-plugin.version>3.5.1</maven-plugin-plugin.version>
<maven-pmd-plugin.version>3.9.0</maven-pmd-plugin.version>
<maven-project-info-reports-plugin.version>2.9</maven-project-info-reports-plugin.version>
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
<maven-repository-plugin.version>2.4</maven-repository-plugin.version>
<maven-resources-plugin.version>2.7</maven-resources-plugin.version>
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
<!-- v3.6 doesn't work with theme -->
<maven-site-plugin.version>3.4</maven-site-plugin.version>
<maven-source-plugin.version>2.4</maven-source-plugin.version>
<maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version>
<maven-surefire-report-plugin.version>2.18.1</maven-surefire-report-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
<maven-surefire-report-plugin.version>2.21.0</maven-surefire-report-plugin.version>
<maven-toolchains-plugin.version>1.1</maven-toolchains-plugin.version>
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
<!-- Properties for maven-compiler-plugin -->
<maven.compiler.compilerVersion>1.5</maven.compiler.compilerVersion>
<maven.compiler.source>1.5</maven.compiler.source>
......@@ -964,10 +1034,11 @@
<author>false</author>
<notimestamp>true</notimestamp>
<!-- Properties for maven-checkstyle-plugin -->
<checkstyle.config.location>${project.basedir}/src/main/checkstyle/checkstyle.xml</checkstyle.config.location>
<checkstyle.config.location>src/main/checkstyle/checkstyle.xml</checkstyle.config.location>
<linkXRef>false</linkXRef>
<!-- Other properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<tz.database.version>2017b</tz.database.version>
<tz.database.version>2018e</tz.database.version>
</properties>
</project>
......@@ -8,6 +8,50 @@
<body>
<!-- types are add, fix, remove, update -->
<release version="2.10" date="2018-05-30" description="v2.10">
<action dev="jodastephen" type="update">
DateTimeZone data updated to version 2018e.
</action>
<action dev="jodastephen" type="add">
Handle negative SAVE values in tzdb.
Once again, tzdb is the source of problems, with their inability to provide stability.
A hack has been added that reverses their latest decision to have negative SAVE values.
The hack works so long as a rule set does not mix positive and negative save values.
</action>
<action dev="jodastephen" type="add">
Add Instant.EPOCH.
See #472.
</action>
<action dev="jodastephen" type="add">
Clarify negative durations.
See #465.
</action>
<action dev="kluever" type="add">
Add Instant.ofEpochMilli(). Add Instant.ofEpochSecond().
Fixes #458.
</action>
<action dev="jodastephen" type="add">
Add automatic module name for Java SE 9.
</action>
<action dev="jodastephen" type="add">
Add Kazakh language translations.
Fixes #446
</action>
<action dev="jodastephen" type="fix">
Avoid double addition when using lenient chronology.
Fixes #432.
</action>
<action dev="jodastephen" type="fix">
Clarify Period.fieldDifference() Javadoc.
</action>
<action dev="jodastephen" type="fix">
Clarify Instant.withMillis() Javadoc.
Fixes jodaorg.github.io#5
</action>
<action dev="mikey-austin" type="update">
Add ZoneInfoProvider() constructor.
</action>
</release>
<release version="2.9.9" date="2017-03-23" description="v2.9.9">
<action dev="jodastephen" type="update">
Optimise release process.
......
......@@ -2,22 +2,22 @@ Package: org.joda.time
Extension-Name: joda-time
Specification-Title: Joda-Time
Specification-Vendor: Joda.org
Specification-Version: 2.9
Specification-Version: 2.10
Implementation-Vendor: Joda.org
Implementation-Title: org.joda.time
Implementation-Version: 2.9.9
Implementation-Version: 2.10
Implementation-Vendor-Id: org.joda
Bundle-ManifestVersion: 2
Bundle-Vendor: Joda.org
Bundle-Name: Joda-Time
Bundle-SymbolicName: joda-time
Bundle-Version: 2.9.9
Export-Package: org.joda.time;version=2.9.9,
org.joda.time.base;version=2.9.9,
org.joda.time.chrono;version=2.9.9,
org.joda.time.convert;version=2.9.9,
org.joda.time.field;version=2.9.9,
org.joda.time.format;version=2.9.9,
org.joda.time.tz;version=2.9.9
Bundle-Version: 2.10
Export-Package: org.joda.time;version=2.10,
org.joda.time.base;version=2.10,
org.joda.time.chrono;version=2.10,
org.joda.time.convert;version=2.10,
org.joda.time.field;version=2.10,
org.joda.time.format;version=2.10,
org.joda.time.tz;version=2.10
Bundle-License: Apache 2.0
Bundle-DocURL: http://www.joda.org/joda-time/
......@@ -127,6 +127,11 @@ public abstract class DateTimeZone implements Serializable {
*/
private static final AtomicReference<DateTimeZone> cDefault =
new AtomicReference<DateTimeZone>();
/**
* The default TZ data path
* This is the default classpath location containing the compiled data files.
*/
public static final String DEFAULT_TZ_DATA_PATH = "org/joda/time/tz/data";
//-----------------------------------------------------------------------
/**
......@@ -504,7 +509,12 @@ public abstract class DateTimeZone implements Serializable {
String providerClass = System.getProperty("org.joda.time.DateTimeZone.Provider");
if (providerClass != null) {
try {
Provider provider = (Provider) Class.forName(providerClass).newInstance();
// do not initialize the class until the type has been checked
Class<?> cls = Class.forName(providerClass, false, DateTimeZone.class.getClassLoader());
if (!Provider.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("System property referred to class that does not implement " + Provider.class);
}
Provider provider = cls.asSubclass(Provider.class).getConstructor().newInstance();
return validateProvider(provider);
} catch (Exception ex) {
throw new RuntimeException(ex);
......@@ -529,7 +539,7 @@ public abstract class DateTimeZone implements Serializable {
}
// approach 3
try {
Provider provider = new ZoneInfoProvider("org/joda/time/tz/data");
Provider provider = new ZoneInfoProvider(DEFAULT_TZ_DATA_PATH);
return validateProvider(provider);
} catch (Exception ex) {
ex.printStackTrace();
......@@ -593,7 +603,12 @@ public abstract class DateTimeZone implements Serializable {
String providerClass = System.getProperty("org.joda.time.DateTimeZone.NameProvider");
if (providerClass != null) {
try {
nameProvider = (NameProvider) Class.forName(providerClass).newInstance();
// do not initialize the class until the type has been checked
Class<?> cls = Class.forName(providerClass, false, DateTimeZone.class.getClassLoader());
if (!NameProvider.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException("System property referred to class that does not implement " + NameProvider.class);
}
nameProvider = cls.asSubclass(NameProvider.class).getConstructor().newInstance();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
......
......@@ -537,4 +537,19 @@ public final class Duration
return new Duration(-getMillis());
}
/**
* Returns a duration that has a positive or zero number of milliseconds.
* <p>
* This instance is immutable and is not altered.
*
* @return the absolute duration instance
* @since 2.10
*/
public Duration abs() {
if (getMillis() < 0) {
return negated();
}
return this;
}
}
......@@ -22,6 +22,7 @@ import org.joda.time.base.AbstractInstant;
import org.joda.time.chrono.ISOChronology;
import org.joda.time.convert.ConverterManager;
import org.joda.time.convert.InstantConverter;
import org.joda.time.field.FieldUtils;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
......@@ -56,6 +57,12 @@ public final class Instant
extends AbstractInstant
implements ReadableInstant, Serializable {
/**
* The Java epoch of 1970-01-01T00:00:00Z.
* @since 2.10
*/
public static final Instant EPOCH = new Instant(0L);
/** Serialization lock */
private static final long serialVersionUID = 3299096530934209741L;
......@@ -73,9 +80,30 @@ public final class Instant
return new Instant();
}
/**
* Obtains an {@code Instant} set to the milliseconds from 1970-01-01T00:00:00Z.
*
* @param epochMilli the milliseconds from 1970-01-01T00:00:00Z
* @since 2.10
*/
public static Instant ofEpochMilli(long epochMilli) {
return new Instant(epochMilli);
}
/**
* Obtains an {@code Instant} set to the seconds from 1970-01-01T00:00:00Z.
*
* @param epochSecond the seconds from 1970-01-01T00:00:00Z
* @throws ArithmeticException if the new instant exceeds the capacity of a long
* @since 2.10
*/
public static Instant ofEpochSecond(long epochSecond) {
return new Instant(FieldUtils.safeMultiply(epochSecond, 1000));
}
//-----------------------------------------------------------------------
/**
* Parses a {@code Instant} from the specified string.
* Parses an {@code Instant} from the specified string.
* <p>
* This uses {@link ISODateTimeFormat#dateTimeParser()}.
*
......@@ -88,7 +116,7 @@ public final class Instant
}
/**
* Parses a {@code Instant} from the specified string using a formatter.
* Parses an {@code Instant} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
......@@ -149,6 +177,10 @@ public final class Instant
* Gets a copy of this instant with different millis.
* <p>
* The returned object will be either be a new Instant or <code>this</code>.
* <p>
* Note that this replaces the entire state of the <code>Instant</code>.
* To manage the sub-second part of the instant, use {@link #toDateTime()}
* and {@link DateTime#withMillisOfSecond(int)}.
*
* @param newMillis the new millis, from 1970-01-01T00:00:00Z
* @return a copy of this instant with different millis
......
......@@ -58,7 +58,7 @@ public final class Interval
//-----------------------------------------------------------------------
/**
* Parses a {@code Interval} from the specified string.
* Parses an {@code Interval} from the specified string.
* <p>
* The String formats are described by {@link ISODateTimeFormat#dateTimeParser()}
* and {@link ISOPeriodFormat#standard()}, and may be 'datetime/datetime',
......@@ -76,7 +76,7 @@ public final class Interval
}
/**
* Parses a {@code Interval} from the specified string, using any offset it contains.
* Parses an {@code Interval} from the specified string, using any offset it contains.
* <p>
* The String formats are described by
* {@link ISODateTimeFormat#dateTimeParser()}{@code .withOffsetParsed()}
......
......@@ -238,7 +238,7 @@ public final class Period
* <p>
* Calculation by field difference works by extracting the difference
* one field at a time and not wrapping into other fields.
* Thus 2005-06-09/2007-04-12 will yield P1Y-2M3D.
* Thus 2005-06-09/2007-04-12 will yield P2Y-2M3D.
* <p>
* For example, you have an event that always runs from the 27th of
* each month to the 2nd of the next month. If you calculate this
......
......@@ -82,7 +82,10 @@ public abstract class AbstractDuration implements ReadableDuration {
//-----------------------------------------------------------------------
/**
* Compares this duration with the specified duration based on length.
* Compares this duration with the specified duration based on length and direction.
* <p>
* The comparison takes into account the sign.
* As such, a duration of 5 seconds is longer than a duration of <i>minus</i> 7 seconds.
*
* @param other a duration to check against
* @return negative value if this is less, 0 if equal, or positive value if greater
......@@ -105,6 +108,9 @@ public abstract class AbstractDuration implements ReadableDuration {
/**
* Is the length of this duration equal to the duration passed in.
* <p>
* The comparison takes into account the sign.
* As such, a duration of 5 seconds is not equal to a duration of <i>minus</i> 5 seconds.
*
* @param duration another duration to compare to, null means zero milliseconds
* @return true if this duration is equal to than the duration passed in
......@@ -118,6 +124,9 @@ public abstract class AbstractDuration implements ReadableDuration {
/**
* Is the length of this duration longer than the duration passed in.
* <p>
* The comparison takes into account the sign.
* As such, a duration of 5 seconds is longer than a duration of <i>minus</i> 7 seconds.
*
* @param duration another duration to compare to, null means zero milliseconds
* @return true if this duration is strictly longer than the duration passed in
......@@ -131,6 +140,9 @@ public abstract class AbstractDuration implements ReadableDuration {
/**
* Is the length of this duration shorter than the duration passed in.
* <p>
* The comparison takes into account the sign.
* As such, a duration of <i>minus</i> 5 seconds is shorter than a duration of 3 seconds.
*
* @param duration another duration to compare to, null means zero milliseconds
* @return true if this duration is strictly shorter than the duration passed in
......@@ -146,6 +158,9 @@ public abstract class AbstractDuration implements ReadableDuration {
/**
* Compares this object with the specified object for equality based
* on the millisecond length. All ReadableDuration instances are accepted.
* <p>
* The comparison takes into account the sign.
* As such, a duration of 5 seconds is not equal to a duration of <i>minus</i> 5 seconds.
*
* @param duration a readable duration to check against
* @return true if the length of the duration is equal
......