diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java b/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java index 5e0bd122..f6ccb2b4 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/JAXBWriter.java @@ -42,6 +42,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; +import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -175,4 +176,12 @@ public class JAXBWriter { c.setTime(date); return datatypeFactory.newXMLGregorianCalendar(c).normalize(); } + + public XMLGregorianCalendar convertCalendar(Calendar calendar) { + if (calendar == null) { + return null; + } + + return datatypeFactory.newXMLGregorianCalendar((GregorianCalendar)calendar).normalize(); + } } diff --git a/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java b/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java index cde759ee..daddb4ce 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java +++ b/airsonic-main/src/main/java/org/airsonic/player/controller/SubsonicRESTController.java @@ -53,6 +53,7 @@ import org.subsonic.restapi.PodcastStatus; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; +import javax.xml.datatype.XMLGregorianCalendar; import java.util.*; @@ -164,13 +165,13 @@ public class SubsonicRESTController { request = wrapRequest(request); License license = new License(); - license.setEmail("airsonic@github.com"); license.setValid(true); - Date farFuture = new Date(); - farFuture.setYear(farFuture.getYear() + 100); - license.setLicenseExpires(jaxbWriter.convertDate(farFuture)); - license.setTrialExpires(jaxbWriter.convertDate(farFuture)); + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.YEAR, 100); + XMLGregorianCalendar farFuture = jaxbWriter.convertCalendar(calendar); + license.setLicenseExpires(farFuture); + license.setTrialExpires(farFuture); Response res = createResponse(); res.setLicense(license);