auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testNotifyingBlockingResultPartitionProducerFinished() { final PipelinedRegionSchedulingStrategy schedulingStrategy = startScheduling(testingSchedulingTopology); final TestingSchedulingExecutionVertex map1 = map.get(0); map1.getProducedResults().iterator().next().setState(ResultPartitionState.CONSUMABLE); schedulingStrategy.onExecutionStateChange(map1.getId(), ExecutionState.FINISHED); <START> assertThat(testingSchedulerOperation.getScheduledVertices().size(), is(2)); <END> final TestingSchedulingExecutionVertex map2 = map.get(1); map2.getProducedResults().iterator().next().setState(ResultPartitionState.CONSUMABLE); schedulingStrategy.onExecutionStateChange(map2.getId(), ExecutionState.FINISHED); assertThat(testingSchedulerOperation.getScheduledVertices().size(), is(4)); final List<List<TestingSchedulingExecutionVertex>> expectedScheduledVertices = new ArrayList<>(); expectedScheduledVertices.add(Arrays.asList(sink.get(0))); expectedScheduledVertices.add(Arrays.asList(sink.get(1))); assertLatestScheduledVerticesAreEqualTo(expectedScheduledVertices); }</code><technical_language>consider hasSize(2)</technical_language>

Target:
public void testNotifyingBlockingResultPartitionProducerFinished() { final PipelinedRegionSchedulingStrategy schedulingStrategy = startScheduling(testingSchedulingTopology); final TestingSchedulingExecutionVertex map1 = map.get(0); map1.getProducedResults().iterator().next().setState(ResultPartitionState.CONSUMABLE); schedulingStrategy.onExecutionStateChange(map1.getId(), ExecutionState.FINISHED); assertThat(testingSchedulerOperation.getScheduledVertices(), hasSize(2)); final TestingSchedulingExecutionVertex map2 = map.get(1); map2.getProducedResults().iterator().next().setState(ResultPartitionState.CONSUMABLE); schedulingStrategy.onExecutionStateChange(map2.getId(), ExecutionState.FINISHED); assertThat(testingSchedulerOperation.getScheduledVertices(), hasSize(4)); final List<List<TestingSchedulingExecutionVertex>> expectedScheduledVertices = new ArrayList<>(); expectedScheduledVertices.add(Arrays.asList(sink.get(0))); expectedScheduledVertices.add(Arrays.asList(sink.get(1))); assertLatestScheduledVerticesAreEqualTo(expectedScheduledVertices); }
Source:
<code>public void testNoShrink_SameNullable() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), newcol bigint)"); ModifyColumnTask task = new ModifyColumnTask(); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); task.setNullable(true); task.setColumnLength(200); getMigrator().setNoColumnShrink(true); getMigrator().addTask(task); getMigrator().migrate(); <START> assertEquals("varchar(255)", JdbcUtils.getColumnType(getConnectionProperties(), "SOMETABLE", "TEXTCOL")); <END> getMigrator().migrate(); getMigrator().migrate(); }</code><technical_language>This is fine, a stronger assert verify "UPDATE TABLE" command database</technical_language>

Target:
public void testNoShrink_SameNullable() throws SQLException { executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255), newcol bigint)"); ModifyColumnTask task = new ModifyColumnTask(); task.setTableName("SOMETABLE"); task.setColumnName("TEXTCOL"); task.setColumnType(AddColumnTask.ColumnTypeEnum.STRING); task.setNullable(true); task.setColumnLength(200); getMigrator().setNoColumnShrink(true); getMigrator().addTask(task); getMigrator().migrate(); assertEquals(0, task.getExecutedStatements().size()); assertEquals(new JdbcUtils.ColumnType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 255), JdbcUtils.getColumnType(getConnectionProperties(), "SOMETABLE", "TEXTCOL")); getMigrator().migrate(); getMigrator().migrate(); }
Source:
<code>public boolean tryAdd(final EventData eventData) { if (eventData == null) { <START> throw new IllegalArgumentException("eventData cannot be null"); <END> } final int size; try { size = getSize(eventData, events.isEmpty()); } catch (java.nio.BufferOverflowException exception) { throw new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, String.format(Locale.US, "Size of the payload exceeded maximum message size: %s kb", maxMessageSize / 1024), contextProvider.getErrorContext()); } synchronized (lock) { if (this.currentSize + size > this.maxMessageSize) { return false; } this.currentSize += size; } this.events.add(eventData); return true; }</code><technical_language>ClientLogger for throwing exceptions</technical_language>

Target:
public boolean tryAdd(final EventData eventData) { if (eventData == null) { logger.logAndThrow(new IllegalArgumentException("eventData cannot be null")); return false; } final int size; try { size = getSize(eventData, events.isEmpty()); } catch (java.nio.BufferOverflowException exception) { logger.logAndThrow(new AmqpException(false, ErrorCondition.LINK_PAYLOAD_SIZE_EXCEEDED, String.format(Locale.US, "Size of the payload exceeded maximum message size: %s kb", maxMessageSize / 1024), contextProvider.getErrorContext())); return false; } synchronized (lock) { if (this.sizeInBytes + size > this.maxMessageSize) { return false; } this.sizeInBytes += size; } this.events.add(eventData); return true; }
Source:
<code>@Override public T next() { if (closed) throw new IllegalStateException("closed"); checkForComodification(); if (size() == 0) throw new NoSuchElementException(); <START> if (nextElementIndex >= size()) throw new NoSuchElementException(); <END> return entries.get(nextElementIndex++); }</code><technical_language>this check previous line unnecessary</technical_language>

Target:
@Override public T next() { if (closed) throw new IllegalStateException("closed"); checkForComodification(); if (nextElementIndex >= size()) throw new NoSuchElementException(); return entries.get(nextElementIndex++); }
Source:
<code>public long getBytesToUpload() { <START> return ioStatisticsStore.getCounterReference(getStatName(BYTES_TO_UPLOAD)).get(); <END> }</code><technical_language>counters.get(stat-name) do this</technical_language>

Target:
public long getBytesToUpload() { return ioStatisticsStore.counters().get(getStatName(BYTES_TO_UPLOAD)); }
Source:
<code>getDescriptor() { <START> return org.apache.druid.data.input.protobuf.ProtoTestEventWrapper.INTERNAL_STATIC_PROTOTEST_PROTOTESTEVENT_DESCRIPTOR; <END> }</code><technical_language><LINK_0></technical_language>

Target:
getDescriptor() { return org.apache.druid.data.input.protobuf.ProtoTestEventWrapper.internal_static_prototest_ProtoTestEvent_descriptor; }
Source:
<code>private boolean popMessageFromQueue(MessageConsumer messageConsumer) throws AxisFault { try { messageConsumer.receive(); <START> return messageConsumer.ack(); <END> } catch (SynapseException e) { handleException(log, "MessageConsumer failed to receive or acknowledge the message :" , e); return false; } }</code><technical_language>In popAndRedirectMessageToStore return false if a message is received. do here</technical_language>

Target:
private boolean popMessageFromQueue(MessageConsumer messageConsumer) throws AxisFault { try { if (messageConsumer.receive() != null) { return messageConsumer.ack(); } } catch (SynapseException e) { handleException(log, "MessageConsumer failed to receive or acknowledge the message :" , e); } return false; }
Source:
<code>private ResultsWrapper<ContentDTO> getEventsBookedByUser(final HttpServletRequest request, final List<String> tags, final RegisteredUserDTO currentUser) throws SegueDatabaseException, ContentManagerException { List<ContentDTO> filteredResults = Lists.newArrayList(); Map<String, BookingStatus> userBookingMap = this.bookingManager.getAllEventStatesForUser(currentUser.getId()); for (String eventId : userBookingMap.keySet()) { if (BookingStatus.CANCELLED.equals(userBookingMap.get(eventId))) { continue; } final IsaacEventPageDTO eventDTOById = this.getEventDTOById(request, eventId); if (tags != null) { Set<String> tagsList = Sets.newHashSet(tags); tagsList.retainAll(eventDTOById.getTags()); if (tagsList.size() == 0) { continue; } } filteredResults.add(eventDTOById); } <START> return new ResultsWrapper<>(filteredResults, (long) filteredResults.size()); <END> }</code><technical_language>Is this safe? I a cast do creating boxed form</technical_language>

Target:
private ResultsWrapper<ContentDTO> getEventsBookedByUser(final HttpServletRequest request, final List<String> tags, final RegisteredUserDTO currentUser) throws SegueDatabaseException, ContentManagerException { List<ContentDTO> filteredResults = Lists.newArrayList(); Map<String, BookingStatus> userBookingMap = this.bookingManager.getAllEventStatesForUser(currentUser.getId()); for (String eventId : userBookingMap.keySet()) { if (BookingStatus.CANCELLED.equals(userBookingMap.get(eventId))) { continue; } final IsaacEventPageDTO eventDTOById = this.getAugmentedEventDTOById(request, eventId); if (tags != null) { Set<String> tagsList = Sets.newHashSet(tags); tagsList.retainAll(eventDTOById.getTags()); if (tagsList.size() == 0) { continue; } } filteredResults.add(eventDTOById); } return new ResultsWrapper<>(filteredResults, (long) filteredResults.size()); }
Source:
<code>static public RpmVersion getOvirtHostOsVersion(VDS vds) { try { return new RpmVersion(vds.getHostOs(), "RHEV Hypervisor -", true); } catch (RuntimeException e) { <START> log.error("Failed to parse version of Host '{}','{}' and Host OS '{}' with error {}", <END> vds.getId(), vds.getName(), vds.getHostOs(), ExceptionUtils.getMessage(e)); } return null; }</code><technical_language>s/ error/:/</technical_language>

Target:
static public RpmVersion getOvirtHostOsVersion(VDS vds) { try { return new RpmVersion(vds.getHostOs(), "RHEV Hypervisor -", true); } catch (RuntimeException e) { log.error("Failed to parse version of Host '{}','{}' and Host OS '{}': {}", vds.getId(), vds.getName(), vds.getHostOs(), ExceptionUtils.getMessage(e)); log.debug("Exception", e); } return null; }
Source:
<code>public boolean checkYearlyRetirements() { if (getCampaignOptions().getUseAtB() <START> && (Math.toIntExact(ChronoUnit.YEARS.between(getRetirementDefectionTracker() .getLastRetirementRoll(), getLocalDate())) == 1)) { <END> Object[] options = { "Show Retirement Dialog", "Not Now" }; return JOptionPane.YES_OPTION == JOptionPane .showOptionDialog( null, "It has been a year since the last retirement/defection roll, and it is time to do another.", "Retirement/Defection roll required", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); } return false; }</code><technical_language>ChronoUnit.YEARS.between returns number of years dates. This logic (but *roughly* logic)</technical_language>

Target:
public boolean checkYearlyRetirements() { if (getCampaignOptions().getUseAtB() && (ChronoUnit.YEARS.between(getRetirementDefectionTracker() .getLastRetirementRoll(), getLocalDate()) == 1L)) { Object[] options = { "Show Retirement Dialog", "Not Now" }; return JOptionPane.YES_OPTION == JOptionPane .showOptionDialog( null, "It has been a year since the last retirement/defection roll, and it is time to do another.", "Retirement/Defection roll required", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); } return false; }
Source:
<code>public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, NestedLoopJoinOperator.class.getSimpleName()); <START> return new NestedLoopJoinOperator(operatorContext, nestedLoopJoinPagesSupplier, probeTypes, pageFilterSupplier.map(s -> s.get())); <END> }</code><technical_language>nit: please abbreviations. I write: pageFilterSupplier.map(Supplier::get)</technical_language>

Target:
public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, NestedLoopJoinOperator.class.getSimpleName()); return new NestedLoopJoinOperator(operatorContext, nestedLoopJoinPagesSupplier, probeTypes, processor.get(), new MergingPageOutput(types, minOutputPageSize.toBytes(), minOutputPageRowCount)); }
Source:
<code>public CardDetails(uk.gov.pay.api.model.CardDetails cardDetails) { this.last_digits_card_number = cardDetails.getLastDigitsCardNumber(); this.first_digits_card_number = cardDetails.getFirstDigitsCardNumber(); this.cardholder_name = cardDetails.getCardHolderName(); this.expiry_date = cardDetails.getExpiryDate(); this.card_brand = cardDetails.getCardBrand(); <START> this.billing_address = cardDetails.getBillingAddress().isPresent() ? new Address( cardDetails.getBillingAddress().get()) : null; <END> }</code><technical_language>java this.billing_address = cardDetails.getBillingAddress().map(Address::new).orElse(null);</technical_language>

Target:
public CardDetails(uk.gov.pay.api.model.CardDetails cardDetails) { this.last_digits_card_number = cardDetails.getLastDigitsCardNumber(); this.first_digits_card_number = cardDetails.getFirstDigitsCardNumber(); this.cardholder_name = cardDetails.getCardHolderName(); this.expiry_date = cardDetails.getExpiryDate(); this.card_brand = cardDetails.getCardBrand(); this.billing_address = cardDetails.getBillingAddress().map(Address::new).orElse(null); }
Source:
<code>public Iterator<Page> getPages() { return new Iterator<Page>() { private int pageCounter; @Override public boolean hasNext() { return pageCounter < channels[0].size(); } @Override public Page next() { Block[] blocks = Stream.of(channels) .map(channel -> channel.get(pageCounter)) .toArray(Block[]::new); pageCounter++; return new Page(blocks); } }; <START> } <END></code><technical_language>AbstractIterator a base</technical_language>

Target:
public Iterator<Page> getPages() { return new AbstractIterator<Page>() { private int pageCounter; @Override protected Page computeNext() { if (pageCounter == channels[0].size()) { return endOfData(); } Block[] blocks = Stream.of(channels) .map(channel -> channel.get(pageCounter)) .toArray(Block[]::new); pageCounter++; return new Page(blocks); } }; }
Source:
<code>public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { try { Attribute foundAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME); if(foundAttribute.getValue() != null) { throw new WrongReferenceAttributeValueException(attribute, foundAttribute, group, null, group, null, "Attribute " + attribute.getName() + " cannot be set because attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is already set."); <START> } <END> } catch (AttributeNotExistsException exc) { throw new ConsistencyErrorException("Attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is supposed to exist", exc); } }</code><technical_language>throw this exception if this is process of removing is "null". is correct</technical_language>

Target:
public void checkAttributeSemantics(PerunSessionImpl sess, Group group, Attribute attribute) throws InternalErrorException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { if (attribute.getValue() == null) return; try { Attribute foundAttribute = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, group, GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME); if(foundAttribute.getValue() != null) { throw new WrongReferenceAttributeValueException(attribute, foundAttribute, group, null, group, null, "Attribute " + attribute.getName() + " cannot be set because attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is already set."); } } catch (AttributeNotExistsException exc) { throw new ConsistencyErrorException("Attribute " + GroupsManager.GROUP_STRUCTURE_SYNCHRO_INTERVAL_ATTRNAME + " is supposed to exist", exc); } }
Source:
<code><START> public Counter getCounter() { <END> return numLateRecordsDropped; }</code><technical_language>access if private, protected methods accessed in tests</technical_language>

Target:
protected Counter getCounter() { return numLateRecordsDropped; }
Source:
<code>private int getDefultHashPartitionCount() { String url = config.getTestGateway(); <START> String username = Optional.ofNullable(config.getTestUsernameOverride()).orElse("verifier-test"); <END> String password = Optional.ofNullable(config.getTestPasswordOverride()).orElse(null); int defaultHashPartitionCount = 0; int numOfActiveNodes = 0; try { ResultSet result = executeQuery(url, username, password, "select count(*) as NUM_OF_WORKERS from system.runtime.nodes where coordinator=false"); while (result.next()) { numOfActiveNodes = result.getInt("NUM_OF_WORKERS"); } result.close(); result = executeQuery(url, username, password, "show session"); while (result.next()) { if ((result.getString("Name")).equals("hash_partition_count")) { defaultHashPartitionCount = Integer.parseInt(result.getString("Value")); break; } } result.close(); } catch (SQLException e) { e.printStackTrace(); } return Math.min(defaultHashPartitionCount, numOfActiveNodes); }</code><technical_language>constant string a static member</technical_language>

Target:
private int getDefultHashPartitionCount() { String url = config.getTestGateway(); String username = Optional.ofNullable(config.getTestUsernameOverride()).orElse(DEFAULT_USER_NAME); String password = Optional.ofNullable(config.getTestPasswordOverride()).orElse(null); int defaultHashPartitionCount = 0; int numOfActiveNodes = 0; try (ResultSet result = executeQuery(url, username, password, "select count(*) as NUM_OF_WORKERS from system.runtime.nodes where coordinator=false")) { while (result.next()) { numOfActiveNodes = result.getInt("NUM_OF_WORKERS"); } } catch (SQLException e) { e.printStackTrace(); } try (ResultSet result = executeQuery(url, username, password, "show session")) { while (result.next()) { if ((result.getString("Name")).equals(HASH_PARTITION_COUNT)) { defaultHashPartitionCount = Integer.parseInt(result.getString("Value")); break; } } } catch (SQLException e) { e.printStackTrace(); } return Math.min(defaultHashPartitionCount, numOfActiveNodes); }
Source:
<code>public String call() { StringBuilder result = new StringBuilder(); final File rootPath = new File(this.rootPathName); <START> final File[] files = rootPath.listFiles(); <END> if (files != null) { for (File file : files) { if (file.isFile()) { try { result.append(Util.getDigestOf(new FileInputStream(file))) .append(" ") .append(file.getName()).append('\n'); } catch (IOException e) { } } } } return result.toString(); }</code><technical_language>FileUtils.listFiles well</technical_language>

Target:
public String call() { StringBuilder result = new StringBuilder(); final File rootPath = new File(this.rootPathName); for (File file : FileUtils.listFiles(rootPath, null, false)) { if (file.isFile()) { try { result.append(Util.getDigestOf(new FileInputStream(file))) .append(" ") .append(file.getName()).append('\n'); } catch (IOException e) { } } } return result.toString(); }
Source:
<code>private void reweightTrainingData(Iterable<? extends AbstractInstance> sortedData, DateTime mostRecentInstance) { for (AbstractInstance instance : sortedData) { double decayConstant = (instance.getClassification().equals(POSITIVE_CLASSIFICATION)) ? decayConstantOfPositive : decayConstantOfNegative; DateTime timeOfInstance = dateTimeExtractor.extractDateTime(instance); double hoursBack = Hours.hoursBetween(mostRecentInstance, timeOfInstance).getHours(); double newWeight = Math.exp(-1.0 * hoursBack / decayConstant); <START> instance.setWeight(newWeight); <END> } }</code><technical_language>this is mutability is bad - modifying weights of Instances in-place, kinds of unintended potentially negative side-effects (what if re-use instances elsewhere?), this method return a new set of instances reweighted, leaving original instances unmodified</technical_language>

Target:
private List<AbstractInstance> reweightTrainingData(Iterable<? extends AbstractInstance> sortedData, DateTime mostRecentInstance) { ArrayList<AbstractInstance> trainingDataList = Lists.newArrayList(); for (AbstractInstance instance : sortedData) { double decayConstant = (instance.getClassification().equals(POSITIVE_CLASSIFICATION)) ? decayConstantOfPositive : decayConstantOfNegative; DateTime timeOfInstance = dateTimeExtractor.extractDateTime(instance); double hoursBack = Hours.hoursBetween(mostRecentInstance, timeOfInstance).getHours(); double newWeight = Math.exp(-1.0 * hoursBack / decayConstant); trainingDataList.add(instance.reweight(newWeight)); } return trainingDataList; }
Source:
<code>public void getIccSlotsStatus(Message result) { IRadio radioProxy = getRadioProxy(result); riljLog("getIccSlotsStatus"); if (radioProxy != null) { riljLog("getIccSlotsStatus: <START> radioProxy != <END> null"); android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 == null) { riljLog("getIccSlotsStatus: radioProxy12 == null"); if (result != null) { riljLog("getIccSlotsStatus: result != null"); AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } else { RILRequest rr = obtainRequest(RIL_REQUEST_GET_SLOT_STATUS, result, mRILDefaultWorkSource); if (RILJ_LOGD) { riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); } try { radioProxy12.getSimSlotsStatus(rr.mSerial); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "getIccSlotStatus", e); } } } }</code><technical_language>for debugging want them? log info in other methods</technical_language>

Target:
public void getIccSlotsStatus(Message result) { IRadio radioProxy = getRadioProxy(result); if (radioProxy != null) { android.hardware.radio.V1_2.IRadio radioProxy12 = android.hardware.radio.V1_2.IRadio.castFrom(radioProxy); if (radioProxy12 == null) { if (result != null) { AsyncResult.forMessage(result, null, CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED)); result.sendToTarget(); } } else { RILRequest rr = obtainRequest(RIL_REQUEST_GET_SLOT_STATUS, result, mRILDefaultWorkSource); if (RILJ_LOGD) { riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); } try { radioProxy12.getSimSlotsStatus(rr.mSerial); } catch (RemoteException | RuntimeException e) { handleRadioProxyExceptionForRR(rr, "getIccSlotStatus", e); } } } }
Source:
<code>public void getAnswer_whenPromptHasAnswer_returnsAnswer() { <START> AudioWidget widget = createWidget(promptWithAnswer(new StringData(destinationPath))); <END> assertThat(widget.getAnswer().getDisplayText(), equalTo(destinationPath)); }</code><technical_language>I values inline (destinationPath) defined anywhere. Easier in test is a string</technical_language>

Target:
public void getAnswer_whenPromptHasAnswer_returnsAnswer() { AudioWidget widget = createWidget(promptWithAnswer(new StringData(FILE_PATH))); assertThat(widget.getAnswer().getDisplayText(), equalTo(FILE_PATH)); }
Source:
<code>private void updateMemoryBalloonDevice() { VDSGroup cluster = getSelectedCluster(); Integer osType = getOSType().getSelectedItem(); if (cluster == null || osType == null) { return; } boolean isBalloonEnabled = AsyncDataProvider.isBalloonEnabled(osType, cluster.getcompatibility_version()); <START> getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); <END> }</code><technical_language>this break instance types balloon is instance type managed field. Instead of setting need to: getMemoryBalloonDeviceEnabled().setIsChangable(isBalloonEnabled); if (!isBalloonEnabled) { getBehavior().deactivateInstanceTypeManager(); getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); getBehavior().activateInstanceTypeManager(); }</technical_language>

Target:
private void updateMemoryBalloonDevice() { VDSGroup cluster = getSelectedCluster(); Integer osType = getOSType().getSelectedItem(); if (cluster == null || osType == null) { return; } boolean isBalloonEnabled = AsyncDataProvider.isBalloonEnabled(osType, cluster.getcompatibility_version()); getMemoryBalloonDeviceEnabled().setIsChangable(isBalloonEnabled); getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); if (!isBalloonEnabled) { getBehavior().deactivateInstanceTypeManager(); getMemoryBalloonDeviceEnabled().setEntity(isBalloonEnabled); getBehavior().activateInstanceTypeManager(); } }
Source:
<code>public void testGetLogicalTypeNameDate() { Schema logicalDateSchema = AvroUtils._logicalDate(); <START> assertEquals("date", LogicalTypeUtils.getLogicalTypeName(logicalDateSchema)); <END> }</code><technical_language>insn't Avro constants for logincal types instead of a plain String</technical_language>

Target:
public void testGetLogicalTypeNameDate() { Schema logicalDateSchema = AvroUtils._logicalDate(); assertEquals(LogicalTypeUtils.DATE, LogicalTypeUtils.getLogicalTypeName(logicalDateSchema)); }
Source:
<code><START> public void toString_() { <END> final StringBuilder sb = new StringBuilder("RealmList<").append(listType.getValueTypeName()).append(">@["); final String separator = ","; for (int i = 0; i < NON_NULL_TEST_SIZE; i++) { final Object value = generateValue(listType, i); if (value instanceof byte[]) { sb.append("byte[").append(((byte[]) value).length).append("]"); } else { sb.append(value); } sb.append(separator); if (typeIsNullable) { sb.append("null").append(separator); } } sb.setLength(sb.length() - separator.length()); sb.append("]"); assertEquals(sb.toString(), list.toString()); }</code><technical_language>testing !!</technical_language>

Target:
public void toString_() { final StringBuilder sb = new StringBuilder("RealmList<").append(listType.getValueTypeName()).append(">@["); final String separator = ","; for (int i = 0; i < NON_NULL_TEST_SIZE; i++) { final Object value = generateValue(listType, i); if (value instanceof byte[]) { sb.append("byte[").append(((byte[]) value).length).append("]"); } else { sb.append(value); } sb.append(separator); if (isTypeNullable) { sb.append("null").append(separator); } } sb.setLength(sb.length() - separator.length()); sb.append("]"); assertEquals(sb.toString(), list.toString()); }
Source:
<code>public void onBlockPhysics(final BlockPhysicsEvent event) { final Block block = event.getBlock(); try (MCTiming timing = TimingPhysicsWaterManipulationCheck.startTiming()) { if (!WaterManipulation.canPhysicsChange(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsEarthPassiveCheck.startTiming()) { if (!EarthPassive.canPhysicsChange(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) { if (Illumination.isIlluminationTorch(block) || Illumination.isIlluminationTorch(block.getRelative(BlockFace.UP))) { <START> System.out.println("Ran Timing Physics Check"); <END> event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsEarthAbilityCheck.startTiming()) { if (EarthAbility.getPreventPhysicsBlocks().contains(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsAirTempBlockBelowFallingBlockCheck.startTiming()) { if ((block.getType() == Material.SAND || block.getType() == Material.RED_SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) && ElementalAbility.isAir(block.getRelative(BlockFace.DOWN).getType()) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN))) { event.setCancelled(true); } } }</code><technical_language>debug message</technical_language>

Target:
public void onBlockPhysics(final BlockPhysicsEvent event) { final Block block = event.getBlock(); try (MCTiming timing = TimingPhysicsWaterManipulationCheck.startTiming()) { if (!WaterManipulation.canPhysicsChange(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsEarthPassiveCheck.startTiming()) { if (!EarthPassive.canPhysicsChange(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) { if (Illumination.isIlluminationTorch(block) || Illumination.isIlluminationTorch(block.getRelative(BlockFace.UP))) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsEarthAbilityCheck.startTiming()) { if (EarthAbility.getPreventPhysicsBlocks().contains(block)) { event.setCancelled(true); return; } } try (MCTiming timing = TimingPhysicsAirTempBlockBelowFallingBlockCheck.startTiming()) { if ((block.getType() == Material.SAND || block.getType() == Material.RED_SAND || block.getType() == Material.GRAVEL || block.getType() == Material.ANVIL || block.getType() == Material.DRAGON_EGG) && ElementalAbility.isAir(block.getRelative(BlockFace.DOWN).getType()) && TempBlock.isTempBlock(block.getRelative(BlockFace.DOWN))) { event.setCancelled(true); } } }
Source:
<code>public FullRevision getPlatformToolsRevision() { File platformTools = new File(mSdkLocation, SdkConstants.FD_PLATFORM_TOOLS); if (!platformTools.isDirectory()) { return null; } Reader reader = null; try { reader = new FileReader(new File(platformTools, SdkConstants.FN_SOURCE_PROP)); Properties props = new Properties(); props.load(reader); String value = props.getProperty(PkgProps.PKG_REVISION); FullRevision toolsRevision = null; try { <START> toolsRevision = FullRevision.parseRevision(value); <END> } catch (NumberFormatException ignore) { } return toolsRevision; } catch (FileNotFoundException ignore) { } catch (IOException ignore) { } finally { Closeables.closeQuietly(reader); } return null; }</code><technical_language>Nit: I combine try/catch blocks one, attempt "return FullRevision.parseRevision(value);" return null bottom of method if fails</technical_language>

Target:
public FullRevision getPlatformToolsRevision() { File platformTools = new File(mSdkLocation, SdkConstants.FD_PLATFORM_TOOLS); if (!platformTools.isDirectory()) { return null; } Reader reader = null; try { reader = new FileReader(new File(platformTools, SdkConstants.FN_SOURCE_PROP)); Properties props = new Properties(); props.load(reader); String value = props.getProperty(PkgProps.PKG_REVISION); return FullRevision.parseRevision(value); } catch (FileNotFoundException ignore) { } catch (IOException ignore) { } catch (NumberFormatException ignore) { } finally { Closeables.closeQuietly(reader); } return null; }
Source:
<code>public Synonym anonymize(Object from, int size, boolean shortlived) { if (size < 2) { throw new UnsupportedOperationException("Can not produce country codes of one character."); } String country = null; while (country == null || country.length() < 1) { Locale l = AVAILABLE_LOCALES[r.nextInt(AVAILABLE_LOCALES.length)]; try { if (size > 2) { country = l.getISO3Country(); if(country.length()==0) { <START> continue; <END> } country = padRight(country, size); } else if (size == 2) { country = l.getCountry(); } } catch (MissingResourceException e) { } } return new StringSynonym( getType(), from.toString(), country, shortlived ); }</code><technical_language>I this work, a StringUtils.isEmpty(country) is more robust</technical_language>

Target:
public Synonym anonymize(Object from, int size, boolean shortlived) { if (size < 2) { throw new UnsupportedOperationException("Can not produce country codes of one character."); } String country = null; while (country == null || country.length() < 1) { Locale l = AVAILABLE_LOCALES[r.nextInt(AVAILABLE_LOCALES.length)]; try { if (size > 2) { country = l.getISO3Country(); if(StringUtils.isEmpty(country)) { continue; } country = padRight(country, size); } else if (size == 2) { country = l.getCountry(); } } catch (MissingResourceException e) { } } return new StringSynonym( getType(), from.toString(), country, shortlived ); }
Source:
<code>public void shouldFetchAllPatientEncounterIncludingVoidedPatientEncountersIfIncludeAllParamIsSetToTrue() throws Exception { <START> String encounterUuuid = "c59b3942-4fdd-11e5-8c3c-410f8777c163"; <END> String patientUuid = "da7f524f-27ce-4bb2-86d6-6d1d05312bd5"; Patient patient = Context.getPatientService().getPatientByUuid(patientUuid); Encounter enc = Context.getEncounterService().getEncounterByUuid(encounterUuuid); Context.getEncounterService().voidEncounter(enc, "bcbcb"); Context.getEncounterService().saveEncounter(enc); List<Encounter> encs = Context.getEncounterService().getEncountersByPatient(patient.getGivenName()); Assert.assertEquals(1, encs.size()); MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("patient", patientUuid); req.addParameter("includeAll", "true"); SimpleObject result = deserialize(handle(req)); List<Object> encounters = result.get("results"); Assert.assertEquals(2, encounters.size()); }</code><technical_language>Do intend reassign values encounterUuuid patientUuid</technical_language>

Target:
public void shouldFetchAllPatientEncounterIncludingVoidedPatientEncountersIfIncludeAllParamIsSetToTrue() throws Exception { Patient patient = Context.getPatientService().getPatientByUuid(RestTestConstants1_9.PATIENT_WITH_ENCOUNTER_UUID); Encounter enc = Context.getEncounterService().getEncounterByUuid(RestTestConstants1_9.ENCOUNTER_UUID); Context.getEncounterService().voidEncounter(enc, "some reason"); Context.getEncounterService().saveEncounter(enc); List<Encounter> encs = Context.getEncounterService().getEncountersByPatient(patient); Assert.assertEquals(1, encs.size()); MockHttpServletRequest req = request(RequestMethod.GET, getURI()); req.addParameter("patient", RestTestConstants1_9.PATIENT_WITH_ENCOUNTER_UUID); req.addParameter("includeAll", "true"); SimpleObject result = deserialize(handle(req)); List<Object> encounters = result.get("results"); Assert.assertEquals(2, encounters.size()); }
Source:
<code>private void validate() { ArgChecker.isTrue(settlementDateOffset.getDays() >= 0, "The settlement date offset must be non-negative"); <START> ArgChecker.isTrue(notional.getAmount() > 0, "Notionanl must be strictly positve"); <END> }</code><technical_language>Spelling</technical_language>

Target:
private void validate() { ArgChecker.isTrue(settlementDateOffset.getDays() >= 0, "The settlement date offset must be non-negative"); ArgChecker.isTrue(notional.getAmount() > 0, "Notional must be strictly positive"); }
Source:
<code>public void disconnect() throws IOException { <START> <END> }</code><technical_language>this need implemented? For example, shutting EventLoopGroup</technical_language>

Target:
public void disconnect() throws IOException { channel.disconnect().syncUninterruptibly(); workerGroup.shutdownGracefully(); }
Source:
<code>private static Stream<String> makeQueries(List<String> inputs, QueryMode queryMode, int queryCount) { queryCount = queryCount > 0 ? queryCount : inputs.size(); switch (queryMode) { case LIST: return inputs.stream().limit(queryCount); case SAMPLE: <START> Random r = new Random(inputs.hashCode()); END> return r.ints(queryCount, 0, inputs.size()).boxed().map(inputs::get); default: throw new IllegalArgumentException(String.format("Unsupported queryMode '%s", queryMode)); } }</code><technical_language>This hashCode expensive, new Random(0)</technical_language>

Target:
private static Stream<String> makeQueries(List<String> inputs, QueryMode queryMode, int queryCount) { queryCount = queryCount > 0 ? queryCount : inputs.size(); switch (queryMode) { case FULL: return inputs.stream().limit(queryCount); case RESAMPLE: Random r = new Random(0); return r.ints(queryCount, 0, inputs.size()).boxed().map(inputs::get); default: throw new IllegalArgumentException(String.format("Unsupported queryMode '%s", queryMode)); } }
Source:
<code>public void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Exception { parseCommandLine(); if ((newParent != null && !newParent.canCreateChildProject()) <START> || (newParent == null && !currentUser.getCapabilityByProject(null) <END> .canCreateProject())) { String msg = String.format( "fatal: %s does not have \"Create Project\" capability.", currentUser.getUserName()); throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg); } validateParameters(); try { nameKey = new Project.NameKey(projectName); String head = permissionsOnly ? GitRepositoryManager.REF_CONFIG : branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!permissionsOnly && createEmptyCommit) { createEmptyCommit(repo, nameKey, branch); } } finally { repo.close(); } } catch (IllegalStateException err) { try { Repository repo = repoManager.openRepository(nameKey); try { if (repo.getObjectDatabase().exists()) { throw new UnloggedFailure(1, "fatal: project \"" + projectName + "\" exists"); } } finally { repo.close(); } } catch (RepositoryNotFoundException doesNotExist) { throw new Failure(1, "fatal: Cannot create " + projectName, err); } } catch (RepositoryNotFoundException badName) { throw new UnloggedFailure(1, "fatal: " + badName.getMessage()); } catch (Exception err) { throw new Failure(1, "fatal: Cannot create " + projectName, err); } } }); }</code><technical_language>Hmm, is confusing. do "--All Projects" projectState querying for canCreateChildProject() instead</technical_language>

Target:
public void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Exception { parseCommandLine(); if ((newParent != null && !newParent.canCreateChildProject()) || (newParent == null && !currentUser.getCapabilities() .canCreateProject())) { final String msg = String.format( "fatal: %s does not have \"Create Project\" capability.", currentUser.getUserName()); throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg); } validateParameters(); try { nameKey = new Project.NameKey(projectName); String head = permissionsOnly ? GitRepositoryManager.REF_CONFIG : branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!permissionsOnly && createEmptyCommit) { createEmptyCommit(repo, nameKey, branch); } } finally { repo.close(); } } catch (IllegalStateException err) { handleRepositoryExistsException(nameKey); } catch (RepositoryCaseMismatchException err) { handleRepositoryExistsException(err.getNameOfExistingProject()); } catch (RepositoryNotFoundException badName) { throw new UnloggedFailure(1, "fatal: " + badName.getMessage()); } catch (Exception err) { throw new Failure(1, "fatal: Cannot create " + projectName, err); } } }); }
Source:
<code>private void cleanup() { try { <START> log.info("Start cleanup"); <END> DateTime latestTimeToKeep = DateTime.getNow().addDays( Config.<Integer>getValue(ConfigValues.CommandEntityAgingThreshold) * -1); commandCoordinatorUtil.removeAllCommandsBeforeDate(latestTimeToKeep); log.info("Finished cleanup"); } catch (Throwable t) { log.error("Exception in performing command entity cleanup: {}", ExceptionUtils.getRootCauseMessage(t)); log.debug("Exception", t); } }</code><technical_language>move debug in patch (or remove all), I for in INFO level</technical_language>

Target:
private void cleanup() { try { log.debug("Start cleanup"); DateTime latestTimeToKeep = DateTime.getNow().addDays( Config.<Integer>getValue(ConfigValues.CommandEntityAgingThreshold) * -1); commandCoordinatorUtil.removeAllCommandsBeforeDate(latestTimeToKeep); log.debug("Finished cleanup"); } catch (Throwable t) { log.error("Exception in performing command entity cleanup: {}", ExceptionUtils.getRootCauseMessage(t)); log.debug("Exception", t); } }
Source:
<code>private TNiftyFuture(final NiftyClientConnector<T> clientChannelConnector, final Duration receiveTimeout, final Duration sendTimeout, final ChannelFuture channelFuture) { channelFuture.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { try { if (future.isSuccess()) { Channel nettyChannel = future.getChannel(); T channel = clientChannelConnector.newThriftClientChannel(nettyChannel, timer); channel.setReceiveTimeout(receiveTimeout); channel.setSendTimeout(sendTimeout); set(channel); } else if (future.isCancelled()) { if (!cancel(true)) { setException(new TTransportException("Unable to cancel client channel connection")); } } else { throw future.getCause(); } } catch (Throwable t) { <START> setException(new TTransportException("Failed to connect client channel", future.getCause())); <END> } } }); }</code><technical_language>this getCause() called exception code try block calls getCause()</technical_language>

Target:
private TNiftyFuture(final NiftyClientConnector<T> clientChannelConnector, final Duration receiveTimeout, final Duration sendTimeout, final ChannelFuture channelFuture) { channelFuture.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { try { if (future.isSuccess()) { Channel nettyChannel = future.getChannel(); T channel = clientChannelConnector.newThriftClientChannel(nettyChannel, timer); channel.setReceiveTimeout(receiveTimeout); channel.setSendTimeout(sendTimeout); set(channel); } else if (future.isCancelled()) { if (!cancel(true)) { setException(new TTransportException("Unable to cancel client channel connection")); } } else { throw future.getCause(); } } catch (Throwable t) { setException(new TTransportException("Failed to connect client channel", t)); } } }); }
Source:
<code>private static MetaData loadMetaData() throws IOException { InputStream stream = RsdlManager.class.getResourceAsStream(METADATA_FILE_NAME); if (stream == null) { throw new IOException("Can't find metadata resource \"" + METADATA_FILE_NAME + "\""); } MetaData metaData; <START> try { <END> Constructor constructor = new CustomClassLoaderConstructor(Thread.currentThread().getContextClassLoader()); metaData = (MetaData) new Yaml(constructor).load(stream); if (metaData == null) { throw new IOException("Can't load metadata file \"" + METADATA_FILE_NAME + "\""); } } finally { stream.close(); } assignDefaults(metaData); for (Action action : metaData.getActions()) { String name = action.getName(); name = name.replaceAll("^/?", ""); action.setName(name); } return metaData; }</code><technical_language>I this cleaned a bit. about: try (stream = RsdlManager.class.getResourceAsStream(METADATA_FILE_NAME)) { // code }</technical_language>

Target:
private static MetaData loadMetaData() throws IOException { try (InputStream in = RsdlManager.class.getResourceAsStream(METADATA_FILE_NAME)) { if (in == null) { throw new IOException("Can't find metadata from resource \"" + METADATA_FILE_NAME + "\""); } return loadMetaData(in); } }
Source:
<code>public List<String> extractData(ResultSet rs) throws SQLException, DataAccessException { <START> List<String> columnNames = new LinkedList<>(); <END> ResultSetMetaData metadata = rs.getMetaData(); for (int col = 1; col <= metadata.getColumnCount(); col++) { columnNames.add(metadata.getColumnName(col)); } return columnNames; }</code><technical_language>arraylist instead? remove column names middle of list</technical_language>

Target:
public List<String> extractData(ResultSet rs) throws SQLException, DataAccessException { ResultSetMetaData metadata = rs.getMetaData(); int columnCount = metadata.getColumnCount(); List<String> columnNames = new ArrayList<>(columnCount); for (int col = 1; col <= columnCount; col++) { columnNames.add(metadata.getColumnName(col)); } return columnNames; }
Source:
<code>public void onError(final InterstitialAd interstitialAd, final ErrorInfo errorInfo) { <START> <END> Log.e(TAG, "Verizon Ads SDK interstitial error: " + errorInfo); }</code><technical_language>difference InterstitialAd.InterstitialAdListener InterstitialAdFactory.InterstitialAdFactoryListener? This onError method is implemented other is. 2 similar interfaces is ok this interface do anything</technical_language>

Target:
public void onError(final InterstitialAd interstitialAd, final ErrorInfo errorInfo) { Log.e(TAG, "Verizon Ads SDK interstitial error: " + errorInfo); ThreadUtils.postOnUiThread(new Runnable() { @Override public void run() { MediationInterstitialAdapter adapter = interstitialAdapterWeakRef.get(); if ((adapter != null) && (interstitialListener != null)) { interstitialListener.onAdOpened(adapter); interstitialListener.onAdClosed(adapter); } } }); }
Source:
<code>public final int parseArguments(final Parameters params) throws CmdLineException { String token = params.getParameter(0); String projectName = token; while (projectName.endsWith("/")) { projectName = projectName.substring(0, projectName.length() - 1); } while (projectName.startsWith("/")) { projectName = projectName.substring(1); <START> token=projectName; <END> } if (projectName.endsWith(".git")) { projectName = projectName.substring(0, projectName.length() - 4); while (projectName.endsWith("/")) { projectName = projectName.substring(0, projectName.length() - 1); } } final ProjectControl control; try { Project.NameKey nameKey = new Project.NameKey(projectName); control = projectControlFactory.validateFor(nameKey, ProjectControl.OWNER | ProjectControl.VISIBLE); } catch (NoSuchProjectException e) { throw new CmdLineException(owner, "'" + token + "': is not a Gerrit project"); } setter.addValue(control); return 1; }</code><technical_language>I purpose of token variable provide project name in error message user entered it, unmodified. Therefore, token modified set. Otherwise, drop token variable projectName for error message</technical_language>

Target:
public final int parseArguments(final Parameters params) throws CmdLineException { String projectName = params.getParameter(0); while (projectName.endsWith("/")) { projectName = projectName.substring(0, projectName.length() - 1); } while (projectName.startsWith("/")) { projectName = projectName.substring(1); } String projectNameWithoutSuffix = projectName; if (projectName.endsWith(Constants.DOT_GIT_EXT)) { projectNameWithoutSuffix = projectName.substring(0, projectName.length() - 4); while (projectNameWithoutSuffix.endsWith("/")) { projectNameWithoutSuffix = projectName.substring(0, projectName.length() - 1); } } final ProjectControl control; try { Project.NameKey nameKey = new Project.NameKey(projectNameWithoutSuffix); control = projectControlFactory.validateFor(nameKey, ProjectControl.OWNER | ProjectControl.VISIBLE); } catch (NoSuchProjectException e) { throw new CmdLineException(owner, "'" + projectName + "': is not a Gerrit project"); } setter.addValue(control); return 1; }