auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void validate() throws Exception { final Environment.Mock mock = new Environment.Mock(); final String name = String.format("src/main/java/foo/%s", this.file); final Environment env = mock.withFile( name, IOUtils.toString( <START> this.getClass().getResourceAsStream(this.file), <END> Charset.defaultCharset() ) ); final Collection<Violation> violations = new PmdValidator(env).validate( Collections.singletonList(new File(env.basedir(), name)) ); MatcherAssert.assertThat(violations.isEmpty(), this.result); final StringBuilder builder = new StringBuilder(); for (final Violation violation : violations) { builder.append( String.format( "PMD: %s[%s]: %s (%s)\n", this.file, violation.lines(), violation.message(), violation.name() ) ); } MatcherAssert.assertThat(builder.toString(), this.matcher); }</code><technical_language>@korthout above, InputStreamOf</technical_language>

Target:
public void validate() throws Exception { final Environment.Mock mock = new Environment.Mock(); final String name = String.format("src/main/java/foo/%s", this.file); final Environment env = mock.withFile( name, IOUtils.toString( this.getClass().getResourceAsStream(this.file), StandardCharsets.UTF_8 ) ); final Collection<Violation> violations = new PmdValidator(env).validate( Collections.singletonList(new File(env.basedir(), name)) ); MatcherAssert.assertThat(violations.isEmpty(), this.result); final StringBuilder builder = new StringBuilder(); for (final Violation violation : violations) { builder.append( String.format( "PMD: %s[%s]: %s (%s)\n", this.file, violation.lines(), violation.message(), violation.name() ) ); } MatcherAssert.assertThat(builder.toString(), this.matcher); }
Source:
<code>protected Blob convertBlobToMimeType(Blob blob, String destinationMimeType) { BlobHolder bh = new SimpleBlobHolder(blob); <START> bh = convertToMimeType(destinationMimeType, bh, new HashMap<String, Serializable>()); <END> if (bh == null) { return null; } Blob result = bh.getBlob(); return result; }</code><technical_language>pass null instead of new HashMap<String, Serializable>()</technical_language>

Target:
protected Blob convertBlobToMimeType(Blob blob, String destinationMimeType) { BlobHolder bh = new SimpleBlobHolder(blob); bh = convertToMimeType(destinationMimeType, bh, null); return bh == null ? null : bh.getBlob(); }
Source:
<code>public void testCookieForStateLessClient() throws HttpException, IOException { TestContext context = TestContainer.getInstance().getTestContext(); String username = context.getAdminUsername(); String password = context.getPassword(); String url = this.getBaseNexusUrl() + "content/"; Header header = new Header("User-Agent", "Java/1.6" ); HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials( AuthScope.ANY, new UsernamePasswordCredentials( username, password ) ); GetMethod getMethod = new GetMethod( url ); getMethod.addRequestHeader( header ); getMethod.releaseConnection(); Assert.assertEquals( httpClient.executeMethod( getMethod ), 200 ); <START> <END> Cookie sessionCookie = this.getSessionCookie( httpClient.getState().getCookies() ); Assert.assertNull( sessionCookie, "Session Cookie is set" ); }</code><technical_language>releasing method executing it</technical_language>

Target:
public void testCookieForStateLessClient() throws HttpException, IOException { TestContext context = TestContainer.getInstance().getTestContext(); String username = context.getAdminUsername(); String password = context.getPassword(); String url = this.getBaseNexusUrl() + "content/"; Header header = new Header("User-Agent", "Java/1.6" ); HttpClient httpClient = new HttpClient(); httpClient.getState().setCredentials( AuthScope.ANY, new UsernamePasswordCredentials( username, password ) ); GetMethod getMethod = new GetMethod( url ); getMethod.addRequestHeader( header ); Assert.assertEquals( executeAndRelease( httpClient, getMethod ), 200 ); Cookie sessionCookie = this.getSessionCookie( httpClient.getState().getCookies() ); Assert.assertNull( sessionCookie, "Session Cookie is set" ); }
Source:
<code>private synchronized void startNextProjectNegotiation() { ISarosSession currentSession = session; if (currentSession == null) { log.warn("could not add resources because there is no active session"); return; } if (!currentSession.hasWriteAccess()) { log.error( "current local user has not enough privileges to add resources to the current session"); return; } <START> ProjectSharingData projectsToShare = new ProjectSharingData(); <END> Map<IReferencePoint, List<IResource>> mapping = nextProjectNegotiation.get(); for (Entry<IReferencePoint, List<IResource>> mapEntry : mapping.entrySet()) { final IReferencePoint referencePoint = mapEntry.getKey(); final List<IResource> resourcesList = mapEntry.getValue(); String referencePointID = currentSession.getReferencePointID(referencePoint); if (referencePointID == null) { referencePointID = String.valueOf(SESSION_ID_GENERATOR.nextInt(Integer.MAX_VALUE)); } projectsToShare.addReferencePoint(referencePoint, referencePointID, resourcesList); if (currentSession.isHost() && !currentSession.isCompletelyShared(referencePoint)) { currentSession.addSharedResources(referencePoint, referencePointID, resourcesList); } } if (projectsToShare.isEmpty()) { log.warn( "skipping project negotiation because no new projects were added to the current session"); return; } executeOutgoingProjectNegotiation(projectsToShare, session.getLocalUser()); }</code><technical_language>Rename? suggestion ProjectSharingData referencePointsToShare = new ProjectSharingData();</technical_language>

Target:
private synchronized void startNextProjectNegotiation() { ISarosSession currentSession = session; if (currentSession == null) { log.warn("could not add resources because there is no active session"); return; } if (!currentSession.hasWriteAccess()) { log.error( "current local user has not enough privileges to add resources to the current session"); return; } ProjectSharingData referencePointsToShare = new ProjectSharingData(); Map<IReferencePoint, List<IResource>> mapping = nextProjectNegotiation.get(); for (Entry<IReferencePoint, List<IResource>> mapEntry : mapping.entrySet()) { final IReferencePoint referencePoint = mapEntry.getKey(); final List<IResource> resourcesList = mapEntry.getValue(); String referencePointID = currentSession.getReferencePointID(referencePoint); if (referencePointID == null) { referencePointID = String.valueOf(SESSION_ID_GENERATOR.nextInt(Integer.MAX_VALUE)); } referencePointsToShare.addReferencePoint(referencePoint, referencePointID, resourcesList); if (currentSession.isHost() && !currentSession.isCompletelyShared(referencePoint)) { currentSession.addSharedResources(referencePoint, referencePointID, resourcesList); } } if (referencePointsToShare.isEmpty()) { log.warn( "skipping project negotiation because no new projects were added to the current session"); return; } executeOutgoingProjectNegotiation(referencePointsToShare, session.getLocalUser()); }
Source:
<code>public void testDisableCompactionForBlobStore() { compactionManager.enable(); assertFalse("Disable compaction on BlobStore is not allowed when compaction executor is not instantiated", compactionManager.disableCompactionForBlobStore(blobStore)); compactionManager.disable(); compactionManager.awaitTermination(); properties.setProperty("store.compaction.triggers", ALL_COMPACTION_TRIGGERS); config = new StoreConfig(new VerifiableProperties(properties)); StorageManagerMetrics metrics = new StorageManagerMetrics(new MetricRegistry()); compactionManager = new CompactionManager(MOUNT_PATH, config, Collections.singleton(blobStore), metrics, time); compactionManager.enable(); assertTrue("Disable compaction on given BlobStore should succeed", compactionManager.disableCompactionForBlobStore(blobStore)); compactionManager.disable(); <START> compactionManager.awaitTermination(); <END> }</code><technical_language>test case store is shutdown</technical_language>

Target:
public void testDisableCompactionForBlobStore() throws Exception { compactionManager.enable(); assertTrue("Disable compaction on BlobStore should be true when compaction executor is not instantiated", compactionManager.disableCompactionForBlobStore(blobStore)); compactionManager.disable(); compactionManager.awaitTermination(); properties.setProperty("store.compaction.triggers", ALL_COMPACTION_TRIGGERS); config = new StoreConfig(new VerifiableProperties(properties)); StorageManagerMetrics metrics = new StorageManagerMetrics(new MetricRegistry()); compactionManager = new CompactionManager(MOUNT_PATH, config, Collections.singleton(blobStore), metrics, time); compactionManager.enable(); assertTrue("Disable compaction on given BlobStore should succeed", compactionManager.disableCompactionForBlobStore(blobStore)); assertFalse("BlobStore should not be scheduled after compaction is disabled on it", compactionManager.scheduleNextForCompaction(blobStore)); compactionManager.disable(); compactionManager.awaitTermination(); }
Source:
<code>public HaxeClassResolveResult resolveHaxeClass() { <START> Throwable t = new Throwable(); <END> StackTraceElement[] stack = t.getStackTrace(); if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Called from " + stack[1].toString())); if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Begin resolving Haxe class:" + this.getText())); HaxeClassResolveResult result = resolveHaxeClassInternal(); if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Finished resolving Haxe class " + this.getText() + " as " + result.debugDump())); return result; }</code><technical_language>HaxeDebugUtil some methods print data method callers. This block replaced with: java if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Called " + HaxeDebugUtil.getCallerCanonicalName()));</technical_language>

Target:
public HaxeClassResolveResult resolveHaxeClass() { if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Begin resolving Haxe class:" + this.getText())); HaxeClassResolveResult result = resolveHaxeClassInternal(); if (LOG.isTraceEnabled()) LOG.trace(traceMsg("Finished resolving Haxe class " + this.getText() + " as " + result.debugDump())); return result; }
Source:
<code>public void loadAd(@Nullable MediationAdRequest request, @Nullable Bundle bundle, @Nullable Bundle bundle1) { Log.d(TAG, "Load Ad"); if (interstitial != null) { interstitial.load(); <START> } <END> }</code><technical_language>This happen, loadAd called initializationSucceeded callback sent, in event interstitial is null, adapter fail request immediately. So, please add else block a failure callback</technical_language>

Target:
public void loadAd(@Nullable MediationAdRequest request, @Nullable Bundle bundle, @Nullable Bundle bundle1) { Log.d(TAG, "Load Ad"); if (interstitial != null) { interstitial.load(); } else { Log.d(TAG, "Ad failed to load: interstitial is null"); if (listener != null) { listener.onAdFailedToLoad(MyTargetRewardedAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } } }
Source:
<code>private boolean menuIsRelevant(Menu m) throws XPathSyntaxException { XPathExpression relevance = m.getMenuRelevance(); if (m.getMenuRelevance() != null) { errorXpathException = m.getMenuRelevanceRaw(); EvaluationContext ec = asw.getEvaluationContext(m.getId()); <START> if (!XPathFuncExpr.toBoolean(relevance.eval(ec))) { <END> return false; } } return true; }</code><technical_language>simplified return XPathFuncExpr.toBoolean(relevance.eval(ec))</technical_language>

Target:
private boolean menuIsRelevant(Menu m) throws XPathSyntaxException { XPathExpression relevance = m.getMenuRelevance(); if (m.getMenuRelevance() != null) { errorXpathException = m.getMenuRelevanceRaw(); EvaluationContext ec = asw.getEvaluationContext(m.getId()); return XPathFuncExpr.toBoolean(relevance.eval(ec)); } return true; }
Source:
<code><START> public void testRequiredTypeAdapterNonNull() { <END> RequiredTypeAdapterModel expected = new RequiredTypeAdapterModel(); expected.uri = Uri.parse(Constants.WIKIPEDIA_URL); RequiredTypeAdapterModel result = unmarshal(RequiredTypeAdapterModel.class, marshal(expected)); assertThat(result, is(expected)); }</code><technical_language>glad this worked funkiness. Yay for Gson</technical_language>

Target:
public void testRequiredTypeAdapterNonNull() { RequiredTypeAdapterModel expected = new RequiredTypeAdapterModel(); expected.uri = Uri.parse(Constants.WIKIPEDIA_URL); RequiredTypeAdapterModel result = unmarshal(gson, RequiredTypeAdapterModel.class, marshal(gson, expected)); assertThat(result, is(expected)); }
Source:
<code>public void addComponent(MultiblockComponent component) { <START> if(getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ)!=null) { <END> throw new IllegalArgumentException("Location in multiblock already occupied"); } components.add(component); changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ); calculateCostForNewComponent(component); addComponentToLocationCache(component); }</code><technical_language>Spaces, brackets</technical_language>

Target:
public void addComponent(MultiblockComponent component) { if(getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ) != null) throw new IllegalArgumentException("Location in multiblock already occupied"); components.add(component); changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ); calculateCostForNewComponent(component); addComponentToLocationCache(component); }
Source:
<code>public boolean isValid() { return coordinates != null && coordinates.size() == 2 <START> && coordinates.get(0) >= -180.0 && coordinates.get(0) <= 180.0 <END> && coordinates.get(1) >= -90.0 && coordinates.get(1) <= 90.0 && (coordinateSystem == null || coordinateSystem.isValid()); }</code><technical_language>isValid check coordinates.get(0) coordinates.get(1) null</technical_language>

Target:
public boolean isValid() { return coordinates != null && coordinates.size() == 2 && coordinates.get(0) != null && coordinates.get(1) != null && coordinates.get(0) >= -180.0 && coordinates.get(0) <= 180.0 && coordinates.get(1) >= -90.0 && coordinates.get(1) <= 90.0 && (coordinateSystem == null || coordinateSystem.isValid()); }
Source:
<code>public void launch() { <START> MongoDBServer server = MongoDBServer.class.cast(entity); <END> Integer port = server.getAttribute(MongoDBServer.PORT); ImmutableList.Builder<String> argsBuilder = ImmutableList.<String>builder() .add("--config", getConfFile()) .add("--pidfilepath", getPidFile()) .add("--dbpath", getDataDirectory()) .add("--logpath", getLogFile()) .add("--port", port.toString()) .add("--fork"); String replicaSetName = server.getReplicaSet().getName(); if (!Strings.isNullOrEmpty(replicaSetName)) argsBuilder.add("--replSet", replicaSetName); if (Boolean.TRUE.equals(server.getConfig(MongoDBServer.ENABLE_REST_INTERFACE))) argsBuilder.add("--rest"); String args = Joiner.on(" ").join(argsBuilder.build()); String command = String.format("%s/bin/mongod %s > out.log 2> err.log < /dev/null", getExpandedInstallDir(), args); log.info(command); newScript(LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(command).execute(); }</code><technical_language>keen constructor takes EntityLocal if a MongoDBServer guaranteed ClassCastException here. a common interface for EntityLocal MongoDBServer, class do both. reluctantly change constructor a MongoDBServerImpl EntityLocal, override getEntity() return a MongoDBServer do cast there. I clearer casting launch() other methods need it</technical_language>

Target:
public void launch() { MongoDBServer server = getEntity(); Integer port = server.getAttribute(MongoDBServer.PORT); ImmutableList.Builder<String> argsBuilder = ImmutableList.<String>builder() .add("--config", getConfFile()) .add("--pidfilepath", getPidFile()) .add("--dbpath", getDataDirectory()) .add("--logpath", getLogFile()) .add("--port", port.toString()) .add("--fork"); if (server.isReplicaSetMember()) { String replicaSetName = server.getReplicaSet().getName(); checkState(!Strings.isNullOrEmpty(replicaSetName), "Replica set name must not be null or empty"); argsBuilder.add("--replSet", replicaSetName); } if (Boolean.TRUE.equals(server.getConfig(MongoDBServer.ENABLE_REST_INTERFACE))) argsBuilder.add("--rest"); String args = Joiner.on(" ").join(argsBuilder.build()); String command = String.format("%s/bin/mongod %s > out.log 2> err.log < /dev/null", getExpandedInstallDir(), args); LOG.info(command); newScript(LAUNCHING) .updateTaskAndFailOnNonZeroResultCode() .body.append(command).execute(); }
Source:
<code>public void emitTuples() { if (!readThread.isAlive() && resultQueue.isEmpty()) { <START> startReadThread(); <END> } try { Result result = resultQueue.poll(); if (result == null) { Thread.sleep(sleepMillis); return; } T tuple = getTuple(result); if (tuple != null) { outputPort.emit(tuple); tuplesRead++; } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>throw RuntimeException redeploy operator</technical_language>

Target:
public void emitTuples() { if (!readThread.isAlive() && threadFailed) { throw new RuntimeException("Exception in scan thread"); } try { Result result = resultQueue.poll(); if (result == null) { return; } T tuple = getTuple(result); if (tuple != null) { outputPort.emit(tuple); tuplesRead++; } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateTemplatesMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VmTemplate> templates = getVmTemplateDao().getVmTemplatesByIds(idsToProcess); for (VmTemplate template : templates) { if (VmTemplateStatus.Locked != template.getstatus()) { VmTemplateHandler.UpdateDisksFromDb(template); boolean verifyDisksNotLocked = verifyDisksNotLocked(template.getDiskList()); if (verifyDisksNotLocked) { loadTemplateData(template); <START> Long currentDbGeneration = getVmStaticDao().getDbGeneration(template.getId()); <END> if (template.getDb_generation() == currentDbGeneration.longValue()) { buildMetadataDictionaryForTemplate(template, vmsAndTemplateMetadata); proccessedIdsInfo.add(template.getId()); proccessedOvfGenerationsInfo.add(template.getDb_generation()); } } } } return vmsAndTemplateMetadata; }</code><technical_language>autobixing</technical_language>

Target:
protected Map<Guid, KeyValuePairCompat<String, List<Guid>>> populateTemplatesMetadataForOvfUpdate(List<Guid> idsToProcess) { Map<Guid, KeyValuePairCompat<String, List<Guid>>> vmsAndTemplateMetadata = new HashMap<Guid, KeyValuePairCompat<String, List<Guid>>>(); List<VmTemplate> templates = getVmTemplateDao().getVmTemplatesByIds(idsToProcess); for (VmTemplate template : templates) { if (VmTemplateStatus.Locked != template.getstatus()) { updateTemplateDisksFromDb(template); boolean verifyDisksNotLocked = verifyDisksNotLocked(template.getDiskList()); if (verifyDisksNotLocked) { loadTemplateData(template); Long currentDbGeneration = getVmStaticDao().getDbGeneration(template.getId()); if (template.getDb_generation().equals(currentDbGeneration)) { buildMetadataDictionaryForTemplate(template, vmsAndTemplateMetadata); proccessedIdsInfo.add(template.getId()); proccessedOvfGenerationsInfo.add(template.getDb_generation()); } } } } return vmsAndTemplateMetadata; }
Source:
<code>public void changePassword_admin_Async_nonLooperThreadThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalStateException.class); <START> user.changePasswordAsync("old", "new", new SyncUser.Callback() { <END> @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { fail(); } }); }</code><technical_language>"old" is user identifier, right? I rename</technical_language>

Target:
public void changePassword_admin_Async_nonLooperThreadThrows() { SyncUser user = createTestUser(); thrown.expect(IllegalStateException.class); user.changePasswordAsync("user-id", "new", new SyncUser.Callback() { @Override public void onSuccess(SyncUser user) { fail(); } @Override public void onError(ObjectServerError error) { fail(); } }); }
Source:
<code>public SimpleResourceDefinition(Parameters parameters) { this.pathElement = parameters.pathElement; this.descriptionResolver = parameters.descriptionResolver; this.addHandler = parameters.addHandler; this.removeHandler = parameters.removeHandler; this.addRestartLevel = parameters.addRestartLevel; this.removeRestartLevel = parameters.removeRestartLevel; this.deprecationData = parameters.deprecationData; this.runtime = parameters.runtime; this.orderedChild = parameters.orderedChildResource; this.descriptionProvider = null; this.capabilities = parameters.capabilities != null ? parameters.capabilities : NO_CAPABILITIES ; this.incorporatingCapabilities = parameters.incorporatingCapabilities; if (parameters.accessConstraints != null) { this.accessConstraints = Arrays.asList(parameters.accessConstraints); } else { this.accessConstraints = Collections.emptyList(); } <START> if(parameters.requirements != null) { <END> this.requirements = new HashSet<>(parameters.requirements); } else { this.requirements = Collections.emptySet(); } this.minOccurs = parameters.minOccurs; this.maxOccurs = parameters.maxOccurs; }</code><technical_language>parameters.requirements instantiated empty collection check if null here</technical_language>

Target:
public SimpleResourceDefinition(Parameters parameters) { this.pathElement = parameters.pathElement; this.descriptionResolver = parameters.descriptionResolver; this.addHandler = parameters.addHandler; this.removeHandler = parameters.removeHandler; this.addRestartLevel = parameters.addRestartLevel; this.removeRestartLevel = parameters.removeRestartLevel; this.deprecationData = parameters.deprecationData; this.runtime = parameters.runtime; this.orderedChild = parameters.orderedChildResource; this.descriptionProvider = null; this.capabilities = parameters.capabilities != null ? parameters.capabilities : NO_CAPABILITIES ; this.incorporatingCapabilities = parameters.incorporatingCapabilities; if (parameters.accessConstraints != null) { this.accessConstraints = Arrays.asList(parameters.accessConstraints); } else { this.accessConstraints = Collections.emptyList(); } this.requirements = new HashSet<>(parameters.requirements); this.minOccurs = parameters.minOccurs; this.maxOccurs = parameters.maxOccurs; }
Source:
<code>public void setAttribute(PerunSession sess, Resource resource, Member member, Attribute attribute) throws PrivilegeException, ResourceNotExistsException, InternalErrorException, MemberNotExistsException, AttributeNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getPerunBl().getResourcesManagerBl().checkResourceExists(sess, resource); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); attribute = this.perunBl.getAttributesManagerBl().convertBlankStringIntoNullInAttrValue(sess, attribute); <START> getAttributesManagerBl().checkAttributeExists(sess, attribute); <END> if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, resource, member)) throw new PrivilegeException("Principal has no access to set attribute = " + new AttributeDefinition(attribute)); getAttributesManagerBl().setAttribute(sess, resource, member, attribute); }</code><technical_language>is information in Commit moving checkAttributeExists method convert method. Is needed checkAttributeExists convert method</technical_language>

Target:
public void setAttribute(PerunSession sess, Resource resource, Member member, Attribute attribute) throws PrivilegeException, ResourceNotExistsException, InternalErrorException, MemberNotExistsException, AttributeNotExistsException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Utils.checkPerunSession(sess); getAttributesManagerBl().checkAttributeExists(sess, attribute); getPerunBl().getResourcesManagerBl().checkResourceExists(sess, resource); getPerunBl().getMembersManagerBl().checkMemberExists(sess, member); attribute = this.perunBl.getAttributesManagerBl().convertEmptyStringIntoNullInAttrValue(sess, attribute); if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, resource, member)) throw new PrivilegeException("Principal has no access to set attribute = " + new AttributeDefinition(attribute)); getAttributesManagerBl().setAttribute(sess, resource, member, attribute); }
Source:
<code>public void onPrepareOptionsMenu(Menu menu) { menu.clear(); if (isClientActive) { menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants .DATA_TABLE_CLIENTS_NAME); menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint)); menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges)); menu.add(Menu.NONE, MENU_ITEM_ADD_SAVINGS_ACCOUNT, Menu.NONE, getString(R.string .savings_account)); menu.add(Menu.NONE, MENU_ITEM_ADD_LOAN_ACCOUNT, Menu.NONE, getString(R.string.add_loan)); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getString(R.string.documents)); menu.add(Menu.NONE, MENU_ITEM_UPLOAD_SIGN, Menu.NONE, R.string.upload_sign); menu.add(Menu.NONE, MENU_ITEM_IDENTIFIERS, Menu.NONE, getString(R.string.identifiers)); menu.add(Menu.NONE, MENU_ITEM_NOTE, Menu.NONE, getString(R.string.note)); } <START> menu.add(Menu.NONE, MENU_ITEM_SURVEYS, Menu.NONE, getString(R.string.survey)); <END> super.onPrepareOptionsMenu(menu); }</code><technical_language>I this line need change</technical_language>

Target:
public void onPrepareOptionsMenu(Menu menu) { menu.clear(); if (isClientActive) { menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants .DATA_TABLE_CLIENTS_NAME); menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint)); menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges)); menu.add(Menu.NONE, MENU_ITEM_ADD_SAVINGS_ACCOUNT, Menu.NONE, getString(R.string .savings_account)); menu.add(Menu.NONE, MENU_ITEM_ADD_LOAN_ACCOUNT, Menu.NONE, getString(R.string.add_loan)); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getString(R.string.documents)); menu.add(Menu.NONE, MENU_ITEM_UPLOAD_SIGN, Menu.NONE, R.string.upload_sign); menu.add(Menu.NONE, MENU_ITEM_IDENTIFIERS, Menu.NONE, getString(R.string.identifiers)); menu.add(Menu.NONE, MENU_ITEM_SURVEYS, Menu.NONE, getString(R.string.survey)); menu.add(Menu.NONE, MENU_ITEM_NOTE, Menu.NONE, getString(R.string.note)); } super.onPrepareOptionsMenu(menu); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> this.addCustomValue("DiskAlias", <END> getDiskImage().getDiskAlias()); return getSucceeded() ? AuditLogType.USER_REGISTER_DISK_FINISHED_SUCCESS : AuditLogType.USER_REGISTER_DISK_FINISHED_FAILURE; }</code><technical_language>do need "this."</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue("DiskAlias", getDiskImage().getDiskAlias()); return getSucceeded() ? AuditLogType.USER_REGISTER_DISK_FINISHED_SUCCESS : AuditLogType.USER_REGISTER_DISK_FINISHED_FAILURE; }
Source:
<code>private void testDropTable() throws SQLException { <START> for (final boolean stdDropTableRestrict : new boolean[] { true, false }) { <END> _testDropTable(stdDropTableRestrict); } }</code><technical_language>please move test cases TestDrop</technical_language>

Target:
private void testDropTable() throws SQLException { trace("testDropTable"); final boolean[] booleans = new boolean[] { true, false }; for (final boolean stdDropTableRestrict : booleans) { for (final boolean restrict : booleans) { testDropTableNoReference(stdDropTableRestrict, restrict); testDropTableViewReference(stdDropTableRestrict, restrict); testDropTableForeignKeyReference(stdDropTableRestrict, restrict); } } }
Source:
<code>public Optional<String> getToscaType(String type, String version) { try { CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version); for (Object o : catalogEntitySummary.getTags()) { Map<String, ?> map = (Map<String, ?>) o; if (map.containsKey("traits")) { List<String> traits = (List<String>) map.get("traits"); for (String key : typeMapping.keySet()) { if (traits.contains(key)) { return Optional.of(typeMapping.get(key)); } } } } } catch (Exception e) { <START> <END> } return Optional.fromNullable(typeMapping.get(type)); }</code><technical_language>log least</technical_language>

Target:
public Optional<String> getToscaType(String type, String version) { try { CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version); Collection<Object> tags = Objects.firstNonNull(catalogEntitySummary.getTags(), ImmutableList.of()); for (Object o : tags) { Map<String, ?> map = (Map<String, ?>) o; if (map.containsKey("traits")) { Collection<String> traits = ImmutableSet.copyOf((Collection<String>) map.get("traits")); for (String key : typeMapping.keySet()) { if (traits.contains(key)) { return Optional.of(typeMapping.get(key)); } } } } } catch (Exception e) { LOG.info("Error getting entity {}: {}", type, e); } return Optional.fromNullable(typeMapping.get(type)); }
Source:
<code>protected String[] validate(Object value, int arrayLength, String message) { <START> if (!Object[].class.isInstance(value)) { <END> throw new NuxeoException(String.format("Expected %s found %s", Object[].class, value.getClass()), SC_BAD_REQUEST); } Object[] values = Object[].class.cast(value); if (values.length != arrayLength) { throw new NuxeoException(String.format("Hint:%s requires %s parameters: %s", getClass().getSimpleName(), arrayLength, message), SC_BAD_REQUEST); } return Arrays.stream(values).toArray(String[]::new); }</code><technical_language>if (!(value instanceof Object[]))</technical_language>

Target:
protected String[] validate(Object value, int arrayLength, String message) { if (!(value instanceof Object[])) { throw new NuxeoException(String.format("Expected an array, found %s", value.getClass()), SC_BAD_REQUEST); } Object[] values = (Object[]) value; if (values.length != arrayLength) { throw new NuxeoException(String.format("Hints: %s requires %s parameters: %s", getClass().getSimpleName(), arrayLength, message), SC_BAD_REQUEST); } return Arrays.asList(values).toArray(new String[0]); }
Source:
<code>char fixMnemonic (String string, boolean replace, boolean removeAppended) { int length = string.length (); char text = new char [length]; string.getChars (0, length, text, 0); int i = 0, j = 0; char result = new char [length * 2]; while (i < length) { switch (text [i]) { case '&': if (i + 1 < length && text [i + 1] == '&') { result [j++] = text [i++]; } else { if (replace) result [j++] = '_'; } i++; break; case '(': if (removeAppended && i + 4 == string.length () && text [i + 1] == '&' && text [i + 3] == ')') { if (replace) result [j++] = ' '; i += 4; } else { <START> for (int k = i; k < i + 4 && k < length; k++) { result[j++] = text[k]; } i = i + 4; <END> } break; case '_': if (text [i] == '_' && replace) result [j++] = '_'; default: result [j++] = text [i++]; } } return result; }</code><technical_language>simplification done is replacing for loop call outer while loop running: result[j++] = text[i++];</technical_language>

Target:
char fixMnemonic (String string, boolean replace, boolean removeAppended) { int length = string.length (); char text = new char [length]; string.getChars (0, length, text, 0); int i = 0, j = 0; char result = new char [length * 2]; while (i < length) { switch (text [i]) { case '&': if (i + 1 < length && text [i + 1] == '&') { result [j++] = text [i++]; } else { if (replace) result [j++] = '_'; } i++; break; case '(': if (removeAppended && i + 4 == string.length () && text [i + 1] == '&' && text [i + 3] == ')') { if (replace) result [j++] = ' '; i += 4; break; } case '_': if (replace) result [j++] = '_'; default: result [j++] = text [i++]; } } return result; }
Source:
<code>protected void editTextAndVerify(ResourceAddress address, String identifier, String attributeName, String value) throws IOException, InterruptedException { <START> ConfigFragment config = page.getConfigFragment(); <END> config.edit().text(identifier, value); config.save(); reloadIfRequiredAndWaitForRunning(); verifier.verifyAttribute(address, attributeName, value); }</code><technical_language>Please move code UI abstraction</technical_language>

Target:
protected void editTextAndVerify(ResourceAddress address, String identifier, String attributeName, String value) throws IOException, InterruptedException { page.getConfigFragment().editTextAndSave(identifier, value); reloadIfRequiredAndWaitForRunning(); verifier.verifyAttribute(address, attributeName, value); }
Source:
<code>private Future<Void> dkimFuture(Context context, EncodedPart encodedPart) { Promise<Void> promise = Promise.promise(); List<Future> dkimFutures = new ArrayList<>(); dkimSigners.forEach(dkim -> dkimFutures.add(dkim.signEmail(context, encodedPart))); <START> CompositeFuture.all(dkimFutures).setHandler(r -> { <END> if (r.succeeded()) { try { List<String> dkimHeaders = dkimFutures.stream().map(f -> f.result().toString()).collect(Collectors.toList()); encodedPart.headers().add(DKIMSigner.DKIM_SIGNATURE_HEADER, dkimHeaders); } finally { promise.complete(); } } else { promise.fail(r.cause()); } }); return promise.future(); }</code><technical_language>instead do: Composite.all(list).map(f) instead of creating a Promise completing in CompositeFuture handler</technical_language>

Target:
private Future<Void> dkimFuture(Context context, EncodedPart encodedPart) { List<Future> dkimFutures = new ArrayList<>(); dkimSigners.forEach(dkim -> dkimFutures.add(dkim.signEmail(context, encodedPart))); return CompositeFuture.all(dkimFutures).map(f -> { List<String> dkimHeaders = dkimFutures.stream().map(fr -> fr.result().toString()).collect(Collectors.toList()); encodedPart.headers().add(DKIMSigner.DKIM_SIGNATURE_HEADER, dkimHeaders); return null; }); }
Source:
<code>public String describe() { StringBuffer sb = new StringBuffer("KafkaIndexWriter\n"); sb.append("\t").append(KafkaConstants.HOST).append(" : hostname \n"); sb.append("\t").append(KafkaConstants.PORT).append(" : port \n"); sb.append("\t").append(KafkaConstants.INDEX) <START> .append(" : Kafka index command \n"); <END> return sb.toString(); }</code><technical_language>commit() close producer (producer.close()) release system resources it</technical_language>

Target:
public Map<String, Map.Entry<String, Object>> describe() { Map<String, Map.Entry<String, Object>> properties = new LinkedHashMap<>(); properties.put(KafkaConstants.HOST, new AbstractMap.SimpleEntry<>( "Location of the host Kafka cluster to connect to using producerConfig", this.host)); properties.put(KafkaConstants.PORT, new AbstractMap.SimpleEntry<>( "The port to connect to using the producerConfig", this.port)); properties.put(KafkaConstants.TOPIC, new AbstractMap.SimpleEntry<>( "Default index to attach to documents", this.topic)); properties.put(KafkaConstants.KEY_SERIALIZER, new AbstractMap.SimpleEntry<>( "instruct how to turn the key object the user provides with their ProducerRecord into bytes", this.keySerializer)); properties.put(KafkaConstants.VALUE_SERIALIZER, new AbstractMap.SimpleEntry<>( "instruct how to turn the value object the user provides with their ProducerRecord into bytes", this.valueSerializer)); properties.put(KafkaConstants.MAX_DOC_COUNT, new AbstractMap.SimpleEntry<>( "Maximum number of documents before a commit is forced", this.maxDocCount)); return properties; }
Source:
<code>public String toString() { StringBuilder buffer = new StringBuilder(); for (byte <START> fBit : <END> fBits) appendByteString(buffer, fBit); return buffer.toString(); }</code><technical_language>rename bit</technical_language>

Target:
public String toString() { StringBuilder buffer = new StringBuilder(); for (byte bit : fBits) appendByteString(buffer, bit); return buffer.toString(); }
Source:
<code>public void expandsCompositeValueAsList() { UriTemplate template = new UriTemplate("/foo{&bar,foobar*}"); assertVariables(template, new TemplateVariable("bar", VariableType.REQUEST_PARAM_CONTINUED), new TemplateVariable("foobar", VariableType.COMPOSITE_PARAM)); String expandedTemplate = template.expand(new HashMap<String, Object>(){{ put("bar", "barExpanded"); put("foobar", new ArrayList<String>(){{ <START> add("foo1"); <END> add("foo2"); }}); }}).toString(); assertThat(expandedTemplate, is("/foo?bar=barExpanded&foobar=foo1&foobar=foo2")); }</code><technical_language>do Arrays.asList("foo1", "foo2")</technical_language>

Target:
public void expandsCompositeValueAsList() { UriTemplate template = new UriTemplate("/foo{&bar,foobar*}"); String expandedTemplate = template.expand(new HashMap<String, Object>(){{ put("bar", "barExpanded"); put("foobar", Arrays.asList("foo1", "foo2")); }}).toString(); assertThat(expandedTemplate, is("/foo?bar=barExpanded&foobar=foo1&foobar=foo2")); }
Source:
<code>public boolean start(@NotNull final JmxConnect jmxConnect) { if (!super.start(jmxConnect)) { return false; } <START> LOGGER.info("Initiated repair job for keyspaces {}", getRemainingKeyspaces()); <END> return true; }</code><technical_language>Copy-paste error, this a repair job</technical_language>

Target:
public boolean start(@NotNull final JmxConnect jmxConnect) { if (!super.start(jmxConnect)) { return false; } LOGGER.info("Initiated backup job for keyspaces {}", getRemainingKeyspaces()); return true; }
Source:
<code>public void theEntityDeviceModelExists(final Map<String, String> expectedEntity) throws Throwable { <START> final Manufacturer manufacturer = new Manufacturer(); <END> final String modelCode = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_MODELCODE, Defaults.DEFAULT_DEVICE_MODEL_MODEL_CODE); final String modelDescription = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_DESCRIPTION, Defaults.DEFAULT_DEVICE_MODEL_DESCRIPTION); final boolean modelMetered = getBoolean(expectedEntity, Keys.KEY_DEVICE_MODEL_METERED, Defaults.DEFAULT_DEVICE_MODEL_METERED); manufacturer .setManufacturerId(getString(expectedEntity, Keys.MANUFACTURER_ID, Defaults.DEFAULT_MANUFACTURER_ID)); final List<DeviceModel> entityList = this.repo.findByManufacturerId(manufacturer); for (final DeviceModel deviceModel : entityList) { if (deviceModel.getModelCode().equals(modelCode)) { Assert.assertEquals(modelDescription, deviceModel.getDescription()); Assert.assertEquals(modelMetered, deviceModel.isMetered()); return; } } Assert.assertFalse(true); }</code><technical_language>choose stick code belongs together, put declaration of Manufacturer object place needed</technical_language>

Target:
public void theEntityDeviceModelExists(final Map<String, String> expectedEntity) throws Throwable { final String modelCode = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_MODELCODE, Defaults.DEFAULT_DEVICE_MODEL_MODEL_CODE); final String modelDescription = getString(expectedEntity, Keys.KEY_DEVICE_MODEL_DESCRIPTION, Defaults.DEFAULT_DEVICE_MODEL_DESCRIPTION); final boolean modelMetered = getBoolean(expectedEntity, Keys.KEY_DEVICE_MODEL_METERED, Defaults.DEFAULT_DEVICE_MODEL_METERED); final Manufacturer manufacturer = new Manufacturer(); manufacturer .setManufacturerId(getString(expectedEntity, Keys.MANUFACTURER_ID, Defaults.DEFAULT_MANUFACTURER_ID)); final List<DeviceModel> entityList = this.repo.findByManufacturerId(manufacturer); for (final DeviceModel deviceModel : entityList) { if (deviceModel.getModelCode().equals(modelCode)) { Assert.assertEquals(modelDescription, deviceModel.getDescription()); Assert.assertEquals(modelMetered, deviceModel.isMetered()); return; } } Assert.assertFalse(true); }
Source:
<code>protected void onResume() { <START> super.onResume();; <END> if (mCurrentCard == null || mIndex < 0) { Timber.e("CardTemplatePreviewer started with empty card list or invalid index"); finishWithoutAnimation(); } }</code><technical_language>Double ;;</technical_language>

Target:
protected void onResume() { super.onResume(); if (mCurrentCard == null || mOrdinal < 0) { Timber.e("CardTemplatePreviewer started with empty card list or invalid index"); finishWithoutAnimation(); return; } }
Source:
<code>public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); ProcessTaskWrapper<String> t = SshTasks.newSshExecTaskFactory(loc, cmd) .requiringZeroAndReturningStdout().newTask(); <START> String output = exec.submit(t).get(); <END> assertTrue(output.contains(port+" still in use"), "output="+output); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); String cmd2 = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); ProcessTaskWrapper<String> t2 = SshTasks.newSshExecTaskFactory(loc, cmd2) .requiringZeroAndReturningStdout().newTask(); String output2 = exec.submit(t2).get(); assertFalse(output2.contains("still in use"), "output="+output2); } finally { serverSocket.close(); } }</code><technical_language>extract this mechanism for executing commands a standalone method. Java public static Integer execCommandsAtLocation(Location loc, String... cmds) { /* TODO */ } public static Integer execCommandsAtLocation(Location loc, Iterable<String> cmds) { /* TODO */ }</technical_language>

Target:
public void testWaitForPortFreeWhenNotAbortingOnTimeout() throws Exception { ServerSocket serverSocket = openServerSocket(); try { int port = serverSocket.getLocalPort(); String cmd = BashCommands.waitForPortFree(port, Duration.ONE_SECOND, false); String output = execRequiringZeroAndReturningStdout(loc, cmd).get(); assertTrue(output.contains(port+" still in use"), "output="+output); serverSocket.close(); assertTrue(Networking.isPortAvailable(port)); String output2 = execRequiringZeroAndReturningStdout(loc, cmd).get(); assertFalse(output2.contains("still in use"), "output="+output2); } finally { serverSocket.close(); } }
Source:
<code>public void clearJob(JobID jobID) throws IOException { checkNotNull(jobID); try { kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { <START> configMap.getData().remove(getKeyForJobId(jobID)); return Optional.of(configMap); <END> } return Optional.empty(); } ).get(); } catch (Exception e) { throw new IOException("Failed to clear job state in ConfigMap " + configMapName + " for job " + jobID, e); } }</code><technical_language>check original try avoid update if is changed</technical_language>

Target:
public void clearJob(JobID jobID) throws IOException { checkNotNull(jobID); try { kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { if (configMap.getData().remove(getKeyForJobId(jobID)) != null) { return Optional.of(configMap); } } return Optional.empty(); } ).get(); } catch (Exception e) { throw new IOException("Failed to clear job state in ConfigMap " + configMapName + " for job " + jobID, e); } }
Source:
<code>public static byte[] hashPassword(final char[] password, final byte[] salt, final int iterations) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); SecretKey key = keyFactory.generateSecret( new PBEKeySpec( password, salt, iterations, KEY_LENGTH ) ); return key.getEncoded(); } catch (InvalidKeySpecException ikse) { log.error("WTF? invalid keyspec"); throw new RuntimeException(ikse); } catch (NoSuchAlgorithmException nsae) { <START> log.error("%s not supported on this system.", ALGORITHM); <END> throw new RuntimeException(nsae); } }</code><technical_language>Please address <LINK_0></technical_language>

Target:
public static byte[] hashPassword(final char[] password, final byte[] salt, final int iterations) { try { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM); SecretKey key = keyFactory.generateSecret( new PBEKeySpec( password, salt, iterations, KEY_LENGTH ) ); return key.getEncoded(); } catch (InvalidKeySpecException ikse) { log.error("WTF? invalid keyspec"); throw new RuntimeException("WTF? invalid keyspec", ikse); } catch (NoSuchAlgorithmException nsae) { log.error("%s not supported on this system.", ALGORITHM); throw new RuntimeException(StringUtils.format("%s not supported on this system.", ALGORITHM), nsae); } }
Source:
<code>private void lookupGetChildrenMethod() { if (_getChildrenMethod != null) { return; } <START> try { if (GETCHILDREN_PAGINATION_DISABLED) { lookupNonPaginatedGetChildren(); } else { _getChildrenMethod = ZooKeeper.class.getMethod("getAllChildrenPaginated", String.class, boolean.class); } } catch (NoSuchMethodException e1) { lookupNonPaginatedGetChildren(); } <END> LOG.info("Pagination config {}={}, method to be invoked: {}", ZkSystemPropertyKeys.ZK_GETCHILDREN_PAGINATION_DISABLED, GETCHILDREN_PAGINATION_DISABLED, _getChildrenMethod.getName()); }</code><technical_language>nit, logic? if (! GETCHILDREN_PAGINATION_DISABLED) { try { _getChildrenMethod = ZooKeeper.class.getMethod("getAllChildrenPaginated", String.class, boolean.class); return; } catch (...) { log... } } lookupNonPaginatedGetChildren(); return;</technical_language>

Target:
private void lookupGetChildrenMethod() { _getChildrenMethod = doLookUpGetChildrenMethod(); LOG.info("Pagination config {}={}, method to be invoked: {}", ZkSystemPropertyKeys.ZK_GETCHILDREN_PAGINATION_DISABLED, GETCHILDREN_PAGINATION_DISABLED, _getChildrenMethod.getName()); }
Source:
<code>public void processLeftData(final MistDataEvent input) { <START> S state = initializeStateFunc.apply(null); <END> final Collection<IN> value = (Collection<IN>) input.getValue(); final Iterator<IN> iterator = value.iterator(); while(iterator.hasNext()) { final IN data = iterator.next(); state = updateStateFunc.apply(data, state); } input.setValue(produceResultFunc.apply(state)); outputEmitter.emitData(input); }</code><technical_language>I applying null is good</technical_language>

Target:
public void processLeftData(final MistDataEvent input) { S state = initializeStateSup.get(); if (input.getValue() instanceof Collection) { final Collection<IN> value = (Collection<IN>) input.getValue(); final Iterator<IN> iterator = value.iterator(); while (iterator.hasNext()) { final IN data = iterator.next(); state = updateStateFunc.apply(data, state); } input.setValue(produceResultFunc.apply(state)); outputEmitter.emitData(input); } else { throw new TypeMismatchException( "The input value for aggregate window operator is not an instance of collection."); } }
Source:
<code>private List<VMWithPlugInfo> getVmsWithPlugInfo(Guid id) { <START> List<VMWithPlugInfo> vmsWithPlugInfo = <END> getCallsHandler().executeReadList ("GetVmsByDiskId", VMWithPlugInfoRowMapper.instance, getCustomMapSqlParameterSource().addValue("disk_guid", id)); return vmsWithPlugInfo; }</code><technical_language>return , need for variable</technical_language>

Target:
private List<VMWithPlugInfo> getVmsWithPlugInfo(Guid id) { return getCallsHandler().executeReadList ("GetVmsByDiskId", VMWithPlugInfoRowMapper.instance, getCustomMapSqlParameterSource().addValue("disk_guid", id)); }