auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldReturnTagByIdWithHttpCode200() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findOne(foundTag.getId())).thenReturn(foundTag); mockMvc.perform(get("/api/v1/tags/{tagId}", foundTag.getId()) .accept(APPLICATION_JSON_UTF8)).andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$." + ID).value(is(((int) foundTag.getId())))) <START> .andExpect(jsonPath("$.name").value(is(foundTag.getName()))) <END> ; verify(tagServiceMock, times(1)).findOne(foundTag.getId()); verifyNoMoreInteractions(tagServiceMock); }</code><technical_language>assert links</technical_language>

Target:
public void shouldReturnTagByIdWithHttpCode200() throws Exception { Tag foundTag = TestTagBuilder.aTag().build(); when(tagServiceMock.findOne(foundTag.getId())).thenReturn(foundTag); mockMvc.perform(get("/api/v1/tags/{tagId}", foundTag.getId()) .accept(APPLICATION_JSON_UTF8)).andDo(print()) .andExpect(status().isOk()) .andExpect(content().contentType(APPLICATION_JSON_UTF8)) .andExpect(jsonPath("$." + ID).value(is(((int) foundTag.getId())))) .andExpect(jsonPath("$.name").value(is(foundTag.getName()))) .andExpect(jsonPath("$.links", hasSize(2))) .andExpect(jsonPath("$.links[0].rel").value(is(Link.REL_SELF))) .andExpect(jsonPath("$.links[0].href").value(containsString("/api/v1/tags/" + foundTag.getId()))) .andExpect(jsonPath("$.links[1].rel").value(is(TagResourceAsm.IDEAS_REL))) .andExpect(jsonPath("$.links[1].href").value(containsString("/api/v1/tags/" + foundTag.getId() + "/ideas"))); verify(tagServiceMock, times(1)).findOne(foundTag.getId()); verifyNoMoreInteractions(tagServiceMock); }
Source:
<code>public void testStartFailure() { final Set<LongRange> rangesToMove = new HashSet<>(); rangesToMove.clear(); rangesToMove.add(new LongRange(0, 9)); try { migrationManager.startMigration("op", EVAL1, EVAL0, DATA_TYPE, rangesToMove, null); <START> } catch (final RuntimeException e) { <END> } try { migrationManager.startMigration("op", EVAL0, EVAL1, "Undefined", rangesToMove, null); fail(); } catch (final RuntimeException e) { } rangesToMove.add(new LongRange(110, 120)); try { migrationManager.startMigration("op", EVAL0, EVAL1, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } }</code><technical_language>Add fail()</technical_language>

Target:
public void testStartFailure() { final Set<LongRange> rangesToMove = new HashSet<>(); rangesToMove.clear(); rangesToMove.add(new LongRange(0, 9)); try { migrationManager.startMigration(OP_ID, EVAL1, EVAL0, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } partitionManager.register(EVAL0, DATA_TYPE, INITIAL_RANGE0); partitionManager.register(EVAL1, DATA_TYPE, INITIAL_RANGE1); try { migrationManager.startMigration(OP_ID, EVAL0, EVAL1, "Undefined", rangesToMove, null); fail(); } catch (final RuntimeException e) { } rangesToMove.add(new LongRange(101, 110)); try { migrationManager.startMigration(OP_ID, EVAL0, EVAL1, DATA_TYPE, rangesToMove, null); fail(); } catch (final RuntimeException e) { } }
Source:
<code>public final void dispose() { Binding[] bindingArray = (Binding[]) bindings.toArray(new Binding[bindings.size()]); for (Binding <START> element : <END> bindingArray) { element.dispose(); } ValidationStatusProvider[] statusProviderArray = (ValidationStatusProvider[]) validationStatusProviders .toArray(new ValidationStatusProvider[validationStatusProviders .size()]); for (int i = 0; i < statusProviderArray.length; i++) { if (!statusProviderArray[i].isDisposed()) statusProviderArray[i].dispose(); } }</code><technical_language>rename 'binding'</technical_language>

Target:
public final void dispose() { Binding[] bindingArray = (Binding[]) bindings.toArray(new Binding[bindings.size()]); for (Binding binding : bindingArray) { binding.dispose(); } ValidationStatusProvider[] statusProviderArray = (ValidationStatusProvider[]) validationStatusProviders .toArray(new ValidationStatusProvider[validationStatusProviders .size()]); for (int i = 0; i < statusProviderArray.length; i++) { if (!statusProviderArray[i].isDisposed()) statusProviderArray[i].dispose(); } }
Source:
<code>public void testA3UseCase() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); PostProcessorDescriptorRegistryImpl registry = new PostProcessorDescriptorRegistryImpl(); registry.put(TestPostProcessor.class.getName(), new TestPostProcessorDescriptor(Pattern <START> .compile(".*/nides"), null, new TestPostProcessor(), 10)); <END> final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); final Comparison comparison = EMFCompare.builder().setPostProcessorRegistry(registry).build() .compare(scope); assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatches().size())); }</code><technical_language>number of times this pattern is repeated, this extracted in a common "setupTest(String nsURI)" method. better, "private Comparison compareWithPostProcessing(Resource left, Resource right, String nsURI)" "assert" extracted</technical_language>

Target:
public void testA3UseCase() throws IOException { final Resource left = input.getLeft(); final Resource right = input.getRight(); final Comparison comparison = compareWithPostProcessing(left, right, Pattern.compile(".*/nides"), null); assertSame(Integer.valueOf(1), Integer.valueOf(comparison.getMatches().size())); }
Source:
<code><START> public void serviceMethod(String string) { <END> invoked = true; }</code><technical_language>this param is unnecessary</technical_language>

Target:
public Object serviceMethod(String string) { invoked = true; return new ObjectTest("testObject"); }
Source:
<code>public VaultPackage getPackage() throws IOException { this.vltPkg = registry.open(installState.getFilePath().toFile()); <START> return this.vltPkg; <END> }</code><technical_language>overwrite this.vltPkg. is this intended? do: if (this.vltPkg == null) { this.vltPkg = ... }</technical_language>

Target:
public VaultPackage getPackage() throws IOException { if (this.vltPkg == null) { this.vltPkg = registry.open(filepath.toFile()); } return this.vltPkg; }
Source:
<code>public String[] getLines() { String fileContent = new String(uploadedFile.getContents(), StandardCharsets.UTF_8); <START> if (null == fileContent || "".equals(fileContent.trim())) { <END> return null; } return fileContent.split("[\\r\\n]+"); }</code><technical_language>fileContent.trim().length() == 0</technical_language>

Target:
public String[] getLines() { String fileContent = new String(uploadedFile.getContents(), StandardCharsets.UTF_8); if (null == fileContent || fileContent.trim().length() == 0) { return null; } return fileContent.split("[\\r\\n]+"); }
Source:
<code>public void onEntityBlockForm(final EntityBlockFormEvent event) { if (!Prism.getIgnore().event("entity-form", event.getBlock())) { return; } final Block block = event.getBlock(); final Location loc = block.getLocation(); final BlockState newState = event.getNewState(); if (event.getEntity() instanceof Player) { <START> final OfflinePlayer player = (OfflinePlayer)event.getEntity(); <END> RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), player)); } else { final String entity = event.getEntity().getType().name().toLowerCase(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), entity)); } }</code><technical_language>cast Player avoid extra import</technical_language>

Target:
public void onEntityBlockForm(final EntityBlockFormEvent event) { if (!Prism.getIgnore().event("entity-form", event.getBlock())) { return; } final Block block = event.getBlock(); final Location loc = block.getLocation(); final BlockState newState = event.getNewState(); if (event.getEntity() instanceof Player) { final Player player = (Player)event.getEntity(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), player)); } else { final String entity = event.getEntity().getType().name().toLowerCase(); RecordingQueue.addToQueue(ActionFactory.createBlockChange("entity-form", loc, block.getType(), block.getBlockData(), newState.getType(), newState.getBlockData(), entity)); } }
Source:
<code>public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions) { LOG.info("Starting the SlotManager."); this.resourceManagerId = Preconditions.checkNotNull(newResourceManagerId); mainThreadExecutor = Preconditions.checkNotNull(newMainThreadExecutor); resourceActions = Preconditions.checkNotNull(newResourceActions); started = true; taskManagerValidCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkValidTaskManagers()), 0L, taskManagerTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); slotRequestTimeoutCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkSlotRequestTimeouts()), 0L, slotRequestTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); registerSlotManagerMetrics(); <START> allocateRedundantSlots(redundantSlotNum); <END> }</code><technical_language>if a JM failover TM lost? happen SM requests redundant TMs, TMs (needed & redundant) previous attempt recovered register SM. a result, redundant TMs expected</technical_language>

Target:
public void start(ResourceManagerId newResourceManagerId, Executor newMainThreadExecutor, ResourceActions newResourceActions) { LOG.info("Starting the SlotManager."); this.resourceManagerId = Preconditions.checkNotNull(newResourceManagerId); mainThreadExecutor = Preconditions.checkNotNull(newMainThreadExecutor); resourceActions = Preconditions.checkNotNull(newResourceActions); started = true; taskManagerTimeoutsAndRedundancyCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkTaskManagerTimeoutsAndRedundancy()), 0L, taskManagerTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); slotRequestTimeoutCheck = scheduledExecutor.scheduleWithFixedDelay( () -> mainThreadExecutor.execute( () -> checkSlotRequestTimeouts()), 0L, slotRequestTimeout.toMilliseconds(), TimeUnit.MILLISECONDS); registerSlotManagerMetrics(); }
Source:
<code>public void sendMetricNotExceedCharLim(){ Metric metric = new Metric(METRIC_KEY_NOT_EXCEEDING, 1278, new Date(), "", ImmutableSet.of(), ImmutableMap.of("what", WHAT, "pod", TAG_VAL_NOT_EXCEEDING), "test_proc"); final List<Metric> metricsList = Collections.singletonList(metric); when(sender.createSession()).thenReturn(session); sink.start(); Future<Void> future = sink.sendMetrics(metricsList); <START> while (!future.isDone()){ <END> } sink.stop(); List<DataPoint> points = session.getDataPoints(); assertEquals(1, points.size()); DataPoint point = points.get(0); assertEquals(METRIC_KEY_NOT_EXCEEDING.length() + 1 + WHAT.length(), point.getMetric().length()); for (Dimension d : point.getDimensionsList()){ String dimVal = d.getValue(); assertTrue(dimVal.length() <= CHAR_LIMIT); } }</code><technical_language>future.get()</technical_language>

Target:
public void sendMetricNotExceedCharLim() throws ExecutionException, InterruptedException { Metric metric = new Metric(METRIC_KEY_NOT_EXCEEDING, 1278, new Date(), "", ImmutableSet.of(), ImmutableMap.of("what", WHAT, "pod", TAG_VAL_NOT_EXCEEDING), "test_proc"); final List<Metric> metricsList = Collections.singletonList(metric); ArgumentCaptor<DataPoint> captor = ArgumentCaptor.forClass(DataPoint.class); when(sender.createSession()).thenReturn(mockSession); when(mockSession.setDatapoint(captor.capture())).thenReturn(mockSession); sink.start(); Future<Void> future = sink.sendMetrics(metricsList); future.get(); sink.stop(); List<DataPoint> points = captor.getAllValues(); assertEquals(1, points.size()); DataPoint point = points.get(0); assertEquals(METRIC_KEY_NOT_EXCEEDING.length() + 1 + WHAT.length(), point.getMetric().length()); for (Dimension d : point.getDimensionsList()){ String dimVal = d.getValue(); assertTrue(dimVal.length() <= CHAR_LIMIT); } }
Source:
<code>private String nextQuotedValue(char quote) throws IOException { char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; int len = p - start - 1; <START> if(null == builder) { <END> return new String(buffer, start, len); } else { builder.append(buffer, start, len); return builder.toString(); } } else if (c == '\\') { pos = p; int len = p - start - 1; char escapeChar = readEscapeCharacter(); if(null == builder) { int estimatedLength = (len + pos - p) * 2; builder = new StringBuilder(estimatedLength < 16 ? 16 : estimatedLength); } builder.append(buffer, start, len); builder.append(escapeChar); p = pos; l = limit; start = p; } else if (c == '\n') { lineNumber++; lineStart = p; } } if(null == builder) { int len = (p - start) * 2; builder = new StringBuilder(len < 16 ? 16 : len); } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } }</code><technical_language>nit: missing space if. traditionally put null right</technical_language>

Target:
private String nextQuotedValue(char quote) throws IOException { char[] buffer = this.buffer; StringBuilder builder = null; while (true) { int p = pos; int l = limit; int start = p; while (p < l) { int c = buffer[p++]; if (c == quote) { pos = p; int len = p - start - 1; if (builder == null) { return new String(buffer, start, len); } else { builder.append(buffer, start, len); return builder.toString(); } } else if (c == '\\') { pos = p; int len = p - start - 1; char escapeChar = readEscapeCharacter(); if (builder == null) { int estimatedLength = (len + pos - p) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, len); builder.append(escapeChar); p = pos; l = limit; start = p; } else if (c == '\n') { lineNumber++; lineStart = p; } } if (builder == null) { int estimatedLength = (p - start) * 2; builder = new StringBuilder(Math.max(estimatedLength, 16)); } builder.append(buffer, start, p - start); pos = p; if (!fillBuffer(1)) { throw syntaxError("Unterminated string"); } } }
Source:
<code>public Optional<Map<String, HiveColumnStatistics>> getTableColumnStatistics(String databaseName, String tableName, Set<String> columnNames) { <START> throw new GlueUnsupportedException(HIVE_METASTORE_ERROR, "getTableColumnStatistics is not supported by Glue, please set hive.table-statistics-enabled=false"); <END> }</code><technical_language>return Optional.of(ImmutableMap.of()), do in FileHiveMetastore? expected statistics for tables</technical_language>

Target:
public Optional<Map<String, HiveColumnStatistics>> getTableColumnStatistics(String databaseName, String tableName, Set<String> columnNames) { return Optional.of(ImmutableMap.of()); }
Source:
<code>private void fixSurveyAssignments(DatastoreService ds) { if (surveyAssignments.size() > 0) { for (Entity e : surveyAssignments) { <START> ArrayList<Long> surveyIds = ((ArrayList<Long>) e.getProperty("formIds")); <END> ArrayList<Long> fixedFormIds = new ArrayList<>(); for (Long id : surveyIds) { if (!forms.contains(id)) { fixedFormIds.add(id); } } if (fixedFormIds.size() != surveyIds.size()) { e.setProperty("formIds", fixedFormIds); surveyAssignmentsToSave.add(e); } } System.out.println("Found " + surveyAssignmentsToSave.size() + " SurveyAssignment to modify"); if (surveyAssignmentsToSave.size() > 0) { ds.put(surveyAssignmentsToSave); System.out.println("Fixed SurveyAssignment"); } } else { System.out.println("No SurveyAssignment found to fix"); } }</code><technical_language>suggestion ArrayList<Long> formIds = ((ArrayList<Long>) e.getProperty("formIds"));</technical_language>

Target:
private void fixSurveyAssignments(DatastoreService ds) { if (surveyAssignments.size() > 0) { for (Entity e : surveyAssignments) { ArrayList<Long> formIds = ((ArrayList<Long>) e.getProperty("formIds")); ArrayList<Long> fixedFormIds = new ArrayList<>(); for (Long id : formIds) { if (!forms.contains(id)) { fixedFormIds.add(id); } } if (fixedFormIds.size() != formIds.size()) { e.setProperty("formIds", fixedFormIds); e.setProperty("lastUpdateDateTime", new Date()); surveyAssignmentsToSave.add(e); } } System.out.println("Found " + surveyAssignmentsToSave.size() + " SurveyAssignment to modify"); if (surveyAssignmentsToSave.size() > 0) { ds.put(surveyAssignmentsToSave); System.out.println("Fixed SurveyAssignment"); } } else { System.out.println("No SurveyAssignment found to fix"); } }
Source:
<code>static void startMIDlet() { if (BGUtils.launchMIDletCalled) { return; } AmsUtil.executeWithArgs(MIDletSuiteStorage.getMIDletSuiteStorage(), 0, BGUtils.getFGMIDletNumber(), <START> BGUtils.getFGMIDletClass(), null, null, null, null, -1, -1, 3, null, false); <END> }</code><technical_language>Nit: Isolate.MAX_PRIORITY clearer is</technical_language>

Target:
static void startMIDlet() { if (BGUtils.launchMIDletCalled) { return; } AmsUtil.executeWithArgs(MIDletSuiteStorage.getMIDletSuiteStorage(), 0, BGUtils.getFGMIDletNumber(), BGUtils.getFGMIDletClass(), null, null, null, null, -1, -1, Isolate.MAX_PRIORITY, null, false); }
Source:
<code>private static void prepareResponseBuilderForPartialRequestWithSingleRange(ByteRange byteRange, long inputLength, HttpServletResponse response) { String contentRangeHeaderValue = String.format("bytes %d-%d/%d", byteRange.getOffset(), inputLength - 1L, inputLength); response.setHeader(HttpHeaders.CONTENT_RANGE, contentRangeHeaderValue); <START> response.setHeader(HttpHeaders.PRAGMA, "no-cache"); <END> response.setStatus(PARTIAL_CONTENT.value()); }</code><technical_language>is this required</technical_language>

Target:
private static void prepareResponseBuilderForPartialRequestWithSingleRange(ByteRange byteRange, long inputLength, HttpServletResponse response) { String contentRangeHeaderValue = String.format("bytes %d-%d/%d", byteRange.getOffset(), inputLength - 1L, inputLength); response.setHeader(HttpHeaders.CONTENT_RANGE, contentRangeHeaderValue); response.setStatus(PARTIAL_CONTENT.value()); }
Source:
<code>public void onEvent(MachineStatusEvent event) { try { final ChannelBroadcastMessage bm = new ChannelBroadcastMessage(); <START> bm.setChannel("workspace:" + event.getWorkspaceId() + ":machines_statuses"); <END> bm.setBody(DtoFactory.getInstance().toJson(event)); WSConnectionContext.sendMessage(bm); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }</code><technical_language>This kind of refactoring affects client, change it, is changed in 2 places(ide, dashboard). I in this case useful extract creation of channel name separate SHARABLE class reused GWT, in need refactor ide client change format of channel. wdyt</technical_language>

Target:
public void onEvent(MachineStatusEvent event) { try { final ChannelBroadcastMessage bm = new ChannelBroadcastMessage(); bm.setChannel(format(ENVIRONMENT_STATUS_CHANNEL_TEMPLATE, event.getWorkspaceId())); bm.setBody(DtoFactory.getInstance().toJson(event)); WSConnectionContext.sendMessage(bm); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } }
Source:
<code>static XmlPullParser createParser(@IdRes int res) throws XmlPullParserException, IOException { InputStream stream = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getResources() .openRawResource(res); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); parser.setInput(stream, null); <START> parser.next(); <END> return parser; }</code><technical_language>next invoked here</technical_language>

Target:
static XmlPullParser createParser(@IdRes int res) throws XmlPullParserException, IOException { InputStream stream = InstrumentationRegistry.getInstrumentation() .getTargetContext() .getResources() .openRawResource(res); XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(true); XmlPullParser parser = factory.newPullParser(); parser.setInput(stream, null); return parser; }
Source:
<code>public static IMultipart createPart(ResourceLocation partType, NBTTagCompound tag) { IAdvancedPartFactory factory = GameRegistry.findRegistry(MultipartRegistryEntry.class).getValue(partType); <START> return factory == null ? null : factory.createPart(partType, tag); <END> }</code><technical_language>CACHE SHIT</technical_language>

Target:
public static IMultipart createPart(ResourceLocation partType, NBTTagCompound tag) { IAdvancedPartFactory factory = ForgeRegistries.MULTIPARTS.getValue(partType); return factory == null ? null : factory.createPart(partType, tag); }
Source:
<code>private Row checkRealmObjectConstraints(String fieldName, @Nullable RealmModel value) { if (value != null) { if (!(RealmObject.isManaged(value) && RealmObject.isValid(value))) { <START> throw new IllegalArgumentException("'value' is not a valid a valid, managed Realm object."); <END> } ProxyState proxyState = ((RealmObjectProxy) value).realmGet$proxyState(); if (!proxyState.getRealm$realm().getPath().equals(realm.getPath())) { throw new IllegalArgumentException("'value' does not belong to the same Realm as the RealmResults."); } Table currentTable = osResults.getTable(); long columnIndex = currentTable.getColumnIndex(fieldName); Table expectedTable = currentTable.getLinkTarget(columnIndex); Table inputTable = proxyState.getRow$realm().getTable(); if (!expectedTable.hasSameSchema(inputTable)) { throw new IllegalArgumentException(String.format(Locale.US, "Type of object is wrong. Was '%s', expected '%s'", inputTable.getClassName(), expectedTable.getClassName())); } return proxyState.getRow$realm(); } return null; }</code><technical_language>"a valid a valid" -> "a valid"</technical_language>

Target:
private Row checkRealmObjectConstraints(String fieldName, @Nullable RealmModel value) { if (value != null) { if (!(RealmObject.isManaged(value) && RealmObject.isValid(value))) { throw new IllegalArgumentException("'value' is not a valid, managed Realm object."); } ProxyState proxyState = ((RealmObjectProxy) value).realmGet$proxyState(); if (!proxyState.getRealm$realm().getPath().equals(realm.getPath())) { throw new IllegalArgumentException("'value' does not belong to the same Realm as the RealmResults."); } Table currentTable = osResults.getTable(); long columnIndex = currentTable.getColumnIndex(fieldName); Table expectedTable = currentTable.getLinkTarget(columnIndex); Table inputTable = proxyState.getRow$realm().getTable(); if (!expectedTable.hasSameSchema(inputTable)) { throw new IllegalArgumentException(String.format(Locale.US, "Type of object is wrong. Was '%s', expected '%s'", inputTable.getClassName(), expectedTable.getClassName())); } return proxyState.getRow$realm(); } return null; }
Source:
<code>public void init(Command afterInit) { navServices.call((NavTree n) -> { navTree = n; <START> afterInit.execute(); <END> }).loadNavTree(); }</code><technical_language>add nullcheck of afterInit avoid potential NPE</technical_language>

Target:
public void init(Command afterInit) { navServices.call((NavTree n) -> { navTree = n; if (afterInit != null) { afterInit.execute(); } }).loadNavTree(); }
Source:
<code>private BroadcastTrimmer broadcastTrimmer() { return new ScheduleResolverBroadcastTrimmer( <START> null, <END> scheduleResolver, contentResolver, contentWriter ); }</code><technical_language>Remove parameter completely, other constructor initiate publisher null</technical_language>

Target:
private BroadcastTrimmer broadcastTrimmer() { return new ScheduleResolverBroadcastTrimmer( scheduleResolver, contentResolver, contentWriter ); }
Source:
<code>public List<EngineMessage> validate(VmInit vmInit) { if (vmInit != null) { <START> setDefaultNetworkProtocolIfNeeded(vmInit); <END> switch (vmInit.getCloudInitNetworkProtocol()) { case OPENSTACK_METADATA: return new VmInitToOpenStackMetadataAdapter().validate(vmInit); case ENI: } } return Collections.emptyList(); }</code><technical_language>point of view, is a good idea change data a method called "validate". VmInit initialize cloudInitNetworkProtocol OPENSTACK_METADATA explode cloudInitNetworkProtocol == null here? VmInitToOpenStackMetadataAdapter().validate() fail for ENI? Please note openStackMetadataAdapter.validate() is called in places</technical_language>

Target:
public List<EngineMessage> validate(VmInit vmInit) { if (vmInit != null && isOpenstackMetadataProtocol(vmInit)) { return new VmInitToOpenStackMetadataAdapter().validate(vmInit); } return Collections.emptyList(); }
Source:
<code>public void checkHeader(String distribId) { if (distribId != null) { <START> assertEquals(String.format("Browsing Distribution '%s'", distribId), header.getText()); <END> } else { assertTrue(header.getText(), header.getText().startsWith("Browsing Distribution")); } }</code><technical_language>put header.getText() (used 3 times) in a local variable</technical_language>

Target:
public void checkHeader(String distribId) { String text = header.getText(); if (distribId != null) { assertEquals(String.format("Browsing Distribution '%s'", distribId), text); } else { assertTrue(text, text.startsWith("Browsing Distribution")); } }
Source:
<code>public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestamp2 = valueGetter.get(key); final V2 value2 = getValueOrNull(valueAndTimestamp2); final long timestamp2; if (value2 == null) { if (change.newValue == null && change.oldValue == null) { return; } timestamp2 = UNKNOWN; } else { timestamp2 = valueAndTimestamp2.timestamp(); } final long timestamp1; if (change.newValue == null) { <START> timestamp1 = UNKNOWN; <END> } else { timestamp1 = context().timestamp(); } resultTimestamp = Math.max(timestamp1, timestamp2); if (value2 != null || change.newValue != null) { newValue = joiner.apply(change.newValue, value2); } if (sendOldValues && (value2 != null || change.oldValue != null)) { oldValue = joiner.apply(change.oldValue, value2); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }</code><technical_language>if this is right... if current left is null, update somewhere, I triggered left, means a null record a timestamp. this timestamp instead of UNKNOWN join result? weird produce -1 timestamps, handle them</technical_language>

Target:
public void process(final K key, final Change<V1> change) { if (key == null) { LOG.warn( "Skipping record due to null key. change=[{}] topic=[{}] partition=[{}] offset=[{}]", change, context().topic(), context().partition(), context().offset() ); metrics.skippedRecordsSensor().record(); return; } R newValue = null; final long resultTimestamp; R oldValue = null; final ValueAndTimestamp<V2> valueAndTimestamp2 = valueGetter.get(key); final V2 value2 = getValueOrNull(valueAndTimestamp2); if (value2 == null) { if (change.newValue == null && change.oldValue == null) { return; } resultTimestamp = context().timestamp(); } else { resultTimestamp = Math.max(context().timestamp(), valueAndTimestamp2.timestamp()); } if (value2 != null || change.newValue != null) { newValue = joiner.apply(change.newValue, value2); } if (sendOldValues && (value2 != null || change.oldValue != null)) { oldValue = joiner.apply(change.oldValue, value2); } context().forward(key, new Change<>(newValue, oldValue), To.all().withTimestamp(resultTimestamp)); }
Source:
<code>public void testHttpDigestJson() { String cp = "REST_JSON_DIGEST"; RestConnectionProfileWizard.openWizard(cp) <START> .setConnectionUrl("<LINK_0>") <END> .setType(RestConnectionProfileWizard.TYPE_JSON) .setAuth(RestConnectionProfileWizard.AUTH_TYPE_DIGEST, "user", "user") .testConnection() .finish(); String sourceModel = "RestJsonDigestSource"; String viewModel = "RestJsonDigestView"; RestImportWizard.openWizard() .setProfileName(cp) .nextPage() .setProject(PROJECT_NAME) .setSourceModelName(sourceModel) .setViewModelName(viewModel) .setProcedureName(PROCEDURE_NAME) .nextPage() .setJndiName(sourceModel + "DS") .nextPage() .setRootPath("response/schedule/day/broadcasts") .setColumns("pid","start","end","programme/title") .finish(); String vdb = "RestJsonDigestVdb"; VdbWizard.openVdbWizard() .setLocation(PROJECT_NAME) .setName(vdb) .addModel(PROJECT_NAME, viewModel) .finish(); ServersViewExt.getInstance().refreshServer(teiidServer.getName()); modelExplorer.deployVdb(PROJECT_NAME, vdb); TeiidJDBCHelper jdbchelper = new TeiidJDBCHelper(teiidServer, vdb); assertEquals(16, jdbchelper.getNumberOfResults("exec " + viewModel + "." + PROCEDURE_NAME + "()")); }</code><technical_language>Do internal url in public tests</technical_language>

Target:
public void testHttpDigestJson() { String sourceModel = "RestJsonDigestSource"; String viewModel = "RestJsonDigestView"; RestImportWizard.openWizard() .setProfileName(ConnectionProfileConstants.REST_JSON_SECURE) .nextPage() .setProject(PROJECT_NAME) .setSourceModelName(sourceModel) .setViewModelName(viewModel) .setProcedureName(PROCEDURE_NAME) .nextPage() .setJndiName(sourceModel + "DS") .nextPage() .setRootPath("response/schedule/day/broadcasts") .setColumns("pid","start","end","programme/title") .finish(); String vdb = "RestJsonDigestVdb"; VdbWizard.openVdbWizard() .setLocation(PROJECT_NAME) .setName(vdb) .addModel(PROJECT_NAME, viewModel) .finish(); ServersViewExt.getInstance().refreshServer(teiidServer.getName()); modelExplorer.deployVdb(PROJECT_NAME, vdb); TeiidJDBCHelper jdbchelper = new TeiidJDBCHelper(teiidServer, vdb); assertEquals(16, jdbchelper.getNumberOfResults("exec " + viewModel + "." + PROCEDURE_NAME + "()")); }
Source:
<code>protected void run(final String[] argv) { try { if (!installConsole()) { AwtAuthenticator.install(); AwtCredentialsProvider.install(); } configureHttpProxy(); execute(argv); } catch (Die err) { <START> if (err.isAborted()) { <END> System.exit(1); } System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } catch (Exception err) { if (err.getClass() == IOException.class) { if (err.getMessage().equals("Broken pipe")) System.exit(0); if (err.getMessage().equals("The pipe is being closed")) System.exit(0); } if (!showStackTrace && err.getCause() != null && err instanceof TransportException) System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } err.printStackTrace(); System.exit(1); } if (System.out.checkError()) { System.err.println(CLIText.get().unknownIoErrorStdout); System.exit(1); } if (System.err.checkError()) { System.exit(1); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
protected void run(final String[] argv) { try { if (!installConsole()) { AwtAuthenticator.install(); AwtCredentialsProvider.install(); } configureHttpProxy(); execute(argv); } catch (Die err) { if (err.isAborted()) System.exit(1); System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } catch (Exception err) { if (err.getClass() == IOException.class) { if (err.getMessage().equals("Broken pipe")) System.exit(0); if (err.getMessage().equals("The pipe is being closed")) System.exit(0); } if (!showStackTrace && err.getCause() != null && err instanceof TransportException) System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getCause().getMessage())); if (err.getClass().getName().startsWith("org.eclipse.jgit.errors.")) { System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage())); if (showStackTrace) err.printStackTrace(); System.exit(128); } err.printStackTrace(); System.exit(1); } if (System.out.checkError()) { System.err.println(CLIText.get().unknownIoErrorStdout); System.exit(1); } if (System.err.checkError()) { System.exit(1); } }
Source:
<code>public void initTestResultSummaries(IProgressMonitor monitor, List<TestresultSummaryDTO> trsListDtos, IProjectPO proj) throws InterruptedException { monitor.beginTask(Messages.ImportFileBPImporting, trsListDtos.size()); List<ITestResultSummaryPO> summaries = new ArrayList<ITestResultSummaryPO>(); int i = 0; for (TestresultSummaryDTO dto : trsListDtos) { m_ioHandle.checkCancel(m_monitor); i++; monitor.worked(1); monitor.subTask(Messages.ImportJsonImportResult + i + StringConstants.SLASH + trsListDtos.size()); ITestResultSummaryPO summary = PoMaker.createTestResultSummaryPO(dto.getGuid()); summary.setInternalProjectGuid(proj.getGuid()); fillTestresultSummary(summary, dto); List<MonitoringValuesDTO> tmpList = dto.getMonitoringValues(); Map<String, IMonitoringValue> tmpMap = new HashMap<String, IMonitoringValue>(); for (int k = 0; k < tmpList.size(); k++) { MonitoringValuesDTO tmpMon = tmpList.get(k); MonitoringValue tmp = new MonitoringValue(); tmp.setCategory(tmpMon.getCategory()); tmp.setSignificant(tmpMon.isSignificant()); tmp.setType(tmpMon.getType()); tmp.setValue(tmpMon.getValue()); tmpMap.put(tmpMon.getKey(), tmp); } summary.setMonitoringValues(tmpMap); if (!TestResultSummaryPM.doesTestResultSummaryExist(summary)) { summaries.add(summary); } } <START> TestResultSummaryPM.storeTestResultSummariesInDB(summaries); <END> }</code><technical_language>This consume a lot of memory. blocks in export</technical_language>

Target:
public void initTestResultSummaries(IProgressMonitor monitor, List<TestresultSummaryDTO> trsListDtos, IProjectPO proj) throws InterruptedException { monitor.beginTask(Messages.ImportFileBPImporting, trsListDtos.size()); List<ITestResultSummaryPO> summaries = new ArrayList<ITestResultSummaryPO>(ImportExportUtil.PAGE_SIZE); int countOfTestResult = 0; for (TestresultSummaryDTO dto : trsListDtos) { ImportExportUtil.checkCancel(m_monitor); countOfTestResult++; monitor.worked(1); monitor.subTask(Messages.ImportJsonImportResult + countOfTestResult + StringConstants.SLASH + trsListDtos.size()); ITestResultSummaryPO summary = PoMaker.createTestResultSummaryPO(dto.getGuid()); summary.setInternalProjectGuid(proj.getGuid()); fillTestresultSummary(summary, dto); List<MonitoringValuesDTO> tmpList = dto.getMonitoringValues(); Map<String, IMonitoringValue> tmpMap = new HashMap<String, IMonitoringValue>(); for (int countOfValue = 0; countOfValue < tmpList.size(); countOfValue++) { MonitoringValuesDTO tmpMon = tmpList.get(countOfValue); MonitoringValue tmp = new MonitoringValue(); tmp.setCategory(tmpMon.getCategory()); tmp.setSignificant(tmpMon.isSignificant()); tmp.setType(tmpMon.getType()); tmp.setValue(tmpMon.getValue()); tmpMap.put(tmpMon.getKey(), tmp); } summary.setMonitoringValues(tmpMap); if (!TestResultSummaryPM.doesTestResultSummaryExist(summary)) { summaries.add(summary); } if (summaries.size() == ImportExportUtil.PAGE_SIZE) { TestResultSummaryPM.storeTestResultSummariesInDB(summaries); summaries.clear(); } } if (!summaries.isEmpty()) { TestResultSummaryPM.storeTestResultSummariesInDB(summaries); } }
Source:
<code>public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final double[] means = new double[sketch.getNumValues()]; final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { means[i] += values[i]; } } for (int i = 0; i < means.length; i++) { <START> means[i] /= sketch.getRetainedEntries(); <END> } return means; }</code><technical_language>If getRetainedEntries() a large number, consider applying Kahan summation algorithm avoid accumulating errors summation in loop above. extra overhead is small</technical_language>

Target:
public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] means = new double[sketch.getNumValues()]; Arrays.setAll(means, i -> stats[i].getMean()); return means; }
Source:
<code>public final ResourceLink build(final HttpServletRequest request, final User user, final Contentlet contentlet) throws DotDataException, DotSecurityException { <START> if(!(contentlet.isFileAsset() || contentlet.isDotAsset())) { <END> throw new DotStateException(getLocalizedMessageOrDefault(user,"File-asset-contentlet-type-expected", "Can only build Resource Links out of content with type `File Asset` or `DotAsset`.",getClass()) ); } return build(request, user, contentlet, FileAssetAPI.BINARY_FIELD); }</code><technical_language>I mising a test here, contentlet.isDotAsset() is true</technical_language>

Target:
public final ResourceLink build(final HttpServletRequest request, final User user, final Contentlet contentlet) throws DotDataException, DotSecurityException { if(!(contentlet.isFileAsset() || contentlet.isDotAsset())) { throw new DotStateException(getLocalizedMessageOrDefault(user,"File-asset-contentlet-type-expected", "Can only build Resource Links out of content with type `File Asset` or `DotAsset`.",getClass()) ); } return build(request, user, contentlet, contentlet.isFileAsset()?FileAssetAPI.BINARY_FIELD: DotAssetContentType.ASSET_FIELD_VAR); }
Source:
<code>public static void addCanningRecipe(ItemStack container, @Nullable ItemStack input, @Nullable ItemStack output) { <START> if (input == null || output == null) <END> return; try { Recipes.cannerBottle.addRecipe(new RecipeInputItemStack(container), new RecipeInputItemStack(input), output); } catch (Throwable error) { Game.logErrorAPI("IC2", error, Recipes.class); } }</code><technical_language>Null checks</technical_language>

Target:
public static void addCanningRecipe(ItemStack container, @Nullable ItemStack input, @Nullable ItemStack output) { if (InvTools.isEmpty(input) || InvTools.isEmpty(output)) return; try { Recipes.cannerBottle.addRecipe(new RecipeInputItemStack(container), new RecipeInputItemStack(input), output); } catch (Throwable error) { Game.logErrorAPI("IC2", error, Recipes.class); } }
Source:
<code>public COREEnvelopeRealTimeResponse realTimeRequest(COREEnvelopeRealTimeRequest coreEnvelopeRealTimeRequest, AssertionType assertion) { COREEnvelopeRealTimeResponse oResponse = null; if (coreEnvelopeRealTimeRequest != null) { LOG.trace("Begin AdapterCORE_X12DSRealTimeOrchImpl.realTimeRequest()"); oResponse = buildAdapterCORE_X12DSRealTimeResponseMetadata(); LogAdapterCORE_X12DSRealTimeRequest(coreEnvelopeRealTimeRequest); LOG.trace("End AdapterCORE_X12DSRealTimeOrchImpl.realTimeRequest()"); } else { <START> return oResponse; <END> } return oResponse; }</code><technical_language>missed this before. null. need add: oResponse = new COREEnvelopeRealTimeResponse(); need a return statement there, assignment</technical_language>

Target:
public COREEnvelopeRealTimeResponse realTimeRequest(COREEnvelopeRealTimeRequest coreEnvelopeRealTimeRequest, AssertionType assertion) { COREEnvelopeRealTimeResponse oResponse = null; if (coreEnvelopeRealTimeRequest != null) { LOG.trace("Begin AdapterCORE_X12DSRealTimeOrchImpl.realTimeRequest()"); oResponse = buildAdapterCORE_X12DSRealTimeResponseMetadata(); logAdapterCORE_X12DSRealTimeRequest(coreEnvelopeRealTimeRequest); LOG.trace("End AdapterCORE_X12DSRealTimeOrchImpl.realTimeRequest()"); } else { oResponse = new COREEnvelopeRealTimeResponse(); } return oResponse; }
Source:
<code>boolean joinGroupIfNeeded(final Timer timer) { while (rejoinNeededOrPending()) { if (!ensureCoordinatorReady(timer)) { return false; } RequestFuture<ByteBuffer> future; synchronized (this) { if (needsJoinPrepare) { needsJoinPrepare = false; onJoinPrepare(generation.generationId, generation.memberId); } future = initiateJoinGroup(); } client.poll(future, timer); if (!future.isDone()) { return false; } if (future.succeeded()) { synchronized (this) { <START> if (generation.generationId != OffsetCommitRequest.DEFAULT_GENERATION_ID) { <END> ByteBuffer memberAssignment = future.value().duplicate(); onJoinComplete(generation.generationId, generation.memberId, generation.protocol, memberAssignment); resetJoinGroupFuture(); needsJoinPrepare = true; } else { log.info("Generation data was cleared by heartbeat thread. Initiating rejoin."); resetStateAndRejoin(); return false; } } } else { resetJoinGroupFuture(); final RuntimeException exception = future.exception(); if (exception instanceof UnknownMemberIdException || exception instanceof RebalanceInProgressException || exception instanceof IllegalGenerationException || exception instanceof MemberIdRequiredException) continue; else if (!future.isRetriable()) throw exception; timer.sleep(rebalanceConfig.retryBackoffMs); } } return true; }</code><technical_language>compare generation object Generation.NO_GENERATION</technical_language>

Target:
boolean joinGroupIfNeeded(final Timer timer) { while (rejoinNeededOrPending()) { if (!ensureCoordinatorReady(timer)) { return false; } if (needsJoinPrepare) { needsJoinPrepare = false; onJoinPrepare(generation.generationId, generation.memberId); } final RequestFuture<ByteBuffer> future = initiateJoinGroup(); client.poll(future, timer); if (!future.isDone()) { return false; } if (future.succeeded()) { Generation generationSnapshot; synchronized (this) { generationSnapshot = this.generation; } if (generationSnapshot != Generation.NO_GENERATION) { ByteBuffer memberAssignment = future.value().duplicate(); onJoinComplete(generationSnapshot.generationId, generationSnapshot.memberId, generationSnapshot.protocol, memberAssignment); resetJoinGroupFuture(); needsJoinPrepare = true; } else { log.info("Generation data was cleared by heartbeat thread. Initiating rejoin."); resetStateAndRejoin(); return false; } } else { resetJoinGroupFuture(); final RuntimeException exception = future.exception(); if (exception instanceof UnknownMemberIdException || exception instanceof RebalanceInProgressException || exception instanceof IllegalGenerationException || exception instanceof MemberIdRequiredException) continue; else if (!future.isRetriable()) throw exception; timer.sleep(rebalanceConfig.retryBackoffMs); } } return true; }
Source:
<code>public MapEntriesWithCursor fetchEntries(int tableIndex, int size, SerializationService serializationService) { List<Map.Entry<Data, R>> entries = new ArrayList<Map.Entry<Data, R>>(size); int newTableIndex = records.fetchEntries(tableIndex, size, entries); List<Map.Entry<Data, Object>> entriesData = new ArrayList<Map.Entry<Data, Object>>(entries.size()); for (Map.Entry<Data, R> entry : entries) { <START> R record = (R)(Record)entry.getValue(); <END> Object value = record.getValue(); Object dataValue = (value instanceof com.hazelcast.map.Immutable) ? value : serializationService.toData(value); entriesData.add(new AbstractMap.SimpleEntry((Data)entry.getKey(), dataValue)); } return new MapEntriesWithCursor(entriesData, newTableIndex); }</code><technical_language>do need cast here</technical_language>

Target:
public MapEntriesWithCursor fetchEntries(int tableIndex, int size, SerializationService serializationService) { List<Map.Entry<Data, R>> entries = new ArrayList<Map.Entry<Data, R>>(size); int newTableIndex = records.fetchEntries(tableIndex, size, entries); List<Map.Entry<Data, Object>> entriesData = new ArrayList<Map.Entry<Data, Object>>(entries.size()); for (Map.Entry<Data, R> entry : entries) { R record = entry.getValue(); Object value = record.getValue(); Object resultValue = (value instanceof Immutable) ? value : serializationService.toData(value); entriesData.add(new AbstractMap.SimpleEntry<Data, Object>(entry.getKey(), resultValue)); } return new MapEntriesWithCursor(entriesData, newTableIndex); }
Source:
<code>public ExtensionFieldEntity getFieldForName(String fieldName, boolean caseInsensitive) { for (ExtensionFieldEntity field : fields) { if (!caseInsensitive) { if (field.getName().equals(fieldName)) { return field; } } else { if (field.getName().equalsIgnoreCase(fieldName)) { return field; } } } <START> throw new InvalidConstraintException("Field " + fieldName + " not available in extension with urn " + urn); <END> }</code><technical_language>Please add single quotes fieldName urn</technical_language>

Target:
public ExtensionFieldEntity getFieldForName(String fieldName, boolean caseInsensitive) { for (ExtensionFieldEntity field : fields) { if (!caseInsensitive) { if (field.getName().equals(fieldName)) { return field; } } else { if (field.getName().equalsIgnoreCase(fieldName)) { return field; } } } throw new InvalidConstraintException(String.format("Field '%s' not available in extension with urn '%s'", fieldName, urn)); }
Source:
<code>public void sent(Frame frame) { if (ResumeUtil.isTracked(frame)) { frames.put(currentPosition, frame.retain()); bufferSize += strategy.cost(frame); currentPosition += ResumeUtil.offset(frame); if (frames.size() > maxBufferSize) { <START> Frame f = frames.remove(first(frames)); <END> bufferSize -= strategy.cost(f); f.release(); } } }</code><technical_language>for perf frames.keySet().iterator().remove() is a tiny bit faster readable need change</technical_language>

Target:
public void sent(Frame frame) { if (ResumeUtil.isTracked(frame)) { frames.put(currentPosition, frame.copy()); bufferSize += strategy.cost(frame); currentPosition += ResumeUtil.offset(frame); if (frames.size() > maxBufferSize) { Frame f = frames.remove(first(frames)); bufferSize -= strategy.cost(f); } } }
Source:
<code>public void onPreviousDiffClicked() { view.getEditableContent(content -> { <START> if (isEdited(content)) { <END> saveContent(content); } currentFileIndex--; showCompareForCurrentFile(); }); }</code><technical_language>Is if (compareWithLatest) { check required</technical_language>

Target:
public void onPreviousDiffClicked() { if (currentFileIndex > 0) { onSaveChangesClicked(); currentFileIndex--; showCompareForCurrentFile(); } }
Source:
<code>private void populateInterface(VdsNetworkInterface iface) { if (iface.getId() != null && StringUtils.isNotEmpty(iface.getName())) { return; } VdsNetworkInterface existingIface = null; if (iface.getId() != null && getExistingIfacesToIds().containsKey(iface.getId())) { existingIface = getExistingIfacesToIds().get(iface.getId()); <START> if (existingIface != null) { <END> iface.setName(existingIface.getName()); } } else if (StringUtils.isNotEmpty(iface.getName()) && getExistingIfaces().containsKey(iface.getName())) { existingIface = getExistingIfaces().get(iface.getName()); if (existingIface != null) { iface.setId(existingIface.getId()); } } }</code><technical_language>this null</technical_language>

Target:
private void populateInterface(VdsNetworkInterface iface) { if (iface.getId() != null && StringUtils.isNotEmpty(iface.getName())) { return; } if (iface.getId() != null && getExistingIfacesByIds().containsKey(iface.getId())) { iface.setName(getExistingIfacesByIds().get(iface.getId()).getName()); } else if (StringUtils.isNotEmpty(iface.getName()) && getExistingIfaces().containsKey(iface.getName())) { iface.setId(getExistingIfaces().get(iface.getName()).getId()); } }
Source:
<code>public Set<ESparkVersion> getSparkVersions() { Set<ESparkVersion> version = new HashSet<>(); Set<ESparkVersion> sparkVersions = super.getSparkVersions(); if (sparkVersions == null || sparkVersions.isEmpty()) { <START> version.add(ESparkVersion.SPARK_2_2); <END> } else { version.addAll(sparkVersions); } return version; }</code><technical_language>spark 24</technical_language>

Target:
public Set<ESparkVersion> getSparkVersions() { Set<ESparkVersion> version = new HashSet<>(); Set<ESparkVersion> sparkVersions = super.getSparkVersions(); if (sparkVersions == null || sparkVersions.isEmpty()) { version.add(ESparkVersion.SPARK_2_4); } else { version.addAll(sparkVersions); } return version; }