Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
JBoss, a division of Red Hat * Copyright 2010, Red Hat Middleware, LLC, and individual * contributors as indicated by the

Authors:
tag. See the * copyright.txt in the distribution for a full listing of * individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. * /
package org.exoplatform.web.security.errorlogin;

Author(s):
Marek Posolda
Version:
$Revision$
    private final String sessionId;
    private final String username;
    private final String hostname;
    private InvalidAttemptKey(String sessionIdString usernameString hostname) {
        this. = sessionId;
        this. = username;
        this. = hostname;
    }
    public static InvalidAttemptKey createKey(InvalidLoginPolicy policyString sessionIdString usernameString hostname) {
        switch (policy) {
            case :
                return new InvalidAttemptKey(sessionIdnullnull);
            case :
                return new InvalidAttemptKey(sessionIdusernamenull);
            case :
                return new InvalidAttemptKey(nullnullhostname);
            default:
                throw new IllegalArgumentException("Non-expected value of InvalidLoginPolicy.");
        }
    }
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof InvalidAttemptKey) {
            InvalidAttemptKey that = (InvalidAttemptKeyobj;
            return Safe.equals(that.sessionId) && Safe.equals(that.username)
                    && Safe.equals(that.hostname);
        }
        return false;
    }
    public int hashCode() {
        int result = 1234567;
        if ( != null) {
            result = .hashCode();
        }
        if ( != null) {
            result = result ^ .hashCode();
        }
        if ( != null) {
            result = result ^ .hashCode();
        }
        return result;
    }
New to GrepCode? Check out our FAQ X