You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2022/08/18 14:28:08 UTC

[sling-org-apache-sling-testing-resourceresolver-mock] branch master updated: SLING-11294 remove unused DateUtils class (leftover from switching to newer Sling API)

This is an automated email from the ASF dual-hosted git repository.

sseifert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-resourceresolver-mock.git


The following commit(s) were added to refs/heads/master by this push:
     new 6833f66  SLING-11294 remove unused DateUtils class (leftover from switching to newer Sling API)
6833f66 is described below

commit 6833f666814f1ab4dd331795aac89b389f4ac063
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Aug 18 16:27:29 2022 +0200

    SLING-11294 remove unused DateUtils class (leftover from switching to newer Sling API)
---
 .../sling/testing/resourceresolver/DateUtils.java  | 99 ----------------------
 1 file changed, 99 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/resourceresolver/DateUtils.java b/src/main/java/org/apache/sling/testing/resourceresolver/DateUtils.java
deleted file mode 100644
index be79c52..0000000
--- a/src/main/java/org/apache/sling/testing/resourceresolver/DateUtils.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.sling.testing.resourceresolver;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.apache.jackrabbit.util.ISO8601;
-
-/**
- * This is copied from org.apache.sling.api.wrappers.impl.DateUtils
- * to avoid dependency to latest Sling API.
- * This can be removed when Sling API 2.17.0 or higher is referenced.
- */
-final class DateUtils {
-
-    private DateUtils() {
-        // static methods only
-    }
-
-    /**
-     * @param date Date value
-     * @return Calendar value or null
-     */
-    public static Calendar toCalendar(Date input) {
-        if (input == null) {
-            return null;
-        }
-        Calendar result = Calendar.getInstance();
-        result.setTime(input);
-        return result;
-    }
-
-    /**
-     * @param calendar Calendar value
-     * @return Date value or null
-     */
-    public static Date toDate(Calendar input) {
-        if (input == null) {
-            return null;
-        }
-        return input.getTime();
-    }
-
-    /**
-     * @param input Date value
-     * @return ISO8601 string representation or null
-     */
-    public static String dateToString(Date input) {
-        return calendarToString(toCalendar(input));
-    }
-
-    /**
-     * @param input Calendar value
-     * @return ISO8601 string representation or null
-     */
-    public static String calendarToString(Calendar input) {
-        if (input == null) {
-            return null;
-        }
-        return ISO8601.format(input);
-    }
-
-    /**
-     * @param input ISO8601 string representation
-     * @return Date value or null
-     */
-    public static Date dateFromString(String input) {
-        return toDate(calendarFromString(input));
-    }
-
-    /**
-     * @param input ISO8601 string representation
-     * @return Calendar value or null
-     */
-    public static Calendar calendarFromString(String input) {
-        if (input == null) {
-            return null;
-        }
-        return ISO8601.parse(input);
-    }
-
-}