1/* Licensed to the Apache Software Foundation (ASF) under one or more 2 * contributor license agreements. See the NOTICE file distributed with 3 * this work for additional information regarding copyright ownership. 4 * The ASF licenses this file to You under the Apache License, Version 2.0 5 * (the "License"); you may not use this file except in compliance with 6 * the License. You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package java.util; 18 19/** 20 * A {@code MissingFormatArgumentException} will be thrown if there is no 21 * corresponding argument with the specified conversion or an argument index 22 * that refers to a missing argument. 23 * 24 * @see java.lang.RuntimeException 25 */ 26public class MissingFormatArgumentException extends IllegalFormatException { 27 private static final long serialVersionUID = 19190115L; 28 29 private final String s; 30 31 /** 32 * Constructs a new {@code MissingFormatArgumentException} with the 33 * specified conversion that lacks the argument. 34 * 35 * @param s 36 * the specified conversion that lacks the argument. 37 */ 38 public MissingFormatArgumentException(String s) { 39 if (s == null) { 40 throw new NullPointerException("s == null"); 41 } 42 this.s = s; 43 } 44 45 /** 46 * Returns the conversion associated with the exception. 47 * 48 * @return the conversion associated with the exception. 49 */ 50 public String getFormatSpecifier() { 51 return s; 52 } 53 54 @Override 55 public String getMessage() { 56 return "Format specifier: " + s; 57 } 58} 59