auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void afterShortExpirationEntryShouldBeAway() throws InterruptedException { final String KEY = "key"; Config hConfig = new Config().setInstanceName("instance") .addMapConfig(new MapConfig().setName("test") .setMaxSizeConfig(new MaxSizeConfig(200, MaxSizeConfig.MaxSizePolicy.FREE_HEAP_SIZE)) .setTimeToLiveSeconds(20)); <START> final HazelcastInstance node = Hazelcast.newHazelcastInstance(hConfig); <END> try { IMap map = node.getMap("test"); map.put(KEY, "value", 1, TimeUnit.SECONDS); map.lock(KEY); Object object = map.get(KEY); map.unlock(KEY); assertNotNull(object); Thread.sleep(1200); map.lock(KEY); object = map.get(KEY); map.unlock(KEY); assertNull(object); } finally { node.shutdown(); } }</code><technical_language>In order for tests able run in parallel, create HazelcastInstance follows: final HazelcastInstance node = createHazelcastInstance(hConfig); createHazelcastInstance test support class create a HazelcastInstance mock network, allowing parallel test execution interference other concurrent tests</technical_language>

Target:
public void afterShortExpirationEntryShouldBeAway() throws InterruptedException { final String KEY = "key"; Config hConfig = new Config().setInstanceName("instance") .addMapConfig(new MapConfig().setName("test") .setMaxSizeConfig(new MaxSizeConfig(200, MaxSizeConfig.MaxSizePolicy.FREE_HEAP_SIZE)) .setTimeToLiveSeconds(20)); final HazelcastInstance node = createHazelcastInstance(hConfig); try { IMap<String, String> map = node.getMap("test"); map.put(KEY, "value", 1, TimeUnit.SECONDS); map.lock(KEY); Object object = map.get(KEY); map.unlock(KEY); assertNotNull(object); Thread.sleep(1200); map.lock(KEY); object = map.get(KEY); map.unlock(KEY); assertNull(object); } finally { node.shutdown(); } }
Source:
<code>public String getDefaultExtension() { return <START> "pro"; <END> }</code><technical_language>Tor - default proguard-rules.txt changed a .pro extension</technical_language>

Target:
public String getDefaultExtension() { return EXT_PRO; }
Source:
<code>private void checkRequirementForRemovedTransparency(Surveillance surv, SurveillanceRequirement req) { if (req.getType() != null && !StringUtils.isEmpty(req.getType().getName()) && req.getType().getName().equalsIgnoreCase(SurveillanceRequirementType.TRANS_DISCLOSURE_REQ)) { String requirement = req.getRequirement(); if (requirement != null && requirement.equalsIgnoreCase("170.523 (k)(2)")) { surv.getErrorMessages().add( <START> msgUtil.getMessage("surveillance.requirementNotAddedForRemovedRequirement", <END> req.getRequirement())); } } }</code><technical_language>Is this error message supposed added for ACBs? I missing some larger context give error for users</technical_language>

Target:
private void checkRequirementForRemovedTransparency(Surveillance surv, SurveillanceRequirement req) { if (req.getType() != null && !StringUtils.isEmpty(req.getType().getName()) && req.getType().getName().equalsIgnoreCase(SurveillanceRequirementType.TRANS_DISCLOSURE_REQ)) { String requirement = req.getRequirement(); if (requirement != null && requirement.equalsIgnoreCase(RequirementTypeEnum.K2.getName())) { surv.getErrorMessages().add( msgUtil.getMessage("surveillance.requirementNotAddedForRemovedRequirement", req.getRequirement())); } } }
Source:
<code>private void initListeners(IContextService ctx) { PlatformUI.getWorkbench().getThemeManager() .addPropertyChangeListener(this.themeListener); getTextWidget().addLineBackgroundListener((event) -> { IDocument document = getDocument(); if (document instanceof DiffDocument) { try { int modelOffset = widgetOffset2ModelOffset( event.lineOffset); ITypedRegion partition = ((DiffDocument) document) .getPartition(modelOffset); if (partition != null) { Color color = backgroundColors.get(partition.getType()); if (color != null) { event.lineBackground = color; } } } catch (BadLocationException e) { } } }); if (ctx != null) { getTextWidget().addFocusListener(new FocusAdapter() { IContextActivation context; @Override public void focusGained(FocusEvent e) { context = ctx <START> .activateContext("org.eclipse.egit.ui.DiffViewer"); <END> } @Override public void focusLost(FocusEvent e) { if (context != null) { ctx.deactivateContext(context); context = null; } } }); } }</code><technical_language>Factor out a constant top of class</technical_language>

Target:
private void initListeners(IContextService ctx) { PlatformUI.getWorkbench().getThemeManager() .addPropertyChangeListener(this.themeListener); getTextWidget().addLineBackgroundListener((event) -> { IDocument document = getDocument(); if (document instanceof DiffDocument) { try { int modelOffset = widgetOffset2ModelOffset( event.lineOffset); ITypedRegion partition = ((DiffDocument) document) .getPartition(modelOffset); if (partition != null) { Color color = backgroundColors.get(partition.getType()); if (color != null) { event.lineBackground = color; } } } catch (BadLocationException e) { } } }); if (ctx != null) { getTextWidget().addFocusListener(new FocusAdapter() { IContextActivation context; @Override public void focusGained(FocusEvent e) { context = ctx .activateContext(DIFF_VIEWER_CONTEXT_ID); } @Override public void focusLost(FocusEvent e) { if (context != null) { ctx.deactivateContext(context); context = null; } } }); } }
Source:
<code>public CassandraKeyValueServiceConfig getConfig() { try { return ProxySelector.getDefault() .select(new URI("tcp", name, null, null)).stream() .filter(proxy -> proxy.type() == Proxy.Type.SOCKS) .findFirst() .map(proxy -> (CassandraKeyValueServiceConfig) ImmutableCassandraKeyValueServiceConfig.builder() .from(config) .servers(ImmutableCqlCapableConfig.builder() .addHosts(name) .cqlPort(CASSANDRA_CQL_PORT) .thriftPort(CASSANDRA_THRIFT_PORT) .socksProxy(proxy.address()) .build()) .build()) .orElse(config); } catch (URISyntaxException e) { <START> return config; <END> } }</code><technical_language>+1, throw figure out work</technical_language>

Target:
public CassandraKeyValueServiceConfig getConfig() { return config; }
Source:
<code><START> public void setPropertyAccessors(PropertyAccessor... accessors) { <END> for (PropertyAccessor accessor : accessors) { this.propertyAccessors.add(accessor); } }</code><technical_language>unlikely, if call this multiple times, want clear (and I guess re-add default is currently a single MapAccessor) adding collection</technical_language>

Target:
public void setPropertyAccessors(PropertyAccessor... accessors) { Assert.noNullElements(accessors, "Cannot have null elements in accessors"); List<PropertyAccessor> propertyAccessors = new ArrayList<PropertyAccessor>(); loadDefaultPropertyAccessors(propertyAccessors); for (PropertyAccessor accessor : accessors) { propertyAccessors.add(accessor); } this.propertyAccessors = propertyAccessors; }
Source:
<code><START> public void shouldPerformKeySelectOperationWhenRepartitionOperationIsUsedWithKeySelector() throws ExecutionException, InterruptedException { <END> final String repartitionedName = "new-key"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); final Repartitioned<String, String> repartitioned = Repartitioned.<String, String>as(repartitionedName) .withKeySerde(Serdes.String()); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString(), Named.as(repartitionedName)) .repartition(repartitioned) .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 1L), new KeyValue<>("2", 1L) ) ); final String topology = builder.build().describe().toString(); final String repartitionTopicName = toRepartitionTopicName(repartitionedName); assertTrue(topicExists(repartitionTopicName)); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*" + repartitionedName + "-repartition.*")); assertEquals(1, countOccurrencesInTopology(topology, "<-- " + repartitionedName + "\n")); }</code><technical_language>need this test</technical_language>

Target:
public void shouldPerformKeySelectOperationWhenRepartitionOperationIsUsedWithKeySelector() throws Exception { final String repartitionedName = "new-key"; final long timestamp = System.currentTimeMillis(); sendEvents( timestamp, Arrays.asList( new KeyValue<>(1, "A"), new KeyValue<>(2, "B") ) ); final StreamsBuilder builder = new StreamsBuilder(); final Repartitioned<String, String> repartitioned = Repartitioned.<String, String>as(repartitionedName) .withKeySerde(Serdes.String()); builder.stream(inputTopic, Consumed.with(Serdes.Integer(), Serdes.String())) .selectKey((key, value) -> key.toString(), Named.as(repartitionedName)) .repartition(repartitioned) .groupByKey() .count() .toStream() .to(outputTopic); startStreams(builder); validateReceivedMessages( new StringDeserializer(), new LongDeserializer(), Arrays.asList( new KeyValue<>("1", 1L), new KeyValue<>("2", 1L) ) ); final String topology = builder.build().describe().toString(); final String repartitionTopicName = toRepartitionTopicName(repartitionedName); assertTrue(topicExists(repartitionTopicName)); assertEquals(1, countOccurrencesInTopology(topology, "Sink: .*" + repartitionedName + "-repartition.*")); assertEquals(1, countOccurrencesInTopology(topology, "<-- " + repartitionedName + "\n")); }
Source:
<code>public static <T extends Enum<?>> List<T> getEnumList(final Config config, final String section, final String subsection, final String setting, final T[] all, final T defaultValue) { final List<T> list = new ArrayList<T>(); final String[] strings = config.getStringList(section, subsection, setting); for (final String string : strings) { if (string != null) { try { list.add(getEnum(section, subsection, setting, string, all)); <START> } catch (IllegalArgumentException e) { <END> } } } if (list.size() == 0) { list.add(defaultValue); } return list; }</code><technical_language>ignore invalid enum value</technical_language>

Target:
public static <T extends Enum<?>> List<T> getEnumList(final Config config, final String section, final String subsection, final String setting, final T[] all, final T defaultValue) { final List<T> list = new ArrayList<T>(); final String[] values = config.getStringList(section, subsection, setting); if (values.length == 0) { list.add(defaultValue); } else { for (String string : values) { if (string != null) { list.add(getEnum(section, subsection, setting, string, all)); } } } return list; }
Source:
<code>public boolean isV4( @NotBlank(message = "Id is missing and is required") final String id ) { log.debug("Requested to get v4 for job {}", id); <START> final JobV4Projection projection = this.jobRepository <END> .findByUniqueId(id, JobV4Projection.class) .orElseThrow( () -> { final String errorMessage = "No job with id " + id + "exists. Unable to get v4 flag."; log.error(errorMessage); return new GenieJobNotFoundException(errorMessage); } ); return projection.isV4(); }</code><technical_language>Unnecessary assign this a variable return</technical_language>

Target:
public boolean isV4( @NotBlank(message = "Id is missing and is required") final String id ) { log.debug("Read v4 flag from db for job ", id); return this.jobRepository .findByUniqueId(id, IsV4JobProjection.class) .orElseThrow( () -> { final String errorMessage = "No job with id " + id + "exists. Unable to get v4 flag."; log.error(errorMessage); return new GenieJobNotFoundException(errorMessage); } ).isV4(); }
Source:
<code>public void verifyWikiName(String expectedWikiName) { Assertion.assertEquals(expectedWikiName, wikiName.getAttribute("value")); <START> PageObjectLogging.log("verifyWikiName", "Verifyimg wiki name equals: " + expectedWikiName, true, driver); <END> }</code><technical_language>1. please change letter: "Verifyimg" "Verifying" 2. do need screenshot here</technical_language>

Target:
public void verifyWikiName(String expectedWikiName) { Assertion.assertEquals(expectedWikiName, wikiName.getAttribute("value")); PageObjectLogging.log("verifyWikiName", "verified wiki name equals: " + expectedWikiName, true); }
Source:
<code>public final int binarySearch(int fromIndex, int toIndex, int key) { if (fromIndex < 0 || toIndex < 0 || fromIndex > _size || toIndex > _size) { throw new IndexOutOfBoundsException(); } <START> if (fromIndex > toIndex) <END> throw new IllegalArgumentException(); return Arrays.binarySearch(_data, fromIndex, toIndex, key); }</code><technical_language>I this condition sense. update code match surrounding formatting (hard tabs, braces)</technical_language>

Target:
public final int binarySearch(int fromIndex, int toIndex, int key) { if (fromIndex < 0 || toIndex < 0 || fromIndex > _size || toIndex > _size) { throw new IndexOutOfBoundsException(); } if (fromIndex > toIndex) { throw new IllegalArgumentException(); } return Arrays.binarySearch(_data, fromIndex, toIndex, key); }
Source:
<code>public int getSize() { <START> return rawlstat[9]; <END> }</code><technical_language>This a long</technical_language>

Target:
public long getSize() { return size; }
Source:
<code>public void setUp() throws Exception { super.setUp(); <START> repository = new RepositoryBuilder().setGitDir(gitDir).build(); <END> repository.create(); file = new File(project.getProject().getLocation().toFile(), "a.txt"); final FileWriter fileWriter = new FileWriter(file); fileWriter.write("aaaaaaaaaaa"); fileWriter.close(); final ConnectProviderOperation operation = new ConnectProviderOperation( project.getProject(), gitDir); operation.execute(null); }</code><technical_language>FileRepositoryBuilder.create instead requires code</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); repository = FileRepositoryBuilder.create(gitDir); repository.create(); file = new File(project.getProject().getLocation().toFile(), "a.txt"); final FileWriter fileWriter = new FileWriter(file); fileWriter.write("aaaaaaaaaaa"); fileWriter.close(); final ConnectProviderOperation operation = new ConnectProviderOperation( project.getProject(), gitDir); operation.execute(null); }
Source:
<code>public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer ) { rh.setBounds( 2, 2, 14, 14, 14, 16 ); <START> rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() ); <END> rh.renderInventoryBox( renderer ); rh.setInvColor( this.getColor().whiteVariant ); rh.renderInventoryFace( this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setInvColor( this.getColor().mediumVariant ); rh.renderInventoryFace( this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setInvColor( this.getColor().blackVariant ); rh.renderInventoryFace( this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setBounds( 4, 4, 13, 12, 12, 14 ); rh.renderInventoryBox( renderer ); }</code><technical_language>re-use stuff</technical_language>

Target:
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer ) { rh.setBounds( 2, 2, 14, 14, 14, 16 ); final IIcon sideTexture = CableBusTextures.PartMonitorSides.getIcon(); final IIcon backTexture = CableBusTextures.PartMonitorBack.getIcon(); rh.setTexture( sideTexture, sideTexture, backTexture, this.is.getIconIndex(), sideTexture, sideTexture ); rh.renderInventoryBox( renderer ); rh.setInvColor( this.getColor().whiteVariant ); rh.renderInventoryFace( this.getFrontBright().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setInvColor( this.getColor().mediumVariant ); rh.renderInventoryFace( this.getFrontDark().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setInvColor( this.getColor().blackVariant ); rh.renderInventoryFace( this.getFrontColored().getIcon(), ForgeDirection.SOUTH, renderer ); rh.setBounds( 4, 4, 13, 12, 12, 14 ); rh.renderInventoryBox( renderer ); }
Source:
<code>protected XmlFile getConfigXml() { <START> return new XmlFile(Jenkins.XSTREAM, new File(Jenkins.getInstance().getRootDir(), this.getXmlFileName())); <END> }</code><technical_language>a fix this is Jenkins.getActiveInstance()</technical_language>

Target:
protected XmlFile getConfigXml() { return new XmlFile(Jenkins.XSTREAM, new File(Jenkins.getActiveInstance().getRootDir(), this.getXmlFileName())); }
Source:
<code>private String getJavaBeanPropertyName(JavaBeanProperty property) { String resolvedName = property.getName(); Field field = getField( resolvedName, property.getDeclaringClass() ); if ( field != null && field.isAnnotationPresent( annotationType ) ) { Annotation a = field.getAnnotation( annotationType ); try { <START> resolvedName = (String) a.annotationType().getMethod( annotationMemberName ).invoke( a ); <END> } catch (Exception e) { e.printStackTrace(); } } return resolvedName; }</code><technical_language>I example try get right: - method resolved in constructor - a Logger a proper error message, e.printStackTrace();. in mind examples copied a lot</technical_language>

Target:
private String getJavaBeanPropertyName(JavaBeanProperty property) { Optional<Field> field = getField( property ); if ( field.isPresent() && field.get().isAnnotationPresent( annotationType ) ) { return getAnnotationMemberValue( field.get(), annotationMemberName ) .orElse( getDefaultName( property ) ); } else { return getDefaultName( property ); } }
Source:
<code>public void setUp() throws NoSuchMethodException { mRootView = new TestView(this.getContext()); final List<PropertyDescription> props = new ArrayList<PropertyDescription>(); <START> final PropertyCaller textGetter = new PropertyCaller(TextView.class, "getText", new Object[0], CharSequence.class); <END> final PropertyDescription text = new PropertyDescription("text", TextView.class, textGetter, "setText"); props.add(text); final PropertyCaller customPropGetter = new PropertyCaller(TestView.CustomPropButton.class, "getCustomProperty", new Object[0], CharSequence.class); final PropertyDescription custom = new PropertyDescription( "custom", TestView.CustomPropButton.class, customPropGetter, "setCustomProperty" ); props.add(custom); final Map<String, Integer> idNamesToIds = new HashMap<String, Integer>(); idNamesToIds.put("ROOT_ID", TestView.ROOT_ID); idNamesToIds.put("TEXT_VIEW_ID", TestView.TEXT_VIEW_ID); idNamesToIds.put("CRAZYSAUCE ID", 1234567); final ResourceIds resourceIds = new TestUtils.TestResourceIds(idNamesToIds); mSnapshot = new ViewSnapshot(props, resourceIds); }</code><technical_language>Do need this rename anymore</technical_language>

Target:
public void setUp() throws NoSuchMethodException { mRootView = new TestView(this.getContext()); final List<PropertyDescription> props = new ArrayList<PropertyDescription>(); final Caller textGetter = new Caller(TextView.class, "getText", new Object[0], CharSequence.class); final PropertyDescription text = new PropertyDescription("text", TextView.class, textGetter, "setText"); props.add(text); final Caller customPropGetter = new Caller(TestView.CustomPropButton.class, "getCustomProperty", new Object[0], CharSequence.class); final PropertyDescription custom = new PropertyDescription( "custom", TestView.CustomPropButton.class, customPropGetter, "setCustomProperty" ); props.add(custom); final Map<String, Integer> idNamesToIds = new HashMap<String, Integer>(); idNamesToIds.put("ROOT_ID", TestView.ROOT_ID); idNamesToIds.put("TEXT_VIEW_ID", TestView.TEXT_VIEW_ID); idNamesToIds.put("CRAZYSAUCE ID", 1234567); final ResourceIds resourceIds = new TestUtils.TestResourceIds(idNamesToIds); mSnapshot = new ViewSnapshot(props, resourceIds); }
Source:
<code>createMutateRowsCall(MutateRowsRequest request) { <START> expandPoolIfNecessary(this.bigtableOptions.getChannelCount()); <END> return createRetryableCall(BigtableServiceGrpc.METHOD_MUTATE_ROWS, ARE_RETRYABLE_MUTATIONS, request); }</code><technical_language>This called blocking async versions of mutateRows, move expandPoolIfNecessary mutateRowsAsync()</technical_language>

Target:
createMutateRowsCall(MutateRowsRequest request) { return createRetryableCall(BigtableServiceGrpc.METHOD_MUTATE_ROWS, ARE_RETRYABLE_MUTATIONS, request); }
Source:
<code>private void decodeGh3000Parameter(Position position, int id, ChannelBuffer buf, int length) { switch (id) { case 1: position.set(Position.KEY_BATTERY_LEVEL, readValue(buf, length, false)); break; case 2: position.set("usbConnected", readValue(buf, length, false) == 1); break; case 5: position.set("uptime", readValue(buf, length, false)); break; case 20: position.set(Position.KEY_HDOP, readValue(buf, length, false) * 0.1); break; case 21: position.set(Position.KEY_VDOP, readValue(buf, length, false) * 0.1); break; case 22: position.set(Position.KEY_PDOP, readValue(buf, length, false) * 0.1); break; case 67: position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001); break; case 221: position.set("button", readValue(buf, length, false)); break; case 222: if (readValue(buf, length, false) == 1) { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } break; case 240: position.set(Position.KEY_MOTION, readValue(buf, length, false) == 1); break; case 244: <START> position.set("roaming", readValue(buf, length, false) == 1); <END> break; default: position.set(Position.PREFIX_IO + id, readValue(buf, length, false)); break; } }</code><technical_language>I a dedicated key for this. I recall some other protocol report this information</technical_language>

Target:
private void decodeGh3000Parameter(Position position, int id, ChannelBuffer buf, int length) { switch (id) { case 1: position.set(Position.KEY_BATTERY_LEVEL, readValue(buf, length, false)); break; case 2: position.set("usbConnected", readValue(buf, length, false) == 1); break; case 5: position.set("uptime", readValue(buf, length, false)); break; case 20: position.set(Position.KEY_HDOP, readValue(buf, length, false) * 0.1); break; case 21: position.set(Position.KEY_VDOP, readValue(buf, length, false) * 0.1); break; case 22: position.set(Position.KEY_PDOP, readValue(buf, length, false) * 0.1); break; case 67: position.set(Position.KEY_BATTERY, readValue(buf, length, false) * 0.001); break; case 221: position.set("button", readValue(buf, length, false)); break; case 222: if (readValue(buf, length, false) == 1) { position.set(Position.KEY_ALARM, Position.ALARM_SOS); } break; case 240: position.set(Position.KEY_MOTION, readValue(buf, length, false) == 1); break; case 244: position.set(Position.KEY_ROAMING, readValue(buf, length, false) == 1); break; default: position.set(Position.PREFIX_IO + id, readValue(buf, length, false)); break; } }
Source:
<code>public void init(Presenter presenter) { this.presenter = presenter; nameLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.name()); typeLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.type()); statelessLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.statelessLabel()); dmnFileLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.dmnModelLabel()); dmnNamespaceLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.dmnNamespaceLabel()); <START> dmnNameLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.dmnNameLabel()); <END> }</code><technical_language>add this check too? chooseButton.setTitle(ScenarioSimulationEditorConstants.INSTANCE.chooseFile());</technical_language>

Target:
public void init(Presenter presenter) { this.presenter = presenter; nameLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.name()); typeLabel.setInnerText(ScenarioSimulationEditorConstants.INSTANCE.type()); statelessLabel.setInnerText(STATELESS_LABEL); dmnFileLabel.setInnerText(DMN_MODEL_LABEL); dmnNamespaceLabel.setInnerText(DMN_NAMESPACE_LABEL); dmnNameLabel.setInnerText(DMN_NAME_LABEL); }
Source:
<code>private void updateCurrentHeading() { double imuDeltaYaw = lastImuHeading.difference(imu.getYaw()); <START> currentHeading.shiftValue(imuDeltaYaw); <END> lastImuHeading = imu.getYaw(); currentHeadingProp.set(currentHeading.getValue()); currentPitch.set(getRobotPitch()); currentRoll.set(getRobotRoll()); }</code><technical_language>This subtract-then-add method odd. store offset</technical_language>

Target:
private void updateCurrentHeading() { currentHeading.setValue(getRobotYaw().getValue() + headingOffset); currentHeadingProp.set(currentHeading.getValue()); currentPitch.set(getRobotPitch()); currentRoll.set(getRobotRoll()); }
Source:
<code>public void setup() { windowStore = buildWindowStore(RETENTION_PERIOD, WINDOW_SIZE, false, Serdes.Integer(), Serdes.String()); final RecordCollector recordCollector = createRecordCollector(windowStore.name()); recordCollector.init(producer); final StreamsMetricsImpl streamsMetrics = niceMock(StreamsMetricsImpl.class); replay(streamsMetrics); context = new InternalMockProcessorContext( baseDir, Serdes.String(), Serdes.Integer(), recordCollector, <START> new ThreadCache( new LogContext("testCache"), 0, streamsMetrics)); <END> windowStore.init(context, windowStore); }</code><technical_language>nit: Please fix code style</technical_language>

Target:
public void setup() { windowStore = buildWindowStore(RETENTION_PERIOD, WINDOW_SIZE, false, Serdes.Integer(), Serdes.String()); final RecordCollector recordCollector = createRecordCollector(windowStore.name()); recordCollector.init(producer); context = new InternalMockProcessorContext( baseDir, Serdes.String(), Serdes.Integer(), recordCollector, new ThreadCache( new LogContext("testCache"), 0, new StreamsMetricsImpl(new Metrics(), "test", StreamsConfig.METRICS_LATEST))); windowStore.init(context, windowStore); }
Source:
<code>public ValueType typeCheck(TypeContext ctx) { <START> if (Util.isDynamicType(getReceiverType(ctx))) return Util.dynType(); <END> typeMethodDeclaration(ctx); return getExprType(); }</code><technical_language>need check arguments some type (even if care is)</technical_language>

Target:
public ValueType typeCheck(TypeContext ctx) { if (Util.isDynamicType(getReceiverType(ctx))) { for (IExpr arg : args) { arg.typeCheck(ctx); } return Util.dynType(); } typeMethodDeclaration(ctx); return getExprType(); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> selectedNodes = getSelectedNodes(event); <START> if (selectedNodes == null || selectedNodes.isEmpty()) { <END> MessageDialog.openError(Display.getDefault().getActiveShell(), UIText.ImportProjectsWrongSelection, UIText.ImportProjectsSelectionInRepositoryRequired); return null; } for (Object node : selectedNodes) { List<File> files = null; Repository repo = null; if (node instanceof PlotCommit) { PlotCommit pt = (PlotCommit) node; repo = getRepository(event); files = getFilesForPlotCommit(pt, repo); } else if (node instanceof RefNode) { RefNode rn = (RefNode) node; repo = getRepository(rn); files = getFilesForRefNode(rn, repo); } if (repo != null) { Set<File> dotProjectFiles = findDotProjectFiles(files, repo); importProjects(dotProjectFiles); } } return null; }</code><technical_language>this happen if context menu entry is properly configured, need raise a message dialog</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> selectedNodes = getSelectedNodes(event); if (selectedNodes == null || selectedNodes.isEmpty()) { MessageDialog.openError(Display.getDefault().getActiveShell(), UIText.ImportProjectsWrongSelection, UIText.ImportProjectsSelectionInRepositoryRequired); return null; } for (Object node : selectedNodes) { List<File> files = null; Repository repo = getRepository(event); if (repo == null || !(node instanceof PlotCommit<?>)) return null; files = getFilesChangedInCommit((RevCommit) node, repo); Set<File> dotProjectFiles = findDotProjectFiles(files, repo); importProjects(dotProjectFiles); } return null; }
Source:
<code>private void deleteArtifactIFPresent() throws ArtifactResolutionException { ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(getArtifact()); ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(newSession(newRepositorySystem()), artifactRequest); if (!result.isMissing()) { File artifactFile = result.getArtifact().getFile(); <START> assertThat(artifactFile.delete()); <END> } }</code><technical_language>This asserThat do - need add isTrue()</technical_language>

Target:
private void deleteArtifactIFPresent() throws ArtifactResolutionException { ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(getArtifact()); ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(newSession(newRepositorySystem()), artifactRequest); if (!result.isMissing()) { File artifactFile = result.getArtifact().getFile(); assertThat(artifactFile.delete()).isTrue(); } }
Source:
<code>public String generate(String columnAlias, List<FilterPredicate.FilterParameter> params) { <START> <END> if (Strings.isNullOrEmpty(columnAlias)) { throw new InvalidValueException(FILTER_PATH_NOT_NULL); } if (argumentCount == ArgumentCount.MANY) { Preconditions.checkState(!params.isEmpty()); } else if (argumentCount == ArgumentCount.ONE) { Preconditions.checkArgument(params.size() == 1); if (Strings.isNullOrEmpty(params.get(0).getPlaceholder())) { throw new IllegalStateException(FILTER_ALIAS_NOT_NULL); } } return String.format(jpqlTemplate, upperOrLower.wrap(columnAlias), params.stream() .map(upperOrLower::wrap) .collect(Collectors.joining(COMMA))); }</code><technical_language>I need a test for CaseAwareJPQLGenerator this method in</technical_language>

Target:
public String generate(String columnAlias, List<FilterPredicate.FilterParameter> params) { if (Strings.isNullOrEmpty(columnAlias)) { log.error("columnAlias cannot be NULL or empty"); throw new InvalidValueException(FILTER_PATH_NOT_NULL); } if (argumentCount == ArgumentCount.MANY) { Preconditions.checkState(!params.isEmpty()); } else if (argumentCount == ArgumentCount.ONE) { Preconditions.checkArgument(params.size() == 1); if (Strings.isNullOrEmpty(params.get(0).getPlaceholder())) { log.error("One non-null, non-empty argument was expected."); throw new IllegalStateException(FILTER_ALIAS_NOT_NULL); } } return String.format(jpqlTemplate, upperOrLower.wrap(columnAlias), params.stream() .map(upperOrLower::wrap) .collect(Collectors.joining(COMMA))); }
Source:
<code><START> public void loginShouldNotReturnDetailedUserDto() throws UserNotFoundException { <END> given(userRepository.findByUserNameAndUserPassword(USER_NAME, USER_PASSWORD)).willReturn(NULL_USER_ENTITY); UserDTO result = userService.login(userDTO); assertNull(result); }</code><technical_language>handled NoResultExcpetion? I worth change service implementation consistent in situations</technical_language>

Target:
public void loginShouldNotReturnDetailedUserDto() throws UserNotFoundException { given(userRepository.findByUserNameAndUserPassword(USER_NAME, USER_PASSWORD)).willReturn(NULL_USER_ENTITY); UserDTO result = userService.login(userDTO); }
Source:
<code>public ByteBufferInputStream(ByteBuffer buffer, int offset, int count) { buffer.position(offset); <START> byteBuf = buffer.slice(); <END> byteBuf.limit(count); }</code><technical_language>call duplicate call position, avoid changing state of original ByteBuffer</technical_language>

Target:
public ByteBufferInputStream(ByteBuffer buffer, int offset, int count) { ByteBuffer temp = buffer.duplicate(); temp.position(offset); byteBuf = temp.slice(); byteBuf.limit(count); }
Source:
<code><START> private <K, V> ImmutableBiMap<K, V> newImmutableBiMapRemovingKeys(ImmutableBiMap<K, V> original, <END> Set<K> keysToRemove) { ImmutableBiMap.Builder<K, V> builder = ImmutableBiMap.builder(); for (Map.Entry<K, V> property : original.entrySet()) { if (!keysToRemove.contains(property.getKey())) { builder.put(property); } } return builder.build(); }</code><technical_language>This method is java original.keySet().removeAll(keysToRemove)</technical_language>

Target:
private static <K, V> ImmutableBiMap<K, V> newImmutableBiMapRemovingKeys(ImmutableBiMap<K, V> original, Set<K> keysToRemove) { ImmutableBiMap.Builder<K, V> builder = ImmutableBiMap.builder(); for (Map.Entry<K, V> property : original.entrySet()) { if (!keysToRemove.contains(property.getKey())) { builder.put(property); } } return builder.build(); }
Source:
<code><START> checkFound(Optional<? extends AggregateRepository<?, ?>> rawRepo) { <END> if (!rawRepo.isPresent()) { final String errMsg = String.format("Unable to find repository for the state class: %s", stateClass); throw new IllegalStateException(errMsg); } else { return rawRepo.get(); } }</code><technical_language>this wrapping again</technical_language>

Target:
checkFound(Optional<? extends AggregateRepository<?, ?>> rawRepo) { if (!rawRepo.isPresent()) { final String errMsg = format("Unable to find repository for the state class: %s", stateClass); throw new IllegalStateException(errMsg); } else { return rawRepo.get(); } }
Source:
<code>public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = null; <START> <END> final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; final String value = "world"; System.out.println("Beginning of synchronous sample..."); ConfigurationSetting setting = client.setConfigurationSetting(key, null, value); System.out.printf(String.format("[SetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); setting = client.getConfigurationSetting(key, null, null); System.out.printf(String.format("[GetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); setting = client.deleteConfigurationSetting(key, null); System.out.printf(String.format("[DeleteConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); System.out.println("End of synchronous sample."); }</code><technical_language>nit: empty line</technical_language>

Target:
public static void main(String[] args) { String endpoint = "{endpoint_value}"; TokenCredential tokenCredential = new DefaultAzureCredentialBuilder().build(); final ConfigurationClient client = new ConfigurationClientBuilder() .credential(tokenCredential) .endpoint(endpoint) .buildClient(); final String key = "hello"; final String value = "world"; System.out.println("Beginning of synchronous sample..."); ConfigurationSetting setting = client.setConfigurationSetting(key, null, value); System.out.printf(String.format("[SetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); setting = client.getConfigurationSetting(key, null, null); System.out.printf(String.format("[GetConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); setting = client.deleteConfigurationSetting(key, null); System.out.printf(String.format("[DeleteConfigurationSetting] Key: %s, Value: %s", setting.getKey(), setting.getValue())); System.out.println("End of synchronous sample."); }
Source:
<code>private boolean blockHandshakeOnce(UUID nodeId) { if (blockedNodeId == null || blockedNodeId.equals(nodeId)) { blockedNodeId = nodeId; <START> return true; <END> } return false; }</code><technical_language>space line</technical_language>

Target:
private boolean blockHandshakeOnce(UUID nodeId) { if (isBlocking && (blockedNodeId == null || blockedNodeId.equals(nodeId))) { blockedNodeId = nodeId; return true; } return false; }
Source:
<code>protected ITmfStateValue getEventFieldValue(ITmfEvent event, String fieldName) { ITmfStateValue value = TmfStateValue.nullValue(); final ITmfEventField field = event.getContent().getField(fieldName); Object fieldValue = null; if (field == null) { if (fieldName.equalsIgnoreCase(TmfXmlStrings.CPU)) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu != null) { return TmfStateValue.newValueInt(cpu.intValue()); } } else if (fieldName.equalsIgnoreCase(TmfXmlStrings.TIMESTAMP)) { return TmfStateValue.newValueLong(event.getTimestamp().getValue()); } else if (fieldName.equalsIgnoreCase(TmfXmlStrings.HOSTID)) { return TmfStateValue.newValueString(event.getTrace().getHostId()); } fieldValue = TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), fieldName, event); if (fieldValue == null) { return value; } } else { fieldValue = field.getValue(); } <START> value = TmfStateValue.newValueObjectWithForcedType(fieldValue, fForcedType); <END> return value; }</code><technical_language>This is nice</technical_language>

Target:
protected ITmfStateValue getEventFieldValue(ITmfEvent event, String fieldName) { ITmfStateValue value = TmfStateValue.nullValue(); final ITmfEventField field = event.getContent().getField(fieldName); Object fieldValue = null; if (field == null) { if (fieldName.equalsIgnoreCase(TmfXmlStrings.CPU)) { Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event); if (cpu != null) { return TmfStateValue.newValueInt(cpu.intValue()); } } else if (fieldName.equalsIgnoreCase(TmfXmlStrings.TIMESTAMP)) { return TmfStateValue.newValueLong(event.getTimestamp().getValue()); } else if (fieldName.equalsIgnoreCase(TmfXmlStrings.HOSTID)) { return TmfStateValue.newValueString(event.getTrace().getHostId()); } fieldValue = TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), fieldName, event); if (fieldValue == null) { return value; } } else { fieldValue = field.getValue(); } value = TmfXmlUtils.newTmfStateValueFromObjectWithForcedType(fieldValue, fForcedType); return value; }
Source:
<code><START> private static void setupPreferences() { final Map<String, String> preferences = new HashMap<String, String>() {{ put(ApplicationPreferences.DATE_FORMAT, DATE_FORMAT); }}; <END> ApplicationPreferences.setUp(preferences); }</code><technical_language>This simplified, private static void setupPreferences() { final Map<String, String> preferences = Collections.singletonMap(ApplicationPreferences.DATE_FORMAT, DATE_FORMAT); ApplicationPreferences.setUp(preferences); }</technical_language>

Target:
private static void setupPreferences() { final Map<String, String> preferences = Collections.singletonMap(ApplicationPreferences.DATE_FORMAT, DATE_FORMAT); ApplicationPreferences.setUp(preferences); }
Source:
<code>protected AbstractProject(ItemGroup parent, String name) { super(parent,name); buildMixIn = createBuildMixIn(); builds = buildMixIn.getRunMap(); <START> final Jenkins j = Jenkins.get(); <END> final List<Node> nodes = j.getNodes(); if(nodes!=null && !nodes.isEmpty()) { canRoam = true; } }</code><technical_language>local var is longer needed</technical_language>

Target:
protected AbstractProject(ItemGroup parent, String name) { super(parent,name); buildMixIn = createBuildMixIn(); builds = buildMixIn.getRunMap(); Jenkins j = Jenkins.getInstanceOrNull(); if (j != null && !j.getNodes().isEmpty()) { canRoam = true; } }
Source:
<code>public @Nonnull Set<Entry<K, V>> entrySet() { return mainMap.entryStream().map(entry -> new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue())) <START> .collect(ImmutableSet.toImmutableSet()); <END> }</code><technical_language>This objects rehashed this expensive ~5-10x For a map of 1 million entries it: 1 million iter 0 [guava] elapsed(ms) : 463 [ImmuableListSetWrapper] elapsed(ms) : 61 iter 1 [guava] elapsed(ms) : 402 [ImmuableListSetWrapper] elapsed(ms) : 63 iter 2 [guava] elapsed(ms) : 388 [ImmuableListSetWrapper] elapsed(ms) : 52 iter 3 [guava] elapsed(ms) : 394 [ImmuableListSetWrapper] elapsed(ms) : 54 For a map of 500 thousand entries: iter 0 [guava] elapsed(ms) : 233 [ImmuableListSetWrapper] elapsed(ms) : 33 iter 1 [guava] elapsed(ms) : 184 [ImmuableListSetWrapper] elapsed(ms) : 38 iter 2 [guava] elapsed(ms) : 197 [ImmuableListSetWrapper] elapsed(ms) : 31 In this experiment, map a UUID for key value, for complex types, this more expensive. This is excluding equality checks collisions, adds bottom line</technical_language>

Target:
public @Nonnull Set<Entry<K, V>> entrySet() { return new ImmuableListSetWrapper(mainMap.entryStream().map(entry -> new AbstractMap.SimpleImmutableEntry<>(entry.getKey(), entry.getValue())) .collect(ImmutableList.toImmutableList())); }
Source:
<code>public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adaptableObject instanceof Exif) { if (IFile.class.equals(adapterType)) { URI uri = ((Exif) adaptableObject).getUri(); if (uri != null) { IFile[] files = workspace.getRoot() .findFilesForLocationURI(uri); if (files.length == 1) { IFile file = files[0]; if (file.exists()) { @SuppressWarnings("unchecked") <START> T iFile = (T) file; <END> return iFile; } } } } } return null; }</code><technical_language>This wrong, IFile casted requested T</technical_language>

Target:
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (adaptableObject instanceof Exif) { if (IFile.class.equals(adapterType)) { URI uri = ((Exif) adaptableObject).getUri(); if (uri != null) { IFile[] files = workspace.getRoot() .findFilesForLocationURI(uri); if (files.length == 1) { IFile file = files[0]; if (file.exists()) { return adapterType.cast(file); } } } } } return null; }
Source:
<code>public T call() throws Exception { running.inc(); <START> Timer.Context context = duration.time(); <END> try { return callable.call(); } finally { context.stop(); running.dec(); completed.mark(); } }</code><technical_language>this final</technical_language>

Target:
public T call() throws Exception { running.inc(); final Timer.Context context = duration.time(); try { return callable.call(); } finally { context.stop(); running.dec(); completed.mark(); } }
Source:
<code>private Set<String> getCurrentValues(final String value, final boolean isMultipleSelect) { final Set<String> result = new HashSet<String>(); if (isMultipleSelect && value != null) { final String[] split = ListSplitter.split("\"", true, removeBrackets(value)); for (String val : Arrays.asList(split)) { result.add(val.trim()); } <START> } else { <END> result.add(value); } return result; }</code><technical_language>This branch simplified: java final String[] split = ListSplitter.split("\"", true, removeBrackets(value)); for (String val : split) { result.add(val.trim()); } shortened java Arrays.stream(ListSplitter.split("\"", true, removeBrackets(value))) .forEach(enumItem -> result.add(enumItem.trim()));</technical_language>

Target:
private Set<String> getCurrentValues(final String value, final boolean isMultipleSelect) { final Set<String> result = new HashSet<String>(); if (value != null) { if (isMultipleSelect) { Arrays.stream(ListSplitter.split("\"", true, removeBrackets(value))) .forEach(enumItem -> result.add(enumItem.trim())); } else { result.add(value); } } return result; }
Source:
<code>protected void configure() { <START> bind(CookieManager.class).to(DefaultCookieManager.class).in(Singleton.class); <END> }</code><technical_language>this builder</technical_language>

Target:
protected void configure() { bind(BodyFactory.class).to(builder.getBodyFactory()).in(Singleton.class); bind(CookieManager.class).to(builder.getCookieManager()).in(Singleton.class); bind(HeaderFactory.class).to(builder.getHeaderFactory()).in(Singleton.class); bind(UriFactory.class).to(builder.getUriFactory()).in(Singleton.class); bind(DispatchCallFactory.class).to(builder.getDispatchCallFactory()).in(Singleton.class); bind(RequestBuilderFactory.class).to(builder.getRequestBuilderFactory()).in(Singleton.class); bind(ResponseDeserializer.class).to(builder.getResponseDeserializer()).in(Singleton.class); bind(HttpParameterFactory.class).to(builder.getHttpParameterFactory()).in(Singleton.class); bind(RestDispatch.class).to(builder.getRestDispatch()).in(Singleton.class); }
Source:
<code>public CreatePromisePairPrim(final boolean eagerWrapper, final SourceSection source) { super(eagerWrapper, source); if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { Breakpoints breakpointCatalog = VM.getWebDebugger().getBreakpoints(); FullSourceCoordinate sourceCoord = SourceCoordinate.create(source); <START> this.promiseResolverBreakpoint = insert(BreakpointNodeGen.create(breakpointCatalog.getPromiseResolverBreakpoint(sourceCoord))); <END> this.promiseResolutionBreakpoint = insert(BreakpointNodeGen.create(breakpointCatalog.getPromiseResolutionBreakpoint(sourceCoord))); } else { this.promiseResolverBreakpoint = insert(new DisabledBreakpointNode()); this.promiseResolutionBreakpoint = insert(new DisabledBreakpointNode()); } }</code><technical_language>multiple places for this stuff, I a helper method for breakpoint node creation. A factory method, internally checks VmSettings. TRUFFLE_DEBUGGER_ENABLED flag</technical_language>

Target:
public CreatePromisePairPrim(final boolean eagerWrapper, final SourceSection source) { super(eagerWrapper, source); this.promiseResolverBreakpoint = insert(Breakpoints.createPromiseResolver(source)); this.promiseResolutionBreakpoint = insert(Breakpoints.createPromiseResolution(source)); }
Source:
<code>private HolidayCalendar maturityDateCalendar() { HolidayCalendar cal = maturityDateOffset.getEffectiveResultCalendar(); if (cal == HolidayCalendars.NO_HOLIDAYS) { <START> cal = fixingCalendar; <END> } return cal; }</code><technical_language>Early return? conditional</technical_language>

Target:
private HolidayCalendar maturityDateCalendar() { HolidayCalendar cal = maturityDateOffset.getEffectiveResultCalendar(); return (cal == HolidayCalendars.NO_HOLIDAYS ? fixingCalendar : cal); }
Source:
<code>private static List<IFile> calculateMembers(final FileList list, final IProject project) throws IOException { List<IResource> resources = project.members(); <START> if (resources.size() == 0) return Collections.emptyList(); <END> Deque<IResource> stack = new LinkedList<>(resources); List<IFile> files = new LinkedList<>(); while (!stack.isEmpty()) { IResource resource = stack.pop(); if (resource.isIgnored() || !resource.exists()) continue; String path = resource.getProjectRelativePath().toPortableString(); if (list.contains(path)) continue; switch (resource.getType()) { case FILE: files.add((IFile) resource); MetaData data = new MetaData(); list.addPath(path, data, false); list.addEncoding(((IFile) resource).getCharset()); break; case FOLDER: stack.addAll(((IFolder) resource).members()); list.addPath(path, null, true); break; } } return files; }</code><technical_language>resources.isEmpty()</technical_language>

Target:
private static List<IFile> calculateMembers(final FileList list, final IProject project) throws IOException { List<IResource> resources = project.members(); if (resources.isEmpty()) return Collections.emptyList(); Deque<IResource> stack = new LinkedList<>(resources); List<IFile> files = new LinkedList<>(); while (!stack.isEmpty()) { IResource resource = stack.pop(); if (resource.isIgnored() || !resource.exists()) continue; String path = resource.getProjectRelativePath().toPortableString(); if (list.contains(path)) continue; switch (resource.getType()) { case FILE: files.add((IFile) resource); MetaData data = new MetaData(); list.addPath(path, data, false); list.addEncoding(((IFile) resource).getCharset()); break; case FOLDER: stack.addAll(((IFolder) resource).members()); list.addPath(path, null, true); break; } } return files; }