nus-yam/ex-repair huggingface dataset:
Buggy code:
public class BaseLayerTestCase extends AbstractTaskTestCase { @ Test public void baseLayerIsAlwaysInstalled ( ) throws Exception { } @ Test public void patchBase ( ) throws Exception { InstalledIdentity installedIdentity = loadInstalledIdentity ( ) ; String patchID = randomString ( ) ; File patchDir = IoUtils . mkdir ( tempDir , patchID ) ; String layerPatchId = "mylayerPatchID" ; String moduleName = randomString ( ) ; ContentModification moduleAdded = ContentModificationUtils . addModule ( patchDir , layerPatchId , moduleName ) ; <START_BUG> ContentModification fileAdded = ContentModificationUtils . addMisc ( patchDir , "new<seq2seq4repair_space>file<seq2seq4repair_space>resource" , "bin" , "my-new-standalone.sh" ) ; <END_BUG> Patch patch = PatchBuilder . create ( ) . setPatchId ( patchID ) . setOneOffType ( productConfig . getProductVersion ( ) ) . setIdentity ( new org . jboss . as . patching . metadata . impl . IdentityImpl ( installedIdentity . getIdentity ( ) . getName ( ) , installedIdentity . getIdentity ( ) . getVersion ( ) ) ) . addElement ( new PatchElementImpl ( layerPatchId ) . setProvider ( new org . jboss . as . patching . metadata . impl . PatchElementProviderImpl ( PatchInfo . BASE , "1.0.1" , false ) ) . setNoUpgrade ( ) . addContentModification ( moduleAdded ) ) . addContentModification ( fileAdded ) . build ( ) ; createPatchXMLFile ( patchDir , patch ) ; System . out . println ( "patch<seq2seq4repair_space>=>>" ) ; File zippedPatch = createZippedPatchFile ( patchDir , patchID ) ; PatchingResult result = executePatch ( zippedPatch ) ; assertPatchHasBeenApplied ( result , patch ) ; InstalledIdentity patchedInstalledIdentity = InstalledIdentity . load ( env . getInstalledImage ( ) . getJbossHome ( ) , productConfig , env . getInstalledImage ( ) . getModulesDir ( ) ) ; assertInstallationIsPatched ( patch , patchedInstalledIdentity . getIdentity ( ) . loadTargetInfo ( ) ) ; assertFileExists ( env . getInstalledImage ( ) . getJbossHome ( ) , "bin" , fileAdded . getItem ( ) . getName ( ) ) ; System . out . println ( "installation<seq2seq4repair_space>=>>" ) ; tree ( env . getInstalledImage ( ) . getJbossHome ( ) ) ; DirectoryStructure layerDirStructure = installedIdentity . getLayers ( ) . get ( 0 ) . loadTargetInfo ( ) . getDirectoryStructure ( ) ; File modulesPatchDir = layerDirStructure . getModulePatchDirectory ( layerPatchId ) ; assertDirExists ( modulesPatchDir ) ; assertDefinedModule ( modulesPatchDir , moduleName , moduleAdded . getItem ( ) . getContentHash ( ) ) ; } }

Fix:
ContentModification fileAdded = ContentModificationUtils . addMisc ( patchDir , patchID , "new<seq2seq4repair_space>file<seq2seq4repair_space>resource" , "bin" , "my-new-standalone.sh" ) ;
Buggy code:
public class MySQLDictionary extends DBDictionary { public static final String SELECT_HINT = "openjpa.hint.MySQLSelectHint" ; public static final String DELIMITER_BACK_TICK = "`" ; public String tableType = "innodb" ; public boolean useClobs = true ; public boolean driverDeserializesBlobs = false ; public boolean optimizeMultiTableDeletes = false ; public static final String tinyBlobTypeName = "TINYBLOB" ; public static final String mediumBlobTypeName = "MEDIUMBLOB" ; public static final String longBlobTypeName = "LONGBLOB" ; public MySQLDictionary ( ) { } @ Override public void connectedConfiguration ( Connection conn ) throws SQLException { } @ Override public Connection decorate ( Connection conn ) throws SQLException { } private static int [ ] getMajorMinorVersions ( String versionStr ) throws IllegalArgumentException { } @ Override public String [ ] getCreateTableSQL ( Table table ) { } @ Override public String [ ] getDropIndexSQL ( Index index ) { } @ Override public String [ ] getDropPrimaryKeySQL ( PrimaryKey pk ) { } @ Override public String [ ] getDropForeignKeySQL ( ForeignKey fk , Connection conn ) { } @ Override public String [ ] getAddPrimaryKeySQL ( PrimaryKey pk ) { } @ Override public String [ ] getDeleteTableContentsSQL ( Table [ ] tables , Connection conn ) { } @ Override protected void appendSelectRange ( SQLBuffer buf , long start , long end , boolean subselect ) { } @ Override protected Column newColumn ( ResultSet colMeta ) throws SQLException { } @ Override public Object getBlobObject ( ResultSet rs , int column , JDBCStore store ) throws SQLException { } @ Override public int getPreferredType ( int type ) { } @ Override public void appendXmlComparison ( SQLBuffer buf , String op , FilterValue lhs , FilterValue rhs , boolean lhsxml , boolean rhsxml ) { } private void appendXmlValue ( SQLBuffer buf , FilterValue val ) { } @ Override public int getBatchFetchSize ( int batchFetchSize ) { } @ Override public String getSelectOperation ( JDBCFetchConfiguration fetch ) { } @ Override protected Collection < String > getSelectTableAliases ( Select sel ) { } @ Override protected int matchErrorState ( Map < Integer , Set < String > > errorStates , SQLException ex ) { } @ Override public boolean isFatalException ( int subtype , SQLException ex ) { } @ Override public String getTypeName ( Column col ) { if ( ( col . getType ( ) ) == ( Types . BLOB ) ) { <START_BUG> if ( ( col . getSize ( ) ) == 0 ) <END_BUG> return blobTypeName ; else if ( ( col . getSize ( ) ) <= 255 ) return MySQLDictionary . tinyBlobTypeName ; else if ( ( col . getSize ( ) ) <= 65535 ) return blobTypeName ; else if ( ( col . getSize ( ) ) <= 16777215 ) return MySQLDictionary . mediumBlobTypeName ; else return MySQLDictionary . longBlobTypeName ; } else { return super . getTypeName ( col ) ; } } }

Fix:
if ( ( col . getSize ( ) ) <= 0 )
Buggy code:
public class CCMCheck extends Continuus { private File file = null ; private String comment = null ; private String task = null ; public CCMCheck ( ) { } public File getFile ( ) { } public void setFile ( File v ) { } public String getComment ( ) { } public void setComment ( String v ) { } public String getTask ( ) { } public void setTask ( String v ) { } public void execute ( ) throws BuildException { Commandline commandLine = new Commandline ( ) ; Project aProj = getProject ( ) ; int result = 0 ; commandLine . setExecutable ( getCcmCommand ( ) ) ; commandLine . createArgument ( ) . setValue ( getCcmAction ( ) ) ; checkOptions ( commandLine ) ; result = run ( commandLine ) ; if ( result != 0 ) { String msg = "Failed<seq2seq4repair_space>executing:<seq2seq4repair_space>" + ( commandLine . toString ( ) ) ; <START_BUG> throw new BuildException ( msg , location ) ; <END_BUG> } } private void checkOptions ( Commandline cmd ) { } public static final String FLAG_COMMENT = "//comment" ; public static final String FLAG_TASK = "//task" ; }

Fix:
throw new BuildException ( msg , getLocation ( ) ) ;
Buggy code:
public class XTSHandlerDeploymentProcessor implements DeploymentUnitProcessor { private static final String TX_BRIDGE_HANDLER = "org.jboss.jbossts.txbridge.inbound.OptionalJaxWSTxInboundBridgeHandler" ; private static final String TX_CONTEXT_HANDLER = "com.arjuna.mw.wst11.service.JaxWSHeaderContextProcessor" ; public void deploy ( final DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { } private boolean updateXTSEndpoint ( final String endpoint , final EndpointMetaData endpointMetaData , final WebservicesMetaData webservicesMetaData , final DeploymentUnit unit ) { <START_BUG> if ( ( endpointMetaData . isWebservice ( ) ) && ( endpointMetaData . getWebServiceAnnotation ( ) . isValidDeclaration ( ) ) ) { <END_BUG> final List < String > handlers = new ArrayList < String > ( ) ; if ( endpointMetaData . isBridgeEnabled ( ) ) { handlers . add ( XTSHandlerDeploymentProcessor . TX_BRIDGE_HANDLER ) ; } handlers . add ( XTSHandlerDeploymentProcessor . TX_CONTEXT_HANDLER ) ; if ( ! ( isAnyOfHandlersRegistered ( unit , endpoint , handlers ) ) ) { addHandlerToEndpoint ( webservicesMetaData , endpointMetaData , endpoint , handlers ) ; registerHandlersWithAS ( unit , endpoint , handlers ) ; return true ; } } return false ; } private void addHandlerToEndpoint ( WebservicesMetaData wsWebservicesMetaData , EndpointMetaData endpointMetaData , String endpointClass , List < String > handlers ) { } private PortComponentMetaData buildPortComponent ( boolean isEJB , String endpointClass , QName portQname , UnifiedHandlerChainsMetaData unifiedHandlerChainsMetaData , WebserviceDescriptionMetaData descriptionMetaData ) { } private UnifiedHandlerChainsMetaData buildHandlerChains ( List < String > handlerClasses ) { } private void registerHandlersWithAS ( DeploymentUnit unit , String endpointClass , List < String > handlersToAdd ) { } private String getClassName ( String fQClass ) { } private Set < String > getDeploymentClasses ( DeploymentUnit unit ) { } private void addEndpointsToList ( Set < String > endpoints , List < AnnotationInstance > annotations ) { } private boolean isAnyOfHandlersRegistered ( final DeploymentUnit unit , final String endpointClass , final List < String > handlers ) { } public void undeploy ( final DeploymentUnit unit ) { } }

Fix:
if ( endpointMetaData . isWebservice ( ) ) {
Buggy code:
public class ContextNames { public static final ServiceName NAMING = JBOSS . append ( "naming" ) ; public static final ServiceName JAVA_CONTEXT_SERVICE_NAME = ContextNames . NAMING . append ( "context" , "java" ) ; public static final ServiceName COMPONENT_CONTEXT_SERVICE_NAME = ContextNames . JAVA_CONTEXT_SERVICE_NAME . append ( "comp" ) ; public static final ServiceName JBOSS_CONTEXT_SERVICE_NAME = ContextNames . JAVA_CONTEXT_SERVICE_NAME . append ( "jboss" ) ; public static final ServiceName GLOBAL_CONTEXT_SERVICE_NAME = ContextNames . JAVA_CONTEXT_SERVICE_NAME . append ( "global" ) ; public static final ServiceName APPLICATION_CONTEXT_SERVICE_NAME = ContextNames . JAVA_CONTEXT_SERVICE_NAME . append ( "app" ) ; public static final ServiceName MODULE_CONTEXT_SERVICE_NAME = ContextNames . JAVA_CONTEXT_SERVICE_NAME . append ( "module" ) ; public static ServiceName contextServiceNameOfComponent ( String app , String module , String comp ) { } public static ServiceName contextServiceNameOfModule ( String app , String module ) { } public static ServiceName contextServiceNameOfApplication ( String app ) { } public static ContextNames . BindInfo bindInfoFor ( String app , String module , String comp , String context ) { } public static ContextNames . BindInfo bindInfoForEnvEntry ( String app , String module , String comp , boolean useCompNamespace , final String envEntryName ) { } public static ServiceName buildServiceName ( final ServiceName parentName , final String relativeName ) { } public static class BindInfo { private final ServiceName parentContextServiceName ; private final ServiceName binderServiceName ; private final String bindName ; private final String absoluteJndiName ; private BindInfo ( final ServiceName parentContextServiceName , final String bindName ) { } public ServiceName getParentContextServiceName ( ) { } public ServiceName getBinderServiceName ( ) { } public String getBindName ( ) { } public String getAbsoluteJndiName ( ) { } public String toString ( ) { } private String generateAbsoluteJndiName ( ) { } } public static ContextNames . BindInfo bindInfoFor ( final String jndiName ) { String bindName ; if ( jndiName . startsWith ( "java:" ) ) { bindName = jndiName . substring ( 5 ) ; } else if ( ( ( ! ( jndiName . startsWith ( "jboss" ) ) ) && ( ! ( jndiName . startsWith ( "global" ) ) ) ) && ( ! ( jndiName . startsWith ( "//" ) ) ) ) { bindName = "//" + jndiName ; } else { bindName = jndiName ; } final ServiceName parentContextName ; if ( bindName . startsWith ( "jboss//" ) ) { parentContextName = ContextNames . JBOSS_CONTEXT_SERVICE_NAME ; bindName = bindName . substring ( 6 ) ; } else if ( bindName . startsWith ( "global//" ) ) { parentContextName = ContextNames . GLOBAL_CONTEXT_SERVICE_NAME ; <START_BUG> bindName = bindName . substring ( 6 ) ; <END_BUG> } else if ( bindName . startsWith ( "//" ) ) { parentContextName = ContextNames . JAVA_CONTEXT_SERVICE_NAME ; bindName = bindName . substring ( 1 ) ; } else { throw NamingMessages . MESSAGES . illegalContextInName ( jndiName ) ; } return new ContextNames . BindInfo ( parentContextName , bindName ) ; } }

Fix:
bindName = bindName . substring ( 7 ) ;
Buggy code:
public class Numbers extends MainActivity { public static String percentage ( String num , String lastNum ) { } public static boolean lastInputIsOperator ( String equation ) { } public static boolean lastInputIsPercent ( String display ) { } public static boolean lastInputIsConstant ( String display ) { } static boolean negative = false ; <START_BUG> public static double factorial ( int x ) { <END_BUG> if ( x < 0 ) { x *= - 1 ; Numbers . negative = true ; } if ( x == 1 ) { if ( Numbers . negative ) { return - 1 ; } else { return 1 ; } } else if ( x == 0 ) { return 1 ; } else { return x * ( Numbers . factorial ( ( x - 1 ) ) ) ; } } No newline ; at end ; of file ; }

Fix:
public static long factorial ( int x ) {
Buggy code:
class DirectServerCommunicationListener { private final Logger log = Logger . getLogger ( DirectServerCommunicationListener . class ) ; private final SocketListener socketListener ; private final ServerManager serverManager ; DirectServerCommunicationListener ( ServerManager serverManager , InetAddress address , int port , int backlog ) throws IOException { } static DirectServerCommunicationListener create ( ServerManager serverManager , InetAddress address , int port , int backlog ) throws IOException { } void start ( ) throws IOException { } void shutdown ( ) { } int getSmPort ( ) { } InetAddress getSmAddress ( ) { } class ServerAcceptor implements SocketHandler { @ Override public void initializeConnection ( Socket socket ) throws IOException , InitialSocketRequestException { InputStream in = socket . getInputStream ( ) ; StringBuilder sb = new StringBuilder ( ) ; Status status = StreamUtils . readWord ( in , sb ) ; if ( status != ( Status . MORE ) ) { throw new InitialSocketRequestException ( ( ( "Server<seq2seq4repair_space>acceptor:<seq2seq4repair_space>received<seq2seq4repair_space>'" + ( sb . toString ( ) ) ) + "'<seq2seq4repair_space>but<seq2seq4repair_space>no<seq2seq4repair_space>more" ) ) ; } if ( ! ( sb . toString ( ) . equals ( "CONNECTED" ) ) ) { throw new InitialSocketRequestException ( ( ( "Server<seq2seq4repair_space>acceptor:<seq2seq4repair_space>received<seq2seq4repair_space>unknown<seq2seq4repair_space>connect<seq2seq4repair_space>command<seq2seq4repair_space>'" + ( sb . toString ( ) ) ) + "'" ) ) ; } sb = new StringBuilder ( ) ; while ( status == ( Status . MORE ) ) { status = StreamUtils . readWord ( in , sb ) ; } String processName = sb . toString ( ) ; Server server = serverManager . getServer ( processName ) ; if ( server == null ) { throw new InitialSocketRequestException ( ( "Server<seq2seq4repair_space>acceptor:<seq2seq4repair_space>unknown<seq2seq4repair_space>server<seq2seq4repair_space>" + processName ) ) ; } <START_BUG> server . setCommunicationHandler ( DirectServerCommunicationHandler . create ( SocketConnection . accepted ( socket ) , processName , new MessageHandler ( serverManager ) ) ) ; <END_BUG> } } }

Fix:
server . setCommunicationHandler ( DirectServerCommunicationHandler . create ( SocketConnection . accepted ( socket ) , processName , new MessageHandler ( serverManager ) , serverManager ) ) ;
Buggy code:
@ RunWith ( Arquillian . class ) @ RunAsClient public class ConnectorTestCase extends ArquillianResourceMgmtTestBase { private final File keyStoreFile = new File ( System . getProperty ( "java.io.tmpdir" ) , "test.keystore" ) ; private final File keyPEMFile = new File ( System . getProperty ( "java.io.tmpdir" ) , "newkey.pem" ) ; private final File certPEMFile = new File ( System . getProperty ( "java.io.tmpdir" ) , "newcert.pem" ) ; private boolean isNative = false ; @ ArquillianResource private URL url ; private static int socketBindingCount = 0 ; @ Deployment public static Archive < ? > getDeployment ( ) { } @ Before public void before ( ) throws IOException { } @ Test public void testDefaultConnectorList ( ) throws Exception { } @ Test public void testHttpConnector ( ) throws Exception { } @ Test public void testHttpOtherConnector ( ) throws Exception { } @ Test public void testHttpsConnector ( ) throws Exception { } @ Test public void testHttpsNativeConnector ( ) throws Exception { } @ Test public void testAjpConnector ( ) throws Exception { } @ Test public void testAddAndRemoveRollbacks ( ) throws Exception { } private void addConnector ( Connector conn ) throws Exception { } private ModelNode getAddSocketBindingOp ( Connector conn ) { } private ModelNode getAddConnectorOp ( Connector conn ) { final ModelNode composite = Util . getEmptyOperation ( COMPOSITE , new ModelNode ( ) ) ; final ModelNode steps = composite . get ( STEPS ) ; ModelNode op = createOpNode ( ( ( "subsystem=web//connector=test-" + ( conn . getName ( ) ) ) + "-connector" ) , "add" ) ; op . get ( "socket-binding" ) . set ( ( ( "test-" + ( conn . getName ( ) ) ) + ( ConnectorTestCase . socketBindingCount ) ) ) ; op . get ( "scheme" ) . set ( conn . getScheme ( ) ) ; op . get ( "protocol" ) . set ( conn . getProtocol ( ) ) ; op . get ( "secure" ) . set ( conn . isSecure ( ) ) ; op . get ( "enabled" ) . set ( true ) ; steps . add ( op ) ; if ( conn . isSecure ( ) ) { <START_BUG> ModelNode ssl = createOpNode ( ( ( "subsystem=web//connector=test-" + ( conn . getName ( ) ) ) + "-connector//configuration=ssl" ) , "add" ) ; <END_BUG> if ( conn . equals ( HTTPSNATIVE ) ) { ssl . get ( "certificate-key-file" ) . set ( keyPEMFile . getAbsolutePath ( ) ) ; ssl . get ( "certificate-file" ) . set ( certPEMFile . getAbsolutePath ( ) ) ; } else { ssl . get ( "certificate-key-file" ) . set ( keyStoreFile . getAbsolutePath ( ) ) ; } ssl . get ( "password" ) . set ( "test123" ) ; steps . add ( ssl ) ; } return composite ; } private void removeConnector ( Connector conn ) throws Exception { } private ModelNode getRemoveSocketBindingOp ( Connector conn ) { } private ModelNode getRemoveConnectorOp ( Connector conn ) { } private HashSet < String > getConnectorList ( ) throws Exception { } }

Fix:
ModelNode ssl = createOpNode ( ( ( "subsystem=web//connector=test-" + ( conn . getName ( ) ) ) + "-connector//ssl=configuration" ) , "add" ) ;
Buggy code:
public class EmbeddedCacheManagerDefaultsService implements Service < EmbeddedCacheManagerDefaults > { public static final ServiceName SERVICE_NAME = JBOSS . append ( SUBSYSTEM_NAME , "config" , "defaults" ) ; private static final String DEFAULTS = "infinispan-defaults.xml" ; private static final Logger log = Logger . getLogger ( CacheContainerAdd . class . getPackage ( ) . getName ( ) ) ; @ SuppressWarnings ( "unchecked" ) private static final ContextClassLoaderSwitcher switcher = ( ( ContextClassLoaderSwitcher ) ( AccessController . doPrivileged ( INSTANTIATOR ) ) ) ; private volatile EmbeddedCacheManagerDefaults defaults ; private final String resource ; public EmbeddedCacheManagerDefaultsService ( ) { } public EmbeddedCacheManagerDefaultsService ( String resource ) { } @ Override public EmbeddedCacheManagerDefaults getValue ( ) throws IllegalArgumentException , IllegalStateException { } @ Override public void start ( StartContext context ) throws StartException { InfinispanConfiguration config = EmbeddedCacheManagerDefaultsService . load ( this . resource ) ; EmbeddedCacheManagerDefaultsService . Defaults defaults = new EmbeddedCacheManagerDefaultsService . Defaults ( config . parseGlobalConfiguration ( ) ) ; Configuration defaultConfig = config . parseDefaultConfiguration ( ) ; Map < String , Configuration > namedConfigs = config . parseNamedConfigurations ( ) ; for ( Configuration . CacheMode mode : CacheMode . values ( ) ) { Configuration configuration = defaultConfig . clone ( ) ; Configuration overrides = namedConfigs . get ( mode . name ( ) ) ; if ( overrides != null ) { configuration . applyOverrides ( overrides ) ; } <START_BUG> configuration . setCacheMode ( mode ) ; <END_BUG> defaults . add ( mode , configuration ) ; } this . defaults = defaults ; } @ Override public void stop ( StopContext context ) { } private static InfinispanConfiguration load ( String resource ) throws StartException { } private static URL find ( String resource , ClassLoader ... loaders ) throws StartException { } class Defaults implements EmbeddedCacheManagerDefaults { private final GlobalConfiguration global ; private final Map < Configuration . CacheMode , Configuration > configs = new EnumMap < Configuration . CacheMode , Configuration > ( org . infinispan . config . Configuration . CacheMode . class ) ; Defaults ( GlobalConfiguration global ) { } void add ( Configuration . CacheMode mode , Configuration config ) { } @ Override public GlobalConfiguration getGlobalConfiguration ( ) { } @ Override public Configuration getDefaultConfiguration ( org . infinispan . config . Configuration . CacheMode mode ) { } } }

Fix:
configuration . fluent ( ) . mode ( mode ) ;
Buggy code:
final class PropertyAdd extends AbstractAddStepHandler { static final PropertyAdd INSTANCE = new PropertyAdd ( ) ; private PropertyAdd ( ) { } @ Override protected void performRuntime ( final OperationContext context , final ModelNode operation , final ModelNode model , final ServiceVerificationHandler verificationHandler , final List < ServiceController < ? > > newControllers ) throws OperationFailedException { final ServerConfig config = PackageUtils . getServerConfig ( context ) ; if ( config != null ) { final PathAddress address = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; final String propertyName = address . getElement ( ( ( address . size ( ) ) - 1 ) ) . getValue ( ) ; final PathElement confElem = address . getElement ( ( ( address . size ( ) ) - 2 ) ) ; final String configType = confElem . getKey ( ) ; final String configName = confElem . getValue ( ) ; final String propertyValue = ( operation . has ( VALUE ) ) ? Attributes . VALUE . resolveModelAttribute ( context , operation ) . asString ( ) : null ; for ( final CommonConfig cfg : PackageUtils . getConfigs ( config , configType ) ) { if ( configName . equals ( cfg . getConfigName ( ) ) ) { cfg . setProperty ( propertyName , propertyValue ) ; if ( ! ( context . isBooting ( ) ) ) { <START_BUG> context . restartRequired ( ) ; <END_BUG> } return ; } } throw WSMessages . MESSAGES . missingConfig ( configName ) ; } } @ Override protected void populateModel ( final ModelNode operation , final ModelNode model ) throws OperationFailedException { } }

Fix:
context . reloadRequired ( ) ;
Buggy code:
public class SoldierPlayer extends BasePlayer { private MapLocation targetLoc ; private Robot closestTar ; private Random r = new Random ( ) ; private Robot friendlyToFollow = null ; private int numTurnsLookingForFriendly = 0 ; private MapLocation friendlyMapLocationToFollow = null ; private final double MAX_DEVIATION_DISTANCE_SQUARE = 10000 ; public SoldierPlayer ( RobotController rc ) { } public void run ( ) { <START_BUG> runFollowFriendlyAndGuardMode ( ) ; <END_BUG> } public void guardThenAttackMode ( ) { } public void runFollowFriendlyMode ( ) { } public void runFollowFriendlyAndGuardMode ( ) { } }

Fix:
guardThenAttackMode ( ) ;
Buggy code:
public final class MutableActivityManager extends AbstractActivityManager implements IMutableActivityManager { private Map activitiesById = new WeakHashMap ( ) ; private Map activityActivityBindingsByParentActivityId = new HashMap ( ) ; private Map activityDefinitionsById = new HashMap ( ) ; private Map activityPatternBindingsByActivityId = new HashMap ( ) ; private IActivityRegistry activityRegistry ; private Map categoriesById = new WeakHashMap ( ) ; private Map categoryActivityBindingsByCategoryId = new HashMap ( ) ; private Map categoryDefinitionsById = new HashMap ( ) ; private Set definedActivityIds = new HashSet ( ) ; private Set definedCategoryIds = new HashSet ( ) ; private Set enabledActivityIds = new HashSet ( ) ; private Map identifiersById = new WeakHashMap ( ) ; public MutableActivityManager ( ) { } public MutableActivityManager ( IActivityRegistry activityRegistry ) { } public IActivity getActivity ( String activityId ) { } public ICategory getCategory ( String categoryId ) { } public Set getDefinedActivityIds ( ) { } public Set getDefinedCategoryIds ( ) { } public Set getEnabledActivityIds ( ) { } public IIdentifier getIdentifier ( String identifierId ) { } private void getRequiredActivityIds ( Set activityIds , Set requiredActivityIds ) { } public boolean isMatch ( String string , Set activityIds ) { } private void notifyActivities ( Map activityEventsByActivityId ) { } private void notifyCategories ( Map categoryEventsByCategoryId ) { } private void notifyIdentifiers ( Map identifierEventsByIdentifierId ) { } private void readRegistry ( ) { } public void setEnabledActivityIds ( Set enabledActivityIds ) { enabledActivityIds = Util . safeCopy ( enabledActivityIds , String . class ) ; Set requiredActivityIds = new HashSet ( enabledActivityIds ) ; getRequiredActivityIds ( enabledActivityIds , requiredActivityIds ) ; enabledActivityIds = requiredActivityIds ; boolean activityManagerChanged = false ; Map activityEventsByActivityId = null ; if ( ! ( this . enabledActivityIds . equals ( enabledActivityIds ) ) ) { this . enabledActivityIds = enabledActivityIds ; activityManagerChanged = true ; <START_BUG> activityEventsByActivityId = updateActivities ( this . definedActivityIds ) ; <END_BUG> } Map identifierEventsByIdentifierId = updateIdentifiers ( identifiersById . keySet ( ) ) ; if ( activityManagerChanged ) fireActivityManagerChanged ( new ActivityManagerEvent ( this , false , false , true ) ) ; if ( activityEventsByActivityId != null ) notifyActivities ( activityEventsByActivityId ) ; if ( identifierEventsByIdentifierId != null ) notifyIdentifiers ( identifierEventsByIdentifierId ) ; } private Map updateActivities ( Collection activityIds ) { } private ActivityEvent updateActivity ( Activity activity ) { } private Map updateCategories ( Collection categoryIds ) { } private CategoryEvent updateCategory ( Category category ) { } private IdentifierEvent updateIdentifier ( Identifier identifier ) { } private Map updateIdentifiers ( Collection identifierIds ) { } }

Fix:
activityEventsByActivityId = updateActivities ( activitiesById . keySet ( ) ) ;
Buggy code:
public class ClaimDetailViewerFragment extends Fragment { private Claim claim ; final OnClickListener closeFragment ; private void initializeFields ( ) { TextView name = ( ( TextView ) ( getView ( ) . findViewById ( textViewClaimName ) ) ) ; TextView startDate = ( ( TextView ) ( getView ( ) . findViewById ( textViewStartDate ) ) ) ; TextView endDate = ( ( TextView ) ( getView ( ) . findViewById ( textViewEndDate ) ) ) ; TextView destination = ( ( TextView ) ( getView ( ) . findViewById ( textViewDestinationList ) ) ) ; TextView descrption = ( ( TextView ) ( getView ( ) . findViewById ( textViewDescription ) ) ) ; TextView tags = ( ( TextView ) ( getView ( ) . findViewById ( textViewTagsList ) ) ) ; name . setText ( claim . getUserName ( ) ) ; startDate . setText ( claim . getStartDateAsString ( ) ) ; endDate . setText ( claim . getEndDateAsString ( ) ) ; destination . setText ( claim . getTravelItineraryAsString ( ) ) ; descrption . setText ( claim . getDescription ( ) ) ; <START_BUG> tags . setText ( "tags<seq2seq4repair_space>TEMP" ) ; <END_BUG> } public void setClaim ( int i ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public void onStart ( ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } No newline ; at end ; of file ; }

Fix:
tags . setText ( claim . getTagsAsString ( ) ) ;
Buggy code:
public class JFETGraphViewer extends ChartPanel { TransistorInfo info ; JFreeChart chart ; XYSeries s ; XYSeriesCollection data ; XYPointerAnnotation pointer ; public JFETGraphViewer ( JFreeChart chart ) { } public void makeNewSeries ( ) { } public double getDrainCurrent ( double Vds ) { } public void printInformation ( ) { } public JFreeChart getResultChart ( ) { this . makeNewSeries ( ) ; this . chart = ChartFactory . createXYLineChart ( "Output<seq2seq4repair_space>characteristic<seq2seq4repair_space>V-I<seq2seq4repair_space>curves" , "V_ds" , "I_d" , data , VERTICAL , true , true , false ) ; XYPlot plot = ( ( XYPlot ) ( chart . getPlot ( ) ) ) ; plot . getRangeAxis ( ) . setRange ( 0 , 2100 ) ; <START_BUG> pointer = new XYPointerAnnotation ( "This<seq2seq4repair_space>point" , info . getVds ( ) , getDrainCurrent ( info . getVds ( ) ) , ( ( Math . PI ) // 4.0 ) ) ; <END_BUG> plot . getAnnotations ( ) . clear ( ) ; plot . addAnnotation ( pointer ) ; return this . chart ; } public void paintComponent ( Graphics g ) { } @ SuppressWarnings ( "unchecked" ) private void initComponents ( ) { } }

Fix:
pointer = new XYPointerAnnotation ( "V_ds" , info . getVds ( ) , getDrainCurrent ( info . getVds ( ) ) , ( ( Math . PI ) // 4.0 ) ) ;
Buggy code:
public class F310Gamepad extends Joystick { public F310Gamepad ( int joystickNumber ) { } public double getLeftJoystickX ( ) { } public double getLeftJoystickY ( ) { double rawInput = this . getRawAxis ( 1 ) ; <START_BUG> if ( ( rawInput < 0 ) && ( rawInput > ( - 0.0078125 ) ) ) { <END_BUG> return 0 ; } return rawInput ; } public boolean getLeftJoystickPressed ( ) { } public double getRightJoystickX ( ) { } public double getRightJoystickY ( ) { } public boolean getRightJoystickPressed ( ) { } public boolean getXButtonPressed ( ) { } public boolean getAButtonPressed ( ) { } public boolean getBButtonPressed ( ) { } public boolean getYButtonPressed ( ) { } public boolean getLeftBumperPressed ( ) { } public boolean getRightBumperPressed ( ) { } public boolean getLeftTriggerPressed ( ) { } public boolean getRightTriggerPressed ( ) { } }

Fix:
if ( ( rawInput < 0 ) && ( rawInput >= ( - 0.0078125 ) ) ) {
Buggy code:
public class WordDatabase { private Quicktionary dictionary ; private TreeMap < String , Integer > map ; private String searchWord ; private Map . Entry < String , Integer > currentEntry ; public WordDatabase ( Quicktionary dictionary ) { } public void newWord ( String word ) { } public void removeWord ( String word ) { } public void fetchPage ( SearchItem item ) { } public void requestResults ( String word ) { } public int fetchResults ( Map . Entry < String , Integer > [ ] entries , int count ) { int i ; <START_BUG> for ( i = 0 ; ( currentEntry ) != null ; i ++ ) { <END_BUG> if ( ! ( currentEntry . getKey ( ) . startsWith ( searchWord ) ) ) break ; entries [ i ] = currentEntry ; currentEntry = map . higherEntry ( currentEntry . getKey ( ) ) ; } return i ; } }

Fix:
for ( i = 0 ; ( i < count ) && ( ( currentEntry ) != null ) ; i ++ ) {
Buggy code:
public class LinearMotionKalmanTracker { private final Matrix A ; private Matrix P ; private final Matrix Q ; private final Matrix R ; private Matrix X ; private final Matrix H ; private Matrix Xp ; private int nOcclusion ; public LinearMotionKalmanTracker ( final Matrix X0 ) { } public Matrix predict ( ) { } public void update ( final Matrix Xm ) { if ( null == Xm ) { ( nOcclusion ) ++ ; X = Xp ; } else { final Matrix TEMP = H . times ( P . times ( H . transpose ( ) ) ) . plus ( R ) ; final Matrix K = P . times ( H . transpose ( ) ) . times ( TEMP . inverse ( ) ) ; <START_BUG> X = X . plus ( K . times ( Xm . minus ( H . times ( X ) ) ) ) ; <END_BUG> } } public int getnOcclusion ( ) { } }

Fix:
X = Xp . plus ( K . times ( Xm . minus ( H . times ( Xp ) ) ) ) ;
Buggy code:
public class DefSymbol extends Unary { public final Tag table ; DefSymbol ( SourcePosition s , Tag table , Expression inner ) { } @ Override public String getPredicate ( ) { } @ Override public String getInterningKey ( ) { } @ Override public boolean checkAlwaysConsumed ( GrammarChecker checker , String startNonTerminal , UList < String > stack ) { <START_BUG> if ( ( ! ( this . checkAlwaysConsumed ( checker , startNonTerminal , stack ) ) ) && ( checker != null ) ) { <END_BUG> checker . reportWarning ( s , ( "unconsumed<seq2seq4repair_space>expression:<seq2seq4repair_space>" + ( this . inner ) ) ) ; } return true ; } @ Override public int inferNodeTransition ( UMap < String > visited ) { } @ Override public Expression checkNodeTransition ( GrammarChecker checker , NodeTransition c ) { } @ Override Expression dupUnary ( Expression e ) { } @ Override public short acceptByte ( int ch ) { } @ Override public boolean match ( SourceContext context ) { } public static boolean checkContextSensitivity ( Expression e , UMap < String > visitedMap ) { } @ Override public Instruction encode ( Compiler bc , Instruction next ) { } @ Override protected int pattern ( GEP gep ) { } @ Override protected void examplfy ( GEP gep , StringBuilder sb , int p ) { } No newline ; at end ; of file ; }

Fix:
if ( ( ! ( this . inner . checkAlwaysConsumed ( checker , startNonTerminal , stack ) ) ) && ( checker != null ) ) {
Buggy code:
public class XMPPUserSearchManager extends AbstractUserSearchManager { protected static final String SERVICE_SEARCH = "search." ; protected ECFConnection ecfConnection ; protected Namespace connectNamespace ; protected ID connectedID ; protected Form form ; protected UserSearch manager ; protected boolean enabled ; protected ICriteria criteria ; protected static final String FORM_TYPE = "FORM_TYPE" ; protected static final String NAME = "name" ; protected static final String JID = "jid" ; protected static final String SEARCH_ACTION = "search" ; public XMPPUserSearchManager ( ) { } public ICriteria createCriteria ( ) { } public IRestriction createRestriction ( ) { } public ISearch search ( ICriteria criteria ) throws UserSearchException { ResultList resultList = new ResultList ( ) ; try { if ( ( form ) == null ) form = manager . getSearchForm ( ecfConnection . getXMPPConnection ( ) , ( ( XMPPUserSearchManager . SERVICE_SEARCH ) + ( ecfConnection . getXMPPConnection ( ) . getServiceName ( ) ) ) ) ; List criterions = criteria . getCriterions ( ) ; String [ ] fields = getUserPropertiesFields ( ) ; for ( int i = 0 ; i < ( fields . length ) ; i ++ ) { Iterator criterionsIterator = criterions . iterator ( ) ; while ( criterionsIterator . hasNext ( ) ) { ICriterion criterion = ( ( ICriterion ) ( criterionsIterator . next ( ) ) ) ; if ( criterion . equals ( fields [ i ] ) ) { Form answerForm = form . createAnswerForm ( ) ; answerForm . setAnswer ( fields [ i ] , true ) ; answerForm . setAnswer ( XMPPUserSearchManager . SEARCH_ACTION , criterion . toExpression ( ) ) ; ReportedData data = manager . sendSearchForm ( ecfConnection . getXMPPConnection ( ) , answerForm , ( ( XMPPUserSearchManager . SERVICE_SEARCH ) + ( ecfConnection . getXMPPConnection ( ) . getServiceName ( ) ) ) ) ; IResultList partialResultList = createResultList ( data ) ; <START_BUG> resultList . addAll ( partialResultList . geResults ( ) ) ; <END_BUG> } } } return new XMPPSearch ( resultList ) ; } catch ( final XMPPException e ) { String message = null ; if ( ( ( e . getXMPPError ( ) ) != null ) && ( ( e . getXMPPError ( ) . getCode ( ) ) == 404 ) ) { message = Messages . XMPPContainer_UNRECOGONIZED_SEARCH_SERVICE ; } else { message = e . getLocalizedMessage ( ) ; } throw new UserSearchException ( message , e , criteria ) ; } catch ( ECFException e ) { throw new UserSearchException ( e , criteria ) ; } } protected IResultList createResultList ( ReportedData data ) { } public void search ( final ICriteria criteria , final IUserSearchListener listener ) { } public void setConnection ( Namespace connectNamespace , ID connectedID , ECFConnection connection ) { } public String [ ] getUserPropertiesFields ( ) throws ECFException { } public boolean isEnabled ( ) { } public void setEnabled ( boolean enabled ) { } public IUserSearchListener createUserSearchListener ( ) { } protected void log ( String msg , Throwable e ) { } public void fireUserSearchEvent ( IUserSearchEvent event ) { } class UserListener implements IUserSearchListener { public void handleUserSearchEvent ( IUserSearchEvent event ) { } } }

Fix:
resultList . addAll ( partialResultList . getResults ( ) ) ;
Buggy code:
public class OperatorRewriter extends TreeVisitor { @ Override public void endVisit ( Assignment node ) { } private boolean isStringAppend ( TreeNode node ) { } @ Override public void endVisit ( InfixExpression node ) { } @ Override public boolean visit ( FieldAccess node ) { } @ Override public boolean visit ( SuperFieldAccess node ) { } @ Override public boolean visit ( QualifiedName node ) { } @ Override public boolean visit ( SimpleName node ) { } @ Override public boolean visit ( VariableDeclarationFragment node ) { } private void rewriteVolatileLoad ( Expression node ) { } private String getAssignmentFunctionName ( Assignment node ) { } private void rewriteRegularAssignment ( Assignment node ) { } private static String intOrLong ( ITypeBinding type ) { } private static String getInfixFunction ( InfixExpression . Operator op , ITypeBinding nodeType ) { } private static boolean isVolatile ( Expression varNode ) { } private static boolean shouldRewriteCompoundAssign ( Assignment node ) { } private static boolean needsPromotionSuffix ( Assignment . Operator op ) { } private static String getPromotionSuffix ( Assignment node ) { } private void rewriteCompoundAssign ( Assignment node ) { } private CStringLiteral getStrcatTypesCString ( List < Expression > operands ) { } private void rewriteStringConcatenation ( InfixExpression node ) { } private List < Expression > getStringAppendOperands ( Assignment node ) { Expression rhs = node . getRightHandSide ( ) ; <START_BUG> if ( rhs instanceof InfixExpression ) { <END_BUG> InfixExpression infixExpr = ( ( InfixExpression ) ( rhs ) ) ; if ( ( infixExpr . getOperator ( ) ) == ( Operator . PLUS ) ) { List < Expression > operands = infixExpr . getOperands ( ) ; List < Expression > result = Lists . newArrayListWithCapacity ( operands . size ( ) ) ; TreeUtil . moveList ( operands , result ) ; return coalesceStringLiterals ( result ) ; } } return Collections . singletonList ( TreeUtil . remove ( rhs ) ) ; } private void rewriteStringAppend ( Assignment node ) { } private List < Expression > coalesceStringLiterals ( List < Expression > rawOperands ) { } private void addStringLiteralArgument ( List < Expression > args , String literal ) { } private static String getLiteralStringValue ( Expression expr ) { } private char getStringConcatenationTypeCharacter ( Expression operand ) { } }

Fix:
if ( ( rhs instanceof InfixExpression ) && ( typeEnv . isStringType ( rhs . getTypeBinding ( ) ) ) ) {
Buggy code:
public class DataSource { public static interface Callback { public void onSuccess ( ) { } public void onError ( String errorMessage ) { } } private ExecutorService executorService ; void submitTask ( Runnable task ) { } private List < Question > questions ; private List < Answer > answers ; private BloQueryUser currentUser ; private BloQueryUser viewedUser ; public DataSource ( ) { } public List < Answer > getAnswers ( ) { } public List < Question > getQuestions ( ) { } public void setCurrentUser ( BloQueryUser user ) { } public BloQueryUser getCurrentUser ( ) { } public void setCurrentViewedUser ( BloQueryUser user ) { } public BloQueryUser getCurrentViewedUser ( ) { } public void setQuestions ( List < Question > questions ) { } public void setAnswers ( List < Answer > answers ) { } void fetchQuestions ( ) { } public void fetchAnswers ( final Question question , final DataSource . Callback result ) { final Handler callbackThreadHandler = new Handler ( ) ; submitTask ( new Runnable ( ) { @ Override public void run ( ) { ParseQuery < Answer > query = ParseQuery . getQuery ( "Answer" ) ; query . whereEqualTo ( "question" , question ) ; <START_BUG> query . orderByDescending ( "createdAt" ) ; <END_BUG> query . setLimit ( 10 ) ; query . findInBackground ( new com . parse . FindCallback < Answer > ( ) { public void done ( List < Answer > answersList , ParseException e ) { answers = answersList ; callbackThreadHandler . post ( new Runnable ( ) { @ Override public void run ( ) { result . onSuccess ( ) ; } } ) ; } } ) ; } } ) ; } }

Fix:
query . orderByDescending ( "votes" ) ;
Buggy code:
public class PropertyDialogAction extends SelectionProviderAction { private IShellProvider shellProvider ; private String initialPageId ; public PropertyDialogAction ( Shell shell , ISelectionProvider provider ) { } public PropertyDialogAction ( IShellProvider shell , ISelectionProvider provider ) { } private boolean hasPropertyPagesFor ( Object object ) { <START_BUG> return PropertyPageContributorManager . getManager ( ) . hasContributorsFor ( object ) ; <END_BUG> } public boolean isApplicableForSelection ( ) { } public boolean isApplicableForSelection ( IStructuredSelection selection ) { } public void run ( ) { } public PreferenceDialog createDialog ( ) { } public void selectionChanged ( IStructuredSelection selection ) { } }

Fix:
return ( PropertyPageContributorManager . getManager ( ) . getApplicableContributors ( object ) . size ( ) ) != 0 ;
Buggy code:
@ Controller public class LoginController extends BaseController { @ Autowired private AdminUserService adminUserService ; @ Autowired private AdminuserLogService adminuserLogService ; private String log_content ; @ RequestMapping ( value = "//login" , method = RequestMethod . GET ) public ModelAndView login ( ) { } @ RequestMapping ( value = "//login" , method = RequestMethod . POST ) public ModelAndView login ( HttpServletRequest request , TadminUser user ) { } <START_BUG> @ RequestMapping ( value = "//ResetPassword" , method = RequestMethod . POST ) <END_BUG> public ModelAndView resetPassword ( HttpServletRequest request , String email ) { ModelAndView mav = new ModelAndView ( ) ; TadminLog adminLog = new TadminLog ( ) ; TadminUser adminUser = adminUserService . getTadminUsersByEmail ( email . toLowerCase ( ) ) ; if ( adminUser == null ) { adminUser = new TadminUser ( ) ; mav . addObject ( ERROR_MSG_KEY , "email<seq2seq4repair_space>not<seq2seq4repair_space>exist." ) ; } else { adminLog . setAdminId ( adminUser . getAdminId ( ) ) ; String random = UUID . randomUUID ( ) . toString ( ) . trim ( ) . replace ( "-" , "" ) . substring ( 0 , 6 ) ; adminUser . setPassword ( SecurityTools . MD5 ( random ) ) ; adminUser . setUpdatedBy ( adminUser . getAdminId ( ) ) ; adminUser . setUpdatedTime ( System . currentTimeMillis ( ) ) ; TemaiMessage message = new TemaiMessage ( ) ; message . setTo ( email ) ; message . setText ( ( ( ( ( ( "your<seq2seq4repair_space>account:<seq2seq4repair_space>" + ( adminUser . getAdminId ( ) ) ) + "<seq2seq4repair_space>reset<seq2seq4repair_space>password<seq2seq4repair_space>:" ) + ( Calendar . getInstance ( ) . getTime ( ) ) ) + "<seq2seq4repair_space>new<seq2seq4repair_space>password:" ) + random ) ) ; message . setSubject ( "MPOS<seq2seq4repair_space>Password<seq2seq4repair_space>Reset" ) ; EMailTool . send ( message ) ; adminUserService . updateAdminUserPassword ( adminUser ) ; LogManageTools . writeAdminLog ( log_content , adminLog , request ) ; } mav . addObject ( "user" , adminUser ) ; mav . addObject ( "msg" , getMessage ( request , "reset.pwd.success" ) ) ; mav . setViewName ( "login" ) ; log_content = "success:resert<seq2seq4repair_space>password<seq2seq4repair_space>success." ; return mav ; } @ RequestMapping ( "//logout" ) public String logout ( HttpSession session , HttpServletRequest request ) { } }

Fix:
@ RequestMapping ( value = "//common//ResetPassword" , method = RequestMethod . POST )
Buggy code:
public class TraitRegistry implements ITraitRegistry { public LinkedHashMap < String , ITrait > traits = new LinkedHashMap < String , ITrait > ( ) ; public LinkedHashMap < ITrait , String > names = new LinkedHashMap < ITrait , String > ( ) ; public LinkedHashMap < ITrait , Integer > ids = new LinkedHashMap < ITrait , Integer > ( ) ; public LinkedHashMap < ITrait , List < String > > methods = new LinkedHashMap < ITrait , List < String > > ( ) ; @ Override public void registerTrait ( String name , ITrait trait ) { } @ Override public ITrait getTrait ( String name ) { } @ Override public String getName ( ITrait trait ) { } @ Override public int getId ( String name ) { <START_BUG> return ( ( getTrait ( name ) ) != null ) && ( ids . containsKey ( getTrait ( name ) ) ) ? ids . get ( getTrait ( name ) ) : null ; <END_BUG> } @ Override public int getId ( ITrait trait ) { } @ Override public LinkedList < ITrait > getTraits ( ) { } public HashMap < ITrait , ArrayList < ITrait > > overrideSupers = new HashMap < ITrait , ArrayList < ITrait > > ( ) ; public HashMap < ITrait , ArrayList < ITrait > > overrideSubs = new HashMap < ITrait , ArrayList < ITrait > > ( ) ; @ Override public void makeTraitOverride ( ITrait superTrait , ITrait subTrait ) { } @ Override public void makeTraitOverride ( String superName , String subName ) { } @ Override public ArrayList < ITrait > getOverridden ( ITrait trait ) { } @ Override public ArrayList < ITrait > getOverriding ( ITrait trait ) { } @ Override public ArrayList < ITrait > getOverridden ( String name ) { } @ Override public ArrayList < ITrait > getOverriding ( String name ) { } @ Override public boolean isOverridden ( ITrait trait ) { } @ Override public boolean isOverriding ( ITrait trait ) { } public LinkedList < ITrait > orderedTraits = new LinkedList < ITrait > ( ) ; @ Override public LinkedList < ITrait > getOrderedTraits ( ) { } }

Fix:
return ids . get ( getTrait ( name ) ) ;
Buggy code:
public class AutoDriveStraight implements CommandOption { private static final double SPEED = 1.0 ; private static final double ANGLE = 0.0 ; @ Override public void doCMD ( ) { <START_BUG> drive . moveArcade ( AutoDriveStraight . SPEED , AutoDriveStraight . ANGLE ) ; <END_BUG> } @ Override public boolean done ( ) { } }

Fix:
drive . moveMechanum ( AutoDriveStraight . SPEED , AutoDriveStraight . ANGLE , AutoDriveStraight . ANGLE ) ;
Buggy code:
public class TestVectorMatrixMultiplicationJob extends MahoutTestCase { private static final double [ ] [ ] MATRIX = new double [ ] [ ] { new double [ ] { 1 , 1 } , new double [ ] { 2 , 3 } } ; private static final double [ ] VECTOR = new double [ ] { 9 , 16 } ; @ Test public void testVectorMatrixMultiplicationMapper ( ) throws Exception { VectorMatrixMultiplicationMapper mapper = new VectorMatrixMultiplicationMapper ( ) ; <START_BUG> Configuration conf = new Configuration ( ) ; <END_BUG> Vector toSave = new DenseVector ( TestVectorMatrixMultiplicationJob . VECTOR ) ; DummyRecordWriter < IntWritable , VectorWritable > writer = new DummyRecordWriter < IntWritable , VectorWritable > ( ) ; Context context = DummyRecordWriter . build ( mapper , conf , writer ) ; mapper . setup ( toSave ) ; for ( int i = 0 ; i < ( TestVectorMatrixMultiplicationJob . MATRIX . length ) ; i ++ ) { Vector v = new RandomAccessSparseVector ( TestVectorMatrixMultiplicationJob . MATRIX [ i ] . length ) ; v . assign ( TestVectorMatrixMultiplicationJob . MATRIX [ i ] ) ; mapper . map ( new IntWritable ( i ) , new VectorWritable ( v ) , context ) ; } assertEquals ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>map<seq2seq4repair_space>results" , TestVectorMatrixMultiplicationJob . MATRIX . length , writer . getData ( ) . size ( ) ) ; for ( int i = 0 ; i < ( TestVectorMatrixMultiplicationJob . MATRIX . length ) ; i ++ ) { List < VectorWritable > list = writer . getValue ( new IntWritable ( i ) ) ; assertEquals ( "Only<seq2seq4repair_space>one<seq2seq4repair_space>vector<seq2seq4repair_space>per<seq2seq4repair_space>key" , 1 , list . size ( ) ) ; Vector v = list . get ( 0 ) . get ( ) ; for ( int j = 0 ; j < ( TestVectorMatrixMultiplicationJob . MATRIX [ i ] . length ) ; j ++ ) { double total = ( ( Math . sqrt ( TestVectorMatrixMultiplicationJob . VECTOR [ i ] ) ) * ( Math . sqrt ( TestVectorMatrixMultiplicationJob . VECTOR [ j ] ) ) ) * ( TestVectorMatrixMultiplicationJob . MATRIX [ i ] [ j ] ) ; assertEquals ( "Product<seq2seq4repair_space>matrix<seq2seq4repair_space>elements" , total , v . get ( j ) , EPSILON ) ; } } } }

Fix:
Configuration conf = getConfiguration ( ) ;