mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
20.42.2016 61b9eb1be03fc03a9f4bb0013a08ff44a1059503
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TimeOfDay.java
@@ -12,24 +12,20 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2008 Sun Microsystems, Inc.
 * Portions Copyright 2013-2015 ForgeRock AS.
 * Portions Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.authorization.dseecompat;
import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.AccessControlMessages.*;
import org.opends.server.util.TimeThread;
import java.util.regex.Pattern;
/**
 * This class represents the timeofday keyword in a bind rule.
 */
public class TimeOfDay implements KeywordBindRule {
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.util.TimeThread;
    /**
     * Regular expression matching a valid timeofday rule value (0-2359).
     */
    private static final String timeofdayRegex = "[0-2]\\d[0-5]\\d";
/** This class represents the timeofday keyword in a bind rule. */
public class TimeOfDay implements KeywordBindRule {
    /** Regular expression matching a valid timeofday rule value (0-2359). */
    private static final Pattern timeofdayRegex = Pattern.compile("[0-2]\\d[0-5]\\d");
    /** Enumeration representing the bind rule operation type. */
    private EnumBindRuleType type;
@@ -57,7 +53,7 @@
    public static TimeOfDay decode(String expr,  EnumBindRuleType type)
    throws AciException  {
        int valueAsInt = 0;
        if (!Pattern.matches(timeofdayRegex, expr))
        if (!timeofdayRegex.matcher(expr).matches())
        {
            LocalizableMessage message = WARN_ACI_SYNTAX_INVALID_TIMEOFDAY.get(expr);
            throw new AciException(message);
@@ -85,6 +81,7 @@
     * @return  An enumeration result representing the result of the
     * evaluation.
     */
    @Override
    public EnumEvalResult evaluate(AciEvalContext evalCtx) {
        EnumEvalResult matched=EnumEvalResult.FALSE;
@@ -129,7 +126,6 @@
        return matched.getRet(type, false);
    }
    /** {@inheritDoc} */
    @Override
    public String toString()
    {
@@ -138,11 +134,9 @@
        return sb.toString();
    }
    /** {@inheritDoc} */
    @Override
    public final void toString(StringBuilder buffer)
    {
        buffer.append(super.toString());
    }
}