auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void canFetchAndCombineHistoriesForLocalAndRemote() { Set<PaxosValue> paxosValues = PaxosSerializationTestUtils.writeToLogs(acceptorLog, learnerLog, 1, 100); int lastVerified = -1; List<HistoryQuery> historyQueries = ImmutableList.of( <START> HistoryQuery.of(ImmutableNamespaceAndUseCase.of(CLIENT, USE_CASE), lastVerified, lastVerified + 500)); <END> List<LogsForNamespaceAndUseCase> remoteHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); when(remote.getPaxosHistory(any(), any())).thenReturn(PaxosHistoryOnRemote.of(remoteHistory)); List<CompletePaxosHistoryForNamespaceAndUseCase> completeHistory = paxosLogHistoryProvider.getHistory(); CompletePaxosHistoryForNamespaceAndUseCase historyForNamespaceAndUseCase = Iterables.getOnlyElement(completeHistory); assertThat(historyForNamespaceAndUseCase.namespace()).isEqualTo(CLIENT); assertSanityWithValuesOfFetchedRecords(historyForNamespaceAndUseCase, CLIENT, USE_CASE, 100, paxosValues); }</code><technical_language>unbounded end factory in HistoryQuery, this is causing a lot of friction</technical_language>

Target:
public void canFetchAndCombineHistoriesForLocalAndRemote() { Set<PaxosValue> paxosValues = PaxosSerializationTestUtils.writeToLogs(acceptorLog, learnerLog, 1, 100); int lastVerified = -1; List<HistoryQuery> historyQueries = ImmutableList.of(HistoryQueries.unboundedHistoryQuerySinceSeq(lastVerified)); List<LogsForNamespaceAndUseCase> remoteHistory = HistoryLoaderAndTransformer.getLogsForHistoryQueries(history, historyQueries); when(remote.getPaxosHistory(any(), any())).thenReturn(PaxosHistoryOnRemote.of(remoteHistory)); List<CompletePaxosHistoryForNamespaceAndUseCase> completeHistory = paxosLogHistoryProvider.getHistory(); CompletePaxosHistoryForNamespaceAndUseCase historyForNamespaceAndUseCase = Iterables.getOnlyElement(completeHistory); assertThat(historyForNamespaceAndUseCase.namespace()).isEqualTo(DEFAULT_CLIENT); assertSanityWithValuesOfFetchedRecords( historyForNamespaceAndUseCase, DEFAULT_CLIENT, DEFAULT_USE_CASE, 100, paxosValues); }
Source:
<code><START> public DiscoveryResults discover(DiscoveryJob job) { <END> List<IPPollRange> ranges = new ArrayList<IPPollRange>(job.getRanges()); CompletableFuture<PingSweepSummary> summary = client.ping().withForeignSource(job.getForeignSource()) .withLocation(job.getLocation()).withIpPollRanges(ranges) .withPacketSize((int) job.getPacketsPerSecond()).execute(); PingSweepSummary pingSummary; try { pingSummary = summary.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException("Exception in Pinging the IPRange",e); } return new DiscoveryResults(pingSummary.getResponses(), job.getForeignSource(), job.getLocation()); }</code><technical_language>Discovery need more changes if want properly incorporate PingSweep RPC client, simply changing is right approach</technical_language>

Target:
public DiscoveryResults discover(DiscoveryJob job) { final PingResponseTracker tracker = new PingResponseTracker(); List<IPPollAddress> addresses = StreamSupport.stream(job.getAddresses().spliterator(), false) .filter(j -> j.getAddress() != null) .collect(Collectors.toList()); addresses.stream() .map(a -> a.getAddress()) .forEach(a -> tracker.expectCallbackFor(a)); RateLimiter limiter = RateLimiter.create(job.getPacketsPerSecond()); addresses.stream().forEach(a -> { limiter.acquire(); ping(a, tracker); }); if (!addresses.isEmpty()) { try { tracker.getLatch().await(); } catch (InterruptedException e) { throw Throwables.propagate(e); } } return new DiscoveryResults(tracker.getResponses(), job.getForeignSource(), job.getLocation()); }
Source:
<code>private String registerClassInternalName(String name) { int num; if (internalNames.containsKey(name)) { num = internalNames.get(name) + 1; } else { <START> num = 1; <END> } internalNames.put(name, num); return num + name; }</code><technical_language>initialize num 1 get rid of else</technical_language>

Target:
private String registerClassInternalName(String name) { internalNames.add(name); return internalNames.count(name) + name; }
Source:
<code>public String toString() { <START> MoreObjects.ToStringHelper strHelper = MoreObjects.toStringHelper(this); <END> if (!mTierAlias.equals(ANY_TIER)) { strHelper.add("TierAlias", mTierAlias); } if (mDirIndex != ANY_DIR) { strHelper.add("DirIndex", mDirIndex); } if (!mMediumType.equals(ANY_MEDIUM)) { strHelper.add("MediumType", mMediumType); } return strHelper.toString(); }</code><technical_language>Do want show information anymore</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("TierAlias", (!mTierAlias.equals(ANY_TIER)) ? mTierAlias : "<Any>") .add("DirIndex", (mDirIndex != ANY_DIR) ? mDirIndex : "<Any>") .add("MediumType", (!mMediumType.equals(ANY_MEDIUM)) ? mMediumType : "<Any>") .toString(); }
Source:
<code>public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { <START> return false; <END> }</code><technical_language>is safer throw exception</technical_language>

Target:
public boolean isAssignableBy(ResolvedReferenceTypeDeclaration other) { throw new UnsupportedOperationException(); }
Source:
<code>private void parseSrcs(String localSource) { for (int i = 0; i < srcs.length; i++) { <START> if (StringUtils.equalsIgnoreCase(srcs[i], LOCAL_SOURCE) || StringUtils.isBlank(srcs[i])) { <END> srcs[i] = localSource; } } }</code><technical_language>in situations srcs blank strings</technical_language>

Target:
private void parseSrcs(String localSource) { for (int i = 0; i < srcs.size(); i++) { if (StringUtils.equalsIgnoreCase(srcs.get(i), LOCAL_SOURCE)) { srcs.set(i, localSource); } } }
Source:
<code>public void run() { BluetoothDevice remoteDevice = mmSocket.getRemoteDevice(); while (true) { try { boolean messageRecvd = mmMessenger.deserializeMessage(mmInStream); if (messageRecvd) { <START> for (IMessage message : mmMessenger.getReceivedMessages()) { <END> sendMessageToHandler(message, remoteDevice.getAddress()); } } } catch (IOException e) { e.printStackTrace(); break; } catch (Throwable t) { t.printStackTrace(); break; } } stopWriteThread(); cancel(); }</code><technical_language>do of variable names start mm? I do this time around, I curious</technical_language>

Target:
public void run() { BluetoothDevice remoteDevice = mmSocket.getRemoteDevice(); while (true) { try { boolean messageRecvd = mmMessenger.deserializeMessage(mmInStream); if (messageRecvd) { for (IMessage message : mmMessenger.getReceivedMessages()) { sendMessageToHandler(message, remoteDevice.getAddress()); } mmMessenger.clearReceivedMessages(); } } catch (IOException e) { e.printStackTrace(); break; } catch (Throwable t) { t.printStackTrace(); break; } } stopWriteThread(); cancel(); }
Source:
<code>public Coords getPosition() { <START> if (secondaryPos == -1) { <END> return entity.getPosition(); } else { return entity.getSecondaryPositions().get(secondaryPos); } }</code><technical_language>suggestion if (secondaryPos < 0 || secondaryPos >= entity.getSecondaryPositions().size()) {</technical_language>

Target:
public Coords getPosition() { if (secondaryPos < 0 || secondaryPos >= entity.getSecondaryPositions().size()) { return entity.getPosition(); } else { return entity.getSecondaryPositions().get(secondaryPos); } }
Source:
<code>public Void visit(VarRefNode varRefNode) { String object; switch (varRefNode.getName()) { case "true": object = "org/twnc/runtime/BTrue"; break; case "false": object = "org/twnc/runtime/BFalse"; break; case "this": object = cn.getName(); break; default: object = ""; try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } catch (VariableNotDeclaredException e) { object = "org/twnc/runtime/BNil"; } } <START> if (!object.isEmpty()) { <END> mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } return super.visit(varRefNode); }</code><technical_language>object empty? Also, if put stack for expression node (which a VarRefNode is) stuff south real quick. push a Nil if to</technical_language>

Target:
public Void visit(VarRefNode varRefNode) { String name = varRefNode.getName(); if (ScopeStack.isSpecial(name)) { String object; switch (name) { case "true": object = "org/twnc/runtime/BTrue"; break; case "false": object = "org/twnc/runtime/BFalse"; break; case "this": object = cn.getName(); break; default: object = "org/twnc/runtime/BNil"; break; } mv.visitTypeInsn(NEW, object); mv.visitInsn(DUP); mv.visitMethodInsn(INVOKESPECIAL, object, "<init>", "()V", false); } else { try { VarDeclNode decl = scope.getVarDeclNode(varRefNode.getName()); mv.visitVarInsn(ALOAD, 1 + decl.getOffset()); } catch (VariableNotDeclaredException e) { e.printStackTrace(); } } return super.visit(varRefNode); }
Source:
<code>private int getPriority(String key) { if (key != null && !priorityMap.containsKey(key)) { int priority = AbstractMenuBuilder.DEFAULT_PRIORITY; try { priority = Integer.parseInt(SiriusEditorPlugin.INSTANCE.getString(key)); } catch (MissingResourceException mre) { } catch (NumberFormatException nfe) { } priorityMap.put(key, priority); } <START> return priorityMap.get(key); <END> }</code><technical_language>case key is null is handled. returned in this case default priority</technical_language>

Target:
private int getPriority(String key) { if (key != null && !priorityMap.containsKey(key)) { int priority = AbstractMenuBuilder.DEFAULT_PRIORITY; try { priority = Integer.parseInt(SiriusEditorPlugin.INSTANCE.getString(key)); } catch (MissingResourceException mre) { } catch (NumberFormatException nfe) { } priorityMap.put(key, priority); } return Objects.firstNonNull(priorityMap.get(key), DEFAULT_PRIORITY); }
Source:
<code>private DNASequence readGenbankResource(final String resource) throws Exception { DNASequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<DNASequence, NucleotideCompound> genbankDNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); LinkedHashMap<String, DNASequence> dnaSequences = genbankDNA.process(); sequence = dnaSequences.values().iterator().next(); } catch (Exception e) { <START> fail(e.getMessage()); <END> } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }</code><technical_language>simply throw exception? I code more readable effect. do explicitly want a failure error here</technical_language>

Target:
private DNASequence readGenbankResource(final String resource) throws Exception { DNASequence sequence = null; InputStream inputStream = null; try { inputStream = getClass().getResourceAsStream(resource); GenbankReader<DNASequence, NucleotideCompound> genbankDNA = new GenbankReader<>( inputStream, new GenericGenbankHeaderParser<>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) ); LinkedHashMap<String, DNASequence> dnaSequences = genbankDNA.process(); sequence = dnaSequences.values().iterator().next(); } finally { try { inputStream.close(); } catch (Exception e) { } } return sequence; }
Source:
<code>public String getChecksum() { try { Properties properties2 = getProperties(); String old = properties2.getProperty(Constants.TSTAMP); <START> properties2.setProperty(Constants.TSTAMP, "0"); <END> try { Properties flattenedProperties = getFlattenedProperties(); Digester<SHA1> digester = SHA1.getDigester(); @SuppressWarnings({ "unchecked", "rawtypes" }) Set<String> keySet = new TreeSet<>((Set) flattenedProperties.keySet()); keySet.forEach(k -> { try { byte[] bytes = k.getBytes(StandardCharsets.UTF_8); digester.write(bytes); String s = flattenedProperties.getProperty(k); if (s == null) return; bytes = s.getBytes(StandardCharsets.UTF_8); digester.write(bytes); } catch (Exception e) { throw Exceptions.duck(e); } }); String checksum = digester.digest() .asHex(); return checksum; } finally { if (old == null) { properties2.remove(Constants.TSTAMP); } else { properties2.setProperty(Constants.TSTAMP, old); } } } catch (Exception e) { throw Exceptions.duck(e); } }</code><technical_language>This risky a thread safety point of view. is cleaner simply set flattenedProperties.setProperty(Constants.TSTAMP, "0"); creating flattened properties object</technical_language>

Target:
public String getChecksum() { try (Processor p = new Processor(this)) { p.setProperty(Constants.TSTAMP, "0"); Properties flattenedProperties = p.getFlattenedProperties(); Digester<SHA1> digester = SHA1.getDigester(); @SuppressWarnings({ "unchecked", "rawtypes" }) Set<String> keySet = new TreeSet<>((Set) flattenedProperties.keySet()); keySet.forEach(k -> { try { byte[] bytes = k.getBytes(StandardCharsets.UTF_8); digester.write(bytes); String s = flattenedProperties.getProperty(k); if (s == null) return; bytes = s.getBytes(StandardCharsets.UTF_8); digester.write(bytes); } catch (Exception e) { throw Exceptions.duck(e); } }); String checksum = digester.digest() .asHex(); return checksum; } catch (Exception e) { throw Exceptions.duck(e); } }
Source:
<code>public void deleteStudentFromRespondantsList(StudentAttributes student) { if (student == null || student.email == null) { return; } List<FeedbackSessionAttributes> sessionsToUpdate = fsDb.getFeedbackSessionsForCourse(student.course); for (FeedbackSessionAttributes session : sessionsToUpdate) { try { <START> deleteStudentFromRespondantList(student.email, session.feedbackSessionName, session.courseId); <END> } catch (InvalidParametersException | EntityDoesNotExistException e) { Assumption.fail("Fail to delete instructor respondant for " + session.feedbackSessionName); } } }</code><technical_language>this chance fix typo respondent</technical_language>

Target:
public void deleteStudentFromRespondantsList(StudentAttributes student) { if (student == null || student.email == null) { return; } List<FeedbackSessionAttributes> sessionsToUpdate = fsDb.getFeedbackSessionsForCourse(student.course); for (FeedbackSessionAttributes session : sessionsToUpdate) { try { deleteStudentFromRespondentList(student.email, session.getFeedbackSessionName(), session.getCourseId()); } catch (InvalidParametersException | EntityDoesNotExistException e) { Assumption.fail("Fail to delete instructor respondant for " + session.getFeedbackSessionName()); } } }
Source:
<code>public void testCreateAllocatedSlotReport() throws Exception { try (SlotPoolImpl slotPool = createAndSetUpSlotPool()) { final ArrayBlockingQueue<AllocationID> allocationIds = new ArrayBlockingQueue<>(1); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.offer(slotRequest.getAllocationId())); final SlotRequestId slotRequestId = new SlotRequestId(); final CompletableFuture<PhysicalSlot> slotRequestFuture = requestNewAllocatedSlot( slotPool, slotRequestId ); final List<AllocatedSlotInfo> allocatedSlotInfos = new ArrayList<>(2); final List<SlotOffer> slotOffers = new ArrayList<>(2); final AllocationID allocatedId = allocationIds.take(); slotOffers.add(new SlotOffer(allocatedId, 0, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(0, allocatedId)); final AllocationID availableId = new AllocationID(); slotOffers.add(new SlotOffer(availableId, 1, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(1, availableId)); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); <START> slotRequestFuture.get(1, TimeUnit.SECONDS); <END> final AllocatedSlotReport slotReport = slotPool.createAllocatedSlotReport(taskManagerLocation.getResourceID()); assertThat(jobId, is(slotReport.getJobId())); assertThat(slotReport.getAllocatedSlotInfos(), containsInAnyOrder(isEachEqual(allocatedSlotInfos))); } }</code><technical_language>making this change</technical_language>

Target:
public void testCreateAllocatedSlotReport() throws Exception { final JobID jobId = new JobID(); try (SlotPoolImpl slotPool = createAndSetUpSlotPool(resourceManagerGateway, jobId)) { final ArrayBlockingQueue<AllocationID> allocationIds = new ArrayBlockingQueue<>(1); resourceManagerGateway.setRequestSlotConsumer( slotRequest -> allocationIds.offer(slotRequest.getAllocationId())); final CompletableFuture<PhysicalSlot> slotRequestFuture = requestNewAllocatedSlot( slotPool, new SlotRequestId()); final List<AllocatedSlotInfo> allocatedSlotInfos = new ArrayList<>(2); final List<SlotOffer> slotOffers = new ArrayList<>(2); final AllocationID allocatedId = allocationIds.take(); slotOffers.add(new SlotOffer(allocatedId, 0, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(0, allocatedId)); final AllocationID availableId = new AllocationID(); slotOffers.add(new SlotOffer(availableId, 1, ResourceProfile.ANY)); allocatedSlotInfos.add(new AllocatedSlotInfo(1, availableId)); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); slotRequestFuture.get(); final AllocatedSlotReport slotReport = slotPool.createAllocatedSlotReport(taskManagerLocation.getResourceID()); assertThat(jobId, is(slotReport.getJobId())); assertThat(slotReport.getAllocatedSlotInfos(), containsInAnyOrder(isEachEqual(allocatedSlotInfos))); } }
Source:
<code>public String toString() { <START> return String.format("int@0x%x=0x%x (%d)", Pointer.nativeValue(getPointer()), getValue(), getValue()); <END> }</code><technical_language>ByteByReference.java</technical_language>

Target:
public String toString() { return String.format("int@0x%1$x=0x%2$x (%2$d)", Pointer.nativeValue(getPointer()), getValue()); }
Source:
<code>public IProblemProfile getResourceProfile(IResource element) { IProblemProfile prof = profiles.get(element); if (prof == null) { if (element instanceof IProject) { prof = (IProblemProfile) getWorkspaceProfile().clone(); ((ProblemProfile) prof).setResource(element); CodanPreferencesLoader loader = new CodanPreferencesLoader(prof); Preferences projectNode = CodanPreferencesLoader.getProjectNode((IProject) element); <START> boolean useWorkspace = projectNode == null ? true : projectNode.getBoolean(PreferenceConstants.P_USE_PARENT, true); <END> if (!useWorkspace) { loader.load(projectNode); } profiles.put(element, prof); } else if (element.getParent() != null) { prof = getResourceProfile(element.getParent()); } else { prof = getResourceProfile(element.getProject()); } } return prof; }</code><technical_language>Simpler more readable: if (projectNode != null && !projectNode.getBoolean(PreferenceConstants.P_USE_PARENT, true)) { loader.load(projectNode); }</technical_language>

Target:
public IProblemProfile getResourceProfile(IResource element) { IProblemProfile prof = profiles.get(element); if (prof == null) { if (element instanceof IProject) { prof = (IProblemProfile) getWorkspaceProfile().clone(); ((ProblemProfile) prof).setResource(element); CodanPreferencesLoader loader = new CodanPreferencesLoader(prof); Preferences projectNode = CodanPreferencesLoader.getProjectNode((IProject) element); if (projectNode != null && !projectNode.getBoolean(PreferenceConstants.P_USE_PARENT, true)) { loader.load(projectNode); } profiles.put(element, prof); } else if (element.getParent() != null) { prof = getResourceProfile(element.getParent()); } else { prof = getResourceProfile(element.getProject()); } } return prof; }
Source:
<code>private void tryReAddingEventToFrontOfQueue(E event) { try { <START> deque.addFirst(event); <END> } catch (IllegalStateException ese) { addInfo("Dropping event due to socket connection error and maxed out deque capacity"); } }</code><technical_language>[Deque API](<LINK_0> recommends offerFirst() instead of addFirst. I simpler (and more performant) check return of offerFirst catch this exception</technical_language>

Target:
private void tryReAddingEventToFrontOfQueue(E event) { final boolean wasInserted = deque.offerFirst(event); if (!wasInserted) { addInfo("Dropping event due to socket connection error and maxed out deque capacity"); } }
Source:
<code>public ColumnChunk(Block block, int[] definitionLevels, int[] repetitionLevels) { <START> this.block = block; <END> this.definitionLevels = definitionLevels; this.repetitionLevels = repetitionLevels; }</code><technical_language>please add requireNonNull checks for parameters</technical_language>

Target:
public ColumnChunk(Block block, int[] definitionLevels, int[] repetitionLevels) { this.block = requireNonNull(block, "block is null"); this.definitionLevels = requireNonNull(definitionLevels, "definitionLevels is null"); this.repetitionLevels = requireNonNull(repetitionLevels, "repetitionLevels is null"); }
Source:
<code><START> public void testShouldPropogateExceptions() { <END> Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), value -> { throw new CustomExecutionException(); }, executor, 2); values.collect(Collectors.toList()); }</code><technical_language>@Test public void testShouldPropogateExceptions() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), -> { throw new CustomExecutionException(); }, executor, 2); assertThatThrownBy(() -> values.collect(Collectors.toList())) .isInstanceOf(CustomExecutionException.class); } subsequent test redundant</technical_language>

Target:
public void testShouldPropogateExceptions() { Stream<Integer> values = ConcurrentStreams.map( ImmutableList.of(1, 2, 3, 4), value -> { throw new CustomExecutionException(); }, executor, 2); assertThatThrownBy(() -> values.collect(Collectors.toList())) .isInstanceOf(CustomExecutionException.class); }
Source:
<code>public void mdbWithFinalClass() throws IOException { <START> MdbValidationsUtil.assertMDBClassValidity(buildClassInfoForClass("org.jboss.as.ejb3.util.InvalidMdbFinalClass")); <END> }</code><technical_language>type safe InvalidMdbFinalClass.class.getName() a hard coded string</technical_language>

Target:
public void mdbWithFinalClass() throws IOException, DeploymentUnitProcessingException { assertEquals(MdbValidityStatus.MDB_CLASS_CANNOT_BE_PRIVATE_ABSTRACT_OR_FINAL, MdbValidationsUtil.assertMDBClassValidity(buildClassInfoForClass(InvalidMdbFinalClass.class.getName()))); }
Source:
<code>public void testRealTimeQueryNotId2() throws Exception { final String metacardTitle = "testRealTimeQueryNotId"; deleteAll(provider); MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord()); metacard.setTitle(metacardTitle); CreateResponse createResponse = create(metacard, provider); Optional<String> id = createResponse.getCreatedMetacards().stream().map(m -> m.getId()).findFirst(); <START> if (!id.isPresent()) { <END> Assert.fail("Metacard creation failed for metacard with title: " + metacardTitle); } queryAndVerifyCount( 1, getFilterBuilder().attribute(Metacard.ID).is().equalTo().text(id.get()), provider); Filter filter = getFilterBuilder() .not(getFilterBuilder().attribute(Metacard.ID).equalTo().text("can't match this")); queryAndVerifyCount(0, filter, provider); }</code><technical_language>assertFalse() <dependency> <groupId>com.github.npathai</groupId> <artifactId>hamcrest-optional</artifactId> <version>${hamcrest-optional.version}</version> <scope>test</scope> </dependency></technical_language>

Target:
public void testRealTimeQueryNotId2() throws Exception { final String metacardTitle = "testRealTimeQueryNotId"; deleteAll(provider); MockMetacard metacard = new MockMetacard(Library.getFlagstaffRecord()); metacard.setTitle(metacardTitle); CreateResponse createResponse = create(metacard, provider); Optional<String> id = createResponse.getCreatedMetacards().stream().map(m -> m.getId()).findFirst(); assertTrue( "Metacard creation failed for metacard with title: " + metacardTitle, id.isPresent()); queryAndVerifyCount( 1, getFilterBuilder().attribute(Metacard.ID).is().equalTo().text(id.get()), provider); Filter filter = getFilterBuilder() .not(getFilterBuilder().attribute(Metacard.ID).equalTo().text("can't match this")); queryAndVerifyCount(0, filter, provider); }
Source:
<code>public void setup() { super.setup(); <START> roleAdminOption = api.getRoleAdminApi(); <END> }</code><technical_language>a entire class, tests require this present. Throw a SkipException automatically skip tests in this class, showing reason</technical_language>

Target:
public void setup() { super.setup(); roleAdminOption = api.getRoleAdminApi(); if (!roleAdminOption.isPresent()) { throw new SkipException("The tests are skipped since OS-KSADM extension is not exposed through the Keystone API"); } }
Source:
<code>protected void init(final VfsNicLabelModel model) { super.init(model); for (ListModel<String> labelModel : model.getItems()) { labelModel.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { ValueChangeEvent.fire(VfsNicLabelWidget.this, null); <START> model.updateSuggestedLabels(); <END> } }); } }</code><technical_language>1. Please export lines 82+83 a method 'selecetLabelChanged'. 2. Please call method add listener</technical_language>

Target:
protected void init(final VfsNicLabelModel model) { super.init(model); selectedLabelsChanged(VfsNicLabelWidget.this); for (ListModel<String> labelModel : model.getItems()) { labelModel.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { selectedLabelsChanged(VfsNicLabelWidget.this); } }); } }
Source:
<code>private void updateAppearanceColorWidgets(String systemDefaultKey) { if (systemDefaultKey == null) { fAppearanceColorDefault.setSelection(false); fAppearanceColorDefault.setVisible(false); fAppearanceColorEditor.getButton().setEnabled(true); } else { boolean systemDefault= fOverlayStore.getBoolean(systemDefaultKey); fAppearanceColorDefault.setSelection(systemDefault); fAppearanceColorDefault.setVisible(true); fAppearanceColorEditor.getButton().setEnabled(!systemDefault); } <START> fAppearanceColorTableViewer.refresh(); <END> }</code><technical_language>is this necessary here</technical_language>

Target:
private void updateAppearanceColorWidgets(String systemDefaultKey) { if (systemDefaultKey == null) { fAppearanceColorDefault.setSelection(false); fAppearanceColorDefault.setVisible(false); fAppearanceColorEditor.getButton().setEnabled(true); } else { boolean systemDefault= fOverlayStore.getBoolean(systemDefaultKey); fAppearanceColorDefault.setSelection(systemDefault); fAppearanceColorDefault.setVisible(true); fAppearanceColorEditor.getButton().setEnabled(!systemDefault); } }
Source:
<code>public void publish(ChatRoom room, TranscriptionResult result) { JSONObject eventObject = createJSONObject(result); <START> eventObject.put(JSON_KEY_TYPE, JSON_VALUE_TOPIC); <END> super.sendJsonMessage(room, eventObject); }</code><technical_language>renaming JSON_VALUE_TOPIC well</technical_language>

Target:
public void publish(ChatRoom room, TranscriptionResult result) { JSONObject eventObject = createJSONObject(result); super.sendJsonMessage(room, eventObject); }
Source:
<code><START> public void EdgeReached(Direction edge) { <END> postEvent(this, "EdgeReached", edge); }</code><technical_language>Note of reasons I chose @EnumeratedBy annotation due fact if extensions out calling int version of this method. annotation allows signature of function runtime. outright changing this, if extension exists result in a NoSuchMethodError this change is published. I recommend int version maintain compatibility</technical_language>

Target:
public void EdgeReached(Direction edge) { postEvent(this, "EdgeReached", edge.getValue()); }
Source:
<code>public void testDontCreateNewTasksWhenInstanceChanged() { String[] instances = new String[]{"instance1", "instance2", "instance3"}; List<DatastreamGroup> datastreams = generateDatastreams("ds", 5); BroadcastStrategy strategy = new BroadcastStrategy(Optional.empty()); Map<String, Set<DatastreamTask>> assignment = strategy.assign(datastreams, Arrays.asList(instances), new HashMap<>()); instances = new String[]{"instance1", "instance2", "instance4"}; Map<String, Set<DatastreamTask>> newAssignment = strategy.assign(datastreams, Arrays.asList(instances), assignment); Set<DatastreamTask> oldAssignmentTasks = assignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Set<DatastreamTask> newAssignmentTasks = newAssignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); <START> LOG.info("{}", oldAssignmentTasks); LOG.info("{}", newAssignmentTasks); <END> Assert.assertTrue(oldAssignmentTasks.containsAll(newAssignmentTasks)); }</code><technical_language>Do need logs in test</technical_language>

Target:
public void testDontCreateNewTasksWhenInstanceChanged() { String[] instances = new String[]{"instance1", "instance2", "instance3"}; List<DatastreamGroup> datastreams = generateDatastreams("ds", 5); BroadcastStrategy strategy = new BroadcastStrategy(Optional.empty()); Map<String, Set<DatastreamTask>> assignment = strategy.assign(datastreams, Arrays.asList(instances), new HashMap<>()); instances = new String[]{"instance1", "instance2", "instance4"}; Map<String, Set<DatastreamTask>> newAssignment = strategy.assign(datastreams, Arrays.asList(instances), assignment); Set<DatastreamTask> oldAssignmentTasks = assignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Set<DatastreamTask> newAssignmentTasks = newAssignment.values().stream().flatMap(Set::stream).collect(Collectors.toSet()); Assert.assertEquals(oldAssignmentTasks, newAssignmentTasks); int totalTasks = newAssignment.values().stream().mapToInt(Set::size).sum(); Assert.assertEquals(totalTasks, newAssignmentTasks.size()); }
Source:
<code>public CommandPalette(Commands commands, RAddins addins, ShortcutManager shortcuts, Host host) { initWidget(uiBinder.createAndBindUi(this)); entries_ = new ArrayList<CommandPaletteEntry>(); host_ = host; shortcuts_ = shortcuts; selected_ = -1; addins_ = addins; commands_ = commands; styles_.ensureInjected(); Element searchBox = searchBox_.getElement(); searchBox.setAttribute("placeholder", "Search and run commands"); searchBox.setAttribute("spellcheck", "false"); Element commandList = commandList_.getElement(); ElementIds.assignElementId(commandList, ElementIds.COMMAND_PALETTE_LIST); Roles.getListboxRole().set(commandList); Roles.getListboxRole().setAriaLabelProperty(commandList, "Matching commands"); ElementIds.assignElementId(searchBox_, ElementIds.COMMAND_PALETTE_SEARCH); Roles.getComboboxRole().setAriaOwnsProperty(searchBox, Id.of(commandList_.getElement())); Roles.getComboboxRole().set(searchBox); Roles.getComboboxRole().setAriaLabelProperty(searchBox, "Search for and run a command"); Roles.getComboboxRole().setAriaExpandedState(searchBox, ExpandedValue.TRUE); A11y.setARIAAutocomplete(searchBox_, "list"); <START> A11y.setVisuallyHidden(resultsCount_); <END> Roles.getAlertRole().setAriaLiveProperty(resultsCount_.getElement(), LiveValue.ASSERTIVE); Scheduler.get().scheduleDeferred(() -> { populate(); }); updateResultsCount_ = new DebouncedCommand(1000) { @Override protected void execute() { int count = 0; for (CommandPaletteEntry entry: entries_) { if (entry.isVisible()) count++; } resultsCount_.getElement().setInnerText(count + " " + "commands found, press up and down to navigate"); } }; }</code><technical_language>nice if AriaLiveStatusWidget instead of rolling own; essential (and more trouble worth) easier track if I try do a desktop workaround for Qt's lack of live region support</technical_language>

Target:
public CommandPalette(Commands commands, RAddins addins, ShortcutManager shortcuts, Host host) { initWidget(uiBinder.createAndBindUi(this)); entries_ = new ArrayList<>(); host_ = host; shortcuts_ = shortcuts; selected_ = -1; addins_ = addins; commands_ = commands; attached_ = false; pageSize_ = 0; styles_.ensureInjected(); Element searchBox = searchBox_.getElement(); searchBox.setAttribute("placeholder", "Search and run commands"); searchBox.setAttribute("spellcheck", "false"); Element commandList = commandList_.getElement(); ElementIds.assignElementId(commandList, ElementIds.COMMAND_PALETTE_LIST); Roles.getListboxRole().set(commandList); Roles.getListboxRole().setAriaLabelProperty(commandList, "Matching commands"); ElementIds.assignElementId(searchBox_, ElementIds.COMMAND_PALETTE_SEARCH); Roles.getComboboxRole().setAriaOwnsProperty(searchBox, Id.of(commandList_.getElement())); Roles.getComboboxRole().set(searchBox); Roles.getComboboxRole().setAriaLabelProperty(searchBox, "Search for and run a command"); Roles.getComboboxRole().setAriaExpandedState(searchBox, ExpandedValue.TRUE); A11y.setARIAAutocomplete(searchBox_, "list"); Scheduler.get().scheduleDeferred(() -> { populate(); }); }
Source:
<code>public Mail parseToEmail(EmailWrapper wrapper) { Mail email = new Mail(); Email sender; if (wrapper.getSenderName() == null || wrapper.getSenderName().isEmpty()) { sender = new Email(wrapper.getSenderEmail()); } else { sender = new Email(wrapper.getSenderEmail(), wrapper.getSenderName()); } email.setFrom(sender); <START> email.setReplyTo(new Email(wrapper.getReplyTo())); <END> Personalization personalization = new Personalization(); personalization.addTo(new Email(wrapper.getRecipient())); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { personalization.addBcc(new Email(wrapper.getBcc())); } email.addPersonalization(personalization); email.setSubject(wrapper.getSubject()); email.addContent(new Content("text/html", wrapper.getContent())); return email; }</code><technical_language>longer setting plaintext part of email</technical_language>

Target:
public Mail parseToEmail(EmailWrapper wrapper) { Mail email = new Mail(); Email sender; if (wrapper.getSenderName() == null || wrapper.getSenderName().isEmpty()) { sender = new Email(wrapper.getSenderEmail()); } else { sender = new Email(wrapper.getSenderEmail(), wrapper.getSenderName()); } email.setFrom(sender); email.setReplyTo(new Email(wrapper.getReplyTo())); Personalization personalization = new Personalization(); personalization.addTo(new Email(wrapper.getRecipient())); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { personalization.addBcc(new Email(wrapper.getBcc())); } email.addPersonalization(personalization); email.setSubject(wrapper.getSubject()); email.addContent(new Content("text/plain", Jsoup.parse(wrapper.getContent()).text())); email.addContent(new Content("text/html", wrapper.getContent())); return email; }
Source:
<code>private static List<Mutation> getMutationsForSystemTaskTable( PhoenixConnection conn, PreparedStatement stmt, boolean accessCheckEnabled) throws IOException { if (accessCheckEnabled) { return User.runAsLoginUser(() -> { final RpcCall rpcContext = RpcUtil.getRpcContext(); try { RpcUtil.setRpcContext(null); stmt.execute(); <START> return conn.getMutationState().toMutations().next() <END> .getSecond(); } catch (SQLException e) { throw new IOException(e); } finally { RpcUtil.setRpcContext(rpcContext); } }); } else { try { stmt.execute(); return conn.getMutationState().toMutations().next().getSecond(); } catch (SQLException e) { throw new IOException(e); } } }</code><technical_language>If other mutations connection, returning joined state of of right? want restrict returning mutations upsert SYSTEM.TASK table</technical_language>

Target:
private static List<Mutation> getMutationsForSystemTaskTable( PhoenixConnection conn, PreparedStatement stmt, boolean accessCheckEnabled) throws IOException { if (accessCheckEnabled) { return User.runAsLoginUser(() -> { final RpcCall rpcContext = RpcUtil.getRpcContext(); try { RpcUtil.setRpcContext(null); return executeStatementAndGetTaskMutations(conn, stmt); } catch (SQLException e) { throw new IOException(e); } finally { RpcUtil.setRpcContext(rpcContext); } }); } else { try { return executeStatementAndGetTaskMutations(conn, stmt); } catch (SQLException e) { throw new IOException(e); } } }
Source:
<code>public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath, Function<byte[], T> deserializer, Closure<T> dataUpdateListener) throws InterruptedException, KeeperException, ZooKeeperConnectionException { ZooKeeperNode<T> zkNode = <START> new ZooKeeperNode<T>(zkClient, nodePath, new FunctionWrapper<T>(deserializer), <END> dataUpdateListener); zkNode.init(); return zkNode; }</code><technical_language>this chain of creates</technical_language>

Target:
public static <T> ZooKeeperNode<T> create(ZooKeeperClient zkClient, String nodePath, Function<byte[], T> deserializer, Closure<T> dataUpdateListener) throws InterruptedException, KeeperException, ZooKeeperConnectionException { return create(zkClient, nodePath, new FunctionWrapper<T>(deserializer), dataUpdateListener); }
Source:
<code>static public ExpressionThreadPoolExecutor getExpressionScheduledPool(String poolName) { ExecutorService pool = pools.get(poolName); if (pool == null) { synchronized (pools) { pool = pools.get(poolName); if (pool == null) { Integer cfg = getConfig(poolName); pool = new ExpressionThreadPoolExecutor(poolName, cfg); ((ThreadPoolExecutor) pool).setKeepAliveTime(THREAD_TIMEOUT, TimeUnit.SECONDS); ((ThreadPoolExecutor) pool).allowCoreThreadTimeOut(true); pools.put(poolName, pool); <START> LoggerFactory.getLogger(ExpressionThreadPoolManager.class).debug( <END> "Created an expression-drive scheduled thread pool '{}' of size {}", new Object[] { poolName, cfg }); } } } if (pool instanceof ExpressionThreadPoolExecutor) { return (ExpressionThreadPoolExecutor) pool; } else { throw new IllegalArgumentException("Pool " + poolName + " is not an expression-driven scheduled pool!"); } }</code><technical_language>part of this PR: If if do another change again, WDYT changing static public public static get common keyword order</technical_language>

Target:
public static ExpressionThreadPoolExecutor getExpressionScheduledPool(String poolName) { ExecutorService pool = pools.get(poolName); if (pool == null) { synchronized (pools) { pool = pools.get(poolName); if (pool == null) { Integer cfg = getConfig(poolName); pool = new ExpressionThreadPoolExecutor(poolName, cfg); ((ThreadPoolExecutor) pool).setKeepAliveTime(THREAD_TIMEOUT, TimeUnit.SECONDS); ((ThreadPoolExecutor) pool).allowCoreThreadTimeOut(true); pools.put(poolName, pool); LoggerFactory.getLogger(ExpressionThreadPoolManager.class) .debug("Created an expression-drive scheduled thread pool '{}' of size {}", poolName, cfg); } } } if (pool instanceof ExpressionThreadPoolExecutor) { return (ExpressionThreadPoolExecutor) pool; } else { throw new IllegalArgumentException("Pool " + poolName + " is not an expression-driven scheduled pool!"); } }
Source:
<code>public List<Training> showMentoringTrainings(@RequestParam String userId) { User user = userService.getUserById(Long.parseLong(userId)).get(); <START> if (user.getRole() == UserRole.ADMIN || user.getRole() == UserRole.EMPLOYEE) <END> return ((Employee)user).getMentoringTrainings(); else if (user.getRole() == UserRole.EXTERNAL_TRAINER) return ((ExternalTrainer)user).getMentoringTrainings(); return null; }</code><technical_language>Admin Employee parents of ExternalTrainer</technical_language>

Target:
public List<Training> showMentoringTrainings(@RequestParam String userId) { User user = userService.getUserById(Long.parseLong(userId)).get(); if (user.getRole() == UserRole.ADMIN || user.getRole() == UserRole.EMPLOYEE || user.getRole() == UserRole.EXTERNAL_TRAINER) return ((ExternalTrainer)user).getMentoringTrainings(); return null; }
Source:
<code>public void onOverlayViewSizeChanged(int width, int height) { synchronized(sLock) { if (sOverlayViewSizeChangedCallback != null) { <START> if (!sOverlayViewSizeChangedCallback.getBundle() .getBoolean("OverlayViewCreated")) { sOverlayViewSizeChangedCallback.getBundle() .putBoolean("OverlayViewCreated", true); } <END> else { if (sDummyVideoTrack.getVideoHeight() <= 0 || sDummyVideoTrack.getVideoWidth() <= 0) { Log.w(TAG, "The width or height of the selected video track is invalid."); } else if (height <= 0 || width <= 0) { Log.w(TAG, "The width or height of the OverlayView is incorrect."); } else if (Math.abs((float)width / height - (float)sDummyVideoTrack.getVideoWidth() * sDummyVideoTrack.getVideoPixelAspectRatio() / sDummyVideoTrack.getVideoHeight()) < sRatioEpsilon) { sOverlayViewSizeChangedCallback.post(); sOverlayViewSizeChangedCallback = null; notifyTrackSelected(TvTrackInfo.TYPE_VIDEO, null); } } } } }</code><technical_language>uncommon config(1000x500) for testing I initial pass condition in L520~523. drop this case</technical_language>

Target:
public void onOverlayViewSizeChanged(int width, int height) { synchronized(sLock) { draw(); if (sOverlayViewSizeChangedCallback != null) { if (sDummyVideoTrack.getVideoHeight() <= 0 || sDummyVideoTrack.getVideoWidth() <= 0) { Log.w(TAG, "The width or height of the selected video track is invalid."); } else if (height <= 0 || width <= 0) { Log.w(TAG, "The width or height of the OverlayView is incorrect."); } else if (Math.abs((float)width / height - (float)sDummyVideoTrack.getVideoWidth() * sDummyVideoTrack.getVideoPixelAspectRatio() / sDummyVideoTrack.getVideoHeight()) < DISPLAY_RATIO_EPSILON) { sOverlayViewSizeChangedCallback.post(); sOverlayViewSizeChangedCallback = null; } } } }
Source:
<code>public void checkAttributeValue(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute userCertDNs; try { userCertDNs = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":userCertDNs"); } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } Map<String, String> certDNsValue; if(userCertDNs.getValue() != null) { certDNsValue = (Map<String, String>) userCertDNs.getValue(); } else { if(attribute.getValue() != null) throw new WrongReferenceAttributeValueException(attribute, userCertDNs, "There is no certificates for this user so preferred certificate can't be choose."); else return; } if(attribute.getValue() == null) { <START> if(certDNsValue != null) throw new WrongAttributeValueException(attribute, user, "This attribute value can't be null because of notNull attribute userCertDNs"); <END> } else { String preferredCertDNValue = (String) attribute.getValue(); if(!certDNsValue.containsKey(preferredCertDNValue)) throw new WrongAttributeValueException(attribute, "This attribute value must be one of exsiting keys in userCertDNs."); } }</code><technical_language>I && instead of || condition removed</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl sess, User user, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { Attribute userCertDNs; try { userCertDNs = sess.getPerunBl().getAttributesManagerBl().getAttribute(sess, user, AttributesManager.NS_USER_ATTR_DEF + ":userCertDNs"); } catch (AttributeNotExistsException ex) { throw new ConsistencyErrorException(ex); } Map<String, String> certDNsValue; if(userCertDNs.getValue() != null) { certDNsValue = (Map<String, String>) userCertDNs.getValue(); } else { if(attribute.getValue() != null) throw new WrongReferenceAttributeValueException(attribute, userCertDNs, "There is no certificates for this user so preferred certificate can't be choose."); else return; } if(attribute.getValue() == null) { if(certDNsValue != null && !certDNsValue.isEmpty()) throw new WrongAttributeValueException(attribute, user, "This attribute value can't be null because of notNull attribute userCertDNs"); } else { String preferredCertDNValue = (String) attribute.getValue(); if(!certDNsValue.containsKey(preferredCertDNValue)) throw new WrongAttributeValueException(attribute, "This attribute value must be one of exsiting keys in userCertDNs."); } }
Source:
<code>private void monitorThreadPoolExecutor(ExecutorService executor, String name, String... tags) { String className = executor.getClass().getName(); if (executor instanceof ThreadPoolExecutor) { CountedThreadFactory.monitorThreads( meterRegistry, (ThreadPoolExecutor) executor, name, Tags.of(tags)); CountedRejectedExecutionHandler.monitorRejections( meterRegistry, (ThreadPoolExecutor) executor, name, Tags.of(tags)); } else if (className.equals( "java.util.concurrent.Executors$DelegatedScheduledExecutorService")) { ThreadPoolExecutor unwrappedExecutor = unwrapThreadPoolExecutor(executor, executor.getClass()); <START> CountedThreadFactory.monitorThreads(meterRegistry, unwrappedExecutor, name, Tags.of(tags)); <END> CountedRejectedExecutionHandler.monitorRejections( meterRegistry, unwrappedExecutor, name, Tags.of(tags)); } else if (className.equals( "java.util.concurrent.Executors$FinalizableDelegatedExecutorService")) { ThreadPoolExecutor unwrappedExecutor = unwrapThreadPoolExecutor(executor, executor.getClass().getSuperclass()); CountedThreadFactory.monitorThreads(meterRegistry, unwrappedExecutor, name, Tags.of(tags)); CountedRejectedExecutionHandler.monitorRejections( meterRegistry, unwrappedExecutor, name, Tags.of(tags)); } }</code><technical_language>potential NPE unwrappedExecutor</technical_language>

Target:
private void monitorThreadPoolExecutor(ExecutorService executor, String name, String... tags) { String className = executor.getClass().getName(); ThreadPoolExecutor unwrappedThreadPoolExecutor = null; if (executor instanceof ThreadPoolExecutor) { unwrappedThreadPoolExecutor = (ThreadPoolExecutor) executor; } else if (className.equals( "java.util.concurrent.Executors$DelegatedScheduledExecutorService")) { unwrappedThreadPoolExecutor = unwrapThreadPoolExecutor(executor, executor.getClass()); } else if (className.equals( "java.util.concurrent.Executors$FinalizableDelegatedExecutorService")) { unwrappedThreadPoolExecutor = unwrapThreadPoolExecutor(executor, executor.getClass().getSuperclass()); } if (unwrappedThreadPoolExecutor != null) { CountedThreadFactory.monitorThreads( meterRegistry, unwrappedThreadPoolExecutor, name, Tags.of(tags)); CountedRejectedExecutionHandler.monitorRejections( meterRegistry, unwrappedThreadPoolExecutor, name, Tags.of(tags)); } }
Source:
<code>public void publish(String topic, String message) { if (senderChannel == null) { return; } try { senderChannel.publish(topic, message.getBytes()); } catch (Exception e) { <START> logger.error("Error publishing message"); <END> } }</code><technical_language>please enhance error message more context. Currently message is comprehensive be</technical_language>

Target:
public void publish(String topic, String message) { if (senderChannel == null) { return; } try { senderChannel.publish(topic, message.getBytes()); } catch (Exception e) { logger.error("Error publishing message: {}", e.getMessage()); } }
Source:
<code>protected void executeCommand() { List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); Guid vdsId = getVm().getDedicatedVmForVds(); List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VdsNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond().getFirst()) { <START> int index = pair.getSecond().getSecond(); <END> for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massUpdateNumaNode(nodes); setSucceeded(true); }</code><technical_language>NPE here: index try eval Integer.valueOf(null) this needs protection especially in API code</technical_language>

Target:
protected void executeCommand() { List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList(); Guid vdsId = getVm().getDedicatedVmForVds(); List<VdsNumaNode> vdsNumaNodes = new ArrayList<>(); if (vdsId != null) { vdsNumaNodes = getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vdsId); } List<VdsNumaNode> nodes = new ArrayList<>(); for (VmNumaNode vmNumaNode : vmNumaNodes) { for (Pair<Guid, Pair<Boolean, Integer>> pair : vmNumaNode.getVdsNumaNodeList()) { if (pair.getSecond() != null && pair.getSecond().getFirst()) { int index = pair.getSecond().getSecond(); for (VdsNumaNode vdsNumaNode : vdsNumaNodes) { if (vdsNumaNode.getIndex() == index) { pair.setFirst(vdsNumaNode.getId()); break; } } } } nodes.add(vmNumaNode); } getVmNumaNodeDao().massUpdateNumaNode(nodes); setSucceeded(true); }