Program: 92301
Project: 92301
Buggy source:
/** 
 * Creates a new format to use for parsing and formatting values of the given type. This method is invoked by   {@link #getFormat(Class)} the first time that a formatis needed for the given type. <p>The default implementation creates the following formats:</p> <table class="sis"> <tr><th>Value type</th>     <th>Format</th></tr> <tr><td> {@link Angle}</td>  <td>  {@link AngleFormat}</td></tr> <tr><td>  {@link Date}</td>   <td>  {@link DateFormat}</td></tr> <tr><td>  {@link Number}</td> <td>  {@link NumberFormat}</td></tr> </table> Subclasses can override this method for adding more types, or for configuring the newly created   {@link Format} instances. Note that implementations shall check thetype using the  {@code expected == type} comparator, not<code>expected. {@linkplain Class#isAssignableFrom(Class) isAssignableFrom}(type)</code>, because the check for parent types is done by the   {@link #getFormat(Class)} method.This approach allows subclasses to create specialized formats for different value sub-types. For example a subclass may choose to format  {@link Double} values differentlythan other types of number.
 * @param valueType The base type of values to parse or format.
 * @return The format to use for parsing of formatting values of the given type,or  {@code null} if none.
 */
protected Format createFormat(final Class<?> valueType){
  final Locale locale=getLocale();
  if (Number.class.isAssignableFrom(valueType)) {
    if (Locale.ROOT.equals(locale)) {
      return DefaultFormat.getInstance(valueType);
    }
 else     if (valueType == Number.class) {
      return NumberFormat.getInstance(locale);
    }
  }
 else   if (valueType == Date.class) {
    final DateFormat format;
    if (!Locale.ROOT.equals(locale)) {
      format=DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,locale);
    }
 else {
      format=new SimpleDateFormat("String_Node_Str",Locale.ROOT);
    }
    format.setTimeZone(getTimeZone());
    return format;
  }
 else   if (valueType == Angle.class) {
    final AngleFormat format=AngleFormat.getInstance(locale);
    format.applyPattern("String_Node_Str");
    return format;
  }
 else   if (valueType == Class.class) {
    return ClassFormat.INSTANCE;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Creates a new format to use for parsing and formatting values of the given type. This method is invoked by   {@link #getFormat(Class)} the first time that a formatis needed for the given type. <p>The default implementation creates the following formats:</p> <table class="sis"> <tr><th>Value type</th>     <th>Format</th></tr> <tr><td> {@link Angle}</td>  <td>  {@link AngleFormat}</td></tr> <tr><td>  {@link Date}</td>   <td>  {@link DateFormat}</td></tr> <tr><td>  {@link Number}</td> <td>  {@link NumberFormat}</td></tr> </table> Subclasses can override this method for adding more types, or for configuring the newly created   {@link Format} instances. Note that implementations shall check thetype using the  {@code expected == type} comparator, not<code>expected. {@linkplain Class#isAssignableFrom(Class) isAssignableFrom}(type)</code>, because the check for parent types is done by the   {@link #getFormat(Class)} method.This approach allows subclasses to create specialized formats for different value sub-types. For example a subclass may choose to format  {@link Double} values differentlythan other types of number.
 * @param valueType The base type of values to parse or format.
 * @return The format to use for parsing of formatting values of the given type,or  {@code null} if none.
 */
protected Format createFormat(final Class<?> valueType){
  final Locale locale=getLocale();
  if (Number.class.isAssignableFrom(valueType)) {
    if (Locale.ROOT.equals(locale)) {
      return DefaultFormat.getInstance(valueType);
    }
 else     if (valueType == Number.class) {
      return NumberFormat.getInstance(locale);
    }
  }
 else   if (valueType == Date.class) {
    final DateFormat format;
    if (!Locale.ROOT.equals(locale)) {
      format=DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM,locale);
    }
 else {
      format=new SimpleDateFormat("String_Node_Str",Locale.ROOT);
    }
    format.setTimeZone(getTimeZone());
    return format;
  }
 else   if (valueType == Angle.class) {
    return AngleFormat.getInstance(locale);
  }
 else   if (valueType == Class.class) {
    return ClassFormat.INSTANCE;
  }
  return null;
}