NTLMException.java revision 12745:f068a4ffddd2
1/* 2 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package com.sun.security.ntlm; 27 28import java.security.GeneralSecurityException; 29 30/** 31 * An NTLM-related Exception 32 */ 33public final class NTLMException extends GeneralSecurityException { 34 private static final long serialVersionUID = -3298539507906689430L; 35 36 /** 37 * If the incoming packet is invalid. 38 */ 39 public static final int PACKET_READ_ERROR = 1; 40 41 /** 42 * If the client cannot get a domain value from the server and the 43 * caller has not provided one. 44 */ 45 public static final int NO_DOMAIN_INFO = 2; 46 47 /** 48 * If the domain provided by the client does not match the one received 49 * from server. 50 */ 51 //public final static int DOMAIN_UNMATCH = 3; 52 53 /** 54 * If the client name is not found on server's user database. 55 */ 56 public static final int USER_UNKNOWN = 3; 57 58 /** 59 * If authentication fails. 60 */ 61 public static final int AUTH_FAILED = 4; 62 63 /** 64 * If an illegal version string is provided. 65 */ 66 public static final int BAD_VERSION = 5; 67 68 /** 69 * Protocol errors. 70 */ 71 public static final int PROTOCOL = 6; 72 73 private int errorCode; 74 75 /** 76 * Constructs an NTLMException object. 77 * @param errorCode the error code, which can be retrieved by 78 * the {@link #errorCode() } method. 79 * @param msg the string message, which can be retrived by 80 * the {@link Exception#getMessage() } method. 81 */ 82 public NTLMException(int errorCode, String msg) { 83 super(msg); 84 this.errorCode = errorCode; 85 } 86 87 /** 88 * Returns the error code associated with this NTLMException. 89 * @return the error code 90 */ 91 public int errorCode() { 92 return errorCode; 93 } 94} 95