nus-yam/ex-repair huggingface dataset:
Buggy code:
public class RequiredValidator extends StringValidator { private static final long serialVersionUID = 1L ; private static final RequiredValidator instance = new RequiredValidator ( ) ; public static RequiredValidator getInstance ( ) { } protected RequiredValidator ( ) { } public final void onValidate ( final FormComponent formComponent , final String value ) { <START_BUG> if ( formComponent . isValueNullable ( ) ) { <END_BUG> if ( Strings . isEmpty ( value ) ) { error ( formComponent ) ; } } } public String toString ( ) { } }

Fix:
if ( formComponent . isInputNullable ( ) ) {
Buggy code:
public class ShowMedicalRecordActivity extends Activity { private static final int PATIENT_ID = 1 ; private MedicalRecordAdapter adapter ; @ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( activity_show_medical_record ) ; ListView medicalRecord = ( ( ListView ) ( findViewById ( medicalRecord ) ) ) ; adapter = new MedicalRecordAdapter ( this ) ; medicalRecord . setAdapter ( adapter ) ; medicalRecord . setOnItemClickListener ( new AdapterView . OnItemClickListener ( ) { @ Override public void onItemClick ( AdapterView < ? > parent , View view , int position , long id ) { MedicalRecordItem item = ( ( MedicalRecordItem ) ( adapter . getItem ( position ) ) ) ; <START_BUG> DialogFragment informationDialog = item . getInformation ( ) ; <END_BUG> if ( informationDialog != null ) { Bundle bundle = new Bundle ( ) ; bundle . putSerializable ( "item" , item ) ; informationDialog . setArguments ( bundle ) ; informationDialog . show ( getFragmentManager ( ) , "MedicalRecordItemInformation" ) ; } } } ) ; refreshListView ( ) ; } private void refreshListView ( ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } No newline ; at end ; of file ; }

Fix:
DialogFragment informationDialog = item . acceptInformation ( ) ;
Buggy code:
public class VMovil_Venta_Cabecera_PlanPagos extends Activity { private Spinner spinnerCuotas ; private TextView textViewMontoTotal ; private Button butttonCalcularCuotas ; DecimalFormat df = new DecimalFormat ( "#.00" ) ; private Cursor cursorEstablecimiento ; private DbAdaptert_Evento_Establec dbHelperEventoEstablecimiento ; private DbAdapter_Temp_Comprob_Cobro dbHelper_TempComprobCobro ; private ArrayAdapter < CharSequence > adapterCuotas ; private Double monto_credito ; private int dias_credito ; private Double total = 0.0 ; private int numeroCuotas ; private int idEstablecimiento ; private int idAgente ; private SimpleCursorAdapter simpleCursorAdapter ; private ListView listView ; private View header ; private Context mContext ; final int id_comprobante = 0 ; final int id_plan_pago = 0 ; final int id_plan_pago_detalle = 0 ; final String tipo_documento = null ; final String doc = null ; final String fecha_cobro = null ; final String hora_cobro = null ; final Double monto_cobrado = 0.0 ; final int estado_cobro = 0 ; final int id_forma_cobro = 1 ; final String lugar_registro = "movil" ; @ Override public void onBackPressed ( ) { } @ Override protected void onCreate ( Bundle savedInstanceState ) { } private Dialog DialogCreditoInsuficiente ( final Context context ) { AlertDialog . Builder builder = new AlertDialog . Builder ( this ) ; builder . setTitle ( "Crédito<seq2seq4repair_space>Insuficiente" ) ; <START_BUG> builder . setMessage ( ( ( ( ( ( "Monto<seq2seq4repair_space>de<seq2seq4repair_space>Crédito<seq2seq4repair_space>:<seq2seq4repair_space>" + ( monto_credito ) ) + "\n" ) + "<seq2seq4repair_space><<seq2seq4repair_space>" ) + "Saldo<seq2seq4repair_space>:<seq2seq4repair_space>" ) + ( formatDecimal ( total ) ) ) ) ; <END_BUG> builder . setPositiveButton ( "OK" , new Dialog . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Intent intent = new Intent ( context , VMovil_Venta_Cabecera . class ) ; finish ( ) ; startActivity ( intent ) ; } } ) ; return builder . create ( ) ; } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } public Date getDatePhone ( ) { } private String getTimePhone ( ) { } public static Date sumaDias ( Date fecha , int dias ) { } public static String dateToString ( Date date ) { } public void CalcularCuotas ( View view ) { } public void calcular ( ) { } double formatDecimal ( double d ) { } No newline ; at end ; of file ; }

Fix:
builder . setMessage ( ( ( ( ( ( "Monto<seq2seq4repair_space>de<seq2seq4repair_space>Crédito<seq2seq4repair_space>:<seq2seq4repair_space>" + ( monto_credito ) ) + "\n" ) + "<seq2seq4repair_space><<seq2seq4repair_space>" ) + "Saldo<seq2seq4repair_space>:<seq2seq4repair_space>" ) + ( df . format ( total ) ) ) ) ;
Buggy code:
public class ExplicitConstructorCall extends Statement implements InvocationSite { public Expression [ ] arguments ; public Expression qualification ; public MethodBinding binding ; public int accessMode ; public static final int ImplicitSuper = 1 ; public static final int Super = 2 ; public static final int This = 3 ; public VariableBinding [ ] [ ] implicitArguments ; boolean discardEnclosingInstance ; MethodBinding syntheticAccessor ; public ExplicitConstructorCall ( int accessMode ) { } public FlowInfo analyseCode ( BlockScope currentScope , FlowContext flowContext , FlowInfo flowInfo ) { } public void generateCode ( BlockScope currentScope , CodeStream codeStream ) { if ( ( ( bits ) & ( IsReachableMASK ) ) == 0 ) { return ; } try { ( ( MethodScope ) ( currentScope ) ) . isConstructorCall = true ; int pc = codeStream . position ; codeStream . aload_0 ( ) ; ReferenceBinding targetType ; if ( ( targetType = binding . declaringClass ) . isNestedType ( ) ) { codeStream . generateSyntheticArgumentValues ( currentScope , targetType , ( discardEnclosingInstance ? null : qualification ) , this ) ; } if ( ( arguments ) != null ) { for ( int i = 0 , max = arguments . length ; i < max ; i ++ ) { arguments [ i ] . generateCode ( currentScope , codeStream , true ) ; } } if ( ( syntheticAccessor ) != null ) { for ( int i = 0 , max = ( syntheticAccessor . parameters . length ) - ( binding . parameters . length ) ; i < max ; i ++ ) { codeStream . aconst_null ( ) ; } codeStream . invokespecial ( syntheticAccessor ) ; } else { codeStream . invokespecial ( binding ) ; } <START_BUG> codeStream . recordPositionsFrom ( pc , this ) ; <END_BUG> } finally { ( ( MethodScope ) ( currentScope ) ) . isConstructorCall = false ; } } public boolean isImplicitSuper ( ) { } public boolean isSuperAccess ( ) { } public boolean isTypeAccess ( ) { } void manageEnclosingInstanceAccessIfNecessary ( BlockScope currentScope ) { } public void manageSyntheticAccessIfNecessary ( BlockScope currentScope ) { } public void resolve ( BlockScope scope ) { } public void setDepth ( int depth ) { } public void setFieldIndex ( int depth ) { } public String toString ( int tab ) { } public void traverse ( IAbstractSyntaxTreeVisitor visitor , BlockScope scope ) { } }

Fix:
codeStream . recordPositionsFrom ( pc , this . sourceStart ) ;
Buggy code:
public class ScreenCaptureFragment extends Fragment implements View . OnClickListener { private static final String TAG = "ScreenCaptureFragment" ; private static final String STATE_RESULT_CODE = "result_code" ; private static final String STATE_RESULT_DATA = "result_data" ; private static final int REQUEST_MEDIA_PROJECTION = 1 ; private int mScreenDensity ; private int mResultCode ; private Intent mResultData ; private Surface mSurface ; private MediaProjection mMediaProjection ; private VirtualDisplay mVirtualDisplay ; private MediaProjectionManager mMediaProjectionManager ; private Button mButtonToggle ; private SurfaceView mSurfaceView ; @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Nullable @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } @ Override public void onViewCreated ( View view , Bundle savedInstanceState ) { } @ Override public void onActivityCreated ( Bundle savedInstanceState ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } @ Override public void onClick ( View v ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { } @ Override public void onPause ( ) { } @ Override public void onDestroy ( ) { } private void setUpMediaProjection ( ) { } private void tearDownMediaProjection ( ) { } private void startScreenCapture ( ) { } private void setUpVirtualDisplay ( ) { <START_BUG> int height = ( mSurfaceView . getHeight ( ) ) - 20 ; <END_BUG> int width = mSurfaceView . getWidth ( ) ; Log . i ( ScreenCaptureFragment . TAG , ( ( ( ( ( ( "Setting<seq2seq4repair_space>up<seq2seq4repair_space>a<seq2seq4repair_space>VirtualDisplay:<seq2seq4repair_space>" + width ) + "x" ) + height ) + "<seq2seq4repair_space>(" ) + ( mScreenDensity ) ) + ")" ) ) ; mVirtualDisplay = mMediaProjection . createVirtualDisplay ( "ScreenCapture" , width , height , mScreenDensity , VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR , mSurface , null , null ) ; mButtonToggle . setText ( stop ) ; } private void stopScreenCapture ( ) { } }

Fix:
int height = mSurfaceView . getHeight ( ) ;
Buggy code:
public class GetCommentsThread implements Runnable { public static void getComments ( ) throws ClassNotFoundException , InterruptedException , SQLException { Thread . sleep ( 10000 ) ; do { System . out . println ( "<seq2seq4repair_space>Will<seq2seq4repair_space>connect<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>database<seq2seq4repair_space>and<seq2seq4repair_space>get<seq2seq4repair_space>status......." ) ; Connection conComments = PublicMethods . getConnection ( ) ; System . out . println ( "<seq2seq4repair_space>Okay<seq2seq4repair_space>the<seq2seq4repair_space>connnection<seq2seq4repair_space>to<seq2seq4repair_space>mysql<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>established..we<seq2seq4repair_space>are<seq2seq4repair_space>going<seq2seq4repair_space>to<seq2seq4repair_space>select<seq2seq4repair_space>id<seq2seq4repair_space>from<seq2seq4repair_space>status....." ) ; Statement stmt = conComments . createStatement ( ResultSet . TYPE_SCROLL_INSENSITIVE , ResultSet . CONCUR_UPDATABLE ) ; <START_BUG> ResultSet rset = stmt . executeQuery ( "select<seq2seq4repair_space>id<seq2seq4repair_space>from<seq2seq4repair_space>status<seq2seq4repair_space>where<seq2seq4repair_space>id<seq2seq4repair_space>=<seq2seq4repair_space>1" ) ; <END_BUG> int pageNum = 1 ; long statusId = ( ( long ) ( 0 ) ) ; while ( rset . next ( ) ) { statusId = rset . getLong ( 1 ) ; try { Paging pag = new Paging ( ) ; pag . setCount ( 100 ) ; pageNum = 1 ; do { pag . setPage ( pageNum ) ; List < Comment > comments = weibo . getComments ( ( statusId + "" ) , pag ) ; pageNum ++ ; if ( comments . isEmpty ( ) ) { PublicMethods . UpdateStatusComments ( conComments , statusId ) ; Thread . sleep ( 4900 ) ; break ; } else { for ( Comment comment : comments ) { PublicMethods . InsertCommentsSql ( conComments , comment , statusId ) ; } } Thread . sleep ( 4900 ) ; } while ( true ) ; } catch ( WeiboException e ) { e . printStackTrace ( ) ; } } conComments . close ( ) ; Thread . sleep ( 20000 ) ; System . out . println ( "No<seq2seq4repair_space>new<seq2seq4repair_space>status....so<seq2seq4repair_space>no<seq2seq4repair_space>new<seq2seq4repair_space>comments" ) ; } while ( true ) ; } public void run ( ) { } }

Fix:
ResultSet rset = stmt . executeQuery ( "select<seq2seq4repair_space>id<seq2seq4repair_space>from<seq2seq4repair_space>status<seq2seq4repair_space>where<seq2seq4repair_space>isDone<seq2seq4repair_space>=<seq2seq4repair_space>false" ) ;
Buggy code:
public class Hex implements BinaryDecoder , BinaryEncoder { private static final char [ ] DIGITS_LOWER = new char [ ] { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' } ; private static final char [ ] DIGITS_UPPER = new char [ ] { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'A' , 'B' , 'C' , 'D' , 'E' , 'F' } ; public static byte [ ] decodeHex ( char [ ] data ) throws DecoderException { } protected static int toDigit ( char ch , int index ) throws DecoderException { } public static char [ ] encodeHex ( byte [ ] data ) { } public static char [ ] encodeHex ( byte [ ] data , boolean toLowerCase ) { } protected static char [ ] encodeHex ( byte [ ] data , char [ ] toDigits ) { } public byte [ ] decode ( byte [ ] array ) throws DecoderException { } public Object decode ( Object object ) throws DecoderException { try { char [ ] charArray = ( object instanceof String ) ? ( ( String ) ( object ) ) . toCharArray ( ) : ( ( char [ ] ) ( object ) ) ; return Hex . decodeHex ( charArray ) ; } catch ( ClassCastException e ) { <START_BUG> throw new DecoderException ( e . getMessage ( ) ) ; <END_BUG> } } public byte [ ] encode ( byte [ ] array ) { } public Object encode ( Object object ) throws EncoderException { } }

Fix:
throw new DecoderException ( e . getMessage ( ) , e ) ;
Buggy code:
@ SuppressWarnings ( "serial" ) public abstract class OpenJPAId implements Serializable , Comparable { public static final char TYPE_VALUE_SEP = '-' ; private static ConcurrentReferenceHashMap _typeCache = new ConcurrentReferenceHashMap ( ReferenceMap . WEAK , ReferenceMap . HARD ) ; protected Class type ; protected boolean subs = true ; private transient int _typeHash = 0 ; protected OpenJPAId ( ) { } protected OpenJPAId ( Class type ) { } protected OpenJPAId ( Class type , boolean subs ) { } public Class getType ( ) { } public boolean hasSubclasses ( ) { } public void setManagedInstanceType ( Class type ) { } public void setManagedInstanceType ( Class type , boolean subs ) { } public abstract Object getIdObject ( ) { } protected abstract int idHash ( ) { } protected abstract boolean idEquals ( OpenJPAId other ) { } public int hashCode ( ) { if ( ( _typeHash ) == 0 ) { Integer typeHashInt = ( ( Integer ) ( OpenJPAId . _typeCache . get ( type ) ) ) ; if ( typeHashInt == null ) { Class base = type ; Class superclass = base . getSuperclass ( ) ; while ( ( superclass != null ) && ( superclass != ( Object . class ) ) ) { base = base . getSuperclass ( ) ; superclass = base . getSuperclass ( ) ; } _typeHash = base . hashCode ( ) ; <START_BUG> OpenJPAId . _typeCache . put ( type , new Integer ( _typeHash ) ) ; <END_BUG> } else { _typeHash = typeHashInt . intValue ( ) ; } } return ( _typeHash ) ^ ( idHash ( ) ) ; } public boolean equals ( Object o ) { } public String toString ( ) { } public int compareTo ( Object other ) { } }

Fix:
OpenJPAId . _typeCache . put ( type , Integer . valueOf ( _typeHash ) ) ;
Buggy code:
public class MutableDouble extends Number implements Comparable < MutableDouble > , Mutable < Number > { private static final long serialVersionUID = 1587163916L ; private double value ; public MutableDouble ( ) { } public MutableDouble ( double value ) { } public MutableDouble ( Number value ) { } public MutableDouble ( String value ) throws NumberFormatException { } public Double getValue ( ) { <START_BUG> return new Double ( this . value ) ; <END_BUG> } public void setValue ( double value ) { } public void setValue ( Number value ) { } public boolean isNaN ( ) { } public boolean isInfinite ( ) { } public void increment ( ) { } public void decrement ( ) { } public void add ( double operand ) { } public void add ( Number operand ) { } public void subtract ( double operand ) { } public void subtract ( Number operand ) { } @ Override public int intValue ( ) { } @ Override public long longValue ( ) { } @ Override public float floatValue ( ) { } @ Override public double doubleValue ( ) { } public Double toDouble ( ) { } @ Override public boolean equals ( Object obj ) { } @ Override public int hashCode ( ) { } public int compareTo ( MutableDouble other ) { } @ Override public String toString ( ) { } }

Fix:
return Double . valueOf ( this . value ) ;
Buggy code:
public class ParameterizedType extends Type { public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor ( ParameterizedType . class , "type" , Type . class , ASTNode . MANDATORY , ASTNode . CYCLE_RISK ) ; public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor ( ParameterizedType . class , "typeArguments" , Type . class , ASTNode . CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; public static List propertyDescriptors ( int apiLevel ) { } private Type type = null ; private ASTNode . NodeList typeArguments = new ASTNode . NodeList ( ParameterizedType . TYPE_ARGUMENTS_PROPERTY ) ; ParameterizedType ( AST ast ) { } final List internalStructuralPropertiesForType ( int apiLevel ) { } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { } final int getNodeType0 ( ) { } ASTNode clone0 ( AST target ) { } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { } void accept0 ( ASTVisitor visitor ) { } public Type getType ( ) { if ( ( this . type ) == null ) { <START_BUG> synchronized ( this . ast ) { <END_BUG> if ( ( this . type ) == null ) { preLazyInit ( ) ; this . type = new SimpleType ( this . ast ) ; postLazyInit ( this . type , ParameterizedType . TYPE_PROPERTY ) ; } } } return this . type ; } public void setType ( Type type ) { } public List typeArguments ( ) { } int memSize ( ) { } int treeSize ( ) { } }

Fix:
synchronized ( this ) {
Buggy code:
public class RCchannels extends RCCommand { @ Override public boolean onCommand ( CommandSender sender , Command command , String label , String [ ] args ) { if ( ! ( CommandUtils . checkPermission ( rc , sender , command . getName ( ) , false , true ) ) ) return true ; if ( rc . getChannelManager ( ) . getBroadcastChannels ( ) . isEmpty ( ) ) { sender . sendMessage ( ( ( rc . getPrefs ( ) . getInfoColor ( ) ) + "There<seq2seq4repair_space>are<seq2seq4repair_space>no<seq2seq4repair_space>active<seq2seq4repair_space>broadcast<seq2seq4repair_space>channels." ) ) ; } else { if ( ( ( args . length ) > 0 ) && ( rc . getChannelManager ( ) . getBroadcastChannels ( ) . containsKey ( args [ 0 ] ) ) ) { if ( ! ( checkChanPermissions ( sender , args [ 0 ] ) ) ) { return true ; } printChannelInfo ( sender , args [ 0 ] ) ; } else { List < String > lines = new ArrayList < String > ( ) ; for ( BroadcastChannel channel : rc . getChannelManager ( ) . getBroadcastChannels ( ) . values ( ) ) { if ( channel . checkChanPermissions ( sender , false ) ) lines . add ( ( ( ( ( ( ( ( ( ( ( ( ( ChatColor . YELLOW ) + ( channel . name ) ) + ( ChatColor . WHITE ) ) + "<seq2seq4repair_space>-<seq2seq4repair_space>" ) + ( channel . getLength ( ) ) ) + "<seq2seq4repair_space>bits,<seq2seq4repair_space>" ) + ( channel . getTransmitters ( ) . size ( ) ) ) + "<seq2seq4repair_space>transmitters,<seq2seq4repair_space>" ) + ( channel . getReceivers ( ) . size ( ) ) ) + "<seq2seq4repair_space>receivers." ) + ( ChatColor . GREEN ) ) + ( channel . isProtected ( ) ? "<seq2seq4repair_space>Protected" : "" ) ) ) ; } if ( lines . isEmpty ( ) ) { sender . sendMessage ( ( ( rc . getPrefs ( ) . getInfoColor ( ) ) + "There<seq2seq4repair_space>are<seq2seq4repair_space>no<seq2seq4repair_space>active<seq2seq4repair_space>broadcast<seq2seq4repair_space>channels." ) ) ; return true ; } String [ ] outputLines = lines . toArray ( new String [ lines . size ( ) ] ) ; sender . sendMessage ( "" ) ; <START_BUG> CommandUtils . pageMaker ( sender , "Active<seq2seq4repair_space>wireless<seq2seq4repair_space>broadcast<seq2seq4repair_space>channels" , command . getName ( ) , outputLines , rc . getPrefs ( ) . getInfoColor ( ) , rc . getPrefs ( ) . getErrorColor ( ) , ( ( CommandUtils . MaxLines ) - 1 ) ) ; <END_BUG> sender . sendMessage ( ( ( ( ( "Use<seq2seq4repair_space>" + ( ChatColor . YELLOW ) ) + "//rcchannels<seq2seq4repair_space><channel<seq2seq4repair_space>name>" ) + ( ChatColor . WHITE ) ) + "<seq2seq4repair_space>for<seq2seq4repair_space>more<seq2seq4repair_space>info<seq2seq4repair_space>about<seq2seq4repair_space>it." ) ) ; } } return true ; } private void printChannelInfo ( CommandSender sender , String channelName ) { } private boolean checkChanPermissions ( CommandSender sender , String name ) { } }

Fix:
CommandUtils . pageMaker ( sender , "Active<seq2seq4repair_space>wireless<seq2seq4repair_space>broadcast<seq2seq4repair_space>channels" , command . getName ( ) , new ArrayLineSource ( outputLines ) , rc . getPrefs ( ) . getInfoColor ( ) , rc . getPrefs ( ) . getErrorColor ( ) , ( ( CommandUtils . MaxLines ) - 1 ) ) ;
Buggy code:
public class RateRenderer extends NumberRenderer { private static final long serialVersionUID = 240L ; public RateRenderer ( String format ) { } @ Override public void setValue ( Object value ) { <START_BUG> if ( ( value == null ) || ( ! ( value instanceof Double ) ) ) { <END_BUG> setText ( "#N//A" ) ; return ; } double rate = ( ( Double ) ( value ) ) . doubleValue ( ) ; if ( rate == ( Double . MAX_VALUE ) ) { setText ( "#N//A" ) ; return ; } String unit = "sec" ; if ( rate < 1.0 ) { rate *= 60.0 ; unit = "min" ; } if ( rate < 1.0 ) { rate *= 60.0 ; unit = "hour" ; } setText ( ( ( ( formatter . format ( rate ) ) + "//" ) + unit ) ) ; } }

Fix:
if ( ! ( value instanceof Double ) ) {
Buggy code:
public class RateStyle extends BStyleAbstract { public BColors getColor ( Object ... obj ) { Double rate = ( ( Double ) ( obj [ 0 ] ) ) ; Double tartget = ( ( Double ) ( obj [ 1 ] ) ) ; if ( ( rate == null ) || ( tartget == null ) ) { return null ; } <START_BUG> return ( rate < tartget ) || ( rate > 1 ) ? BColors . RED : null ; <END_BUG> } }

Fix:
return ( rate < tartget ) || ( rate > 1 ) ? BColors . RED : BColors . NONE ;
Buggy code:
public class TableTreeEditor extends ControlEditor { TableTree tableTree ; TableTreeItem item ; int column = - 1 ; ControlListener columnListener ; TreeListener treeListener ; public TableTreeEditor ( TableTree tableTree ) { } Rectangle computeBounds ( ) { } public void dispose ( ) { } public int getColumn ( ) { } public TableTreeItem getItem ( ) { } public void setColumn ( int column ) { } public void setItem ( TableTreeItem item ) { } public void setEditor ( Control editor , TableTreeItem item , int column ) { } public void layout ( ) { <START_BUG> if ( tableTree . isDisposed ( ) ) <END_BUG> return ; if ( ( ( item ) == null ) || ( item . isDisposed ( ) ) ) return ; Table table = tableTree . getTable ( ) ; int columnCount = table . getColumnCount ( ) ; if ( ( columnCount == 0 ) && ( ( column ) != 0 ) ) return ; if ( ( columnCount > 0 ) && ( ( ( column ) < 0 ) || ( ( column ) >= columnCount ) ) ) return ; super . layout ( ) ; } }

Fix:
if ( ( ( tableTree ) == null ) || ( tableTree . isDisposed ( ) ) )
Buggy code:
public class UnitHealEvent implements GameEvent , Serializable { private static final long serialVersionUID = 9092015L ; private final int healer_x ; private final int healer_y ; private final int target_x ; private final int target_y ; private final int heal ; private final int experience ; public UnitHealEvent ( int healer_x , int healer_y , int target_x , int target_y , int heal , int experience ) { } @ Override public Point getFocus ( GameCore game ) { } @ Override public boolean canExecute ( GameCore game ) { } @ Override public void execute ( GameManager manager ) { Unit healer = manager . getGame ( ) . getMap ( ) . getUnit ( healer_x , healer_y ) ; Unit target = manager . getGame ( ) . getMap ( ) . getUnit ( target_x , target_y ) ; target . changeCurrentHp ( heal ) ; manager . submitAnimation ( new com . toyknight . aeii . animator . HpChangeAnimator ( target , heal ) ) ; if ( ( target . getCurrentHp ( ) ) <= 0 ) { <START_BUG> manager . executeGameEvent ( new UnitDestroyEvent ( target_x , target_y ) ) ; <END_BUG> } boolean level_up = healer . gainExperience ( experience ) ; if ( level_up ) { manager . submitAnimation ( new com . toyknight . aeii . animator . UnitLevelUpAnimator ( healer ) ) ; } if ( manager . getGame ( ) . getCurrentPlayer ( ) . isLocalPlayer ( ) ) { manager . onUnitActionFinished ( healer ) ; } } }

Fix:
manager . executeGameEvent ( new UnitDestroyEvent ( target_x , target_y ) , false ) ;
Buggy code:
public class HtmlHeaderContainer extends HeaderContainer { private static final long serialVersionUID = 1L ; public HtmlHeaderContainer ( final MarkupContainer parent , final String id ) { } @ Override protected final void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { final Response webResponse = this . getResponse ( ) ; try { final StringResponse response = new StringResponse ( ) ; this . getRequestCycle ( ) . setResponse ( response ) ; super . onComponentTagBody ( markupStream , openTag ) ; <START_BUG> renderHeaderSections ( getPage ( ) , this ) ; <END_BUG> CharSequence output = response . getBuffer ( ) ; if ( ( output . length ( ) ) > 0 ) { if ( ( output . charAt ( 0 ) ) == '\r' ) { for ( int i = 2 ; i < ( output . length ( ) ) ; i += 2 ) { char ch = output . charAt ( i ) ; if ( ch != '\r' ) { output = output . subSequence ( ( i - 2 ) , output . length ( ) ) ; break ; } } } else if ( ( output . charAt ( 0 ) ) == '\n' ) { for ( int i = 1 ; i < ( output . length ( ) ) ; i ++ ) { char ch = output . charAt ( i ) ; if ( ch != '\n' ) { output = output . subSequence ( ( i - 1 ) , output . length ( ) ) ; break ; } } } } if ( ( output . length ( ) ) > 0 ) { webResponse . write ( "<head>" ) ; webResponse . write ( output ) ; webResponse . write ( "<//head>" ) ; } } finally { this . getRequestCycle ( ) . setResponse ( webResponse ) ; } } }

Fix:
renderHeaderSections ( getPage ( ) ) ;
Buggy code:
public class Snippet159 { public static void main ( String [ ] args ) { final String newTitle = "New<seq2seq4repair_space>Value<seq2seq4repair_space>for<seq2seq4repair_space>Title" ; Display display = new Display ( ) ; final Shell shell = new Shell ( display ) ; shell . setLayout ( new FillLayout ( ) ) ; final Browser browser ; try { browser = new Browser ( shell , SWT . NONE ) ; } catch ( SWTError e ) { <START_BUG> System . out . println ( ( "Count<seq2seq4repair_space>not<seq2seq4repair_space>instantiate<seq2seq4repair_space>Browser:<seq2seq4repair_space>" + ( e . getMessage ( ) ) ) ) ; <END_BUG> return ; } browser . addTitleListener ( new TitleListener ( ) { public void changed ( TitleEvent event ) { System . out . println ( ( "TitleEvent:<seq2seq4repair_space>" + ( event . title ) ) ) ; shell . setText ( event . title ) ; } } ) ; browser . addProgressListener ( new ProgressListener ( ) { public void changed ( ProgressEvent event ) { } public void completed ( ProgressEvent event ) { boolean result = browser . execute ( ( ( "document.title='" + newTitle ) + "'" ) ) ; if ( ! result ) { System . out . println ( "Script<seq2seq4repair_space>was<seq2seq4repair_space>not<seq2seq4repair_space>executed." ) ; } } } ) ; browser . setUrl ( "http:////www.eclipse.org" ) ; shell . open ( ) ; while ( ! ( shell . isDisposed ( ) ) ) { if ( ! ( display . readAndDispatch ( ) ) ) display . sleep ( ) ; } display . dispose ( ) ; } }

Fix:
System . out . println ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>instantiate<seq2seq4repair_space>Browser:<seq2seq4repair_space>" + ( e . getMessage ( ) ) ) ) ;
Buggy code:
public class ImageViewer extends JPanel implements IMimePartViewer { private MessageController mediator ; private byte [ ] data ; private ImageIcon image ; private int width ; public ImageViewer ( MessageController mediator ) { } public void view ( IMailbox folder , Object uid , Integer [ ] address , MailFrameMediator mediator ) throws Exception { } public void updateGUI ( ) throws Exception { removeAll ( ) ; image = new ImageIcon ( Toolkit . getDefaultToolkit ( ) . createImage ( data ) ) ; Container parent = mediator . getViewport ( ) ; int cwidth = ( ( int ) ( parent . getWidth ( ) ) ) ; if ( cwidth < ( image . getIconWidth ( ) ) ) { float scaling = ( ( float ) ( cwidth ) ) // ( image . getIconWidth ( ) ) ; <START_BUG> image = new ImageIcon ( image . getImage ( ) . getScaledInstance ( ( ( int ) ( ( image . getIconWidth ( ) ) * scaling ) ) , ( ( int ) ( ( image . getIconHeight ( ) ) * scaling ) ) , Image . SCALE_SMOOTH ) ) ; <END_BUG> } JLabel label = new JLabel ( image ) ; add ( label , BorderLayout . CENTER ) ; revalidate ( ) ; } public JComponent getView ( ) { } public boolean isVisible ( ) { } }

Fix:
image = new ImageIcon ( image . getImage ( ) . getScaledInstance ( ( ( int ) ( ( image . getIconWidth ( ) ) * scaling ) ) , ( ( int ) ( ( image . getIconHeight ( ) ) * scaling ) ) , Image . SCALE_FAST ) ) ;
Buggy code:
public final class TextSerializer extends BaseMarkupSerializer { public TextSerializer ( ) { } public void setOutputFormat ( OutputFormat format ) { } public void startElement ( String namespaceURI , String localName , String rawName , Attributes attrs ) { } public void endElement ( String namespaceURI , String localName , String rawName ) { } public void startElement ( String tagName , AttributeList attrs ) { } public void endElement ( String tagName ) { } public void processingInstruction ( String target , String code ) { } public void comment ( String text ) { } public void comment ( char [ ] chars , int start , int length ) { } public void characters ( char [ ] chars , int start , int length ) { } protected void characters ( String text , boolean unescaped ) { } protected void startDocument ( String rootTagName ) { } protected void serializeElement ( Element elem ) { } protected void serializeNode ( Node node ) { } protected ElementState content ( ) { } <START_BUG> protected String getEntityRef ( char ch ) { <END_BUG> return null ; } }

Fix:
protected String getEntityRef ( int ch ) {
Buggy code:
public class TextWebSocketHandlerAdapter extends WebSocketHandlerAdapter { @ Override protected void handleBinaryMessage ( WebSocketSession session , BinaryMessage message ) { try { session . close ( NOT_ACCEPTABLE . withReason ( "Binary<seq2seq4repair_space>messages<seq2seq4repair_space>not<seq2seq4repair_space>supported" ) ) ; <START_BUG> } catch ( IOException e ) { <END_BUG> } } }

Fix:
} catch ( IOException ex ) {
Buggy code:
public class DenoisingExample { public static void main ( String [ ] args ) { try { WavFile wavFile = WavFile . openWavFile ( new File ( "hynek.wav" ) ) ; wavFile . display ( ) ; int fs = ( ( int ) ( wavFile . getSampleRate ( ) ) ) ; int numChannels = wavFile . getNumChannels ( ) ; int numFrames = ( ( int ) ( wavFile . getNumFrames ( ) ) ) ; int samples = numFrames * numChannels ; double [ ] buffer = new double [ samples ] ; int framesRead ; framesRead = wavFile . readFrames ( buffer , numFrames ) ; wavFile . close ( ) ; Denoiser denoiser = new Denoiser ( fs , 0.4 , 9 ) ; double [ ] enhanced = denoiser . process ( buffer ) ; <START_BUG> WavFile output = WavFile . newWavFile ( new File ( "test.wav" ) , 1 , numFrames , 16 , fs ) ; <END_BUG> output . writeFrames ( enhanced , enhanced . length ) ; } catch ( Exception e ) { System . err . println ( e ) ; } } }

Fix:
WavFile output = WavFile . newWavFile ( new File ( "enhanced.wav" ) , 1 , numFrames , 16 , fs ) ;
Buggy code:
public class FixedPointLongCodec extends FixedLenMeasureCodec < LongWritable > { private static final int SIZE = 8 ; int scale ; BigDecimal scalePower ; DataType type ; LongWritable current = new LongWritable ( ) ; public FixedPointLongCodec ( DataType type ) { } @ Override public int getLength ( ) { } @ Override public DataType getDataType ( ) { } @ Override public LongWritable valueOf ( String value ) { } @ Override public String toString ( LongWritable value ) { } @ Override public LongWritable read ( byte [ ] buf , int offset ) { } @ Override public void write ( LongWritable v , byte [ ] buf , int offset ) { <START_BUG> BytesUtil . writeLong ( v . get ( ) , buf , offset , FixedPointLongCodec . SIZE ) ; <END_BUG> } }

Fix:
BytesUtil . writeLong ( ( v == null ? 0 : v . get ( ) ) , buf , offset , FixedPointLongCodec . SIZE ) ;
Buggy code:
public class QueueAdd extends AbstractMessagingSubsystemUpdate < Void > { private static final long serialVersionUID = 2210829361890051692L ; private final String name ; private String address ; private String filter ; private Boolean durable ; public QueueAdd ( final String name ) { } protected void applyUpdate ( MessagingSubsystemElement element ) throws UpdateFailedException { } protected < P > void applyUpdate ( UpdateContext context , UpdateResultHandler < ? super Void , P > resultHandler , P param ) { final QueueService service = new QueueService ( address , name , filter , ( ( durable ) != null ? durable : true ) , false ) ; <START_BUG> context . getBatchBuilder ( ) . addService ( CORE_QUEUE_BASE . append ( name ) , service ) . addDependency ( JBOSS_MESSAGING , HornetQServer . class , service . getHornetQService ( ) ) . addListener ( new UpdateResultHandler . ServiceStartListener < P > ( resultHandler , param ) ) . setInitialMode ( ACTIVE ) . install ( ) ; <END_BUG> } public AbstractSubsystemUpdate < MessagingSubsystemElement , ? > getCompensatingUpdate ( MessagingSubsystemElement original ) { } public String getAddress ( ) { } public void setAddress ( String address ) { } public String getFilter ( ) { } public void setFilter ( String filter ) { } public Boolean getDurable ( ) { } public void setDurable ( Boolean durable ) { } public String getName ( ) { } }

Fix:
context . getServiceTarget ( ) . addService ( CORE_QUEUE_BASE . append ( name ) , service ) . addDependency ( JBOSS_MESSAGING , HornetQServer . class , service . getHornetQService ( ) ) . addListener ( new UpdateResultHandler . ServiceStartListener < P > ( resultHandler , param ) ) . setInitialMode ( ACTIVE ) . install ( ) ;
Buggy code:
public class OpenMessageWithComposerAction extends FrameAction implements SelectionListener { public OpenMessageWithComposerAction ( AbstractFrameController frameController ) { } public void actionPerformed ( ActionEvent evt ) { <START_BUG> FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameController ( ) ) ) . getTableSelection ( ) ; <END_BUG> processor . addOp ( new org . columba . mail . gui . composer . command . OpenMessageWithComposerCommand ( r ) ) ; } public void selectionChanged ( SelectionChangedEvent e ) { } }

Fix:
FolderCommandReference [ ] r = ( ( org . columba . mail . gui . frame . AbstractMailFrameController ) ( getFrameMediator ( ) ) ) . getTableSelection ( ) ;
Buggy code:
final class MembershipMapper implements RowMapper < Membership > { private static final String MEMBERSHIP_ID = "membership_id" ; private static final String MEMBER_ID = "member_id" ; private static final String ENTITY_TYPE_CD = "entity_type_cd" ; private static final String NEXT_DUE_DT = "next_due_dt" ; private static final String COMPANY_NAME = "company_name" ; private static final String OWNER_IDENT = "owner_ident" ; private static final String JOIN_DT = "join_dt" ; private static final String NAME_LAST = "name_last" ; private static final String NAME_MIDDLE = "name_middle" ; private static final String NAME_FIRST = "name_first" ; private static final String FIXED_DUES = "fixed_dues" ; private static final String CALCULATED_DUES = "calculated_dues" ; private static final String BALANCE = "balance" ; private static final String LAST_PAYMENT_DT = "last_payment_dt" ; private static final String DUES_AMOUNT = "dues_amount" ; private static final String CLOSE_REASON_ID = "close_reason_id" ; private static final String CLOSE_REASON_TXT = "close_reason_txt" ; private static final String CLOSE_DT_TM = "close_dt_tm" ; private static final String ACTIVE_IND = "active_ind" ; private static final String CREATE_ID = "create_id" ; private static final String UPDT_ID = "updt_id" ; private static final String MEMBERSHIP_UPDT_CNT = "membership_updt_cnt" ; private final CodeValueRepository codeValueRepo ; public MembershipMapper ( final CodeValueRepository codeValueRepo ) { } @ Override public Membership mapRow ( final ResultSet rs , final int rowNum ) throws SQLException { } public static MapSqlParameterSource mapInsertStatement ( final Membership membership , final User user ) { } public static MapSqlParameterSource mapUpdateStatement ( final Membership membership , final User user ) { } private static void mapCommonProperties ( final MapSqlParameterSource params , final Membership membership , final User user ) { params . addValue ( MembershipMapper . NEXT_DUE_DT , CGTDateTimeUtils . convertDateTimeToTimestamp ( membership . getNextDueDate ( ) ) ) ; params . addValue ( MembershipMapper . ENTITY_TYPE_CD , membership . getEntityType ( ) . getCodeValueUID ( ) ) ; params . addValue ( MembershipMapper . DUES_AMOUNT , membership . getFixedDuesAmount ( ) ) ; params . addValue ( MembershipMapper . ACTIVE_IND , membership . isActive ( ) ) ; params . addValue ( MembershipMapper . CLOSE_REASON_ID , ( ( membership . getCloseReasonUID ( ) ) > 0 ? membership . getCloseReasonUID ( ) : null ) ) ; params . addValue ( MembershipMapper . CLOSE_REASON_TXT , membership . getCloseReasonText ( ) ) ; <START_BUG> params . addValue ( MembershipMapper . CLOSE_DT_TM , membership . getCloseDate ( ) ) ; <END_BUG> params . addValue ( MembershipMapper . UPDT_ID , user . getUserUID ( ) ) ; } }

Fix:
params . addValue ( MembershipMapper . CLOSE_DT_TM , CGTDateTimeUtils . convertDateTimeToTimestamp ( membership . getCloseDate ( ) ) ) ;
Buggy code:
public final class EEDefaultPermissionsProcessor implements DeploymentUnitProcessor { private static final Permissions DEFAULT_PERMISSIONS ; public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; final ModuleSpecification attachment = deploymentUnit . getAttachment ( MODULE_SPECIFICATION ) ; if ( attachment == null ) { return ; } final List < PermissionFactory > permissions = attachment . getPermissionFactories ( ) ; final Enumeration < Permission > e = EEDefaultPermissionsProcessor . DEFAULT_PERMISSIONS . elements ( ) ; while ( e . hasMoreElements ( ) ) { permissions . add ( new ImmediatePermissionFactory ( e . nextElement ( ) ) ) ; } ResourceRoot root = deploymentUnit . getAttachment ( DEPLOYMENT_ROOT ) ; try { File file = root . getRoot ( ) . getPhysicalFile ( ) ; if ( ( file != null ) && ( file . isDirectory ( ) ) ) { <START_BUG> FilePermission permission = new FilePermission ( ( ( file . getAbsolutePath ( ) ) + "//-" ) , "read" ) ; <END_BUG> permissions . add ( new ImmediatePermissionFactory ( permission ) ) ; } } catch ( IOException ex ) { throw new DeploymentUnitProcessingException ( ex ) ; } } public void undeploy ( final DeploymentUnit context ) { } }

Fix:
FilePermission permission = new FilePermission ( ( ( ( file . getAbsolutePath ( ) ) + ( File . separatorChar ) ) + "-" ) , "read" ) ;
Buggy code:
public class WeatherSyncAdapter extends AbstractThreadedSyncAdapter { private final String LOG_TAG = getClass ( ) . getSimpleName ( ) ; public static final int SYNC_INTERVAL = ( 60 * 60 ) * 3 ; public static final int SYNC_FLEXTIME = ( WeatherSyncAdapter . SYNC_INTERVAL ) // 3 ; private static final long DAY_IN_MILLIS = ( ( 1000 * 60 ) * 60 ) * 24 ; private static final int WEATHER_NOTIFICATION_ID = 1000 ; private static final String [ ] NOTIFY_WEATHER_PROJECTION = new String [ ] { WeatherEntry . COLUMN_WEATHER_ID , WeatherEntry . COLUMN_MAX_TEMP , WeatherEntry . COLUMN_MIN_TEMP , WeatherEntry . COLUMN_SHORT_DESC } ; private static final int INDEX_WEATHER_ID = 0 ; private static final int INDEX_MAX_TEMP = 1 ; private static final int INDEX_MIN_TEMP = 2 ; private static final int INDEX_SHORT_DESC = 3 ; public WeatherSyncAdapter ( Context context , boolean autoInitialize ) { } @ Override public void onPerformSync ( Account account , Bundle extras , String authority , ContentProviderClient provider , SyncResult syncResult ) { } public static void syncImmediately ( Context context ) { } public static Account getSyncAccount ( Context context ) { } public static void configurePeriodicSync ( Context context , int syncInterval , int flexTime ) { } private static void onAccountCreated ( Account newAccount , Context context ) { } public static void initializeSyncAdapter ( Context context ) { } private void notifyWeather ( ) { } private void showNotification ( Context context , Uri itemUri , int iconId , String title , String desc ) { } private void deleteOldData ( ) { Calendar calendar = Calendar . getInstance ( ) ; calendar . add ( Calendar . DATE , ( - 1 ) ) ; String yesterdayDate = String . valueOf ( Utility . normalizeDate ( calendar . getTimeInMillis ( ) ) ) ; <START_BUG> getContext ( ) . getContentResolver ( ) . delete ( CONTENT_URI , ( ( WeatherEntry . COLUMN_DATE ) + "<=" ) , new String [ ] { yesterdayDate } ) ; <END_BUG> } }

Fix:
getContext ( ) . getContentResolver ( ) . delete ( CONTENT_URI , ( ( WeatherEntry . COLUMN_DATE ) + "<=?" ) , new String [ ] { yesterdayDate } ) ;
Buggy code:
public class TextRetrieval { private ST < String , Set < String > > directIndex = new ST < String , Set < String > > ( ) ; private ST < String , Set < String > > invertedIndex = new ST < String , Set < String > > ( ) ; private Set < String > queryTagSet ; private Set < String > queryImageSet ; private Map < String , Integer > occuranceMap = new HashMap < String , Integer > ( ) ; private Map < String , Integer > resultMap = new HashMap < String , Integer > ( ) ; private int count = 0 ; public void LoadTerms ( String path ) { } public void AddFile ( String fileName , String [ ] fileTerms ) { } private void LoadTerms ( String tagspath , ST < String , Set < String > > index ) throws IOException { } private void UpdateInvertedIndex ( String fileName , String [ ] fileSet ) { } private double CosineSimilarity ( String [ ] fileTerms , String [ ] terms ) { } public String [ ] getDocumentsByTerm ( String term ) { } public String [ ] getTermsByDocument ( String term ) { } public String [ ] [ ] getWeightedResults ( String [ ] terms ) { String [ ] results = new String [ directIndex . size ( ) ] ; double [ ] indexes = new double [ directIndex . size ( ) ] ; <START_BUG> String [ ] [ ] combinedResult = new String [ directIndex . size ( ) ] [ 1 ] ; <END_BUG> int counter = 0 ; double similarity = 0 ; for ( String str : directIndex . keys ( ) ) { similarity = CosineSimilarity ( directIndex . get ( str ) . toArray ( new String [ directIndex . get ( str ) . size ( ) ] ) , terms ) ; if ( counter == 0 ) { results [ counter ] = str ; indexes [ counter ] = similarity ; } else { int index ; for ( index = 0 ; index < counter ; index ++ ) { if ( similarity > ( indexes [ counter ] ) ) break ; } for ( int j = counter - 1 ; j > ( index - 1 ) ; j -- ) { results [ ( j + 1 ) ] = results [ j ] ; indexes [ ( j + 1 ) ] = indexes [ j ] ; } results [ index ] = str ; indexes [ index ] = similarity ; } counter ++ ; } for ( int i = 0 ; i < ( combinedResult . length ) ; i ++ ) { combinedResult [ i ] [ 0 ] = results [ i ] ; combinedResult [ i ] [ 1 ] = String . valueOf ( indexes [ i ] ) ; } return combinedResult ; } }

Fix:
String [ ] [ ] combinedResult = new String [ directIndex . size ( ) ] [ 2 ] ;
Buggy code:
public class XMLWriter implements XMLEventProcessor { private XMLEventFactory eventFactory ; private XMLEventWriter writer ; public XMLWriter ( final String filename ) throws FileNotFoundException , XMLStreamException { } @ Override public void process ( final XMLEvent event ) throws XMLStreamException { } public void close ( ) throws XMLStreamException { if ( ( writer ) != null ) { <START_BUG> XMLEvent endElement = this . eventFactory . createStartElement ( new QName ( "posts" ) , null , null ) ; <END_BUG> this . writer . add ( endElement ) ; this . writer . flush ( ) ; this . writer . close ( ) ; } } }

Fix:
XMLEvent endElement = this . eventFactory . createEndElement ( new QName ( "posts" ) , null ) ;
Buggy code:
public class ProperFractionFormat extends FractionFormat { private static final long serialVersionUID = 760934726031766749L ; private NumberFormat wholeFormat ; public ProperFractionFormat ( ) { } public ProperFractionFormat ( NumberFormat format ) { } public ProperFractionFormat ( NumberFormat wholeFormat , NumberFormat numeratorFormat , NumberFormat denominatorFormat ) { } @ Override public StringBuffer format ( Fraction fraction , StringBuffer toAppendTo , FieldPosition pos ) { } public NumberFormat getWholeFormat ( ) { } @ Override public Fraction parse ( String source , ParsePosition pos ) { Fraction ret = super . parse ( source , pos ) ; if ( ret != null ) { return ret ; } int initialIndex = pos . getIndex ( ) ; parseAndIgnoreWhitespace ( source , pos ) ; Number whole = getWholeFormat ( ) . parse ( source , pos ) ; if ( whole == null ) { pos . setIndex ( initialIndex ) ; return null ; } parseAndIgnoreWhitespace ( source , pos ) ; Number num = getNumeratorFormat ( ) . parse ( source , pos ) ; if ( num == null ) { pos . setIndex ( initialIndex ) ; return null ; } if ( ( num . intValue ( ) ) < 0 ) { pos . setIndex ( initialIndex ) ; return null ; } int startIndex = pos . getIndex ( ) ; char c = parseNextCharacter ( source , pos ) ; switch ( c ) { case 0 : return new Fraction ( num . intValue ( ) , 1 ) ; case '//' : break ; default : pos . setIndex ( initialIndex ) ; pos . setErrorIndex ( startIndex ) ; return null ; } parseAndIgnoreWhitespace ( source , pos ) ; Number den = getDenominatorFormat ( ) . parse ( source , pos ) ; if ( den == null ) { pos . setIndex ( initialIndex ) ; return null ; } if ( ( den . intValue ( ) ) < 0 ) { pos . setIndex ( initialIndex ) ; return null ; } int w = whole . intValue ( ) ; int n = num . intValue ( ) ; int d = den . intValue ( ) ; <START_BUG> return new Fraction ( ( ( ( ( Math . abs ( w ) ) * d ) + n ) * ( MathUtils . sign ( w ) ) ) , d ) ; <END_BUG> } public void setWholeFormat ( NumberFormat format ) { } }

Fix:
return new Fraction ( ( ( ( ( Math . abs ( w ) ) * d ) + n ) * ( MathUtils . copySign ( 1 , w ) ) ) , d ) ;