diff -Nru axmlrpc-1.8.0/build.gradle axmlrpc-1.8.1/build.gradle --- axmlrpc-1.8.0/build.gradle 2014-10-14 16:57:19.000000000 +0000 +++ axmlrpc-1.8.1/build.gradle 2015-08-07 08:27:05.000000000 +0000 @@ -1,8 +1,12 @@ +plugins { + id "com.jfrog.bintray" version "1.3.1" +} + apply plugin: 'java' apply plugin: 'maven' apply plugin: 'signing' -version = '1.8.0' +version = '1.8.1' group = 'de.timroes' task sourcesJar(type: Jar, dependsOn: classes) { @@ -20,66 +24,27 @@ archives javadocJar } -def sonatypeProps = 'sonatype.properties' - -if(project.hasProperty(sonatypeProps) && new File(project.property(sonatypeProps)).exists()) { - - Properties props = new Properties() - props.load(new FileInputStream(file(project.property(sonatypeProps)))) - - gradle.taskGraph.whenReady { taskGraph -> - if (taskGraph.allTasks.any { it instanceof Sign }) { - allprojects { ext."signing.keyId" = props['signing.keyId'] } - allprojects { ext."signing.secretKeyRingFile" = props['signing.secretKeyRingFile'] } - allprojects { ext."signing.password" = props['signing.password'] } - } - } - - signing { - required { has("release") && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - uploadArchives { - - configuration = configurations.archives - repositories.mavenDeployer { - - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: props['sonatypeRepo']) { - authentication(userName: props['sonatypeUsername'], password: props['sonatypePassword']) - } - - pom.project { - - name rootProject.name - description 'Lightweight Java XML-RPC working also on Android.' - url 'https://github.com/timroes/aXMLRPC' - - scm { - url 'scm:git@github.com:timroes/aXMLRPC.git' - connection 'scm:git@github.com:timroes/aXMLRPC.git' - developerConnection 'scm:git@github.com:timroes/aXMLRPC.git' - } - - licenses { - license { - name 'The MIT License (MIT)' - } - } - - developers { - developer { - id 'timroes' - name 'Tim Roes' - email 'mail@timroes.de' - } - } - - } +repositories { + mavenLocal() + mavenCentral() +} - } - } +dependencies { + testCompile "junit:junit:4.12" +} +bintray { + user = project.properties['bintray.user'] + key = project.properties['bintray.key'] + configurations = ['archives'] + pkg { + repo = 'maven' + name = 'aXMLRPC' + userOrg = project.properties['bintray.user'] + licenses = ['MIT'] + vcsUrl = 'https://github.com/timroes/aXMLRPC.git' + version { + name = project.version + } + } } diff -Nru axmlrpc-1.8.0/debian/changelog axmlrpc-1.8.1/debian/changelog --- axmlrpc-1.8.0/debian/changelog 2015-07-22 21:48:00.000000000 +0000 +++ axmlrpc-1.8.1/debian/changelog 2015-09-15 07:15:18.000000000 +0000 @@ -1,3 +1,11 @@ +axmlrpc (1.8.1-1) unstable; urgency=medium + + * New upstream release + - Refreshed debian/pom.xml + - New build dependency on junit4 + + -- Guillaume Turri Tue, 15 Sep 2015 09:15:03 +0200 + axmlrpc (1.8.0-1) unstable; urgency=medium * Initial release (Closes: #790491) diff -Nru axmlrpc-1.8.0/debian/control axmlrpc-1.8.1/debian/control --- axmlrpc-1.8.0/debian/control 2015-07-22 21:48:00.000000000 +0000 +++ axmlrpc-1.8.1/debian/control 2015-09-15 07:02:10.000000000 +0000 @@ -7,6 +7,7 @@ debhelper (>= 9), default-jdk, default-jdk-doc, + junit4, libmaven-javadoc-plugin-java, maven-debian-helper (>= 1.5) Standards-Version: 3.9.6 diff -Nru axmlrpc-1.8.0/debian/maven.rules axmlrpc-1.8.1/debian/maven.rules --- axmlrpc-1.8.0/debian/maven.rules 2015-07-22 21:54:17.000000000 +0000 +++ axmlrpc-1.8.1/debian/maven.rules 2015-09-15 07:02:10.000000000 +0000 @@ -1,2 +1,3 @@ de.timroes aXMLRPC jar s/.*/debian/ * * +junit junit jar s/4\..*/4.x/ * * diff -Nru axmlrpc-1.8.0/debian/pom.xml axmlrpc-1.8.1/debian/pom.xml --- axmlrpc-1.8.0/debian/pom.xml 2015-07-22 21:48:00.000000000 +0000 +++ axmlrpc-1.8.1/debian/pom.xml 2015-09-15 07:02:10.000000000 +0000 @@ -3,7 +3,7 @@ 4.0.0 de.timroes aXMLRPC - 1.8.0 + 1.8.1 jar @@ -26,9 +26,17 @@ mail@timroes.de + + + junit + junit + 4.12 + test + + scm:git@github.com:timroes/aXMLRPC.git scm:git@github.com:timroes/aXMLRPC.git scm:git@github.com:timroes/aXMLRPC.git - \ No newline at end of file + diff -Nru axmlrpc-1.8.0/README.md axmlrpc-1.8.1/README.md --- axmlrpc-1.8.0/README.md 2014-10-14 16:57:19.000000000 +0000 +++ axmlrpc-1.8.1/README.md 2015-08-07 08:27:05.000000000 +0000 @@ -3,7 +3,7 @@ aXMLRPC is a Java library with a leightweight XML-RPC client. XML-RPC is a specification for making remote procedure calls over the HTTP protocol -in an XML format. The specificationc an be found under http://www.xmlrpc.com/spec. +in an XML format. The specificationc can be found under http://www.xmlrpc.com/spec. The library was developed for the use with Android. Since it has no dependencies to any Android library or any other 3rd-party library, it is fully functional in any @@ -26,16 +26,11 @@ ### Compile it as library -The library itself is a NetBeans project and can be compiled either with NetBeans or -with `ant`. The resulting JAR file can be used as a dependency in your project. If you -use NetBeans you can make a dependency directly to the project. +aXMLRPC uses gradle, so you can build it using -### Use Maven + ./gradlew jar -The library is also a valid Maven project. So you can use Maven to compile it. -If you want to use it as a Maven project in NetBeans, you will have to delete -the `nbproject` folder. Afterwards NetBeans will detect it as a Maven project (NetBeans -restart required). +### Use Maven To use it on your Maven project, add it as a dependency on your pom.xml file: @@ -46,14 +41,8 @@ X.Y.Z ``` - -where X.Y.Z is the current aXMLRPC version and install it on your local Maven -repository (since it's not available on the Maven repositories): - -```console -$ cd /path/to/aXMLRPC/ -$ mvn clean install -``` + +where X.Y.Z is the current aXMLRPC version ### Download the JAR library diff -Nru axmlrpc-1.8.0/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java axmlrpc-1.8.1/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java --- axmlrpc-1.8.0/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java 2014-10-14 16:57:19.000000000 +0000 +++ axmlrpc-1.8.1/src/main/java/de/timroes/axmlrpc/serializer/DateTimeSerializer.java 2015-08-07 08:27:05.000000000 +0000 @@ -1,11 +1,14 @@ package de.timroes.axmlrpc.serializer; +import java.text.SimpleDateFormat; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.w3c.dom.Element; + import de.timroes.axmlrpc.XMLRPCException; import de.timroes.axmlrpc.XMLUtil; import de.timroes.axmlrpc.xmlcreator.XmlElement; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import org.w3c.dom.Element; /** * @@ -15,15 +18,38 @@ private static final String DATETIME_FORMAT = "yyyyMMdd'T'HH:mm:ss"; private static final SimpleDateFormat DATE_FORMATER = new SimpleDateFormat(DATETIME_FORMAT); + private static final Pattern PATTERN_WITHOUT_COLON = Pattern.compile("(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\+\\d{2})(\\d{2})"); + private static final Pattern PATTERN_LEGACY = Pattern.compile("(\\d{4})(\\d{2})(\\d{2}T\\d{2}:\\d{2}:\\d{2})"); + @Override public Object deserialize(Element content) throws XMLRPCException { + return deserialize(XMLUtil.getOnlyTextContent(content.getChildNodes())); + } + + public Object deserialize(String dateStr) throws XMLRPCException { try { - return DATE_FORMATER.parse(XMLUtil.getOnlyTextContent(content.getChildNodes())); - } catch (ParseException ex) { + String value = formatStringIfNeeded(dateStr); + return javax.xml.bind.DatatypeConverter.parseDateTime(value).getTime(); + } catch (Exception ex) { throw new XMLRPCException("Unable to parse given date.", ex); } } + private static String formatStringIfNeeded(String dateStr){ + Matcher matcherWithoutColon = PATTERN_WITHOUT_COLON.matcher(dateStr); + if ( matcherWithoutColon.matches() ){ + return matcherWithoutColon.group(1) + ":" + matcherWithoutColon.group(2); + } + + Matcher matcherLegacy = PATTERN_LEGACY.matcher(dateStr); + if ( matcherLegacy.matches() ){ + return matcherLegacy.group(1) + "-" + matcherLegacy.group(2) + "-" + matcherLegacy.group(3); + } + + return dateStr; + } + + @Override public XmlElement serialize(Object object) { return XMLUtil.makeXmlTag(SerializerHandler.TYPE_DATETIME, DATE_FORMATER.format(object)); diff -Nru axmlrpc-1.8.0/src/test/java/de/timroes/axmlrpc/serializer/TestDateTimeSerializer.java axmlrpc-1.8.1/src/test/java/de/timroes/axmlrpc/serializer/TestDateTimeSerializer.java --- axmlrpc-1.8.0/src/test/java/de/timroes/axmlrpc/serializer/TestDateTimeSerializer.java 1970-01-01 00:00:00.000000000 +0000 +++ axmlrpc-1.8.1/src/test/java/de/timroes/axmlrpc/serializer/TestDateTimeSerializer.java 2015-08-07 08:27:05.000000000 +0000 @@ -0,0 +1,33 @@ +package de.timroes.axmlrpc.serializer; + +import static org.junit.Assert.*; + +import java.util.Date; + +public class TestDateTimeSerializer { + private static final Date EXPECTED_DATE = new Date(85, 2, 4, 12, 13, 14); + + @org.junit.Test + public void canParseLegacyDates() throws Exception { + Date date = (Date) new DateTimeSerializer().deserialize("19850304T12:13:14"); + assertDatesCloseEnough(EXPECTED_DATE, date); + } + + @org.junit.Test + public void canParseDateWithoutSemiColon() throws Exception { + Date date = (Date) new DateTimeSerializer().deserialize("1985-03-04T12:13:14+0100"); + assertDatesCloseEnough(EXPECTED_DATE, date); + } + + @org.junit.Test + public void canParseDateWithSemiColon() throws Exception { + Date date = (Date) new DateTimeSerializer().deserialize("1985-03-04T12:13:14+01:00"); + assertDatesCloseEnough(EXPECTED_DATE, date); + } + + //Because I don't want the tests to fail if the user isn't in my timezone + private void assertDatesCloseEnough(Date expected, Date actual){ + long differenceInMs = Math.abs(expected.getTime() - actual.getTime()); + assertTrue(differenceInMs < 24 * 60 * 60 * 1000); + } +}