1 /* |
1 /* |
2 * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
25 |
25 |
26 package javax.security.auth.callback; |
26 package javax.security.auth.callback; |
27 |
27 |
28 /** |
28 /** |
29 * <p> Underlying security services instantiate and pass a |
29 * <p> Underlying security services instantiate and pass a |
30 * <code>TextOutputCallback</code> to the <code>handle</code> |
30 * {@code TextOutputCallback} to the {@code handle} |
31 * method of a <code>CallbackHandler</code> to display information messages, |
31 * method of a {@code CallbackHandler} to display information messages, |
32 * warning messages and error messages. |
32 * warning messages and error messages. |
33 * |
33 * |
34 * @see javax.security.auth.callback.CallbackHandler |
34 * @see javax.security.auth.callback.CallbackHandler |
35 */ |
35 */ |
36 public class TextOutputCallback implements Callback, java.io.Serializable { |
36 public class TextOutputCallback implements Callback, java.io.Serializable { |
59 * Construct a TextOutputCallback with a message type and message |
59 * Construct a TextOutputCallback with a message type and message |
60 * to be displayed. |
60 * to be displayed. |
61 * |
61 * |
62 * <p> |
62 * <p> |
63 * |
63 * |
64 * @param messageType the message type (<code>INFORMATION</code>, |
64 * @param messageType the message type ({@code INFORMATION}, |
65 * <code>WARNING</code> or <code>ERROR</code>). <p> |
65 * {@code WARNING} or {@code ERROR}). <p> |
66 * |
66 * |
67 * @param message the message to be displayed. <p> |
67 * @param message the message to be displayed. <p> |
68 * |
68 * |
69 * @exception IllegalArgumentException if <code>messageType</code> |
69 * @exception IllegalArgumentException if {@code messageType} |
70 * is not either <code>INFORMATION</code>, |
70 * is not either {@code INFORMATION}, |
71 * <code>WARNING</code> or <code>ERROR</code>, |
71 * {@code WARNING} or {@code ERROR}, |
72 * if <code>message</code> is null, |
72 * if {@code message} is null, |
73 * or if <code>message</code> has a length of 0. |
73 * or if {@code message} has a length of 0. |
74 */ |
74 */ |
75 public TextOutputCallback(int messageType, String message) { |
75 public TextOutputCallback(int messageType, String message) { |
76 if ((messageType != INFORMATION && |
76 if ((messageType != INFORMATION && |
77 messageType != WARNING && messageType != ERROR) || |
77 messageType != WARNING && messageType != ERROR) || |
78 message == null || message.length() == 0) |
78 message == null || message.length() == 0) |