auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private FormulaEditorFragment addResourceToActiveFormulaInFormulaEditor(CategoryListItem categoryListItem) { FormulaEditorFragment formulaEditorFragment = ((FormulaEditorFragment) getFragmentManager() .findFragmentByTag(FormulaEditorFragment.FORMULA_EDITOR_FRAGMENT_TAG)); <START> formulaEditorFragment.addResourceToActiveFormula(categoryListItem.nameResId); <END> return formulaEditorFragment; }</code><technical_language>Please check if fragment exists. lead a null-pointer exception</technical_language>

Target:
private FormulaEditorFragment addResourceToActiveFormulaInFormulaEditor(CategoryListItem categoryListItem) { FormulaEditorFragment formulaEditorFragment = null; if (getFragmentManager() != null) { formulaEditorFragment = ((FormulaEditorFragment) getFragmentManager() .findFragmentByTag(FormulaEditorFragment.FORMULA_EDITOR_FRAGMENT_TAG)); if (formulaEditorFragment != null) { formulaEditorFragment.addResourceToActiveFormula(categoryListItem.nameResId); } } return formulaEditorFragment; }
Source:
<code>public void onOpened() { super.onOpened(); worlds.clear(); worldNumber = 0; final UIDropdownScrollable worldsDropdown = find("worlds", UIDropdownScrollable.class); if (worldsDropdown != null) { worldsDropdown.setOptions(worldNames()); } selectedWorld = ""; <START> indexOfWorld =findIndex(worlds, selectedWorld); <END> }</code><technical_language>Trivial: Missing whitespace. check affected files <LINK_0> - caught this :-)</technical_language>

Target:
public void onOpened() { super.onOpened(); worlds.clear(); worldNumber = 0; final UIDropdownScrollable worldsDropdown = find("worlds", UIDropdownScrollable.class); if (worldsDropdown != null) { worldsDropdown.setOptions(worldNames()); } selectedWorld = ""; indexOfSelectedWorld = findIndex(worlds, selectedWorld); }
Source:
<code>protected void onDestroy() { super.onDestroy(); getService().unregisterOnServiceStateChangeListener(this); <START> } <END></code><technical_language>this null</technical_language>

Target:
protected void onDestroy() { super.onDestroy(); SyncthingService syncthingService = getService(); if (syncthingService != null) { syncthingService.unregisterOnServiceStateChangeListener(this::onServiceStateChange); } }
Source:
<code>public List<Double> interpretDurationDiff(ImmutableList<Double> durationDiff) { final ImmutableList<Integer> path = hmm.decodeSensorData(durationDiff); <START> List<List<Double>> jointProbs = bayesModel.getJointOfForwardsAndBackwards(path); <END> List<Double> probOfMeInBed = Lists.newArrayList(); for (final List<Double> joint : jointProbs) { final double notJointNot = 1.0 - joint.get(1); probOfMeInBed.add(notJointNot); } return probOfMeInBed; }</code><technical_language>final</technical_language>

Target:
public List<Double> interpretDurationDiff(ImmutableList<Double> durationDiff) { final ImmutableList<Integer> path = hmm.decodeSensorData(durationDiff); final List<List<Double>> jointProbs = bayesModel.getJointOfForwardsAndBackwards(path); final List<Double> probOfMeInBed = Lists.newArrayList(); for (final List<Double> joint : jointProbs) { final double notJointNot = 1.0 - joint.get(1); probOfMeInBed.add(notJointNot); } return probOfMeInBed; }
Source:
<code>public KafkaMockConsumer(final OffsetResetStrategy offsetResetStrategy) { super(OffsetResetStrategy.EARLIEST); assign(Arrays.asList(new TopicPartition("testtopic", 0))); HashMap<TopicPartition, Long> beginningOffsets = new HashMap<>(); beginningOffsets.put(new TopicPartition("testtopic", 0), 0L); updateBeginningOffsets(beginningOffsets); for (int idx = 0; idx < 10; ++idx) { addRecord(new ConsumerRecord<byte[], byte[]>("testtopic", <START> 0, idx, ("mykey" + idx).getBytes(Charset.forName("UTF-8")), <END> ("myvalue" + idx).getBytes(Charset.forName("UTF-8")))); } }</code><technical_language>[StandardCharsets.UTF_8](<LINK_0></technical_language>

Target:
public KafkaMockConsumer(final OffsetResetStrategy offsetResetStrategy) { super(OffsetResetStrategy.EARLIEST); assign(Arrays.asList(new TopicPartition("testtopic", 0))); HashMap<TopicPartition, Long> beginningOffsets = new HashMap<>(); beginningOffsets.put(new TopicPartition("testtopic", 0), 0L); updateBeginningOffsets(beginningOffsets); for (int idx = 0; idx < 10; ++idx) { addRecord(new ConsumerRecord<byte[], byte[]>("testtopic", 0, idx, ("mykey" + idx).getBytes(StandardCharsets.UTF_8), ("myvalue" + idx).getBytes(StandardCharsets.UTF_8))); } }
Source:
<code>private Collection<File> getPluginFiles() throws IOException { <START> if (pluginsDir == null || !pluginsDir.exists()) <END> return Collections.emptyList(); return FileUtils.listFiles(pluginsDir, new String[] {"jar"}, false); }</code><technical_language>style-nit: wrap block in curly braces</technical_language>

Target:
private Collection<File> getPluginFiles() throws IOException { if (pluginsDir == null || !pluginsDir.exists()) { return Collections.emptyList(); } return FileUtils.listFiles(pluginsDir, new String[] {"jar"}, false); }
Source:
<code>private URI createMergedGraphic(final File printDirectory, final Dimension mapSize, final List<URI> graphics, final MapfishMapContext mapContext, final String outputFormat) throws IOException, JRException { final File mergedGraphic = File.createTempFile("map-", "." + outputFormat, printDirectory); int width = (int) Math.round(mapContext.getMapSize().width); int height = (int) Math.round(mapContext.getMapSize().height); if ("pdf".equalsIgnoreCase(outputFormat)) { com.lowagie.text.Document document = new com.lowagie.text.Document( new com.lowagie.text.Rectangle(width, height)); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(mergedGraphic)); document.open(); PdfContentByte pdfCB = writer.getDirectContent(); Graphics g = pdfCB.createGraphics(width, height); drawGraphics(width, height, graphics, g); g.dispose(); <START> document.close(); <END> } catch (BadElementException e) { throw new IOException(e); } catch (DocumentException e) { throw new IOException(e); } } else { boolean isJpeg = RenderType.fromFileExtension(outputFormat) == RenderType.JPEG; final BufferedImage bufferedImage = new BufferedImage(width, height, (isJpeg ? this.jpegImageType.value : this.imageType.value)); Graphics g = bufferedImage.getGraphics(); if (isJpeg) { g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); } drawGraphics(width, height, graphics, g); g.dispose(); ImageIO.write(bufferedImage, outputFormat, mergedGraphic); } return mergedGraphic.toURI(); }</code><technical_language>belong a finally</technical_language>

Target:
private URI createMergedGraphic(final File printDirectory, final Dimension mapSize, final List<URI> graphics, final MapfishMapContext mapContext, final String outputFormat) throws IOException, JRException { final File mergedGraphic = File.createTempFile("map-", "." + outputFormat, printDirectory); int width = (int) Math.round(mapContext.getMapSize().width); int height = (int) Math.round(mapContext.getMapSize().height); if ("pdf".equalsIgnoreCase(outputFormat)) { com.lowagie.text.Document document = new com.lowagie.text.Document( new com.lowagie.text.Rectangle(width, height)); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(mergedGraphic)); document.open(); PdfContentByte pdfCB = writer.getDirectContent(); Graphics g = pdfCB.createGraphics(width, height); try { drawGraphics(width, height, graphics, g); } finally { g.dispose(); } } catch (BadElementException e) { throw new IOException(e); } catch (DocumentException e) { throw new IOException(e); } finally { document.close(); } } else { boolean isJpeg = RenderType.fromFileExtension(outputFormat) == RenderType.JPEG; final BufferedImage bufferedImage = new BufferedImage(width, height, (isJpeg ? this.jpegImageType.value : this.imageType.value)); Graphics g = bufferedImage.getGraphics(); if (isJpeg) { g.setColor(Color.WHITE); g.fillRect(0, 0, width, height); } try { drawGraphics(width, height, graphics, g); } finally { g.dispose(); } ImageIO.write(bufferedImage, outputFormat, mergedGraphic); } return mergedGraphic.toURI(); }
Source:
<code>public void putAll( Table<Locator, String, String> meta ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_STATE_NAME ); Session session = DatastaxIO.getSession(); try { <START> PreparedStatement ps = session.prepare( "INSERT INTO metrics_metadata (key, column1, value) VALUES (?, ?, ?)" ); <END> BatchStatement batch = new BatchStatement(); for( Table.Cell<Locator, String, String> cell : meta.cellSet() ) { batch.add( ps.bind( cell.getRowKey().toString(), cell.getColumnKey(), serDes.serialize( cell.getValue() ) ) ); } ResultSet result = session.execute( batch ); LOG.debug( "result.size=" + result.all().size() ); } finally { ctx.stop(); } }</code><technical_language>CF_METRICS_METADATA_NAME too</technical_language>

Target:
public void putAll( Table<Locator, String, String> meta ) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.CF_METRICS_METADATA_NAME ); Session session = DatastaxIO.getSession(); try { PreparedStatement ps = session.prepare( "INSERT INTO " + CassandraModel.CF_METRICS_METADATA_NAME + " (key, column1, value) VALUES (?, ?, ?)" ); BatchStatement batch = new BatchStatement(); for( Table.Cell<Locator, String, String> cell : meta.cellSet() ) { batch.add( ps.bind( cell.getRowKey().toString(), cell.getColumnKey(), serDes.serialize( cell.getValue() ) ) ); } ResultSet result = session.execute( batch ); LOG.debug( "result.size=" + result.all().size() ); } finally { ctx.stop(); } }
Source:
<code>public void freeUnderlyingResources() { int spi = mSpi.getSpi(); try { mSrvConfig .getNetdInstance() .ipSecDeleteSecurityAssociation( uid, mConfig.getSourceAddress(), mConfig.getDestinationAddress(), spi, <START> 0, <END> mConfig.getMarkMask()); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Failed to delete SA with ID: " + mResourceId, e); } getResourceTracker().give(); }</code><technical_language>This is a related change... if move a separate patchset. Also, discussion, I cutting mark functionality in middle here, zero out in config leave logic. If want do this remove logic wholesale (which reluctant do). For now, set 0 in config</technical_language>

Target:
public void freeUnderlyingResources() { int spi = mSpi.getSpi(); try { mSrvConfig .getNetdInstance() .ipSecDeleteSecurityAssociation( uid, mConfig.getSourceAddress(), mConfig.getDestinationAddress(), spi, mConfig.getMarkValue(), mConfig.getMarkMask()); } catch (RemoteException | ServiceSpecificException e) { Log.e(TAG, "Failed to delete SA with ID: " + mResourceId, e); } getResourceTracker().give(); }
Source:
<code>protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; mFailsInFileSyncsFound = 0; mConflictsFound = 0; try { mLocalFolder = getStorageManager().getFileByPath(mRemotePath); result = checkForChanges(client); if (result.isSuccess()) { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { prepareOpsFromLocalKnowledge(); } if (result.isSuccess()) { syncContents(client); } if (mFilesForDirectDownload.isEmpty()) { sendBroadcastForNotifyingUIUpdate(result.isSuccess()); } } if (mCancellationRequested.get()) { throw new OperationCancelledException(); } } catch (OperationCancelledException e) { result = new RemoteOperationResult(e); <START> sendBroadcastForNotifyingUIUpdate(result.isSuccess()); <END> Intent intent = new Intent(mContext, FileDownloader.class); intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); intent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); intent.putExtra(FileDownloader.EXTRA_FILE, mLocalFolder); mContext.startService(intent); } return result; }</code><technical_language>Replace result.isSuccess() false</technical_language>

Target:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; mFailsInFileSyncsFound = 0; mConflictsFound = 0; try { mLocalFolder = getStorageManager().getFileByPath(mRemotePath); result = checkForChanges(client); if (result.isSuccess()) { if (mRemoteFolderChanged) { result = fetchAndSyncRemoteFolder(client); } else { prepareOpsFromLocalKnowledge(); } if (result.isSuccess()) { syncContents(client); } if (mFilesForDirectDownload.isEmpty()) { sendBroadcastForNotifyingUIUpdate(result.isSuccess()); } } if (mCancellationRequested.get()) { throw new OperationCancelledException(); } } catch (OperationCancelledException e) { result = new RemoteOperationResult(e); sendBroadcastForNotifyingUIUpdate(false); Intent intent = new Intent(mContext, FileDownloader.class); intent.setAction(FileDownloader.ACTION_CANCEL_FILE_DOWNLOAD); intent.putExtra(FileDownloader.EXTRA_ACCOUNT, mAccount); intent.putExtra(FileDownloader.EXTRA_FILE, mLocalFolder); mContext.startService(intent); } return result; }
Source:
<code>public CompositeTriJoiner(List<SingleTriJoiner<A, B, C>> joinerList) { this.joinerList = joinerList; if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); <START> } <END> }</code><technical_language>Possibly throw assigning</technical_language>

Target:
public CompositeTriJoiner(List<SingleTriJoiner<A, B, C>> joinerList) { if (joinerList.isEmpty()) { throw new IllegalArgumentException("The joinerList (" + joinerList + ") must not be empty."); } this.joinerList = joinerList; }
Source:
<code>public void testRandomName(){ try { createConfigFileWithRobot("SafetyDuck!!!"); RobobuggyConfigFile.loadConfigFile(); Assert.fail(); } catch (IOException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalArgumentException e) { <START> } <END> }</code><technical_language>ditto. is bad</technical_language>

Target:
public void testRandomName(){ try { createConfigFileWithRobot("SafetyDuck!!!"); RobobuggyConfigFile.loadConfigFile(); Assert.fail(); } catch (IOException e) { e.printStackTrace(); Assert.fail(); } catch (IllegalArgumentException e) { return; } Assert.fail(); }
Source:
<code><START> public KeySettings delimiter(String delimiter) { <END> this.delimiter = delimiter; return this; }</code><technical_language>test for null delimiter ignore preferably interpret null "no delimiter" (the empty String)</technical_language>

Target:
public KeySettings delimiter(String delimiter) { if (delimiter == null) { return this; } this.delimiter = delimiter; return this; }
Source:
<code>public void simplePlanExecutionTest() { final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 0) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 1) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 2) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 3) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 2, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResultImpl summary = (PlanResultImpl) result.get(); <START> assertEquals(planSize, summary.getNumExecutedOps()); <END> } catch (final Exception e) { e.printStackTrace(); } }</code><technical_language>Please PlanResult instead of PlanResultImpl, added geNumExecutedOps() interface</technical_language>

Target:
public void simplePlanExecutionTest() { final Plan plan = PlanImpl.newBuilder() .addEvaluatorToDelete("WORKER", EVAL_PREFIX + 0) .addEvaluatorToAdd("WORKER", EVAL_PREFIX + 1) .addEvaluatorToAdd("SERVER", EVAL_PREFIX + 2) .addEvaluatorToDelete("SERVER", EVAL_PREFIX + 3) .addTransferStep("SERVER", new TransferStepImpl(EVAL_PREFIX + 4, EVAL_PREFIX + 2, new DataInfoImpl(1))) .build(); final Future<PlanResult> result = planExecutor.execute(plan); final int planSize = plan.getPlanSize(); try { final PlanResult summary = result.get(10, TimeUnit.SECONDS); assertEquals(planSize, summary.getNumExecutedOps()); } catch (final TimeoutException e) { fail("Failed to execute the plan. Timeout occurred."); e.printStackTrace(); } catch (final InterruptedException | ExecutionException e) { fail("Failed to execute the plan. Exception occurred."); e.printStackTrace(); } }
Source:
<code>public ResponseEntity<OsmRecipient> registerOsm(@RequestParam("bitcoin_addr") String bitcoinAddress, @RequestParam("osm_usr") String osmUser, @RequestParam("osm_pwd") String osmPassword, @RequestParam("email") String email) { <START> checkParameter("Bitcoin address", bitcoinAddress); <END> checkParameter("E-mail", email); checkParameter("Osm user", osmUser); checkParameter("Osm password", osmPassword); String username = processOsmUsername(osmUser); String credentials = encodeCredentialsToBase64(username, osmPassword); authenticateUser(credentials); long registerTimestamp = System.currentTimeMillis(); OsmRecipient recipient = new OsmRecipient(osmUser, email, bitcoinAddress, registerTimestamp); recipient = osmRecipientsRepository.save(recipient); return ResponseEntity.ok(recipient); }</code><technical_language>Bitcoin address validated</technical_language>

Target:
public ResponseEntity<OsmRecipient> registerOsm(@RequestParam("bitcoin_addr") String bitcoinAddress, @RequestParam("osm_usr") String osmUser, @RequestParam("osm_pwd") String osmPassword, @RequestParam("email") String email) { checkParameter("Bitcoin address", bitcoinAddress); validateBitcoinAddress(bitcoinAddress); checkParameter("E-mail", email); checkParameter("Osm user", osmUser); checkParameter("Osm password", osmPassword); String username = processOsmUsername(osmUser); String credentials = encodeCredentialsToBase64(username, osmPassword); authenticateUser(credentials); long registerTimestamp = System.currentTimeMillis(); OsmRecipient recipient = new OsmRecipient(osmUser, email, bitcoinAddress, registerTimestamp); recipient = osmRecipientsRepository.save(recipient); return ResponseEntity.ok(recipient); }
Source:
<code>public void write(String targetName) { File outFile = new File(mainFolder, targetName + ".html"); <START> WriteTextFile out = new WriteTextFile(outFile.getAbsolutePath()); <END> for (String line : lines) { out.writeln(line); } out.close(); lines = new ArrayList<>(); }</code><technical_language>Prefer try-with-resources here. disregard WriteTextFile standard BufferedWriter + PrintWriter: java try (BufferedWriter bw = Files.newBufferedWriter(outFile.toPath()); PrintWriter out = new PrintWriter(bw)) { for (String line : lines) { out.println(line); } }</technical_language>

Target:
public void write(String targetName) { File outFile = new File(mainFolder, targetName + ".html"); try (BufferedWriter bw = Files.newBufferedWriter(outFile.toPath()); PrintWriter out = new PrintWriter(bw)) { for (String line : lines) { out.println(line); } } catch (IOException e) { e.printStackTrace(); } lines = new ArrayList<>(); }
Source:
<code>public void gcUnsafe() { while (garbageSendingDeque.size() < SENDING_QUEUE_CAPACITY && garbageReceivingQueue.size() >= BATCH_SIZE) { List<SMRGarbageEntry> garbageEntries = new ArrayList<>(); garbageReceivingQueue.drainTo(garbageEntries, BATCH_SIZE); <START> if (garbageEntries.isEmpty()) { <END> log.trace("Garbage Informer has nothing to send"); return; } GarbageBatch garbageBatch = new GarbageBatch(compressGarbage(garbageEntries)); garbageSendingDeque.offer(garbageBatch); } log.debug("GarbageInformer: Drains sending queue"); sendGarbage(); }</code><technical_language>check drainTo return < BATCH_SIZE</technical_language>

Target:
public void gcUnsafe() { while (garbageSendingDeque.size() < SENDING_QUEUE_CAPACITY) { List<SMRGarbageEntry> garbageEntries = new ArrayList<>(); int drainedNum = garbageReceivingQueue.drainTo(garbageEntries, BATCH_SIZE); if (drainedNum == 0) { break; } GarbageBatch garbageBatch = new GarbageBatch(compressGarbage(garbageEntries)); garbageSendingDeque.offer(garbageBatch); if (drainedNum < BATCH_SIZE) { break; } } log.debug("GarbageInformer: Drains sending queue"); sendGarbage(); }
Source:
<code>public Response accept(@InjectParam AuthenticatedUser user, @QueryParam("token") String token) { Database database; try { database = entityManager.get().createQuery("SELECT db FROM Database db " + "WHERE db.transferToken = :token", Database.class) .setParameter("token", token) .getSingleResult(); } catch(NoResultException noResult) { return Response.status(Response.Status.NOT_FOUND) .entity("Token is no longer valid. Database transfer may have been cancelled, or may already have been approved").build(); } User currentOwner = database.getOwner(); User proposedOwner = database.getTransferUser(); if (user.isAnonymous()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } if (proposedOwner.getId() != user.getUserId()) { return Response.status(Response.Status.FORBIDDEN).build(); } <START> TransferAuthorized transfer = new TransferAuthorized(currentOwner.getId(), proposedOwner.getId(), database.getId(), token); <END> DatabaseResource resource = new DatabaseResource(catalog, dispatcher, new DatabaseProviderImpl(entityManager), entityManager, mailSender, database.getId()); return resource.startTransfer(user, transfer.toJson().toJson()); }</code><technical_language>leaking requesting user token?? This allow requestor accept transfer theirself! This a secret person controls receipient of transfer request knows</technical_language>

Target:
public Response accept(@InjectParam AuthenticatedUser user, @QueryParam("token") String token) { Database database; try { database = entityManager.get().createQuery("SELECT db FROM Database db " + "WHERE db.transferToken = :token", Database.class) .setParameter("token", token) .getSingleResult(); } catch(NoResultException noResult) { return Response.status(Response.Status.NOT_FOUND) .entity("Token is no longer valid. Database transfer may have been cancelled, or may already have been approved").build(); } User currentOwner = database.getOwner(); User proposedOwner = database.getTransferUser(); if (user.isAnonymous()) { return Response.status(Response.Status.UNAUTHORIZED).build(); } if (proposedOwner.getId() != user.getUserId()) { return Response.status(Response.Status.FORBIDDEN).build(); } TransferAuthorized transfer = new TransferAuthorized(currentOwner.getId(), proposedOwner.getId(), database.getId(), token); DatabaseResource resource = new DatabaseResource(catalog, dispatcher, new DatabaseProviderImpl(entityManager), entityManager, mailSender, database.getId()); return resource.startTransfer(user, transfer); }
Source:
<code>public void bytesSkipped( long bytesSkipped ) { <START> out.println( "... skipped " + bytesSkipped + " bytes of weird tx log data" ); <END> }</code><technical_language>call data indecipherable instead of weird</technical_language>

Target:
public void bytesSkipped( long bytesSkipped ) { out.println( "... skipped " + bytesSkipped + " bytes of indecipherable transaction log data" ); }
Source:
<code>private Map<String, String> getConceptAnswers(Locale locale) { Map<String, String> conceptAnswers = new LinkedHashMap<String, String>(); for (ConceptAnswer answer : concept.getAnswers(true)) { log.debug("getting answers"); String key = answer.getAnswerConcept().getConceptId().toString(); ConceptName cn = answer.getAnswerConcept().getName(locale); String name = ""; if (cn != null) { name = cn.toString(); } if (answer.getAnswerDrug() != null) { key = key + "^" + answer.getAnswerDrug().getDrugId(); name = answer.getAnswerDrug().getFullName(locale); } if (answer.getAnswerConcept().isRetired()) { <START> String string = Context.getMessageSourceService().getMessage("Concept.retired"); <END> name = name + string ; } conceptAnswers.put(key, name); } return conceptAnswers; }</code><technical_language>name for a retired concept name needs a strike through, original code needs tweaked a little, need html codes for tags e.g **&lt;** for **<**</technical_language>

Target:
private Map<String, String> getConceptAnswers(Locale locale) { Map<String, String> conceptAnswers = new LinkedHashMap<String, String>(); for (ConceptAnswer answer : concept.getAnswers(true)) { log.debug("getting answers"); String key = answer.getAnswerConcept().getConceptId().toString(); ConceptName cn = answer.getAnswerConcept().getName(locale); String name = ""; if (cn != null) { name = cn.toString(); } if (answer.getAnswerDrug() != null) { key = key + "^" + answer.getAnswerDrug().getDrugId(); name = answer.getAnswerDrug().getFullName(locale); } if (answer.getAnswerConcept().isRetired()) { name = "<span class='retired'>" + name + "</span>"; } conceptAnswers.put(key, name); } return conceptAnswers; }
Source:
<code>public SelectionContext(boolean authenticated, String user, Optional<String> source, Set<String> clientTags, int queryPriority, Optional<String> queryType) { this.authenticated = authenticated; this.user = requireNonNull(user, "user is null"); this.source = requireNonNull(source, "source is null"); <START> this.clientTags = requireNonNull(clientTags, "tags is null"); <END> this.queryPriority = queryPriority; this.queryType = requireNonNull(queryType, "queryType is null"); }</code><technical_language>this.clientTags = Collections.unmodifiableSet(requireNonNull(clientTags, "tags is null"));</technical_language>

Target:
public SelectionContext(boolean authenticated, String user, Optional<String> source, Set<String> clientTags, int queryPriority, Optional<String> queryType) { this.authenticated = authenticated; this.user = requireNonNull(user, "user is null"); this.source = requireNonNull(source, "source is null"); this.clientTags = unmodifiableSet(requireNonNull(clientTags, "tags is null")); this.queryPriority = queryPriority; this.queryType = requireNonNull(queryType, "queryType is null"); }
Source:
<code><START> void onAllNodesReplicated(int totalPushTasksCount) { <END> if (replicationsCount == 0) { return; } RefReplicationDoneEvent event = new RefReplicationDoneEvent(replicatedProject, replicatedRef, replicationsCount); postEvent(replicatedProject, replicatedRef, event); }</code><technical_language>totalPushTasksCount</technical_language>

Target:
void onAllNodesReplicated(int totalPushTasksCount) { if (totalPushTasksCount == 0) { return; } RefReplicationDoneEvent event = new RefReplicationDoneEvent(replicatedProject, replicatedRef, totalPushTasksCount); postEvent(replicatedProject, replicatedRef, event); }
Source:
<code>public void handleMemberAttributeChangeEventV10(Member member, Collection<Member> members, String key, int opType, String value) { Collection<Member> currentMembersList = clusterService.getMemberList(); <START> if (currentMembersList.contains(member)) { <END> final MemberAttributeOperationType operationType = MemberAttributeOperationType.getValue(opType); ((AbstractMember) member).updateAttribute(operationType, key, value); MemberAttributeEvent memberAttributeEvent = new MemberAttributeEvent(client.getCluster(), member, new HashSet<>(members), operationType, key, value); clusterService.fireMemberAttributeEvent(memberAttributeEvent); } }</code><technical_language>This behavior change. need check uuids. Contains equals checks for address equality</technical_language>

Target:
public void handleMemberAttributeChangeEventV10(Member member, Collection<Member> members, String key, int opType, String value) { Collection<Member> currentMembersList = clusterService.getMemberList(); String uuid = member.getUuid(); for (Member target : currentMembersList) { if (target.getUuid().equals(uuid)) { final MemberAttributeOperationType operationType = MemberAttributeOperationType.getValue(opType); ((AbstractMember) target).updateAttribute(operationType, key, value); MemberAttributeEvent memberAttributeEvent = new MemberAttributeEvent(client.getCluster(), target, new HashSet<>(members), operationType, key, value); clusterService.fireMemberAttributeEvent(memberAttributeEvent); break; } } }
Source:
<code>public Response delete(@PathParam("id") Long id) { Migration migration = migrationService.delete(id); if (migration == null) { return getMigrationNotFound(id); } <START> return Response.ok(migration).build(); <END> }</code><technical_language>here, thrown service in opinion</technical_language>

Target:
public Response delete(@PathParam("id") Long id) throws MigrationNotFoundException { return Response.ok(migrationService.delete(id)).build(); }
Source:
<code><START> public Map<String, Product> getProducts(IOperationMonitor monitor) throws BugzillaRestException { <END> return retrieveItems(monitor, "/product?type=accessible", new Function<ProductResponse, Product[]>() { public Product[] apply(ProductResponse input) { return input.getProducts(); } }, new TypeToken<ProductResponse>() { }); }</code><technical_language>methods private</technical_language>

Target:
private Map<String, Product> getProducts(IOperationMonitor monitor) throws BugzillaRestException { return retrieveItems(monitor, "/product?type=accessible", new TypeToken<ProductResponse>() { }); }
Source:
<code>public EntityInteractHandler getItemHandler() { return (e, item) -> { if (e.getRightClicked().getType() == EntityType.ZOMBIE_VILLAGER) { Player p = e.getPlayer(); <START> item.setAmount(item.getAmount() - 1); <END> if (e.getHand() == EquipmentSlot.OFF_HAND) { p.getInventory().setItemInOffHand(item); } else { p.getInventory().setItemInMainHand(item); } p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); ZombieVillager zombieVillager = (ZombieVillager) e.getRightClicked(); zombieVillager.setConversionTime(1); if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { zombieVillager.setConversionPlayer(p); } } }; }</code><technical_language>ItemUtils.consumeItem... for this</technical_language>

Target:
public EntityInteractHandler getItemHandler() { return (p, entity, item, offhand) -> { if (entity.getType() == EntityType.ZOMBIE_VILLAGER) { ItemUtils.consumeItem(item, false); p.playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1, 1); ZombieVillager zombieVillager = (ZombieVillager) entity; if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) { zombieVillager.setConversionTime(1); if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) { zombieVillager.setConversionPlayer(p); } } else { zombieVillager.setVillager(true); } } }; }
Source:
<code>public static Double getGenotypeDouble(final Genotype g, final String fieldName, final double defaultValue) { final Object o2ExtendedAttribute = g.getExtendedAttribute(fieldName, VCFConstants.MISSING_VALUE_v4); final String o2PArtifactAsString = String.valueOf(o2ExtendedAttribute); <START> if ((o2PArtifactAsString == null) || (o2PArtifactAsString.equals(VCFConstants.MISSING_VALUE_v4))) { <END> return defaultValue; } return Double.parseDouble(o2PArtifactAsString); }</code><technical_language>Extra parentheses</technical_language>

Target:
public static Double getGenotypeDouble(final Genotype g, final String fieldName, final double defaultValue) { Utils.nonNull(g); final String genotypeFieldAsString = getGenotypeString(g, fieldName); return isVcfGenotypeFieldEmpty(genotypeFieldAsString) ? defaultValue : Double.parseDouble(genotypeFieldAsString); }
Source:
<code>public Guid executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, true); CommandCallBack callBack = command.getCallBack(); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } try { executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { <START> command.setCommandStatus(CommandStatus.FAILED); <END> } return command.getCommandId(); }</code><technical_language>I consider perform audit log other log anti flood protection reached this situation. If failing commands due Reject of thread pool, ovirt administrator system is extermely busy</technical_language>

Target:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, true); CommandCallBack callBack = command.getCallBack(); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }
Source:
<code>private static Metadata metadataForSnapshot(SnapshotsInProgress.Entry snapshot, Metadata metadata) { if (snapshot.includeGlobalState() == false) { Metadata.Builder builder = Metadata.builder(); for (IndexId index : snapshot.indices()) { final IndexMetadata indexMetadata = metadata.index(index.getName()); if (indexMetadata == null) { assert snapshot.partial() : "Index [" + index + "] was deleted during a snapshot but snapshot was not partial."; } else { builder.put(indexMetadata, false); } } Map<String, DataStream> dataStreams = new HashMap<>(metadata.dataStreams()); <START> dataStreams.keySet().removeIf(ds -> snapshot.dataStreams().contains(ds) == false); <END> builder.dataStreams(dataStreams); metadata = builder.build(); } return metadata; }</code><technical_language>This potentially broken. remove a data stream while is in process of snapshotted? (looks it) If so, failing error if concurrently removes (while data nodes busy work) get it</technical_language>

Target:
private static Metadata metadataForSnapshot(SnapshotsInProgress.Entry snapshot, Metadata metadata) { if (snapshot.includeGlobalState() == false) { Metadata.Builder builder = Metadata.builder(); for (IndexId index : snapshot.indices()) { final IndexMetadata indexMetadata = metadata.index(index.getName()); if (indexMetadata == null) { assert snapshot.partial() : "Index [" + index + "] was deleted during a snapshot but snapshot was not partial."; } else { builder.put(indexMetadata, false); } } if (snapshot.userMetadata() != null && snapshot.userMetadata().containsKey(DataStream.DATA_STREAMS_METADATA_FIELD)) { @SuppressWarnings("unchecked") List<String> dataStreamNames = (List<String>) snapshot.userMetadata().get(DataStream.DATA_STREAMS_METADATA_FIELD); Map<String, DataStream> dataStreams = new HashMap<>(); for (String dataStreamName : dataStreamNames) { DataStream dataStream = metadata.dataStreams().get(dataStreamName); if (dataStream == null) { assert snapshot.partial() : "Data stream [" + dataStreamName + "] was deleted during a snapshot but snapshot was not partial."; } else { dataStreams.put(dataStreamName, dataStream); } } builder.dataStreams(dataStreams); } metadata = builder.build(); } return metadata; }
Source:
<code>public void theChannelOfDeviceIsCleared(final String gMeter) { final SmartMeter mbusDevice = this.smartMeterRepository.findByDeviceIdentification(gMeter); <START> Assert.assertNotNull(mbusDevice); <END> Assert.assertNull("GatewayDevice must be empty", mbusDevice.getChannel()); }</code><technical_language>Add a message</technical_language>

Target:
public void theChannelOfDeviceIsCleared(final String gMeter) { final SmartMeter mbusDevice = this.smartMeterRepository.findByDeviceIdentification(gMeter); Assert.assertNotNull("No MbusDevice found", mbusDevice); Assert.assertNull("GatewayDevice must be empty", mbusDevice.getChannel()); }
Source:
<code>public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException { if (run instanceof AbstractBuild) { try { return TokenMacro.expandAll((AbstractBuild) run, listener, content, false, loadPrivateTokens()); } catch (MacroEvaluationException e) { LOGGER.error("Can't process token content in ({})", content, run.getParent().getFullName(), e.getMessage()); LOGGER.trace(e.getMessage(), e); return content; } } else { <START> return run.getEnvironment(listener).expand(trimToEmpty(content)); <END> } }</code><technical_language>this contribute vars node=env. ParameterActions need extracted in case of parametrised run</technical_language>

Target:
public String expandAll(Run<?, ?> run, TaskListener listener) throws IOException, InterruptedException { if (run instanceof AbstractBuild) { try { return TokenMacro.expandAll( (AbstractBuild) run, listener, content, false, Collections.<TokenMacro>emptyList() ); } catch (MacroEvaluationException e) { LOGGER.error("Can't process token content in ({})", content, run.getParent().getFullName(), e.getMessage()); LOGGER.trace(e.getMessage(), e); return content; } } else { return run.getEnvironment(listener).expand(trimToEmpty(content)); } }
Source:
<code>private InputStream getInputStream() throws IOException { ContentResolver contentResolver = context.getContentResolver(); Uri uri = getData().uri; switch (matcher.match(uri)) { case ID_LOOKUP: uri = ContactsContract.Contacts.lookupContact(contentResolver, uri); if (null == uri) { return null; } case ID_CONTACT: if (SDK_INT < ICE_CREAM_SANDWICH) { return openContactPhotoInputStream(contentResolver, uri); } else { return ContactPhotoStreamIcs.get(contentResolver, uri); } case ID_THUMBNAIL: case ID_DISPLAY_PHOTO: return contentResolver.openInputStream(uri); default: <START> return null; <END> } }</code><technical_language>This throw IllegalStateException, no</technical_language>

Target:
private InputStream getInputStream() throws IOException { ContentResolver contentResolver = context.getContentResolver(); Uri uri = getData().uri; switch (matcher.match(uri)) { case ID_LOOKUP: uri = ContactsContract.Contacts.lookupContact(contentResolver, uri); if (null == uri) { return null; } case ID_CONTACT: if (SDK_INT < ICE_CREAM_SANDWICH) { return openContactPhotoInputStream(contentResolver, uri); } else { return ContactPhotoStreamIcs.get(contentResolver, uri); } case ID_THUMBNAIL: case ID_DISPLAY_PHOTO: return contentResolver.openInputStream(uri); default: throw new IllegalStateException("Invalid uri: " + uri); } }
Source:
<code>protected void initialize(Subject subj) throws PrivilegedActionException { final Configuration config = getRemoteCacheManagerConfig(subj); <START> Subject.doAs(subj, new PrivilegedExceptionAction<Void>() { <END> public Void run() throws Exception { remoteCacheManager = new RemoteCacheManager(config, true); return null; } }); remoteCache = remoteCacheManager.getCache(TEST_CACHE_NAME); }</code><technical_language>necessary crate RemoteCacheManager in a PrivligedAction. GSSAPI mech requires a Subject initialize SASL client, passed in configuration</technical_language>

Target:
protected void initialize(Subject subj) throws PrivilegedActionException { final Configuration config = getRemoteCacheManagerConfig(subj); remoteCacheManager = new RemoteCacheManager(config, true); remoteCache = remoteCacheManager.getCache(TEST_CACHE_NAME); }
Source:
<code>public void responseReceived(SubscribeToShardResponse response) { parent.setLastRequestId(response.responseMetadata().requestId()); log.debug("{}: [SubscriptionLifetime]: (RecordFlow#responseReceived) @ id: -- Response received. rid: {}, erid: {}, sdkfields: {}", <START> parent.shardId, connectionStartedAt, subscribeToShardId, response.responseMetadata().requestId(), response.responseMetadata().extendedRequestId(), response.sdkFields()); <END> }</code><technical_language>lets remove sdkfields</technical_language>

Target:
public void responseReceived(SubscribeToShardResponse response) { log.debug("{}: [SubscriptionLifetime]: (RecordFlow#responseReceived) @ id: -- Response received. Request id - {}", parent.shardId, connectionStartedAt, subscribeToShardId, response.responseMetadata().requestId()); final RequestDetails requestDetails = new RequestDetails(response.responseMetadata().requestId(), connectionStartedAt.toString()); parent.setLastSuccessfulRequestDetails(requestDetails); }
Source:
<code><START> public FateStatus getTransactionStatus(ReadOnlyTStore<T> zs, Set<Long> filterTxid, <END> EnumSet<TStatus> filterStatus, Map<Long,List<String>> heldLocks, Map<Long,List<String>> waitingLocks) { List<Long> transactions = zs.list(); List<TransactionStatus> statuses = new ArrayList<>(transactions.size()); for (Long tid : transactions) { zs.reserve(tid); String debug = (String) zs.getProperty(tid, "debug"); List<String> hlocks = null; if (heldLocks == null) { heldLocks = Collections.emptyMap(); } else { hlocks = heldLocks.remove(tid); } if (hlocks == null) { hlocks = Collections.emptyList(); } List<String> wlocks = null; if (waitingLocks == null) { waitingLocks = Collections.emptyMap(); } else { wlocks = waitingLocks.remove(tid); } if (wlocks == null) { wlocks = Collections.emptyList(); } String top = null; ReadOnlyRepo<T> repo = zs.top(tid); if (repo != null) top = repo.getDescription(); TStatus status = zs.getStatus(tid); zs.unreserve(tid, 0); if ((filterTxid != null && !filterTxid.contains(tid)) || (filterStatus != null && !filterStatus.contains(status))) continue; statuses.add(new TransactionStatus(tid, status, debug, hlocks, wlocks, top)); } return new FateStatus(statuses, heldLocks, waitingLocks); }</code><technical_language>sense this private public methods call it. java public FateStatus getStatus(ReadOnlyTStore<T> zs, IZooReader zk, String lockPath, Set<Long> filterTxid, EnumSet<TStatus> filterStatus) public List<TransactionStatus> getTransactionStatus(ReadOnlyTStore<T> zs, IZooReader zk, Set<Long> filterTxid, EnumSet<TStatus> filterStatus)</technical_language>

Target:
private FateStatus getTransactionStatus(ReadOnlyTStore<T> zs, Set<Long> filterTxid, EnumSet<TStatus> filterStatus, Map<Long,List<String>> heldLocks, Map<Long,List<String>> waitingLocks) { List<Long> transactions = zs.list(); List<TransactionStatus> statuses = new ArrayList<>(transactions.size()); for (Long tid : transactions) { zs.reserve(tid); String debug = (String) zs.getProperty(tid, "debug"); List<String> hlocks = heldLocks.remove(tid); if (hlocks == null) { hlocks = Collections.emptyList(); } List<String> wlocks = waitingLocks.remove(tid); if (wlocks == null) { wlocks = Collections.emptyList(); } String top = null; ReadOnlyRepo<T> repo = zs.top(tid); if (repo != null) top = repo.getDescription(); TStatus status = zs.getStatus(tid); zs.unreserve(tid, 0); if ((filterTxid != null && !filterTxid.contains(tid)) || (filterStatus != null && !filterStatus.contains(status))) continue; statuses.add(new TransactionStatus(tid, status, debug, hlocks, wlocks, top)); } return new FateStatus(statuses, heldLocks, waitingLocks); }
Source:
<code>public Response toResponse(InstallerException exception) { ServiceError serviceError = DtoFactory.newDto(ServiceError.class).withMessage(exception.getMessage()); String errorAsJson = DtoFactory.getInstance().toJson(serviceError); if (exception instanceof InstallerNotFoundException) { return Response.status(Response.Status.NOT_FOUND) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof InstallerConflictException) { return Response.status(Response.Status.CONFLICT) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof IllegalInstallerKeyException) { <START> return Response.status(Response.Status.BAD_REQUEST) <END> .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else { return Response.serverError() .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } }</code><technical_language>I 403 forbidden instead server understood request entity is valid in entity prevents fulfilment of request</technical_language>

Target:
public Response toResponse(InstallerException exception) { ServiceError serviceError = DtoFactory.newDto(ServiceError.class).withMessage(exception.getMessage()); String errorAsJson = DtoFactory.getInstance().toJson(serviceError); if (exception instanceof InstallerNotFoundException) { return Response.status(Response.Status.NOT_FOUND) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof InstallerAlreadyExistsException) { return Response.status(Response.Status.CONFLICT) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else if (exception instanceof IllegalInstallerKeyException) { return Response.status(Response.Status.BAD_REQUEST) .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } else { return Response.serverError() .entity(errorAsJson) .type(MediaType.APPLICATION_JSON) .build(); } }
Source:
<code>public synchronized void close() { isClosed = true; <START> ingestJob.addStreamingIngestDataSource(); <END> }</code><technical_language>need a name for this method</technical_language>

Target:
public synchronized void close() { isClosed = true; ingestJob.processStreamingIngestDataSource(); }
Source:
<code>private static RankProcessStrategy getRankStrategy(boolean insertOnly) { <START> if (insertOnly) { return AppendFastStrategy$.MODULE$; } else { return RetractStrategy$.MODULE$; <END> } }</code><technical_language>port java</technical_language>

Target:
private static RankProcessStrategy getRankStrategy(boolean insertOnly) { if (insertOnly) { return RankProcessStrategy.APPEND_FAST_STRATEGY; } else { return RankProcessStrategy.RETRACT_STRATEGY; } }
Source:
<code>public SemanticException(QualifierType type) { <START> super(String.format("Invalid input in filter for type \"%s\"", type)); <END> }</code><technical_language>a lot of room in status bar, want preamble shorter. Also, this constructor another parameter for details of error. explain input a problem</technical_language>

Target:
public SemanticException(QualifierType type) { super(String.format(ERROR_MESSAGE, type, type.getDescriptionOfValidInputs())); }
Source:
<code>private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += ".fastq"; <START> if (COMPRESS_OUTPUTS) { <END> fileName += ".gz"; } final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }</code><technical_language>fileName += COMPRESS_PER_RG_OUTPUTS ? ".fastq.gz" : ".fastq";</technical_language>

Target:
private File makeReadGroupFile(final SAMReadGroupRecord readGroup, final String preExtSuffix) { String fileName = null; if (RG_TAG.equalsIgnoreCase("PU")){ fileName = readGroup.getPlatformUnit(); } else if (RG_TAG.equalsIgnoreCase("ID")){ fileName = readGroup.getReadGroupId(); } if (fileName == null) { throw new PicardException("The selected RG_TAG: "+RG_TAG+" is not present in the bam header."); } fileName = IOUtil.makeFileNameSafe(fileName); if (preExtSuffix != null) fileName += preExtSuffix; fileName += COMPRESS_OUTPUTS_PER_RG ? ".fastq.gz" : ".fastq"; final File result = (OUTPUT_DIR != null) ? new File(OUTPUT_DIR, fileName) : new File(fileName); IOUtil.assertFileIsWritable(result); return result; }