From: gotty Date: Wed, 20 Nov 2019 03:01:43 +0000 (+0000) Subject: [LIB-10] Сorrect some site data X-Git-Url: https://git.hedgecode.org/?p=snooker-score-api.git;a=commitdiff_plain;h=70af784f3d0752e97b68f77b34ab9bd4dcd1fb23 [LIB-10] Сorrect some site data git-svn-id: https://svn.hedgecode.org/lib/snooker-score-api/trunk@187 fb0bcced-7025-49ed-a12f-f98bce993226 --- diff --git a/pom.xml b/pom.xml index ba62697..0c671d4 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.hedgecode.maven lib-parent - 2 + 3 ../lib-parent/pom.xml @@ -41,7 +41,32 @@ 2017 - http://lib.hedgecode.org/${project.artifactId}/ + https://lib.hedgecode.org/${project.artifactId}/ + + + + Hedgehog + Hedgecode + https://hedgecode.org/ + + inspirer + + + https://hedgecode.org/img/hedgehog50x50.png + + + + Bundle + Hedgecode + https://hedgecode.org/ + + data storage + + + https://hedgecode.org/img/bundle50x50.png + + + scm:svn:http://svn.hedgecode.org/lib/${project.artifactId}/trunk/ @@ -51,7 +76,7 @@ JIRA - http://issues.hedgecode.org/browse/${issueKey}/component/${issueComponentId} + https://issues.hedgecode.org/browse/${issueKey}/component/${issueComponentId} diff --git a/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java b/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java index aceb36a..69da93b 100644 --- a/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java +++ b/src/main/java/org/hedgecode/snooker/SnookerDateUtils.java @@ -28,28 +28,39 @@ import java.util.TimeZone; */ public final class SnookerDateUtils { + private static SnookerDateUtils _instance; + public static final String DATE_PATTERN = "dd.MM.yyyy"; public static final String TIME_PATTERN = "HH:mm"; - public static final String DATETIME_PATTERN = TIME_PATTERN + " " + DATE_PATTERN; - - private static final TimeZone CTZ = TimeZone.getTimeZone("CET"); - private static final TimeZone LTZ = TimeZone.getDefault(); - - private static final DateFormat DATE_FORMAT = new SimpleDateFormat(DATE_PATTERN); - private static final DateFormat CET_TIME_FORMAT = new SimpleDateFormat(TIME_PATTERN); - private static final DateFormat CET_DATETIME_FORMAT = new SimpleDateFormat(DATETIME_PATTERN); - private static final DateFormat LOCAL_TIME_FORMAT = new SimpleDateFormat(TIME_PATTERN); - private static final DateFormat LOCAL_DATETIME_FORMAT = new SimpleDateFormat(DATETIME_PATTERN); - - static { - CET_TIME_FORMAT.setTimeZone(CTZ); - CET_DATETIME_FORMAT.setTimeZone(CTZ); - LOCAL_TIME_FORMAT.setTimeZone(LTZ); - LOCAL_DATETIME_FORMAT.setTimeZone(LTZ); + public static final String DATETIME_PATTERN = String.format("%s %s", TIME_PATTERN , DATE_PATTERN); + + private static final TimeZone SNOOKER_TIMEZONE = TimeZone.getTimeZone("CET"); + private static final TimeZone LOCAL_TIMEZONE = TimeZone.getDefault(); + + private final DateFormat dateFormat; + private final DateFormat snookerTimeFormat; + private final DateFormat snookerDateTimeFormat; + private final DateFormat localTimeFormat; + private final DateFormat localDateTimeFormat; + + private SnookerDateUtils() { + dateFormat = new SimpleDateFormat(DATE_PATTERN); + + snookerTimeFormat = new SimpleDateFormat(TIME_PATTERN); + snookerTimeFormat.setTimeZone(SNOOKER_TIMEZONE); + + snookerDateTimeFormat = new SimpleDateFormat(DATETIME_PATTERN); + snookerDateTimeFormat.setTimeZone(SNOOKER_TIMEZONE); + + localTimeFormat = new SimpleDateFormat(TIME_PATTERN); + localTimeFormat.setTimeZone(LOCAL_TIMEZONE); + + localDateTimeFormat = new SimpleDateFormat(DATETIME_PATTERN); + localDateTimeFormat.setTimeZone(LOCAL_TIMEZONE); } public static String formatDate(Date date) { - return DATE_FORMAT.format(date); + return getInstance().format(date); } public static String formatTime(Date date) { @@ -57,7 +68,7 @@ public final class SnookerDateUtils { } public static String formatTime(Date date, boolean withDate) { - return withDate ? CET_DATETIME_FORMAT.format(date) : CET_TIME_FORMAT.format(date); + return getInstance().format(date, false, withDate); } public static String formatLocalTime(Date date) { @@ -65,7 +76,28 @@ public final class SnookerDateUtils { } public static String formatLocalTime(Date date, boolean withDate) { - return withDate ? LOCAL_DATETIME_FORMAT.format(date) : LOCAL_TIME_FORMAT.format(date); + return getInstance().format(date, true, withDate); + } + + private String format(Date date) { + return dateFormat.format(date); + } + + private String format(Date date, boolean isLocal, boolean withDate) { + return getDateFormat(isLocal, withDate).format(date); + } + + private DateFormat getDateFormat(boolean isLocal, boolean withDate) { + if (isLocal) { + return withDate ? localDateTimeFormat : localTimeFormat; + } + return withDate ? snookerDateTimeFormat : snookerTimeFormat; + } + + protected static SnookerDateUtils getInstance() { + if (_instance == null) + _instance = new SnookerDateUtils(); + return _instance; } } diff --git a/src/main/java/org/hedgecode/snooker/api/PlayerImage.java b/src/main/java/org/hedgecode/snooker/api/PlayerImage.java index 9a23a93..2b8e0ff 100644 --- a/src/main/java/org/hedgecode/snooker/api/PlayerImage.java +++ b/src/main/java/org/hedgecode/snooker/api/PlayerImage.java @@ -29,8 +29,10 @@ import org.hedgecode.snooker.SnookerURLUtils; */ public class PlayerImage implements Serializable { + private static final long serialVersionUID = -8500007961319779078L; + private URL url; - private BufferedImage image; + private transient BufferedImage image; public PlayerImage(URL imageUrl) { url = imageUrl; diff --git a/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java b/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java index ccce491..5aaedc7 100644 --- a/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java +++ b/src/main/java/org/hedgecode/snooker/cache/CacheSnookerScore.java @@ -65,7 +65,7 @@ public class CacheSnookerScore extends JsonSnookerScore implements SnookerScoreA public static CacheSnookerScore getInstance() { if (_instance == null) - _instance= new CacheSnookerScore(); + _instance = new CacheSnookerScore(); return _instance; } diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index 2104fed..171838b 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -31,7 +31,7 @@ ${project.name} so for the functioning of applications that use this library Internet access is required. The current version of the library: - {{{http://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} + {{{https://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} <>: @@ -59,4 +59,4 @@ ${project.name} Portal {{{http://snooker.org/}Snooker.org}} -[http://snooker.org/img/design/snookerorg_small.png] Snooker.org Logo +[${project.url}images/snooker_org.png] Snooker.org Logo diff --git a/src/site/resources/images/snooker_org.png b/src/site/resources/images/snooker_org.png new file mode 100644 index 0000000..f8f2595 Binary files /dev/null and b/src/site/resources/images/snooker_org.png differ diff --git a/src/site/ru/apt/index.apt.vm b/src/site/ru/apt/index.apt.vm index d728191..828997f 100644 --- a/src/site/ru/apt/index.apt.vm +++ b/src/site/ru/apt/index.apt.vm @@ -33,7 +33,7 @@ ${project.name} поэтому для функционирования приложений, использующих данную библиотеку, необходим доступ в Интернет. Текущая версия библиотеки: - {{{http://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} + {{{https://repo.hedgecode.org/content/repositories/releases/org/hedgecode/snooker/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar}${project.version}}} <<Примечание>>: <Все версии библиотеки до версии 1.0 не могут считаться полностью стабильными.> @@ -61,4 +61,4 @@ ${project.name} Портал {{{http://snooker.org/}Snooker.org}} -[http://snooker.org/img/design/snookerorg_small.png] Snooker.org Logo +[${project.url}images/snooker_org.png] Snooker.org Logo diff --git a/src/site/ru/xdoc/download.xml.vm b/src/site/ru/xdoc/download.xml.vm index 62f7cf8..f7ec094 100644 --- a/src/site/ru/xdoc/download.xml.vm +++ b/src/site/ru/xdoc/download.xml.vm @@ -28,23 +28,23 @@

Текущая стабильная версия ${project.name}: - ${project.artifactId}-${project.version}.jar - и её MD5 сумма. + ${project.artifactId}-${project.version}.jar + и её MD5 сумма.

-

Старые release-версии ${project.artifactId} доступны на странице Hedgecode Release Repository.

-

Старые snapshot-версии ${project.artifactId} доступны на странице Hedgecode Snapshot Repository.

+

Старые release-версии ${project.artifactId} доступны на странице Hedgecode Release Repository.

+

Старые snapshot-версии ${project.artifactId} доступны на странице Hedgecode Snapshot Repository.

Архивы с javadoc и исходными кодами текущей версии библиотеки: - javadoc, - sources. + javadoc, + sources.

-

Исходный код ${project.artifactId} доступен в Hedgecode Subversion Repository.

-

Исходный код ${project.name} распространяется под лицензией Apache License, version 2.0.

+

Исходный код ${project.artifactId} доступен в Hedgecode Subversion Repository.

+

Исходный код ${project.name} распространяется под лицензией Apache License, version 2.0.

diff --git a/src/site/site.xml b/src/site/site.xml index ce7ebeb..c615134 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -31,7 +31,7 @@ - + diff --git a/src/site/site_ru.xml b/src/site/site_ru.xml index f7f47ba..c441b88 100644 --- a/src/site/site_ru.xml +++ b/src/site/site_ru.xml @@ -31,7 +31,7 @@ - + diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 446b0bf..ead216b 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -28,23 +28,23 @@

The current stable version of ${project.name}: - ${project.artifactId}-${project.version}.jar - and its MD5 sum. + ${project.artifactId}-${project.version}.jar + and its MD5 sum.

-

Older releases can be found on ${project.artifactId} page of Hedgecode Release Repository.

-

Older snapshots can be found on ${project.artifactId} page of Hedgecode Snapshot Repository.

+

Older releases can be found on ${project.artifactId} page of Hedgecode Release Repository.

+

Older snapshots can be found on ${project.artifactId} page of Hedgecode Snapshot Repository.

Javadoc and Sources archives of the current version of the library: - javadoc, - sources. + javadoc, + sources.

-

Source code of the ${project.artifactId} can be found on Hedgecode Subversion Repository.

-

${project.name} source code is distributed under the Apache License, version 2.0.

+

Source code of the ${project.artifactId} can be found on Hedgecode Subversion Repository.

+

${project.name} source code is distributed under the Apache License, version 2.0.