[Spacewalk-devel] Java 6 required?
Hi, We tested a build today and a testcase I added some days ago in our tree (to be upstreamed) failed. It was because 2 scenarios: - a SUSE Manager 1.7 build that was updated to 2.1 and therefore the old jvm stayed on 1.6 - a Docker container with an outdated description, using 1.6 from the beginning. I realized that in FormatDateTag I used: private static final String ISO_FORMAT = -MM-dd'T'HH:mm:ssXXX; private final DateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); the X pattern is new in Java 7. To make it Java 6 compatible it would need to be done something like (untested, but an elegant solution from a SO user) private static final String ISO_FORMAT = -MM-dd'T'HH:mm:ssZ; private final DateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT) { public Date parse(String source, ParsePosition pos) { return super.parse(source.replaceFirst(:(?=[0-9]{2}$),),pos); } }; The question is wether we need to backport it. At least for us, we are using Java 7 already, but I am not sure what Spacewalk wants to support. I am not a fan of legacy code just in case someone runs it on an old platform (openssl cough cough), then the backport belongs in that git branch, but in the case there is no need to support Java 6, spacewalk-java.spec needs to be updated. -- Duncan Mac-Vicar P. - http://www.suse.com/ SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5, 90409 Nürnberg, Germany ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] Java 6 required?
On 05/20/2014 08:43 AM, Duncan Mac-Vicar P. wrote: Hi, We tested a build today and a testcase I added some days ago in our tree (to be upstreamed) failed. It was because 2 scenarios: - a SUSE Manager 1.7 build that was updated to 2.1 and therefore the old jvm stayed on 1.6 - a Docker container with an outdated description, using 1.6 from the beginning. I realized that in FormatDateTag I used: private static final String ISO_FORMAT = -MM-dd'T'HH:mm:ssXXX; private final DateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); the X pattern is new in Java 7. To make it Java 6 compatible it would need to be done something like (untested, but an elegant solution from a SO user) private static final String ISO_FORMAT = -MM-dd'T'HH:mm:ssZ; private final DateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT) { public Date parse(String source, ParsePosition pos) { return super.parse(source.replaceFirst(:(?=[0-9]{2}$),),pos); } }; The question is wether we need to backport it. At least for us, we are using Java 7 already, but I am not sure what Spacewalk wants to support. I am not a fan of legacy code just in case someone runs it on an old platform (openssl cough cough), then the backport belongs in that git branch, but in the case there is no need to support Java 6, spacewalk-java.spec needs to be updated. Hi Duncan, Spacewalk has to support Java 6 for older operating systems like RHEL 5 and 6, so a backport would be appreciated. -Stephen ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel