auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void clone(Q query) { super.clone(query); this.cachable = query.cachable; <START> this.binds.addBinds((List) query.binds.getArgs()); <END> }</code><technical_language>Operation objects immutable? copy</technical_language>

Target:
protected void clone(Q query) { super.clone(query); this.cachable = query.cachable; this.binds.addBinds(((Operation) query.binds.accept(new ReplaceVisitor<Void>(), null)).getArgs()); }
Source:
<code>public void clearImports() { unloadJavaExtensions(this.imports); <START> this.imports.clear(); <END> }</code><technical_language>clear couldNotBeLoaded</technical_language>

Target:
public void clearImports() { unloadJavaExtensions(this.imports); this.imports.clear(); this.couldNotBeLoaded.clear(); }
Source:
<code>public void postReport(String urlString, Report report, Map<String, String> headers) throws NetworkException, BadResponseException { try { <START> nullCheckLatch.await(20, TimeUnit.MILLISECONDS); <END> } catch (InterruptedException exception) { exception.printStackTrace(); } super.postReport(urlString, report, headers); }</code><technical_language>Is worth extending this timeout? AFIACT effect correct working of latch, prevent issues if tests running especially slow device/simulator</technical_language>

Target:
public void postReport(String urlString, Report report, Map<String, String> headers) throws NetworkException, BadResponseException { try { nullCheckLatch.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException exception) { exception.printStackTrace(); } super.postReport(urlString, report, headers); }
Source:
<code>public AggregateResult aggregate(KeyType key) { try { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer.remaining() != keySize) { throw new IAE( "keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize ); } final int prevRecordOffset = curWriteIndex * recordSize; if (curWriteIndex == -1 || !keyEquals(keyBuffer, buffer, prevRecordOffset)) { initNewSlot(keyBuffer); } final int curRecordOffset = curWriteIndex * recordSize; for (int i = 0; i < aggregatorOffsets.length; i++) { aggregators[i].aggregate(buffer, curRecordOffset + aggregatorOffsets[i]); } return AggregateResult.ok(); } <START> catch (Throwable t) { <END> finish(); throw t; } }</code><technical_language>Suggested RuntimeException</technical_language>

Target:
public AggregateResult aggregate(KeyType key) { try { final ByteBuffer keyBuffer = keySerde.toByteBuffer(key); if (keyBuffer.remaining() != keySize) { throw new IAE( "keySerde.toByteBuffer(key).remaining[%s] != keySerde.keySize[%s], buffer was the wrong size?!", keyBuffer.remaining(), keySize ); } final int prevRecordOffset = curWriteIndex * recordSize; if (curWriteIndex == -1 || !keyEquals(keyBuffer, buffer, prevRecordOffset)) { initNewSlot(keyBuffer); } final int curRecordOffset = curWriteIndex * recordSize; for (int i = 0; i < aggregatorOffsets.length; i++) { aggregators[i].aggregate(buffer, curRecordOffset + aggregatorOffsets[i]); } return AggregateResult.ok(); } catch (RuntimeException e) { finished = true; throw e; } }
Source:
<code>public void testManyFiles() throws Exception { FileList files = new FileList(); List<File> fl = new ArrayList<>(); File f1 = new File(); fl.add(f1); File f2 = new File(); fl.add(f2); files.setFiles(fl); String q1 = "name='A' and 'root' in parents and mimeType='application/vnd.google-apps.folder'"; when(drive.files().list().setQ(q1).execute()).thenReturn(files); when(drive.files().list().setQ(anyString()).execute()).thenReturn(files); properties.file.setValue("/A"); testRuntime.initialize(container, properties); testRuntime.runAtDriver(container); <START> fail("Should not be herer"); <END> }</code><technical_language>instead of herer</technical_language>

Target:
public void testManyFiles() throws Exception { FileList files = new FileList(); List<File> fl = new ArrayList<>(); File f1 = new File(); fl.add(f1); File f2 = new File(); fl.add(f2); files.setFiles(fl); String q1 = "name='A' and 'root' in parents and mimeType='application/vnd.google-apps.folder'"; when(drive.files().list().setQ(q1).execute()).thenReturn(files); when(drive.files().list().setQ(anyString()).execute()).thenReturn(files); properties.file.setValue("/A"); testRuntime.initialize(container, properties); testRuntime.runAtDriver(container); fail("Should not be here"); }
Source:
<code><START> private void buildScript(Site site) { <END> currentScript.add(new BecauseYouReadClient(site)); currentScript.add(new ContinueReadingClient()); currentScript.add(new IntegerListClient()); }</code><technical_language>This client want access to, "request a new full page of cards"</technical_language>

Target:
private void buildScript(Site site) { pendingClients.add(new BecauseYouReadClient(site)); pendingClients.add(new ContinueReadingClient()); pendingClients.add(new IntegerListClient()); }
Source:
<code>private boolean usesCatalogsAsSchemas(DatabaseMetaData metaData) { boolean result = true; ResultSet rs = null; try { rs = metaData.getSchemas(); while (rs.next() && result) { result = false; } } catch (SQLException e) { throw JdbcUtils.wrapException(e, "retrieve schema and catalog metadata", JdbcActionType.METADATA); } finally { <START> if(rs != null) { <END> try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } close(null); } return result; }</code><technical_language>minor, code style conventions a space if (</technical_language>

Target:
private boolean usesCatalogsAsSchemas(DatabaseMetaData metaData) { boolean result = true; ResultSet rs = null; try { rs = metaData.getSchemas(); while (rs.next() && result) { result = false; } } catch (SQLException e) { throw JdbcUtils.wrapException(e, "retrieve schema and catalog metadata", JdbcActionType.METADATA); } finally { FileHelper.safeClose(rs); } return result; }
Source:
<code>public PasswordVerificationResult checkPassword(String username, String password) { <START> if (Strings.isFilled(passwordHash)) { <END> for (PasswordHashFunction hashFunction : hashFunctions) { String givenPasswordHash = hashFunction.computeHash(username, salt, password); if (Strings.isFilled(givenPasswordHash) && Strings.areEqual(givenPasswordHash, passwordHash)) { return hashFunction.isOutdated() ? PasswordVerificationResult.VALID_NEEDS_RE_HASH : PasswordVerificationResult.VALID; } } } return PasswordVerificationResult.INVALID; }</code><technical_language>invert abort early</technical_language>

Target:
public PasswordVerificationResult checkPassword(String username, String password) { if (!Strings.isFilled(passwordHash)) { return PasswordVerificationResult.INVALID; } for (PasswordHashFunction hashFunction : hashFunctions) { String givenPasswordHash = hashFunction.computeHash(username, salt, password); if (Strings.isFilled(givenPasswordHash) && Strings.areEqual(givenPasswordHash, passwordHash)) { return hashFunction.isOutdated() ? PasswordVerificationResult.VALID_NEEDS_RE_HASH : PasswordVerificationResult.VALID; } } return PasswordVerificationResult.INVALID; }
Source:
<code>public Set<Change.Id> call() { final Map<Change.Id, Change> resultChanges = new HashMap<Change.Id, Change>(); AccountAccess dbAccounts = db.accounts(); try { Set<Account.Id> accountSources = getAccountSources(db, userName); for (Account.Id account : accountSources) { process(db, account, resultChanges); } } catch(OrmException ex) { <START> throw new RuntimeException(ex); <END> } return resultChanges.keySet(); }</code><technical_language>Ick. prefer implement Callable declare this method throw OrmException. Wrapping a checked exception in unchecked RuntimeException meet interface need meet is a good idea</technical_language>

Target:
public Set<Change.Id> call() throws OrmException { final Map<Change.Id, Change> resultChanges = new HashMap<Change.Id, Change>(); AccountAccess dbAccounts = db.accounts(); Set<Account.Id> accountSources = getAccountSources(db, userName); for (Account.Id account : accountSources) { process(db, account, resultChanges); } return resultChanges.keySet(); }
Source:
<code>public final Object setBufferSize(final SFileDescriptor file, final int size) { file.setBufferSize(size); <START> return Nil.nilObject; <END> }</code><technical_language>nicer return file</technical_language>

Target:
public final boolean setBufferSize(final SFileDescriptor file, final int size) { if (!file.isClosed()) { return false; } file.setBufferSize(size); return true; }
Source:
<code>public int readMarker(SequenceFile.Reader reader) throws IOException { if (valueBytes == null) { valueBytes = reader.createValueBytes(); } rawKey.reset(); value.reset(); int status = reader.nextRaw(rawKey, valueBytes); if (status != -1 && isMarkerValid()) { valueBytes.writeUncompressedBytes(valueDataStream); valueDataStream.flush(); return Ints.fromByteArray(value.toByteArray()); } if (status != -1) { throw new IOException(String.format("Invalid key for num entries appended found %s, expected : %s", new String(rawKey.getData()), TxConstants.TransactionLog.NUM_ENTRIES_APPENDED)); } <START> return -1; <END> }</code><technical_language>If handle EOF case first, other conditions simple. code easy read. do say</technical_language>

Target:
public int readMarker(SequenceFile.Reader reader) throws IOException { if (valueBytes == null) { valueBytes = reader.createValueBytes(); } rawKey.reset(); rawValue.reset(); int status = reader.nextRaw(rawKey, valueBytes); if (status == -1) { return -1; } if (isMarkerValid()) { valueBytes.writeUncompressedBytes(rawValue); rawValue.flush(); return Ints.fromByteArray(rawValue.getData()); } throw new IOException(String.format("Invalid key for num entries appended found %s, expected : %s", new String(rawKey.getData()), TxConstants.TransactionLog.NUM_ENTRIES_APPENDED)); }
Source:
<code><START> public CpkScopeInfo getEncryptionScope() { <END> return encryptionScope; }</code><technical_language>getter renamed</technical_language>

Target:
public String getEncryptionScope() { if (encryptionScope == null) { return null; } return encryptionScope.getEncryptionScope(); }
Source:
<code>public StandaloneKieServerControllerImpl() { super(); ServiceLoader<KieServerTemplateStorage> storages = ServiceLoader.load(KieServerTemplateStorage.class); if (storages != null && storages.iterator().hasNext()) { KieServerTemplateStorage storage = storages.iterator().next(); this.setTemplateStorage(storage); logger.debug("Server template storage for standalone kie server controller is {}",storage.getClass().getName()); <START> if (this.getTemplateStorage() instanceof FileBasedKieServerTemplateStorage) { <END> logger.debug("Server template storage location is {}",((FileBasedKieServerTemplateStorage)storage).getTemplatesLocation()); } } }</code><technical_language>instead of this if implement this part of toString method of FileBasedKieServerTemplateStorage generic reusable modifying this class for new implementations of storage</technical_language>

Target:
public StandaloneKieServerControllerImpl() { super(); ServiceLoader<PersistingServerTemplateStorageService> storageServices = ServiceLoader.load(PersistingServerTemplateStorageService.class); if (storageServices != null && storageServices.iterator().hasNext()) { PersistingServerTemplateStorageService storageService = storageServices.iterator().next(); this.setTemplateStorage(storageService.getTemplateStorage()); logger.debug("Server template storage for standalone kie server controller is {}", storageService.getTemplateStorage().toString()); } else { logger.warn("No server template storage defined. Default storage: InMemoryKieServerTemplateStorage will be used"); } }
Source:
<code>private void setCheckBoxClickListener(final int dishId) { mViewHolder.dishCheckBox.setId(dishId); mViewHolder.dishCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { OrderManager orderManager = OrderManager.getInstance(); DatabaseHelper dbHelper = DatabaseHelper.getInstance(); <START> int categoryId = (int) dbHelper.getDishCategoryId(dishId); <END> if (isChecked) { orderManager.addOneDish(dishId, categoryId); } else { orderManager.removeDish(dishId, categoryId); } } }); }</code><technical_language>id attribute in eOrder is defined long type. In opinion, need switch type of variate long. others</technical_language>

Target:
private void setCheckBoxClickListener(final int dishId) { mViewHolder.dishCheckBox.setId(dishId); OrderManager orderManager = OrderManager.getInstance(); if (orderManager.isOrderedDish(dishId)) { mViewHolder.dishCheckBox.setChecked(true); } else { mViewHolder.dishCheckBox.setChecked(false); } }
Source:
<code>public Loader<Cursor> onCreateLoader(int id, Bundle args) { final ProviderFacade.QueryBuilder<Event> query = provider.query(Event.class); if (filterClusterId != null) query.where(CLUSTER_ID, filterClusterId); if (filterVmId != null) query.where(VM_ID, filterVmId); return query.orderByDescending(ID).asLoader(); <START> } <END></code><technical_language>please add enter</technical_language>

Target:
public Loader<Cursor> onCreateLoader(int id, Bundle args) { final ProviderFacade.QueryBuilder<Event> query = provider.query(Event.class); if (filterClusterId != null) query.where(CLUSTER_ID, filterClusterId); if (filterVmId != null) query.where(VM_ID, filterVmId); return query.orderByDescending(ID).limit(page * EVENTS_PER_PAGE).asLoader(); }
Source:
<code>private void castEveryonePermissionsToUser(permissions entity) { if (entity.getad_element_id() != null && entity.getad_element_id().equals(Guid.EVERYONE) && queryType.equals(VdcQueryType.GetPermissionsByAdElementId)) { <START> entity.setad_element_id(((MultilevelAdministrationByAdElementIdParameters) queryParams).getAdElementId()); <END> } }</code><technical_language>this.targetId instead (more readable)</technical_language>

Target:
private void castEveryonePermissionsToUser(permissions entity) { if (entity.getad_element_id() != null && entity.getad_element_id().equals(Guid.EVERYONE) && queryType.equals(VdcQueryType.GetPermissionsByAdElementId)) { entity.setad_element_id(this.targetId); } }
Source:
<code>public void createAntOnBlockedCellTest() { inputFile = new String[] { "0000", "0*00", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0b00", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0A00", "0000" }; runs = new Run[] { new NoOutputRun("move 1"), new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); <START> } <END></code><technical_language>Some program logic throw error creating ant a field ant of name</technical_language>

Target:
public void createAntOnBlockedCellTest() { inputFile = new String[] { "0000", "0*00", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0b00", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create a,2,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0A00", "0000" }; runs = new Run[] { new NoOutputRun("move 1"), new ErrorRun("create h,1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); }
Source:
<code>protected void updateQuickAccessTriggerSequenceFormat() { TriggerSequence triggerSequence = bindingService.getBestActiveBindingFor(QUICK_ACCESS_COMMAND_ID); if (triggerSequence == null) { <START> for (Binding b : bindingService.getBindings()) { <END> if (b.getParameterizedCommand() != null && QUICK_ACCESS_COMMAND_ID.equalsIgnoreCase(b.getParameterizedCommand().getId())) { triggerSequence = b.getTriggerSequence(); } } } this.quickAccessTriggerSequenceFormat = triggerSequence.format(); }</code><technical_language>Point of interest: I hit this code in testing IDE is running. I get rid of this code instead return null. updateText a separate message for unbound state. Remember user remove bindings for Quick Access, this is a state need support anyways</technical_language>

Target:
protected void updateQuickAccessTriggerSequenceFormat() { TriggerSequence triggerSequence; ParameterizedCommand cmd = eCommandService.createCommand(QUICK_ACCESS_COMMAND_ID, null); ContextSet contextSet = manager.createContextSet(Arrays.asList(contextService.getDefinedContexts())); Binding binding = manager.getBestSequenceFor(contextSet, cmd); triggerSequence = binding.getTriggerSequence(); this.quickAccessTriggerSequenceFormat = (triggerSequence == null) ? "" : triggerSequence.format(); }
Source:
<code>public Map<String, TaskFactory> getTaskFactory() { Map<String, TaskFactory> taskRegistry = new HashMap<>(); for (String taskClass : taskClasses) { TaskFactory taskFac = context -> { try { AbstractTask task = AbstractTask.class.cast(Class.forName(taskClass).newInstance()); task.setParticipant(GlobalParticipant.this); <START> return task.setCallbackContext(context).setTaskHelper(new TaskHelperImpl()); <END> } catch (InstantiationException | IllegalAccessException e) { logger.error("Failed to initialize the task", e); return null; } catch (ClassNotFoundException e) { logger.error("Task class can not be found in the class path", e); return null; } }; TaskDef taskDef; try { taskDef = Class.forName(taskClass).getAnnotation(TaskDef.class); taskRegistry.put(taskDef.name(), taskFac); } catch (ClassNotFoundException e) { e.printStackTrace(); } } return taskRegistry; }</code><technical_language>AbstractTask.set.set format. Do introduce new variable immediately returning</technical_language>

Target:
public Map<String, TaskFactory> getTaskFactory() { Map<String, TaskFactory> taskRegistry = new HashMap<>(); for (String taskClass : taskClasses) { TaskFactory taskFac = context -> { try { return AbstractTask.class.cast(Class.forName(taskClass).newInstance()) .setParticipant(GlobalParticipant.this) .setCallbackContext(context) .setTaskHelper(new TaskHelperImpl()); } catch (InstantiationException | IllegalAccessException e) { logger.error("Failed to initialize the task", e); return null; } catch (ClassNotFoundException e) { logger.error("Task class can not be found in the class path", e); return null; } }; TaskDef taskDef; try { taskDef = Class.forName(taskClass).getAnnotation(TaskDef.class); taskRegistry.put(taskDef.name(), taskFac); } catch (ClassNotFoundException e) { e.printStackTrace(); } } return taskRegistry; }
Source:
<code>private InsertRevisionCallable.Result doForceInsertNewDocumentWithHistory(SQLDatabase db, DocumentRevision rev, List<String> revHistory) <START> throws AttachmentException, SQLException { <END> logger.entering("DocumentRevision", "doForceInsertNewDocumentWithHistory()", new Object[]{rev, revHistory}); long docNumericID = insertDocumentID(db,rev.getId()); long parentSequence = 0L; for (int i = 0; i < revHistory.size() - 1; i++) { InsertRevisionCallable.Result result = insertStubRevision(db,docNumericID, revHistory.get(i), parentSequence); if (result.duplicate){ logger.warning(String.format(Locale.ENGLISH, "Attempted to insert duplicate revision with id: %s at revision, %s.", rev.getId(), revHistory.get(i))); } parentSequence = result.sequence; } InsertRevisionCallable callable = new InsertRevisionCallable(); callable.docNumericId = docNumericID; callable.revId = revHistory.get(revHistory.size() - 1); callable.parentSequence = parentSequence; callable.deleted = rev.isDeleted(); callable.current = true; callable.data = rev.getBody().asBytes(); callable.available = true; return callable.call(db); }</code><technical_language>method signature changed include this exception</technical_language>

Target:
private long doForceInsertNewDocumentWithHistory(SQLDatabase db, DocumentRevision rev, List<String> revHistory) throws AttachmentException{ logger.entering("DocumentRevision", "doForceInsertNewDocumentWithHistory()", new Object[]{rev, revHistory}); long docNumericID = insertDocumentID(db,rev.getId()); long parentSequence = 0L; for (int i = 0; i < revHistory.size() - 1; i++) { parentSequence = insertStubRevision(db,docNumericID, revHistory.get(i), parentSequence); } InsertRevisionCallable callable = new InsertRevisionCallable(); callable.docNumericId = docNumericID; callable.revId = revHistory.get(revHistory.size() - 1); callable.parentSequence = parentSequence; callable.deleted = rev.isDeleted(); callable.current = true; callable.data = rev.getBody().asBytes(); callable.available = true; long sequence = callable.call(db); return sequence; }
Source:
<code>private void notifyTetheringNoUpstream() { final Resources res = getResourcesForSubId(mContext, mActiveDataSubId); final String title = res.getString(R.string.no_upstream_notification_title); final String message = res.getString(R.string.no_upstream_notification_message); final String disableButton = <START> res.getString(R.string.no_upstream_notification_disable_button); <END> final PendingIntent pi = PendingIntent.getBroadcast( mContext.createContextAsUser(UserHandle.CURRENT, 0), 0 , new Intent(ACTION_DISABLE_TETHERING), 0 ); final Action action = new Action.Builder(NO_ICON_ID, disableButton, pi).build(); showNotification(R.drawable.stat_sys_tether_general, title, message, NO_UPSTREAM_NOTIFICATION_ID, null , action); }</code><technical_language>in case I 'if (TextUtils.isEmpty(title) || isEmpty(message) || isEmpty(disableButton)) return'</technical_language>

Target:
private void notifyTetheringNoUpstream() { final Resources res = getResourcesForSubId(mContext, mActiveDataSubId); final String title = res.getString(R.string.no_upstream_notification_title); final String message = res.getString(R.string.no_upstream_notification_message); final String disableButton = res.getString(R.string.no_upstream_notification_disable_button); if (isEmpty(title) || isEmpty(message) || isEmpty(disableButton)) return; final Intent intent = new Intent(ACTION_DISABLE_TETHERING); intent.setPackage(mContext.getPackageName()); final PendingIntent pi = PendingIntent.getBroadcast( mContext.createContextAsUser(UserHandle.CURRENT, 0 ), 0 , intent, 0 ); final Action action = new Action.Builder(NO_ICON_ID, disableButton, pi).build(); showNotification(R.drawable.stat_sys_tether_general, title, message, NO_UPSTREAM_NOTIFICATION_ID, null , action); }
Source:
<code>protected void runOneIteration() { log.debug("Reaping agents"); final List<String> deadAgents = getDeadAgents(masterModel, timeoutMillis, SYSTEM_CLOCK); log.debug("Reaping dead agents: {}", deadAgents.size(), deadAgents); for (final String agent : deadAgents) { <START> log.info("Reaping dead agent {}", agent); <END> try { masterModel.deregisterHost(agent); } catch (Exception e) { log.error("Failed to reap dead agent {}", agent, e); } } }</code><technical_language>I helpful log amount of downtime</technical_language>

Target:
protected void runOneIteration() { log.debug("Reaping agents"); final List<String> agents = masterModel.listHosts(); for (final String agent : agents) { try { final HostStatus hostStatus = masterModel.getHostStatus(agent); if (hostStatus == null || hostStatus.getStatus() != HostStatus.Status.DOWN) { continue; } final AgentInfo agentInfo = hostStatus.getAgentInfo(); if (agentInfo == null) { continue; } final long downSince = agentInfo.getStartTime() + agentInfo.getUptime(); final long downDurationMillis = clock.now().getMillis() - downSince; if (downDurationMillis >= timeoutMillis) { try { log.info("Reaping dead agent '{}' (DOWN for hours)", DurationFormatUtils.formatDurationHMS(downDurationMillis)); masterModel.deregisterHost(agent); } catch (Exception e) { log.warn("Failed to reap agent '{}'", agent, e); } } } catch (Exception e) { log.warn("Failed to determine if agent '{}' should be reaped", agent, e); } } }
Source:
<code>public Response cancelPayment(@ApiParam(value = "accountId", hidden = true) @Auth Account account, @PathParam("paymentId") String paymentId) { logger.info("Payment cancel request - payment_id=[{}]", paymentId); String url = account.getPaymentType().equals(DIRECT_DEBIT) ? connectorDDUrl : connectorUrl; UriBuilder builder = UriBuilder .fromPath(url) .path(format("/v1/api/accounts/%s/charges/%s/cancel", account.getAccountId(), paymentId)); <START> Collections.<Pair<String, String>>emptyList().stream().forEach(pair -> { <END> if (isNotBlank(pair.getRight())) { builder.queryParam(pair.getKey(), pair.getValue()); } }); Response connectorResponse = client .target(builder.toString()) .request() .post(Entity.json("{}")); if (connectorResponse.getStatus() == HttpStatus.SC_NO_CONTENT) { connectorResponse.close(); return Response.noContent().build(); } throw new CancelChargeException(connectorResponse); }</code><technical_language>streaming empty list</technical_language>

Target:
public Response cancelPayment(@ApiParam(value = "accountId", hidden = true) @Auth Account account, @PathParam("paymentId") String paymentId) { logger.info("Payment cancel request - payment_id=[{}]", paymentId); Response connectorResponse = client .target(connectorUriGenerator.cancelURI(account, paymentId)) .request() .post(Entity.json("{}")); if (connectorResponse.getStatus() == HttpStatus.SC_NO_CONTENT) { connectorResponse.close(); return Response.noContent().build(); } throw new CancelChargeException(connectorResponse); }
Source:
<code>public long getDelayBetweenSyncs(@NonNull TimeUnit unit) { <START> return TimeUnit.MILLISECONDS.convert(this.getDelayBetweenSyncs(), unit); <END> }</code><technical_language>No, this correct... want convert internal delay (expressed in milliseconds) unit client asked</technical_language>

Target:
public long getDelayBetweenSyncs(@NonNull TimeUnit unit) { return unit.convert(this.getDelayBetweenSyncs(), TimeUnit.MILLISECONDS); }
Source:
<code>public String testConnection(Request request, Response response) { JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(request.body()); String type = jsonReader.getString("type"); haltIfMaterialTypeIsInvalid(type); haltIfMaterialTypeDoesNotSupportsCheckConnection(type); ScmMaterialConfig scmMaterialConfig = buildEntityFromRequestBody(request); validateMaterialConfig(scmMaterialConfig, jsonReader); if (!scmMaterialConfig.errors().isEmpty()) { List<String> errorsList = new ArrayList<>(); scmMaterialConfig.errors().forEach((key, errors) -> errorsList.add(String.format("- %s: %s", key, StringUtils.join(errors, ", ")))); response.status(422); return MessageJson.create(String.format("There was an error with the material configuration.\n%s", StringUtils.join(errorsList, "\n")), jsonWriter(scmMaterialConfig)); } performParamExpansion(scmMaterialConfig, jsonReader); Material material = materialConfigConverter.toMaterial(scmMaterialConfig); try { ValidationBean validationBean = material.checkConnection(new CheckConnectionSubprocessExecutionContext(systemEnvironment)); return handleValidationBeanResponse(validationBean, response); } catch (UnsupportedOperationException e) { response.status(422); <START> return MessageJson.create(String.format("The material of type '%s' does not support connection testing.", type)); <END> } }</code><technical_language>IMO this is redundant of haltIfMaterialTypeDoesNotSupportsCheckConnection(type)</technical_language>

Target:
public String testConnection(Request request, Response response) { JsonReader jsonReader = GsonTransformer.getInstance().jsonReaderFrom(request.body()); String type = jsonReader.getString("type"); String pipelineName = jsonReader.getStringOrDefault("pipeline_name", ""); String pipelineGroupName = jsonReader.getStringOrDefault("pipeline_group", ""); haltIfMaterialTypeIsInvalid(type); haltIfMaterialTypeDoesNotSupportsCheckConnection(type); ScmMaterialConfig scmMaterialConfig = buildEntityFromRequestBody(request); validateMaterialConfig(scmMaterialConfig, pipelineName, pipelineGroupName); if (!scmMaterialConfig.errors().isEmpty()) { List<String> errorsList = new ArrayList<>(); scmMaterialConfig.errors().forEach((key, errors) -> errorsList.add(String.format("- %s: %s", key, StringUtils.join(errors, ", ")))); response.status(422); return MessageJson.create(String.format("There was an error with the material configuration.\n%s", StringUtils.join(errorsList, "\n")), jsonWriter(scmMaterialConfig)); } if (isNotBlank(pipelineName)) { performParamExpansion(scmMaterialConfig, pipelineName); } Material material = materialConfigConverter.toMaterial(scmMaterialConfig); ValidationBean validationBean = material.checkConnection(new CheckConnectionSubprocessExecutionContext(systemEnvironment)); return handleValidationBeanResponse(validationBean, response); }
Source:
<code>public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); <START> String name = propertyMap.getOrDefault(NAME, "UnknownName"); <END> String version = propertyMap.getOrDefault(VERSION, "UnknownVersion"); return new UserAgentProperties(name, version); }</code><technical_language>UnknownName UnknownVersion constants</technical_language>

Target:
public static UserAgentProperties getUserAgentProperties(String propertiesFileName) { Map<String, String> propertyMap = getProperties(propertiesFileName); String name = propertyMap.getOrDefault(NAME, UNKNOWN_NAME); String version = propertyMap.getOrDefault(VERSION, UNKNOWN_VERSION); return new UserAgentProperties(name, version); }
Source:
<code>public void testTranslateServiceCreationConfigurationWithoutTags() { ManagementRegistryServiceConfigurationParser configTranslator = new ManagementRegistryServiceConfigurationParser(); DefaultManagementRegistryConfiguration defaultManagementRegistryConfiguration = new DefaultManagementRegistryConfiguration().setCacheManagerAlias("my-cache-alias"). setCollectorExecutorAlias("my-executor"); Node retElement = configTranslator.unparseServiceCreationConfiguration(defaultManagementRegistryConfiguration); assertThat(retElement, is(notNullValue())); assertThat(retElement.getNodeName(), is("mgm:management")); assertThat(retElement.getAttributes(), is(notNullValue())); assertThat(retElement.getAttributes().getLength(), is(3)); <START> assertThat(retElement.getAttributes().item(0).getNodeName(), is("cache-manager-alias")); <END> assertThat(retElement.getAttributes().item(0).getNodeValue(), is("my-cache-alias")); assertThat(retElement.getAttributes().item(1).getNodeName(), is("collector-executor-alias")); assertThat(retElement.getAttributes().item(1).getNodeValue(), is("my-executor")); assertThat(retElement.getAttributes().item(2).getNodeName(), is("xmlns:mgm")); assertThat(retElement.getAttributes().item(2).getNodeValue(), is("<LINK_0>")); assertThat(retElement.getFirstChild(), is(nullValue())); }</code><technical_language>extract a method asserts items</technical_language>

Target:
public void testTranslateServiceCreationConfigurationWithoutTags() { ManagementRegistryServiceConfigurationParser configTranslator = new ManagementRegistryServiceConfigurationParser(); DefaultManagementRegistryConfiguration defaultManagementRegistryConfiguration = new DefaultManagementRegistryConfiguration().setCacheManagerAlias("my-cache-alias"). setCollectorExecutorAlias("my-executor"); Node retElement = configTranslator.unparseServiceCreationConfiguration(defaultManagementRegistryConfiguration); assertThat(retElement, is(notNullValue())); assertThat(retElement.getNodeName(), is("mgm:management")); checkAttributeItems(retElement); assertThat(retElement.getFirstChild(), is(nullValue())); }
Source:
<code>protected void ExecuteIrsBrokerCommand() { final P params = getParameters(); final String storagePoolId = params.getStoragePoolId().toString(); final String targetVersion = params.getCompatibilityVersion(); <START> log.info("Upgrading storage pool \"" + storagePoolId + "\" to version \"" + targetVersion + "\""); <END> status = getIrsProxy().upgradeStoragePool(storagePoolId, targetVersion); ProceedProxyReturnValue(); }</code><technical_language>please replace log.info log.infoFormat</technical_language>

Target:
protected void ExecuteIrsBrokerCommand() { final P params = getParameters(); final String storagePoolId = params.getStoragePoolId().toString(); final String targetVersion = params.getCompatibilityVersion(); log.infoFormat("Upgrading storage pool {0} to version {1}", storagePoolId, targetVersion); status = getIrsProxy().upgradeStoragePool(storagePoolId, targetVersion); ProceedProxyReturnValue(); }
Source:
<code>public void close() { if (watchDog != null) { <START> ipythonClient.stop(StopRequest.newBuilder().build()); <END> watchDog.destroyProcess(); LOGGER.debug("Kill IPython Process"); } }</code><technical_language>log error/exception</technical_language>

Target:
public void close() { if (watchDog != null) { LOGGER.debug("Kill IPython Process"); ipythonClient.stop(StopRequest.newBuilder().build()); watchDog.destroyProcess(); gatewayServer.shutdown(); } }
Source:
<code>protected String createHttpRequestURL() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); <START> if ((!(this instanceof BugzillaRestValidateRequest) && !(this instanceof BugzillaRestUnauthenticatedGetRequest)) <END> && token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { bugUrl += "&"; } bugUrl += "token=" + token.getToken(); } return baseUrl() + bugUrl; }</code><technical_language>exclude BugzillaRestValidateRequest BugzillaRestUnauthenticatedGetRequest BugzillaRestAuthenticatedPostRequest overrides this method? 3 override it</technical_language>

Target:
protected String createHttpRequestURL() { String bugUrl = getUrlSuffix(); LoginToken token = ((BugzillaRestHttpClient) getClient()).getLoginToken(); if (token != null && bugUrl.length() > 0) { if (!bugUrl.endsWith("?")) { bugUrl += "&"; } bugUrl += "token=" + token.getToken(); } return baseUrl() + bugUrl; }
Source:
<code>public void testDecode() throws Exception { Xrb28ProtocolDecoder decoder = new Xrb28ProtocolDecoder(null); verifyAttributes(decoder, text( "*SCOR,OM,123456789123456,Q0,412,80,28#")); verifyPosition(decoder, text( "*SCOR,OM,867584030387299,D0,0,012102.00,A,0608.00062,S,10659.70331,E,12,0.69,151118,30.3,M,A#")); verifyAttributes(decoder, text( "*SCOR,OM,863158022988725,H0,0,412,28,80,0#")); verifyAttributes(decoder, text( "*HBCR,OM,123456789123456,R0,0,55,1234,1497689816#")); verifyPosition(decoder, text( "*HBCR,OM,123456789123456,D0,0,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); verifyPosition(decoder, text( "*SCOR,OM,863158022988725,D0,0,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); <START> verifyPosition(decoder, text( <END> "*HBCR,OM,123456789123456,D0,1,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); verifyPosition(decoder, text( "*SCOR,OM,863158022988725,D0,1,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); }</code><technical_language>Wrong indentation. Also, I tests completely unnecessary here. enough. Also, a sample real device, manually modified sample other test</technical_language>

Target:
public void testDecode() throws Exception { Xrb28ProtocolDecoder decoder = new Xrb28ProtocolDecoder(null); verifyAttributes(decoder, text( "*SCOR,OM,123456789123456,Q0,412,80,28#")); verifyPosition(decoder, text( "*SCOR,OM,867584030387299,D0,0,012102.00,A,0608.00062,S,10659.70331,E,12,0.69,151118,30.3,M,A#")); verifyAttributes(decoder, text( "*SCOR,OM,863158022988725,H0,0,412,28,80,0#")); verifyAttributes(decoder, text( "*HBCR,OM,123456789123456,R0,0,55,1234,1497689816#")); verifyPosition(decoder, text( "*HBCR,OM,123456789123456,D0,0,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); verifyPosition(decoder, text( "*SCOR,OM,863158022988725,D0,0,124458.00,A,2237.7514,N,11408.6214,E,6,0.21,151216,10,M,A#")); verifyPosition(decoder, text( "*SCOR,NG,868020030308430,D0,1,020455.00,A,2359.36129,S,04615.24677,W,12,0.72,201119,8.5,M,A#")); }
Source:
<code><START> private void drawArea(Set<MapWaypoint> area, Graphics2D g, JXMapViewer map) { <END> if (area.isEmpty()) { return; } boolean first = true; GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, area.size()); for (MapWaypoint wp : area) { Point2D p = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom()); int thisX = (int) p.getX(); int thisY = (int) p.getY(); if (first) { polygon.moveTo(thisX, thisY); first = false; } else { polygon.lineTo(thisX, thisY); } } polygon.closePath(); Color areaColor = area.iterator().next().getColor(); g.setPaint(new Color((float)(areaColor.getRed() / 255.0), (float)(areaColor.getGreen() / 255.0), (float)(areaColor.getBlue() / 255.0), .2f)); g.fill(polygon); g.draw(polygon); }</code><technical_language>Missing method header</technical_language>

Target:
private void drawArea(Set<MapWaypoint> area, Graphics2D g, JXMapViewer map) { if (area.isEmpty()) { return; } boolean first = true; GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD, area.size()); for (MapWaypoint wp : area) { Point2D p = map.getTileFactory().geoToPixel(wp.getPosition(), map.getZoom()); int thisX = (int) p.getX(); int thisY = (int) p.getY(); if (first) { polygon.moveTo(thisX, thisY); first = false; } else { polygon.lineTo(thisX, thisY); } } polygon.closePath(); Color areaColor = area.iterator().next().getColor(); final double maxColorValue = 255.0; g.setPaint(new Color((float)(areaColor.getRed() / maxColorValue), (float)(areaColor.getGreen() / maxColorValue), (float)(areaColor.getBlue() / maxColorValue), .2f)); g.fill(polygon); g.draw(polygon); }
Source:
<code>public void executeAsync() { Replicas.checkFull(targetReplicas); <START> makeDataRequests(targetReplicas.subList(0, targetReplicas.size() > 1 ? 2 : 1).asEndpoints()); <END> if (targetReplicas.size() > 2) makeDigestRequests(targetReplicas.subList(2, targetReplicas.size()).asEndpoints()); cfs.metric.speculativeRetries.inc(); }</code><technical_language>two, avoid creating extra intermediate list</technical_language>

Target:
public void executeAsync() { Replicas.checkFull(targetReplicas); makeDataRequests(targetReplicas.subList(0, targetReplicas.size() > 1 ? 2 : 1)); if (targetReplicas.size() > 2) makeDigestRequests(targetReplicas.subList(2, targetReplicas.size())); cfs.metric.speculativeRetries.inc(); }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); Boolean clientMode = client.get(); client.set(null); <START> if (clientMode == null || !clientMode) { <END> cfg.setCacheConfiguration(cacheConfiguration(TX_CACHE1, TRANSACTIONAL), cacheConfiguration(TX_CACHE2, TRANSACTIONAL), cacheConfiguration(ATOMIC_CACHE, ATOMIC)); } return cfg; }</code><technical_language>cfg.isClientMode() there</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); if (!cfg.isClientMode()) { cfg.setCacheConfiguration(cacheConfiguration(TX_CACHE1, TRANSACTIONAL), cacheConfiguration(TX_CACHE2, TRANSACTIONAL), cacheConfiguration(ATOMIC_CACHE, ATOMIC)); } return cfg; }
Source:
<code>public SpongePluginContainer(String className, ModCandidate container, Map<String, Object> modDescriptor) { <START> super(className, container, modDescriptor); <END> this.fmlDescriptor = modDescriptor; this.source = container.getModContainer(); try { LANGUAGE_ADAPTER_FIELD.set(this, GuiceJavaAdapter.INSTANCE); } catch (IllegalAccessException e) { throw new ExceptionInInitializerError(e); } this.fmlDescriptor.put("acceptableRemoteVersions", "*"); this.selfInjector = SpongeMod.instance.getInjector().createChildInjector(new SpongePluginGuiceModule(this)); }</code><technical_language>This is error: do /not/ want sending plugin class super long extending FMLModContainer. Letting FMLModContainer actual class search class for mod-related annotations</technical_language>

Target:
public SpongePluginContainer(String className, ModCandidate container, Map<String, Object> modDescriptor) { super(className, container, modDescriptor); this.fmlDescriptor = modDescriptor; this.source = container.getModContainer(); this.languageAdapter = GuiceJavaAdapter.INSTANCE; this.fmlDescriptor.put("acceptableRemoteVersions", "*"); this.selfInjector = SpongeMod.instance.getInjector().createChildInjector(new SpongePluginGuiceModule(this)); }
Source:
<code><START> public boolean adjustFormula(Ptg[] ptgs, int currentExternSheetIx) { <END> boolean refsWereChanged = false; for(int i=0; i<ptgs.length; i++) { Ptg newPtg; if(_rowModeElseColumn){ newPtg = adjustPtg(ptgs[i], currentExternSheetIx); if (newPtg != null) { refsWereChanged = true; ptgs[i] = newPtg; } } else { Ptg transposedPtg = transpose(ptgs[i]); newPtg = adjustPtg(transposedPtg, currentExternSheetIx); if (newPtg != null) { refsWereChanged = true; ptgs[i] = transpose(transposedPtg); } } } return refsWereChanged; }</code><technical_language>Wrong level of abstraction. adjustFormula care if modifying row column portion of a cell reference. adjustPtg does, ShiftMode determine modify cell reference</technical_language>

Target:
public boolean adjustFormula(Ptg[] ptgs, int currentExternSheetIx) { boolean refsWereChanged = false; for(int i=0; i<ptgs.length; i++) { Ptg newPtg = adjustPtg(ptgs[i], currentExternSheetIx); if (newPtg != null) { refsWereChanged = true; ptgs[i] = newPtg; } } return refsWereChanged; }
Source:
<code>protected RemoteNeo4jDatabaseIdentifier getDatabaseIdentifier() { if ( !configuration.getHosts().isSingleHost() ) { logger.doesNotSupportMultipleHosts( configuration.getHosts().toString() ); } Hosts.HostAndPort hostAndPort = configuration.getHosts().getFirst(); try { <START> return new RemoteNeo4jDatabaseIdentifier( getProtocol(), getConfiguration() ); <END> } catch (Exception e) { throw logger.malformedDataBaseUrl( e, hostAndPort.getHost(), hostAndPort.getPort(), configuration.getDatabaseName() ); } }</code><technical_language>minor consistent protocol configuration (I check if a good reason getters for this specific call)</technical_language>

Target:
protected RemoteNeo4jDatabaseIdentifier getDatabaseIdentifier() { if ( !configuration.getHosts().isSingleHost() ) { logger.doesNotSupportMultipleHosts( configuration.getHosts().toString() ); } Hosts.HostAndPort hostAndPort = configuration.getHosts().getFirst(); try { return new RemoteNeo4jDatabaseIdentifier( protocol, configuration ); } catch (Exception e) { throw logger.malformedDataBaseUrl( e, hostAndPort.getHost(), hostAndPort.getPort(), configuration.getDatabaseName() ); } }
Source:
<code>public PhilipsHueGatewayImpl(GatewayTable gatewayTable) { GatewayPhilipsHue gateway = (GatewayPhilipsHue) GatewayUtils.getGateway(gatewayTable); try { philipsHueGatewayPoller = new PhilipsHueGatewayPoller(gateway); new Thread(philipsHueGatewayPoller).start(); _logger.info("Connected successfully with philipsHueGatewayPoller[{}, PublicKey:{}]", <START> gateway.getUrl(), gateway.getAuthorizedUser()); <END> gateway.setStatus(STATE.UP, "Connected Successfully"); } catch (Exception ex) { _logger.error("Exception, ", ex); gateway.setStatus(STATE.DOWN, "ERROR: " + ex.getMessage()); } }</code><technical_language>@Fraid Typo, PublicKey AuthorizedUser</technical_language>

Target:
public PhilipsHueGatewayImpl(GatewayTable gatewayTable) { GatewayPhilipsHue gateway = (GatewayPhilipsHue) GatewayUtils.getGateway(gatewayTable); try { philipsHueGatewayPoller = new PhilipsHueGatewayPoller(gateway); new Thread(philipsHueGatewayPoller).start(); _logger.info("Connected successfully with philipsHueGatewayPoller[{}, AuthorizedUser:{}]", gateway.getUrl(), gateway.getAuthorizedUser()); gateway.setStatus(STATE.UP, "Connected Successfully"); } catch (Exception ex) { _logger.error("Exception, ", ex); gateway.setStatus(STATE.DOWN, "ERROR: " + ex.getMessage()); } }
Source:
<code>public int decompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) throws MalformedInputException { <START> try { <END> Inflater inflater = new Inflater(true); inflater.setInput(input, inputOffset, inputLength); int resultLength = inflater.inflate(output, outputOffset, maxOutputLength); inflater.end(); return resultLength; } catch (DataFormatException e) { throw Throwables.propagate(e); } }</code><technical_language>broken (add some details in commit message)? This is obvious</technical_language>

Target:
public int decompress(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset, int maxOutputLength) throws MalformedInputException { try { Inflater inflater = new Inflater(true); inflater.setInput(input, inputOffset, inputLength); int resultLength = inflater.inflate(output, outputOffset, maxOutputLength); inflater.end(); return resultLength; } catch (DataFormatException e) { throw new RuntimeException(e); } }
Source:
<code>public EntitlementCertificate createUeberCertificate(@Context Principal principal, @Verify(Owner.class) @PathParam("owner_key") String ownerKey) { Owner o = findOwner(ownerKey); if (o == null) { throw new NotFoundException(i18n.tr("owner with key: {0} was not found.", ownerKey)); } try { Consumer ueberConsumer = consumerCurator.findByName(o, Consumer.UEBER_CERT_CONSUMER); <START> List<Entitlement> ueberEntitlements = entitlementCurator.listByConsumer(ueberConsumer); <END> if (ueberConsumer != null && ueberEntitlements.size() > 0) { poolManager.regenerateCertificatesOf(ueberEntitlements.get(0), true, false); return entitlementCertCurator.listForConsumer(ueberConsumer).get(0); } return ueberCertGenerator.generate(o, principal); } catch (Exception e) { log.error("Problem generating ueber cert for owner: " + o.getKey(), e); throw new BadRequestException(i18n.tr( "Problem generating ueber cert for owner {0}", e)); } }</code><technical_language>@Ceiu This line moved if code block in safety of null check for ueberConsumer ( rely listByConsumer safe ) PR good otherwise, merge this is tweaked</technical_language>

Target:
public EntitlementCertificate createUeberCertificate(@Context Principal principal, @Verify(Owner.class) @PathParam("owner_key") String ownerKey) { Owner o = findOwner(ownerKey); if (o == null) { throw new NotFoundException(i18n.tr("owner with key: {0} was not found.", ownerKey)); } try { Consumer ueberConsumer = consumerCurator.findByName(o, Consumer.UEBER_CERT_CONSUMER); if (ueberConsumer != null) { List<Entitlement> ueberEntitlements = entitlementCurator.listByConsumer(ueberConsumer); if (ueberEntitlements.size() > 0) { poolManager.regenerateCertificatesOf(ueberEntitlements.get(0), true, false); return entitlementCertCurator.listForConsumer(ueberConsumer).get(0); } } return ueberCertGenerator.generate(o, principal); } catch (Exception e) { log.error("Problem generating ueber cert for owner: " + o.getKey(), e); throw new BadRequestException(i18n.tr( "Problem generating ueber cert for owner {0}", e)); } }