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 * An {@code IllegalFormatWidthException} will be thrown if the width is a 21 * negative value other than -1 or in other cases where a width is not 22 * supported. 23 * 24 * @see java.lang.RuntimeException 25 */ 26public class IllegalFormatWidthException extends IllegalFormatException { 27 28 private static final long serialVersionUID = 16660902L; 29 30 private final int w; 31 32 /** 33 * Constructs a new {@code IllegalFormatWidthException} with specified 34 * width. 35 * 36 * @param w 37 * the width. 38 */ 39 public IllegalFormatWidthException(int w) { 40 this.w = w; 41 } 42 43 /** 44 * Returns the width associated with the exception. 45 * 46 * @return the width. 47 */ 48 public int getWidth() { 49 return w; 50 } 51 52 @Override 53 public String getMessage() { 54 return Integer.toString(w); 55 } 56} 57