44 */
45 public static class BadArgs extends Exception
46 {
47 /**
48 * Create a Fault.
49 * @param i18n A resource bundle in which to find the detail message.
50 * @param s The key for the detail message.
51 */
52 public BadArgs(ResourceBundle i18n, String s) {
53 super(i18n.getString(s));
54 }
55
56 /**
57 * Create a Fault.
58 * @param i18n A resource bundle in which to find the detail message.
59 * @param s The key for the detail message.
60 * @param o An argument to be formatted with the detail message by
61 * {@link java.text.MessageFormat#format}
62 */
63 public BadArgs(ResourceBundle i18n, String s, Object o) {
64 super(MessageFormat.format(i18n.getString(s), new Object[] {o}));
65 }
66
67 /**
68 * Create a Fault.
69 * @param i18n A resource bundle in which to find the detail message.
70 * @param s The key for the detail message.
71 * @param o An array of arguments to be formatted with the detail message by
72 * {@link java.text.MessageFormat#format}
73 */
74 public BadArgs(ResourceBundle i18n, String s, Object[] o) {
75 super(MessageFormat.format(i18n.getString(s), o));
76 }
77 }
78
79 /**
80 * This exception is to report problems that occur while updating an interview.
81 */
82 public static class Fault extends Exception
83 {
84 /**
85 * Create a Fault.
86 * @param i18n A resource bundle in which to find the detail message.
87 * @param s The key for the detail message.
88 */
89 public Fault(ResourceBundle i18n, String s) {
90 super(i18n.getString(s));
91 }
92
93 /**
94 * Create a Fault.
95 * @param i18n A resource bundle in which to find the detail message.
96 * @param s The key for the detail message.
97 * @param o An argument to be formatted with the detail message by
98 * {@link java.text.MessageFormat#format}
99 */
100 public Fault(ResourceBundle i18n, String s, Object o) {
101 super(MessageFormat.format(i18n.getString(s), new Object[] {o}));
102 }
103
104 /**
105 * Create a Fault.
106 * @param i18n A resource bundle in which to find the detail message.
107 * @param s The key for the detail message.
108 * @param o An array of arguments to be formatted with the detail message by
109 * {@link java.text.MessageFormat#format}
110 */
111 public Fault(ResourceBundle i18n, String s, Object[] o) {
112 super(MessageFormat.format(i18n.getString(s), o));
113 }
114 }
115
116 /**
117 * Write a short description of the command line syntax and options to System.err.
118 */
119 public static void usage() {
120 String prog = System.getProperty("program");
121 if (prog == null)
915 case '\n':
916 out.write("<br>");
917 break;
918 case '<':
919 out.write("<");
920 break;
921 case '>':
922 out.write(">");
923 break;
924 case '&':
925 out.write("&");
926 break;
927 default:
928 out.write(c);
929 }
930 }
931 }
932 }
933
934 private static String formatI18N(String key, Object arg) {
935 return MessageFormat.format(i18n.getString(key), new Object[] { arg });
936 }
937
938 private static String formatI18N(String key, Object[] args) {
939 return MessageFormat.format(i18n.getString(key), args);
940 }
941
942 private void setWriter(Writer o) {
943 if (out instanceof BufferedWriter)
944 out = (BufferedWriter)o;
945 else
946 out = new BufferedWriter(o);
947 }
948
949 private static boolean equal(String s1, String s2) {
950 return (s1 == null ? s2 == null : s1.equals(s2));
951 }
952
953 private Interview interview;
954 private Question[] questions;
955 private BufferedWriter out;
|
44 */
45 public static class BadArgs extends Exception
46 {
47 /**
48 * Create a Fault.
49 * @param i18n A resource bundle in which to find the detail message.
50 * @param s The key for the detail message.
51 */
52 public BadArgs(ResourceBundle i18n, String s) {
53 super(i18n.getString(s));
54 }
55
56 /**
57 * Create a Fault.
58 * @param i18n A resource bundle in which to find the detail message.
59 * @param s The key for the detail message.
60 * @param o An argument to be formatted with the detail message by
61 * {@link java.text.MessageFormat#format}
62 */
63 public BadArgs(ResourceBundle i18n, String s, Object o) {
64 super(MessageFormat.format(i18n.getString(s), o));
65 }
66
67 /**
68 * Create a Fault.
69 * @param i18n A resource bundle in which to find the detail message.
70 * @param s The key for the detail message.
71 * @param o An array of arguments to be formatted with the detail message by
72 * {@link java.text.MessageFormat#format}
73 */
74 public BadArgs(ResourceBundle i18n, String s, Object[] o) {
75 super(MessageFormat.format(i18n.getString(s), o));
76 }
77 }
78
79 /**
80 * This exception is to report problems that occur while updating an interview.
81 */
82 public static class Fault extends Exception
83 {
84 /**
85 * Create a Fault.
86 * @param i18n A resource bundle in which to find the detail message.
87 * @param s The key for the detail message.
88 */
89 public Fault(ResourceBundle i18n, String s) {
90 super(i18n.getString(s));
91 }
92
93 /**
94 * Create a Fault.
95 * @param i18n A resource bundle in which to find the detail message.
96 * @param s The key for the detail message.
97 * @param o An argument to be formatted with the detail message by
98 * {@link java.text.MessageFormat#format}
99 */
100 public Fault(ResourceBundle i18n, String s, Object o) {
101 super(MessageFormat.format(i18n.getString(s), o));
102 }
103
104 /**
105 * Create a Fault.
106 * @param i18n A resource bundle in which to find the detail message.
107 * @param s The key for the detail message.
108 * @param o An array of arguments to be formatted with the detail message by
109 * {@link java.text.MessageFormat#format}
110 */
111 public Fault(ResourceBundle i18n, String s, Object[] o) {
112 super(MessageFormat.format(i18n.getString(s), o));
113 }
114 }
115
116 /**
117 * Write a short description of the command line syntax and options to System.err.
118 */
119 public static void usage() {
120 String prog = System.getProperty("program");
121 if (prog == null)
915 case '\n':
916 out.write("<br>");
917 break;
918 case '<':
919 out.write("<");
920 break;
921 case '>':
922 out.write(">");
923 break;
924 case '&':
925 out.write("&");
926 break;
927 default:
928 out.write(c);
929 }
930 }
931 }
932 }
933
934 private static String formatI18N(String key, Object arg) {
935 return MessageFormat.format(i18n.getString(key), arg);
936 }
937
938 private static String formatI18N(String key, Object[] args) {
939 return MessageFormat.format(i18n.getString(key), args);
940 }
941
942 private void setWriter(Writer o) {
943 if (out instanceof BufferedWriter)
944 out = (BufferedWriter)o;
945 else
946 out = new BufferedWriter(o);
947 }
948
949 private static boolean equal(String s1, String s2) {
950 return (s1 == null ? s2 == null : s1.equals(s2));
951 }
952
953 private Interview interview;
954 private Question[] questions;
955 private BufferedWriter out;
|