Codebase list libjxmpp-java / 2403af3
Import upstream version 1.0.2 Debian Janitor 1 year, 11 months ago
5 changed file(s) with 28 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
315315 }
316316
317317 dependencies {
318 errorprone 'com.google.errorprone:error_prone_core:2.3.3'
318 errorprone 'com.google.errorprone:error_prone_core:2.3.4'
319319 errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
320320 }
321321 }
104104 int forbiddenCharPos = Arrays.binarySearch(excludedChars, c);
105105 if (forbiddenCharPos >= 0) {
106106 throw new XmppStringprepException(input, parttype.getCapitalizedName() + " must not contain '"
107 + LOCALPART_FURTHER_EXCLUDED_CHARACTERS[forbiddenCharPos] + "'");
107 + excludedChars[forbiddenCharPos] + "'");
108108 }
109109 }
110110 }
00 /**
11 *
2 * Copyright © 2014-2018 Florian Schmaus
2 * Copyright © 2014-2021 Florian Schmaus
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2424 import java.util.Comparator;
2525 import java.util.Date;
2626 import java.util.List;
27 import java.util.Locale;
2728 import java.util.TimeZone;
2829 import java.util.regex.Matcher;
2930 import java.util.regex.Pattern;
5758
5859 private static final TimeZone TIME_ZONE_UTC = TimeZone.getTimeZone("UTC");
5960
61 private static DateFormat constructUtcDateFormat(String format) {
62 DateFormat dateFormat = new SimpleDateFormat(format, Locale.ENGLISH);
63 dateFormat.setTimeZone(TIME_ZONE_UTC);
64 return dateFormat;
65 }
66
6067 private static final ThreadLocal<DateFormat> xep0091Formatter = new ThreadLocal<DateFormat>() {
6168 @Override
6269 protected DateFormat initialValue() {
63 DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
64 dateFormat.setTimeZone(TIME_ZONE_UTC);
70 DateFormat dateFormat = constructUtcDateFormat("yyyyMMdd'T'HH:mm:ss");
6571 return dateFormat;
6672 }
6773 };
6874 private static final ThreadLocal<DateFormat> xep0091Date6DigitFormatter = new ThreadLocal<DateFormat>() {
6975 @Override
7076 protected DateFormat initialValue() {
71 DateFormat dateFormat = new SimpleDateFormat("yyyyMd'T'HH:mm:ss");
72 dateFormat.setTimeZone(TIME_ZONE_UTC);
77 DateFormat dateFormat = constructUtcDateFormat("yyyyMd'T'HH:mm:ss");
7378 return dateFormat;
7479 }
7580 };
7681 private static final ThreadLocal<DateFormat> xep0091Date7Digit1MonthFormatter = new ThreadLocal<DateFormat>() {
7782 @Override
7883 protected DateFormat initialValue() {
79 DateFormat dateFormat = new SimpleDateFormat("yyyyMdd'T'HH:mm:ss");
80 dateFormat.setTimeZone(TIME_ZONE_UTC);
84 DateFormat dateFormat = constructUtcDateFormat("yyyyMdd'T'HH:mm:ss");
8185 dateFormat.setLenient(false);
8286 return dateFormat;
8387 }
8589 private static final ThreadLocal<DateFormat> xep0091Date7Digit2MonthFormatter = new ThreadLocal<DateFormat>() {
8690 @Override
8791 protected DateFormat initialValue() {
88 DateFormat dateFormat = new SimpleDateFormat("yyyyMMd'T'HH:mm:ss");
89 dateFormat.setTimeZone(TIME_ZONE_UTC);
92 DateFormat dateFormat = constructUtcDateFormat("yyyyMMd'T'HH:mm:ss");
9093 dateFormat.setLenient(false);
9194 return dateFormat;
9295 }
124127 FORMATTER = new ThreadLocal<DateFormat>() {
125128 @Override
126129 protected DateFormat initialValue() {
127 DateFormat dateFormat = new SimpleDateFormat(FORMAT_STRING);
128 dateFormat.setTimeZone(TIME_ZONE_UTC);
130 DateFormat dateFormat = constructUtcDateFormat(FORMAT_STRING);
129131 return dateFormat;
130132 }
131133 };
00 /**
11 *
2 * Copyright © 2014-2018 Florian Schmaus
2 * Copyright © 2014-2021 Florian Schmaus
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2020 import java.text.ParseException;
2121 import java.util.Calendar;
2222 import java.util.Date;
23 import java.util.Locale;
2324 import java.util.TimeZone;
2425
2526 import org.junit.Test;
295296 cal.setTimeZone(TimeZone.getTimeZone("GMT"));
296297 assertEquals(3, cal.get(Calendar.SECOND));
297298 }
299
300 @Test
301 public void testArabicLocale() throws ParseException {
302 Locale.setDefault(new Locale("AR"));
303 String initialDateString = "2018-09-22T20:09:42.000+00:00";
304 Date date = XmppDateTime.parseXEP0082Date(initialDateString);
305 String dateString = XmppDateTime.formatXEP0082Date(date);
306 assertEquals(initialDateString, dateString);
307 }
308
298309 }
0 1.0.1
0 1.0.2