nus-yam/ex-repair huggingface dataset:
Buggy code:
//* * Copyright (c) 2007 Mockito contributors * This program is made available under the terms of the MIT License. *//package org.mockito.internal.util;import java.util.HashMap;import java.util.Map;@SuppressWarnings("unchecked")public class Primitives {        public static <T> Class<T> primitiveTypeOf(Class<T> clazz) {        if(clazz.isPrimitive()) {            return clazz;        }        return (Class<T>) primitiveTypes.get(clazz);    }    public static boolean isPrimitiveWrapper(Class<?> type) {        return wrapperReturnValues.containsKey(type);    }    public static <T> T primitiveWrapperOf(Class<T> type) {        return (T) wrapperReturnValues.get(type);    }    public static <T> T primitiveValueOrNullFor(Class<T> primitiveType) {        return (T) primitiveValues.get(primitiveType);    }    private static Map<Class<?>, Class<?>> wrapperTypes = new HashMap<Class<?>, Class<?>>();    private static Map<Class<?>, Class<?>> primitiveTypes = new HashMap<Class<?>, Class<?>>();    private static Map<Class<?>, Object> wrapperReturnValues = new HashMap<Class<?>, Object>();    private static Map<Class<?>, Object> primitiveValues = new HashMap<Class<?>, Object>();    static {        primitiveTypes.put(Boolean.class, Boolean.TYPE);        primitiveTypes.put(Character.class, Character.TYPE);        primitiveTypes.put(Byte.class, Byte.TYPE);        primitiveTypes.put(Short.class, Short.TYPE);        primitiveTypes.put(Integer.class, Integer.TYPE);        primitiveTypes.put(Long.class, Long.TYPE);        primitiveTypes.put(Float.class, Float.TYPE);        primitiveTypes.put(Double.class, Double.TYPE);    }    static {        wrapperReturnValues.put(Boolean.class, false);        wrapperReturnValues.put(Character.class, '\u0000');        wrapperReturnValues.put(Byte.class, (byte) 0);        wrapperReturnValues.put(Short.class, (short) 0);        wrapperReturnValues.put(Integer.class, 0);        wrapperReturnValues.put(Long.class, 0L);        wrapperReturnValues.put(Float.class, 0F);        wrapperReturnValues.put(Double.class, 0D);    }    static {        primitiveValues.put(boolean.class, false);        primitiveValues.put(char.class, '\u0000');        primitiveValues.put(byte.class, (byte) 0);        primitiveValues.put(short.class, (short) 0);        primitiveValues.put(int.class, 0);        primitiveValues.put(long.class, 0L);        primitiveValues.put(float.class, 0F);        <START_BUG> primitiveValues.put(double.class, 0); <END_BUG>    }}


Fix:
primitiveValues.put(double.class, 0D);
Buggy code:
//*  * Copyright (c) 2007 Mockito contributors  * This program is made available under the terms of the MIT License.  *// package org.mockito.internal.verification.argumentmatching;  import java.util.LinkedList; import java.util.List;  import org.hamcrest.Matcher; import org.hamcrest.StringDescription; import org.mockito.internal.matchers.ContainsExtraTypeInformation;  @SuppressWarnings("unchecked") public class ArgumentMatchingTool {      //**      * Suspiciously not matching arguments are those that don't much, the toString() representation is the same but types are different.      *//     public Integer[] getSuspiciouslyNotMatchingArgsIndexes(List<Matcher> matchers, Object[] arguments) {         if (matchers.size() != arguments.length) {             return new Integer[0];         }                  List<Integer> suspicious = new LinkedList<Integer>();         int i = 0;         for (Matcher m : matchers) {             if (m instanceof ContainsExtraTypeInformation                      && !safelyMatches(m, arguments[i])                      && toStringEquals(m, arguments[i])                     && !((ContainsExtraTypeInformation) m).typeMatches(arguments[i])) {                 suspicious.add(i);             }             i++;         }         return suspicious.toArray(new Integer[0]);     }      private boolean safelyMatches(Matcher m, Object arg) {         try {             return m.matches(arg);         } catch (Throwable t) {             return false;         }     }      private boolean toStringEquals(Matcher m, Object arg) {         <START_BUG> return StringDescription.toString(m).equals(arg.toString()); <END_BUG>     } } 

Fix:
return StringDescription.toString(m).equals(arg == null? "null" : arg.toString());
Buggy code:
//*  * Copyright (c) 2007 Mockito contributors  * This program is made available under the terms of the MIT License.  *// package org.mockito.internal.matchers;  import org.hamcrest.Description; import org.mockito.ArgumentMatcher;  import java.io.Serializable;   public class Same extends ArgumentMatcher<Object> implements Serializable {      private static final long serialVersionUID = -1226959355938572597L;     private final Object wanted;      public Same(Object wanted) {         this.wanted = wanted;     }      public boolean matches(Object actual) {         return wanted == actual;     }      public void describeTo(Description description) {         description.appendText("same(");         appendQuoting(description);         description.appendText();         appendQuoting(description);         <START_BUG> description.appendText(wanted.toString()); <END_BUG>     }      private void appendQuoting(Description description) {         if (wanted instanceof String) {             description.appendText("\"");         } else if (wanted instanceof Character) {             description.appendText("'");         }     } } 


Fix:
description.appendText(wanted == null ? "null" : wanted.toString());
Buggy code:
//* ===========================================================  * JFreeChart : a free chart library for the Java(tm) platform  * ===========================================================  *  * (C) Copyright 2000-2008, by Object Refinery Limited and Contributors.  *  * Project Info:  http: *  * This library is free software; you can redistribute it and//or modify it   * under the terms of the GNU Lesser General Public License as published by   * the Free Software Foundation; either version 2.1 of the License, or   * (at your option) any later version.  *  * This library is distributed in the hope that it will be useful, but   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY   * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public   * License for more details.  *  * You should have received a copy of the GNU Lesser General Public  * License along with this library; if not, write to the Free Software  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,   * USA.    *  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.   * in the United States and other countries.]  *  * ----------------------------------------  * StandardToolTipTagFragmentGenerator.java  * ----------------------------------------  * (C) Copyright 2003-2008, by Richard Atkinson and Contributors.  *  * Original Author:  Richard Atkinson;  * Contributors:     David Gilbert (for Object Refinery Limited);  *  * Changes  * -------  * 12-Aug-2003 : Version 1 (RA);  * 04-Dec-2007 : Escape tool tip text to fix bug 1400917 (DG);  *   *//   package org.jfree.chart.imagemap;  //**  * Generates tooltips using the HTML title attribute for image map area tags.  *// public class StandardToolTipTagFragmentGenerator          implements ToolTipTagFragmentGenerator {      //**      * Creates a new instance.      *//     public StandardToolTipTagFragmentGenerator() {         super();     } 	     //**      * Generates a tooltip string to go in an HTML image map.      *      * @param toolTipText  the tooltip.      *       * @return The formatted HTML area tag attribute(s).      *//     public String generateToolTipFragment(String toolTipText) {         <START_BUG> return " title=\"" + toolTipText <END_BUG>             + "\" alt=\"\"";     }  } 

Fix:
return " title=\"" + ImageMapUtilities.htmlEscape(toolTipText)