auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testThrowError() throws Exception { Error error = new Error("Transaction throws!"); Mockito.when(c.getAutoCommit()).thenReturn(true); Mockito.when(h.getConnection()).thenReturn(c); try { new LocalTransactionHandler().inTransaction(h, x -> { throw error; }); <START> } catch (Throwable throwable) { <END> assertThat(throwable).isSameAs(error); } }</code><technical_language>do this assertj's assertThatThrownBy instead of a regular catch, please</technical_language>

Target:
public void testThrowError() throws Exception { Error error = new Error("Transaction throws!"); Mockito.when(c.getAutoCommit()).thenReturn(true); Mockito.when(h.getConnection()).thenReturn(c); assertThatThrownBy(() -> new LocalTransactionHandler().inTransaction(h, x -> { throw error; })) .isSameAs(error); }
Source:
<code>public Object getCaptionValue() { if (captionValue != null) { return captionValue; } <START> return getKey(); <END> }</code><technical_language>I current behavior is if captionColumn is defined, fall name, finally key</technical_language>

Target:
public Object getCaptionValue() { if (captionValue != null) { return captionValue; } Object name = getPropertyValue(Property.NAME.name); return name != null ? name : key; }
Source:
<code>public static void start(final int port) { new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket client = null; try { serverSocket = new ServerSocket(port); while (true) { client = serverSocket.accept(); PrintWriter out = new PrintWriter(client.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); <START> KnockKnockProtocol kkp = new KnockKnockProtocol(); <END> String inputLine, outputLine; while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.print(outputLine); out.flush(); if (outputLine.equals("Bye.")) break; } } } catch (IOException e) { e.printStackTrace(); } finally { if (serverSocket != null) try { serverSocket.close(); } catch (IOException e) } } }).start(); }</code><technical_language>KnockKnockProtocol instantiated while loop. is constant for socket client</technical_language>

Target:
public static void start(final int port) { new Thread(new Runnable() { @Override public void run() { ServerSocket serverSocket = null; Socket client = null; try { serverSocket = new ServerSocket(port); KnockKnockProtocol kkp = new KnockKnockProtocol(); while (true) { client = serverSocket.accept(); PrintWriter out = new PrintWriter(client.getOutputStream()); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); String inputLine, outputLine; while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.print(outputLine); out.flush(); if (outputLine.equals("Bye.")) break; } } } catch (IOException e) { e.printStackTrace(); } finally { if (serverSocket != null) try { serverSocket.close(); } catch (IOException e) } } }).start(); }
Source:
<code>private IResource[] getSelectedResources(IStructuredSelection selection) { Set<IResource> result = new HashSet<IResource>(); for (Object o : selection.toList()) { IResource resource = (IResource) getAdapter(o, IResource.class); <START> if (resource != null) { <END> result.add(resource); } else { extractResourcesFromMapping(result, o); } } return result.toArray(new IResource[result.size()]); }</code><technical_language>curly brackets single line block's</technical_language>

Target:
private IResource[] getSelectedResources(IStructuredSelection selection) { Set<IResource> result = new HashSet<IResource>(); for (Object o : selection.toList()) { IResource resource = (IResource) getAdapter(o, IResource.class); if (resource != null) result.add(resource); else extractResourcesFromMapping(result, o); } return result.toArray(new IResource[result.size()]); }
Source:
<code>public List<EmailWrapper> generateFeedbackSessionReminderEmails( FeedbackSessionAttributes session, List<StudentAttributes> students, List<InstructorAttributes> instructorsToRemind, InstructorAttributes instructorToNotify) { CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_OPEN); String additionalContactInformation = HTML_NO_ACTION_REQUIRED + getAdditionalContactInformationFragment(course); List<InstructorAttributes> instructorToNotifyAsList = new ArrayList<InstructorAttributes>(); instructorToNotifyAsList.add(instructorToNotify); List<EmailWrapper> emails = generateFeedbackSessionEmailBasesForInstructorReminders(course, session, instructorsToRemind, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject()); <START> emails.addAll(generateFeedbackSessionEmailBases(course, session, students, instructorToNotifyAsList, template, <END> EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), FEEDBACK_ACTION_SUBMIT, additionalContactInformation)); return emails; }</code><technical_language>If this method is in this call, if instead change method parameter accept a single InstructorAttributes a List</technical_language>

Target:
public List<EmailWrapper> generateFeedbackSessionReminderEmails( FeedbackSessionAttributes session, List<StudentAttributes> students, List<InstructorAttributes> instructorsToRemind, InstructorAttributes instructorToNotify) { CourseAttributes course = coursesLogic.getCourse(session.getCourseId()); String template = EmailTemplates.USER_FEEDBACK_SESSION.replace("${status}", FEEDBACK_STATUS_SESSION_OPEN); String additionalContactInformation = HTML_NO_ACTION_REQUIRED + getAdditionalContactInformationFragment(course); List<InstructorAttributes> instructorToNotifyAsList = new ArrayList<>(); instructorToNotifyAsList.add(instructorToNotify); List<EmailWrapper> emails = generateFeedbackSessionEmailBasesForInstructorReminders(course, session, instructorsToRemind, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject()); emails.addAll(generateFeedbackSessionEmailBases(course, session, students, instructorToNotifyAsList, template, EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), FEEDBACK_ACTION_SUBMIT, additionalContactInformation)); return emails; }
Source:
<code>private static String deleteLineBreak(String postdata) { <START> String repl = ""; <END> if (postdata != null) { Matcher m = deleteLinePattern.matcher(postdata); repl = m.replaceAll(""); } return repl; }</code><technical_language>for returning results instead of a variable reassigning it</technical_language>

Target:
private static String deleteLineBreak(String postdata) { Matcher m = deleteLinePattern.matcher(postdata); return m.replaceAll(""); }
Source:
<code>protected void migrateComments(CoreSession session, RelationManager relationManager, CommentServiceConfig config, Statement statement) { Map<String, Object> ctxMap = Collections.singletonMap(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); QNameResourceImpl object = (QNameResourceImpl) statement.getObject(); DocumentModel parent = (DocumentModel) relationManager.getResourceRepresentation(config.documentNamespace, object, ctxMap); QNameResourceImpl subject = (QNameResourceImpl) statement.getSubject(); DocumentModel comment = (DocumentModel) relationManager.getResourceRepresentation(config.commentNamespace, subject, ctxMap); comment.setPropertyValue(COMMENT_PARENT_ID, parent.getId()); <START> comment.setPropertyValue(COMMENT_ANCESTOR_IDS, new ArrayList<>(Collections.singletonList(parent.getId()))); <END> session.saveDocument(comment); Graph graph = relationManager.getGraph(config.graphName, session); graph.remove(statement); }</code><technical_language>need handle replies case</technical_language>

Target:
protected void migrateComments(CoreSession session, RelationManager relationManager, CommentServiceConfig config, Statement statement) { Map<String, Object> ctxMap = Collections.singletonMap(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, session); QNameResourceImpl object = (QNameResourceImpl) statement.getObject(); DocumentModel parent = (DocumentModel) relationManager.getResourceRepresentation(config.documentNamespace, object, ctxMap); QNameResourceImpl subject = (QNameResourceImpl) statement.getSubject(); DocumentModel comment = (DocumentModel) relationManager.getResourceRepresentation(config.commentNamespace, subject, ctxMap); comment.setPropertyValue(COMMENT_PARENT_ID, parent.getId()); session.saveDocument(comment); Graph graph = relationManager.getGraph(config.graphName, session); graph.remove(statement); }
Source:
<code>public boolean onPrepareOptionsMenu(final Menu menu) { mSyncbutton = menu.findItem(R.id.syncbutton); <START> mAddPatientMenuItem = menu.findItem(R.id.actionAddPatients); <END> MenuItem logoutMenuItem = menu.findItem(R.id.actionLogout); if (logoutMenuItem != null) { logoutMenuItem.setTitle(getString(R.string.action_logout) + " " + mOpenMRS.getUsername()); } if(mSyncbutton !=null) { final Boolean syncState = NetworkUtils.isOnline(); if (mAddPatientMenuItem != null){ enableAddPatient(syncState); } setSyncButtonState(syncState); } return true; }</code><technical_language>bad behavior add mAddPatientMenuItem in this class. ACBaseActivity is intended handle behavior this solved some listener mAddPatientMenuItem mSyncbutton SyncedPatientsFragment - ACBaseActivity</technical_language>

Target:
public boolean onPrepareOptionsMenu(final Menu menu) { mSyncbutton = menu.findItem(R.id.syncbutton); MenuItem logoutMenuItem = menu.findItem(R.id.actionLogout); if (logoutMenuItem != null) { logoutMenuItem.setTitle(getString(R.string.action_logout) + " " + mOpenMRS.getUsername()); } if(mSyncbutton !=null) { final Boolean syncState = NetworkUtils.isOnline(); setSyncButtonState(syncState); } return true; }
Source:
<code>public Ds3Request toDs3Request() { <START> Ds3Request ds3request = new Ds3Request( <END> name, request.getHttpVerb(), classification, request.getBucketRequirement(), request.getObjectRequirement(), toDs3ResponseCodes(), toDs3Params(request.getOptionalQueryParams()), toDs3Params(request.getRequiredQueryParams())); return ds3request; }</code><technical_language>missing final</technical_language>

Target:
public Ds3Request toDs3Request() { final Ds3Request ds3request = new Ds3Request( name, request.getHttpVerb(), classification, request.getBucketRequirement(), request.getObjectRequirement(), toDs3ResponseCodes(), toDs3Params(request.getOptionalQueryParams()), toDs3Params(request.getRequiredQueryParams())); return ds3request; }
Source:
<code>public static void pushExportBuffer( int partitionId, String signature, long uso, long bufferPtr, ByteBuffer buffer, boolean sync) { if (bufferPtr != 0) DBBPool.registerUnsafeMemory(bufferPtr); ExportManager instance = instance(); try { ExportGeneration generation = instance.m_generation.get(); if (generation == null) { if (buffer != null) { DBBPool.wrapBB(buffer).discard(); } return; } generation.pushExportBuffer(partitionId, signature, uso, buffer, sync); } catch (Exception e) { exportLog.error("Error pushing export buffer", e); <START> } finally { <END> } }</code><technical_language>need for finally block</technical_language>

Target:
public static void pushExportBuffer( int partitionId, String signature, long uso, long bufferPtr, ByteBuffer buffer, boolean sync) { if (bufferPtr != 0) DBBPool.registerUnsafeMemory(bufferPtr); ExportManager instance = instance(); try { ExportGeneration generation = instance.m_generation.get(); if (generation == null) { if (buffer != null) { DBBPool.wrapBB(buffer).discard(); } return; } generation.pushExportBuffer(partitionId, signature, uso, buffer, sync); } catch (Exception e) { exportLog.error("Error pushing export buffer", e); } }
Source:
<code>protected RedirectAction retrieveRedirectAction(final WebContext context) { <START> return redirector.redirect(context); <END> }</code><technical_language>This is confusing a bit. A redirector redirect apparently. builds a RedirectAction, redirect. I opt for names here. A redirector sounds redirecting happening right</technical_language>

Target:
protected RedirectAction retrieveRedirectAction(final WebContext context) throws RequiresHttpAction { return redirectActionBuilder.redirect(context); }
Source:
<code>public ImageTemplate buildImageTemplateFromNode(String name, String id) { <START> name = name.toLowerCase(); <END> return new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build(); }</code><technical_language>assume immutable parameters. modify references input variable</technical_language>

Target:
public ImageTemplate buildImageTemplateFromNode(String name, String id) { String imageName = name.toLowerCase(); return new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(imageName).build(); }
Source:
<code>public void testGetFromChangeId() throws Exception { ITask task = createAndSynchronizeQuery(true); AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(repository.getConnectorKind()); GerritClient client = ((GerritConnector) connector).getClient(repository); <START> Project.NameKey project = client.getChange(task.getTaskId(), null).getChangeDetail().getChange().getProject(); <END> if (GerritVersion.isVersion28OrLater(client.getVersion())) { ((GerritClient28) client).clearCachedBranches(project); assertNull(client.getCachedBranches(project)); } TaskData taskData = connector.getTaskData(repository, task.getTaskId(), new NullProgressMonitor()); assertEquals(task.getTaskId(), taskData.getTaskId()); if (GerritVersion.isVersion28OrLater(client.getVersion())) { assertNotNull(client.getCachedBranches(project)); } TaskAttribute changeIdAttribute = taskData.getRoot().getAttribute( GerritTaskSchema.getDefault().CHANGE_ID.getKey()); assertNotNull(changeIdAttribute); assertThat(task.getTaskId(), not(equalTo(changeIdAttribute.getValue()))); TaskData taskDataFromChangeId = connector.getTaskData(repository, changeIdAttribute.getValue(), new NullProgressMonitor()); assertEquals(task.getTaskId(), taskDataFromChangeId.getTaskId()); assertEquals(taskData.getRoot().toString(), taskDataFromChangeId.getRoot().toString()); }</code><technical_language>get project task data? mapped TaskAttribute.PRODUCT</technical_language>

Target:
public void testGetFromChangeId() throws Exception { ITask task = createAndSynchronizeQuery(true); AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(repository.getConnectorKind()); GerritClient client = ((GerritConnector) connector).getClient(repository); Project.NameKey project = new Project.NameKey(taskDataManager.getTaskData(task) .getRoot() .getMappedAttribute(TaskAttribute.PRODUCT) .getValue()); if (GerritVersion.isVersion28OrLater(client.getVersion())) { ((GerritClient28) client).clearCachedBranches(project); assertNull(client.getCachedBranches(project)); } TaskData taskData = connector.getTaskData(repository, task.getTaskId(), new NullProgressMonitor()); assertEquals(task.getTaskId(), taskData.getTaskId()); if (GerritVersion.isVersion28OrLater(client.getVersion())) { assertNotNull(client.getCachedBranches(project)); } TaskAttribute changeIdAttribute = taskData.getRoot().getAttribute( GerritTaskSchema.getDefault().CHANGE_ID.getKey()); assertNotNull(changeIdAttribute); assertThat(task.getTaskId(), not(equalTo(changeIdAttribute.getValue()))); TaskData taskDataFromChangeId = connector.getTaskData(repository, changeIdAttribute.getValue(), new NullProgressMonitor()); assertEquals(task.getTaskId(), taskDataFromChangeId.getTaskId()); assertEquals(taskData.getRoot().toString(), taskDataFromChangeId.getRoot().toString()); }
Source:
<code>public void testPinning() { assertThat(OperationCode.PUT.shouldBePinned(), is(false)); <START> for (OperationCode operationCode : OperationCode.values()) { <END> if (OperationCode.PUT != operationCode) { assertThat(operationCode.shouldBePinned(), is(true)); } } }</code><technical_language>stream().filter() ;-) test getDecode well</technical_language>

Target:
public void testPinning() { assertThat(OperationCode.PUT.shouldBePinned(), is(false)); Arrays.stream(OperationCode.values()) .filter(operationCode -> operationCode != OperationCode.PUT) .forEach((operationCode -> assertThat(operationCode + " must be pinned", operationCode.shouldBePinned(), is(true)))); }
Source:
<code>private void loadAllCertificates() { Path certPath = securityConfig.getCertificateLocation(); if (Files.exists(certPath) && Files.isDirectory(certPath) && certPath.toFile().listFiles() != null) { getLogger().info("Loading certificate from location:{}.", certPath); <START> for (File file : certPath.toFile().listFiles()) { <END> if (file.isFile()) { CertificateCodec certificateCodec = new CertificateCodec(securityConfig); try { X509CertificateHolder x509CertificateHolder = certificateCodec .readCertificate(certPath, file.getName()); X509Certificate cert = CertificateCodec.getX509Certificate(x509CertificateHolder); certificateMap.putIfAbsent(cert.getSerialNumber().toString(), cert); getLogger().info("Added certificate from file:{}.", file.getAbsolutePath()); } catch (java.security.cert.CertificateException | IOException e) { getLogger().error("Error reading certificate.", e); } } } } }</code><technical_language>issues here: 1. 2nd listFIles() call avoided line: 113. 2. This load local cert downloaded scm saved subdirectories (certSerialID)</technical_language>

Target:
private void loadAllCertificates() { Path certPath = securityConfig.getCertificateLocation(); if (Files.exists(certPath) && Files.isDirectory(certPath)) { getLogger().info("Loading certificate from location:{}.", certPath); File[] certFiles = certPath.toFile().listFiles(); if (certFiles != null) { CertificateCodec certificateCodec = new CertificateCodec(securityConfig); for (File file : certFiles) { if (file.isFile()) { try { X509CertificateHolder x509CertificateHolder = certificateCodec .readCertificate(certPath, file.getName()); X509Certificate cert = CertificateCodec.getX509Certificate(x509CertificateHolder); certificateMap.putIfAbsent(cert.getSerialNumber().toString(), cert); getLogger().info("Added certificate from file:{}.", file.getAbsolutePath()); } catch (java.security.cert.CertificateException | IOException e) { getLogger().error("Error reading certificate from file:{}.", file.getAbsolutePath(), e); } } } } } }
Source:
<code>public void transactionCancelledTest() { String label = "testwork"; Model model = job.getWritableModel(); Bag depBag = model.createBag(depositPid.getRepositoryPath()); PID workPid = repository.mintContentPid(); Bag workBag = model.createBag(workPid.getRepositoryPath()); <START> workBag.addProperty(RDF.type, Cdr.FileObject); <END> workBag.addProperty(CdrDeposit.label, label); PID mainPid = addFileObject(workBag, FILE1_LOC, FILE1_MIMETYPE, FILE1_SHA1); depBag.add(workBag); workBag.asResource().addProperty(Cdr.primaryObject, model.getResource(mainPid.getRepositoryPath())); job.closeModel(); job.run(); }</code><technical_language>I this type Cdr.WorkObject instead of FileObject</technical_language>

Target:
public void transactionCancelledTest() { String label = "testwork"; Model model = job.getWritableModel(); Bag depBag = model.createBag(depositPid.getRepositoryPath()); PID workPid = repository.mintContentPid(); Bag workBag = model.createBag(workPid.getRepositoryPath()); workBag.addProperty(RDF.type, Cdr.FileObject); workBag.addProperty(CdrDeposit.label, label); PID mainPid = addFileObject(workBag, FILE1_LOC, FILE1_MIMETYPE, FILE1_SHA1); depBag.add(workBag); workBag.asResource().addProperty(Cdr.primaryObject, model.getResource(mainPid.getRepositoryPath())); job.closeModel(); try { job.run(); } finally { assertFalse(FedoraTransaction.hasTxId()); assertFalse(FedoraTransaction.isStillAlive()); assertFalse(repository.objectExists(workPid)); } }
Source:
<code>private static AbbreviatedObjectId id(DiffEntry de) { <START> return (de.changeType == ChangeType.DELETE ? de.oldId : de.newId); <END> }</code><technical_language>Style-nit: put () ?: in a return</technical_language>

Target:
private static AbbreviatedObjectId id(DiffEntry de) { return de.changeType == ChangeType.DELETE ? de.oldId : de.newId; }
Source:
<code>private void exceptionHandler(Exception exception) { <START> if (exception.getClass().getName().equals("org.jabref.logic.importer.FetcherException")) { <END> if (exception.getMessage().equals("A network error occurred")) { dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), Localization.lang(exception.getMessage() + ". You have no rights to access resources")); } } else { dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), Localization.lang(exception.getMessage())); } }</code><technical_language>exception instanceof FetcherException</technical_language>

Target:
private void exceptionHandler(Exception exception) { if (exception instanceof FetcherException) { if (exception.getMessage().equals("A network error occurred")) { dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), Localization.lang(exception.getMessage() + ". You have no rights to access resources.")); } } else { dialogService.showWarningDialogAndWait(Localization.lang("An error occurred"), Localization.lang(exception.getMessage())); } }
Source:
<code>private Optional<Long> getStartForFailuresInBuckets( long now, List<Long> recentFailures, long bucketSizeMillis, int numBuckets, double percentThreshold, int minBucketIndexPercent ) { long thresholdFailTimeMillis = now - (bucketSizeMillis * numBuckets); <START> long[] bucketThresholds = new long[numBuckets]; <END> for (int i = 0; i < numBuckets; i++) { bucketThresholds[i] = thresholdFailTimeMillis + i * bucketSizeMillis; } int bucketsWithFailure = 0; int maxBucketIndex = -1; for (int i = 0; i < bucketThresholds.length; i++) { for (long t : recentFailures) { if ( t > bucketThresholds[i] && (i == bucketThresholds.length - 1 || t <= bucketThresholds[i + 1]) ) { bucketsWithFailure++; maxBucketIndex = i; break; } } } if ((double) bucketsWithFailure / numBuckets > percentThreshold) { boolean failuresAreRecentEnough = maxBucketIndex >= 0 && maxBucketIndex * 100 / numBuckets > minBucketIndexPercent; if (failuresAreRecentEnough) { return recentFailures.stream().min(Comparator.comparingLong(Long::longValue)); } } return Optional.empty(); }</code><technical_language>array a List, OOC</technical_language>

Target:
private Optional<Long> getStartForFailuresInBuckets( long now, List<Long> recentFailures, long bucketSizeMillis, int numBuckets, double percentThreshold, int minBucketIndexPercent ) { long thresholdFailTimeMillis = now - (bucketSizeMillis * numBuckets); List<Long> bucketThresholds = IntStream .range(0, numBuckets - 1) .mapToLong(i -> thresholdFailTimeMillis + i * bucketSizeMillis) .collect(ArrayList::new, ArrayList::add, ArrayList::addAll); int bucketsWithFailure = 0; int maxBucketIndex = -1; for (int i = 0; i < bucketThresholds.size(); i++) { for (long t : recentFailures) { if ( t > bucketThresholds.get(i) && (i == bucketThresholds.size() - 1 || t <= bucketThresholds.get(i + 1)) ) { bucketsWithFailure++; maxBucketIndex = i; break; } } } if ((double) bucketsWithFailure / numBuckets > percentThreshold) { boolean failuresAreRecentEnough = maxBucketIndex >= 0 && maxBucketIndex * 100 / numBuckets > minBucketIndexPercent; if (failuresAreRecentEnough) { return recentFailures.stream().min(Comparator.comparingLong(Long::longValue)); } } return Optional.empty(); }
Source:
<code><START> public BoldStylerProvider <END> getBoldStylerProvider() { return fBoldStylerProvider; }</code><technical_language>Remove this, package visible only</technical_language>

Target:
BoldStylerProvider getBoldStylerProvider() { return fBoldStylerProvider; }
Source:
<code>public PhysicalDevice getPhysicalDevice() { <START> return physicalDevice; <END> }</code><technical_language>add "this" qualifier</technical_language>

Target:
public PhysicalDevice getPhysicalDevice() { return this.physicalDevice; }
Source:
<code><START> private boolean maybeOverridePartitionDiscovery(String key, String value, boolean override) { <END> boolean overridden = false; String userValue = props.getProperty(key); if (override) { LOG.warn( String.format( "Property %s is provided but will be overridden from %s to %s", key, userValue, value)); props.setProperty(key, value); overridden = true; } else { if (userValue != null) { } else { props.setProperty(key, KafkaSourceOptions.PARTITION_DISCOVERY_INTERVAL_MS .defaultValue() .toString()); } } return overridden; }</code><technical_language>override->isBounded more readable</technical_language>

Target:
private boolean maybeOverridePartitionDiscovery(String key, String value, boolean override) { boolean overridden = false; String userValue = props.getProperty(key); if (override) { props.setProperty(key, value); overridden = true; } else { if (userValue == null) { props.setProperty(key, KafkaSourceOptions.PARTITION_DISCOVERY_INTERVAL_MS .defaultValue() .toString()); } } return overridden; }
Source:
<code>private void printAllReferredServices(StringBuilder buf, boolean detail) { <START> boolean printHeader = true; <END> for (ConsumerModel consumer : ApplicationModel.allConsumerModels()) { if (printHeader) { buf.append("CONSUMER:\r\n"); printHeader = false; } buf.append(consumer.getServiceName()); if (detail) { buf.append(" -> "); buf.append(" addresses: "); buf.append(getConsumerAddressNum(consumer.getServiceName())); } } }</code><technical_language>done approach</technical_language>

Target:
private void printAllReferredServices(StringBuilder buf, boolean detail) { if (!ApplicationModel.allConsumerModels().isEmpty()) { buf.append("CONSUMER:\r\n"); } for (ConsumerModel consumer : ApplicationModel.allConsumerModels()) { buf.append(consumer.getServiceName()); if (detail) { buf.append(" -> "); buf.append(" addresses: "); buf.append(getConsumerAddressNum(consumer.getServiceName())); } } }
Source:
<code>public void updateParticipant(Study study, Set<Roles> callerRoles, StudyParticipant participant) { checkNotNull(study); checkNotNull(callerRoles); checkNotNull(participant); Validate.entityThrowingException(new StudyParticipantValidator(externalIdService, study, false), participant); Account account = getAccountThrowingException(study, participant.getId()); account = accountDao.getAccount(AccountId.forId(study.getIdentifier(), account.getId())); if (account.getExternalId() == null) { account.setExternalId(participant.getExternalId()); } updateAccountAndRoles(study, callerRoles, account, participant); if (participant.getStatus() != null) { if (callerRoles.contains(Roles.ADMIN) || callerRoles.contains(Roles.WORKER)) { account.setStatus(participant.getStatus()); } } accountDao.updateAccount(account, false); <START> externalIdService.assignExternalId(study, account.getExternalId(), account.getHealthCode()); <END> }</code><technical_language>assign external ID if changes</technical_language>

Target:
public void updateParticipant(Study study, Set<Roles> callerRoles, StudyParticipant participant) { checkNotNull(study); checkNotNull(callerRoles); checkNotNull(participant); Validate.entityThrowingException(new StudyParticipantValidator(externalIdService, study, false), participant); Account account = getAccountThrowingException(study, participant.getId()); account = accountDao.getAccount(AccountId.forId(study.getIdentifier(), account.getId())); boolean assigningExternalId = (account.getExternalId() == null && participant.getExternalId() != null); if (assigningExternalId) { account.setExternalId(participant.getExternalId()); } updateAccountAndRoles(study, callerRoles, account, participant); if (participant.getStatus() != null) { if (callerRoles.contains(Roles.ADMIN) || callerRoles.contains(Roles.WORKER)) { account.setStatus(participant.getStatus()); } } accountDao.updateAccount(account, false); if (assigningExternalId) { externalIdService.assignExternalId(study, account.getExternalId(), account.getHealthCode()); } }
Source:
<code>public static List<CompressedDecklistInfo> decToDecklist(File decFile) { try { BufferedReader reader = new BufferedReader(new FileReader(decFile)); List<CompressedDecklistInfo> deckList = new ArrayList<>(); String line; while ((line = reader.readLine()) != null) { if (Character.isDigit(line.charAt(0)) || line.startsWith("SB:")) { boolean isSideboard = false; int numberOf; String cardName = null; String setName = null; if (line.startsWith("SB:")) { isSideboard = true; line = line.substring(3).trim(); } int firstSpace = line.indexOf(' '); numberOf = Integer.valueOf(line.substring(0, firstSpace).trim()); line = line.substring(firstSpace).trim(); int bracketIndex = line.indexOf('['); if (bracketIndex >= 0) { int endBracket = line.indexOf(']'); setName = line.substring(bracketIndex + 1, line.indexOf(']')); if (bracketIndex > 0) { cardName = line.substring(0, bracketIndex).trim(); } else { cardName = line.substring(endBracket + 1).trim(); } } } } return deckList; } catch (FileNotFoundException fnf) { <START> return null; END> } catch (IOException ioe) { return null; } }</code><technical_language>previously returning null a db error occurs, I hope is calling function handle a null return. worth double checking. If handles null, returning null is fine</technical_language>

Target:
public static List<CompressedDecklistInfo> decToDecklist(File decFile) { List<CompressedDecklistInfo> deckList = new ArrayList<>(); try { BufferedReader reader = new BufferedReader(new FileReader(decFile)); String line; while ((line = reader.readLine()) != null) { if (Character.isDigit(line.charAt(0)) || line.startsWith("SB:")) { boolean isSideboard = false; int numberOf; String cardName = null; String setName = null; if (line.startsWith("SB:")) { isSideboard = true; line = line.substring(3).trim(); } int firstSpace = line.indexOf(' '); numberOf = Integer.valueOf(line.substring(0, firstSpace).trim()); line = line.substring(firstSpace).trim(); int bracketIndex = line.indexOf('['); if (bracketIndex >= 0) { int endBracket = line.indexOf(']'); setName = line.substring(bracketIndex + 1, line.indexOf(']')); if (bracketIndex > 0) { cardName = line.substring(0, bracketIndex).trim(); } else { cardName = line.substring(endBracket + 1).trim(); } } try { deckList.add( new CompressedDecklistInfo( cardName, setName, false, numberOf, isSideboard ) ); } catch (InstantiationException ie) { } } } } catch (FileNotFoundException fnf) { return null; } catch (IOException ioe) { return null; } return deckList; }
Source:
<code>public UfsJournal(URI location, Master master, long quietPeriodMs, Supplier<Set<JournalSink>> journalSinks) { <START> this(location, master, master.getMasterContext().getUfsManager().getRoot().acquireUfsResource() <END> .get(), quietPeriodMs, journalSinks); }</code><technical_language>root UFS is journal UFS. If UfsManager already, a method for acquiring journal UFS (to journal conf, instead of root ufs conf). basically of journal UFS a mount point (separate other mount point), is for accessing journal UFS</technical_language>

Target:
public UfsJournal(URI location, Master master, long quietPeriodMs, Supplier<Set<JournalSink>> journalSinks) { this(location, master, master.getMasterContext().getUfsManager().getJournal() .acquireUfsResource() .get(), quietPeriodMs, journalSinks); }
Source:
<code>public void testCardResourceFields() throws HTTPError { Card card = createCreditableCard(); assertNotNull(card.address); assertNull(card.avs_postal_match); assertNull(card.avs_result); assertNull(card.avs_street_match); assertNotNull(card.bank_name); assertNotNull(card.can_credit); assertNotNull(card.can_debit); assertNotNull(card.category); assertNotNull(card.created_at); assertNull(card.cvv_match); assertNull(card.cvv_result); assertNotNull(card.expiration_month); assertNotNull(card.expiration_year); assertNotNull(card.fingerprint); assertNotNull(card.href); assertNotNull(card.id); assertNotNull(card.is_verified); assertNotNull(card.meta); assertNotNull(card.name); assertNotNull(card.number); assertNotNull(card.type); assertNotNull(card.updated_at); assertNotNull(card.card_holds); assertNull(card.customer); assertNotNull(card.debits); assertNotNull(card.disputes); <START> assertNotNull(card.credits); <END> }</code><technical_language>Assert applicable field values match supplied in createCreditableCard()</technical_language>

Target:
public void testCardResourceFields() throws HTTPError { Card card = createCreditableCard(); Map<String, String> meta = new HashMap<String, String>(); meta.put("facebook", "0192837465"); card.meta = meta; card.save(); Map<String, Object> payload = personCustomerPayload(); Customer customer = new Customer(payload); customer.save(); card.associateToCustomer(customer); assertEquals(card.address.toString(), "{city=null, line2=null, " + "line1=null, state=null, postal_code=null, country_code=null}"); assertNull(card.avs_postal_match); assertNull(card.avs_result); assertNull(card.avs_street_match); assertEquals(card.bank_name, "WELLS FARGO BANK, N.A."); assertTrue(card.can_credit); assertTrue(card.can_debit); assertEquals(card.category, "other"); assertNotNull(card.created_at); assertNull(card.cvv_match); assertNull(card.cvv_result); assertEquals(card.expiration_month.intValue(), 5); assertEquals(card.expiration_year.intValue(), 2016); assertNotNull(card.fingerprint); assertTrue(card.href.contains("/cards/CC")); assertTrue(card.id.contains("CC")); assertTrue(card.is_verified); assertEquals(card.meta.get("facebook"), "0192837465"); assertEquals(card.name, "Johannes Bach"); assertEquals(card.number, "xxxxxxxxxxxx1118"); assertEquals(card.type, "debit"); assertNotNull(card.updated_at); assertEquals(card.customer.href, customer.href); assertTrue(card.disputes instanceof Dispute.Collection); assertTrue(card.card_holds instanceof CardHold.Collection); assertTrue(card.debits instanceof Debit.Collection); assertTrue(card.credits instanceof Credit.Collection); }
Source:
<code>private void applyRasterFunction(Raster raster) { RasterFunction rasterFunction = RasterFunction.fromJson(getString(R.string.hillshade_simplified)); RasterFunctionArguments rasterFunctionArguments = rasterFunction.getArguments(); List<String> rasterName = rasterFunctionArguments.getRasterNames(); rasterFunctionArguments.setRaster(rasterName.get(0), raster); raster = new Raster(rasterFunction); RasterLayer hillshadeLayer = new RasterLayer(raster); <START> map.getOperationalLayers().add(hillshadeLayer); <END> }</code><technical_language>mMapView.getMap().getOperationalLayers()..</technical_language>

Target:
private void applyRasterFunction(Raster raster) { RasterFunction rasterFuntionFromJson = RasterFunction.fromJson(getString(R.string.hillshade_simplified)); RasterFunctionArguments rasterFunctionArguments = rasterFuntionFromJson.getArguments(); List<String> rasterNames = rasterFunctionArguments.getRasterNames(); rasterFunctionArguments.setRaster(rasterNames.get(0), raster); raster = new Raster(rasterFuntionFromJson); RasterLayer hillshadeLayer = new RasterLayer(raster); mMapView.getMap().getOperationalLayers().add(hillshadeLayer); }
Source:
<code>public ApiResponse handleApiView(String name, JSONObject params) throws ApiException { ApiResponse result; String contextId = null; switch (name) { case VIEW_GET_SCAN_PROGRESS: LOGGER.debug("Access control get scan progress called"); <START> contextId = params.getString(PARAM_CONTEXT_ID); <END> result = new ApiResponseElement( name, String.valueOf( extension.getScanProgress(Integer.parseInt(contextId)))); break; case VIEW_GET_SCAN_STATUS: LOGGER.debug("Access control get scan status called"); contextId = params.getString(PARAM_CONTEXT_ID); result = new ApiResponseElement( name, extension.getScanStatus(Integer.parseInt(contextId))); break; default: throw new ApiException(ApiException.Type.BAD_ACTION); } return result; }</code><technical_language>ApiUtils.getIntParam</technical_language>

Target:
public ApiResponse handleApiView(String name, JSONObject params) throws ApiException { ApiResponse result; int contextId; switch (name) { case VIEW_GET_SCAN_PROGRESS: LOGGER.debug("Access control get scan progress called"); contextId = ApiUtils.getContextByParamId(params, PARAM_CONTEXT_ID).getIndex(); String scanStatus; try { scanStatus = String.valueOf(extension.getScanProgress(contextId)); } catch (IllegalStateException ise) { throw new ApiException( ApiException.Type.DOES_NOT_EXIST, "Failed to obtain scan progress for contextId: " + contextId); } result = new ApiResponseElement(name, scanStatus); break; case VIEW_GET_SCAN_STATUS: LOGGER.debug("Access control get scan status called"); contextId = ApiUtils.getContextByParamId(params, PARAM_CONTEXT_ID).getIndex(); result = new ApiResponseElement(name, extension.getScanStatus(contextId)); break; default: throw new ApiException(ApiException.Type.BAD_VIEW); } return result; }
Source:
<code>public GrpcBackedQueryMessage(QueryRequest queryRequest, Serializer messageSerializer, Serializer serializer) { <START> this.query = queryRequest; <END> this.serializedPayload = new LazyDeserializingObject<>(new GrpcSerializedObject(queryRequest.getPayload()), messageSerializer); this.serializedResponseType = new LazyDeserializingObject<>(new GrpcSerializedObject(queryRequest.getResponseType()), serializer); this.metaDataSupplier = new GrpcMetaData(queryRequest.getMetaDataMap(), messageSerializer); }</code><technical_language>invoke private constructor</technical_language>

Target:
public GrpcBackedQueryMessage(QueryRequest queryRequest, Serializer messageSerializer, Serializer serializer) { this( queryRequest, new LazyDeserializingObject<>(new GrpcSerializedObject(queryRequest.getPayload()), messageSerializer), new LazyDeserializingObject<>(new GrpcSerializedObject(queryRequest.getResponseType()), serializer), new GrpcMetaData(queryRequest.getMetaDataMap(), messageSerializer) ); }
Source:
<code><START> protected void write(ByteBuffer bb, InetSocketAddress remoteAddress) throws IOException { <END> writeQueue.add(new WriteDataPair(remoteAddress, bb)); getSocketExecuter().startListening(this); }</code><technical_language>Is a concern point providing pressure here</technical_language>

Target:
protected void write(ByteBuffer bb, InetSocketAddress remoteAddress) throws IOException { writeQueue.add(new Pair<InetSocketAddress, ByteBuffer>(remoteAddress, bb)); getSocketExecuter().setUDPServerOperations(this, true); }
Source:
<code>public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { <START> <END> public boolean execute() { moveProductsUpward(); return isTimerOn; } }, 6000); }</code><technical_language>rm 99</technical_language>

Target:
public void startTimer() { isTimerOn = true; Scheduler.get().scheduleFixedPeriod(new Scheduler.RepeatingCommand() { public boolean execute() { moveProductsUpward(); return isTimerOn; } }, timerTopDownPeriod); }
Source:
<code><START> public List<ComponentDto> selectComponentKeysHavingIssuesToMerge(DbSession dbSession, String mergeBranchUuid) { <END> return mapper(dbSession).selectComponentKeysHavingIssuesToMerge(mergeBranchUuid); }</code><technical_language>Yes, I do</technical_language>

Target:
public List<KeyWithUuidDto> selectComponentKeysHavingIssuesToMerge(DbSession dbSession, String mergeBranchUuid) { return mapper(dbSession).selectComponentKeysHavingIssuesToMerge(mergeBranchUuid); }
Source:
<code>@Test public void noTypeAdapterForQualifiedPlatformType() { Moshi moshi = new Moshi.Builder().build(); Field uppercaseStringField; try { uppercaseStringField = MoshiTest.class.getDeclaredField("uppercaseString"); <START> } catch (NoSuchFieldException e) { <END> throw new AssertionError(e); } try { moshi.adapter(uppercaseStringField.getGenericType(), Util.jsonAnnotations(uppercaseStringField)); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("No JsonAdapter for class java.lang.String " + "annotated [@com.squareup.moshi.MoshiTest$Uppercase()]"); } }</code><technical_language>declare test throws Exception</technical_language>

Target:
@Test public void noTypeAdapterForQualifiedPlatformType() throws Exception { Moshi moshi = new Moshi.Builder().build(); Field uppercaseStringField = MoshiTest.class.getDeclaredField("uppercaseString"); try { moshi.adapter(uppercaseStringField.getGenericType(), Util.jsonAnnotations(uppercaseStringField)); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("No JsonAdapter for class java.lang.String " + "annotated [@com.squareup.moshi.MoshiTest$Uppercase()]"); } }
Source:
<code>public boolean isReferenceTo(PsiElement element) { if (!(element instanceof HaxeFile)) { final HaxeReference[] references = PsiTreeUtil.getChildrenOfType(this, HaxeReference.class); final boolean chain = references != null && references.length == 2; if (chain) return false; } final PsiElement resolve = element instanceof HaxeComponentName ? resolveToComponentName() : resolve(); boolean b = resolve instanceof HaxeNamedComponent; boolean b1 = (resolve instanceof HaxeComponentName || b) && resolve.getParent() instanceof HaxeClass; if (element instanceof HaxeFile && <START> (b1 || resolve instanceof AbstractHaxePsiClass) ) { <END> return element == resolve.getContainingFile(); } return resolve == element; }</code><technical_language>element a name, resolve actual entity -- name (via call resolve() resolveToParent()). will, said, a component name get line, test fails. answer test more complex, simplify to: if (element instanceof HaxeFile && resolve instanceof HaxeClass) This tests pass. In case of resolving a HaxeFunctionDeclarationWithAttributes, is a function so, reference equated a file, a class is. This brings question moving files named class is. (In Java this allowed, in Haxe is.)</technical_language>

Target:
public boolean isReferenceTo(PsiElement element) { if (!(element instanceof HaxeFile)) { final HaxeReference[] references = PsiTreeUtil.getChildrenOfType(this, HaxeReference.class); final boolean chain = references != null && references.length == 2; if (chain) return false; } final PsiElement resolve = element instanceof HaxeComponentName ? resolveToComponentName() : resolve(); if (element instanceof HaxeFile && resolve instanceof HaxeClass) { return element == resolve.getContainingFile(); } return resolve == element; }
Source:
<code>public CapabilityResource parse(ConfigResource parent, IdString id) throws ResourceNotFoundException, Exception { <START> return null; <END> }</code><technical_language>return null, throw instead</technical_language>

Target:
public CapabilityResource parse(ConfigResource parent, IdString id) throws ResourceNotFoundException { throw new ResourceNotFoundException(id); }
Source:
<code>public final <T> PojoModelElementAccessor<T> createAccessor(Class<T> requestedType) { if ( !isAssignableTo( requestedType ) ) { <START> log.incompatibleRequestedType( createAccessor(), requestedType ); <END> } return (PojoModelElementAccessor<T>) createAccessor(); }</code><technical_language>please improve this while it; I expect pass a path here, accessor itself. do this: log.incompatibleRequestedType( getModelPathTypeNode().toUnboundPath(), requestedType ); ... PojoModelPathFormatter format path</technical_language>

Target:
public final <T> PojoModelElementAccessor<T> createAccessor(Class<T> requestedType) { if ( !isAssignableTo( requestedType ) ) { log.incompatibleRequestedType( getModelPathTypeNode().toUnboundPath(), requestedType ); } return (PojoModelElementAccessor<T>) createAccessor(); }
Source:
<code>public static Set<@ClassGetName String> getClassnamesFromArgs(VisibilityPredicate visibility) { Set<@ClassGetName String> classnames = getClassNamesFromFile(classlist); for (Path jarFile : testjar) { classnames.addAll(getClassnamesFromJarFile(jarFile, visibility)); } for (String classname : testclass) { if (!Signatures.isClassGetName(classname)) { throw new RandoopUsageError( "Illegal argument --testclass=" + classname + ", should be a class name"); } classnames.add(classname); } for (Iterator<String> itor = classnames.iterator(); itor.hasNext(); ) { String classname = itor.next(); if (shouldOmitClass(classname)) { itor.remove(); break; <START> } <END> } return classnames; }</code><technical_language>I understand break; ? continue looping for rest of classnames</technical_language>

Target:
public static Set<@ClassGetName String> getClassnamesFromArgs(VisibilityPredicate visibility) { Set<@ClassGetName String> classnames = getClassNamesFromFile(classlist); for (Path jarFile : testjar) { classnames.addAll(getClassnamesFromJarFile(jarFile, visibility)); } for (String classname : testclass) { if (!Signatures.isClassGetName(classname)) { throw new RandoopUsageError( "Illegal argument --testclass=" + classname + ", should be a class name"); } classnames.add(classname); } for (Iterator<String> itor = classnames.iterator(); itor.hasNext(); ) { String classname = itor.next(); if (shouldOmitClass(classname)) { itor.remove(); } } return classnames; }
Source:
<code>public void validate() { super.validate(); <START> assertTrue(courseId != null, "Time zone should not be null"); <END> }</code><technical_language>This is time zone</technical_language>

Target:
public void validate() { super.validate(); assertTrue(courseId != null, "Course ID should not be null"); }
Source:
<code>public Maintainable toMaintenance() { <START> return null; <END> }</code><technical_language>throw UnsupportedOperationException for now</technical_language>

Target:
public Maintainable toMaintenance() { throw new UnsupportedOperationException("not yet implemented"); }
Source:
<code>public void validate(final UsernamePasswordCredentials credentials, final WebContext context) throws HttpAction { init(context); if (credentials == null || credentials.getPassword() == null || credentials.getUsername() == null) { throw new TechnicalException("Credentials are required"); } final String ticketGrantingTicketId = requestTicketGrantingTicket(credentials.getUsername(), credentials.getPassword(), context); if (Strings.isNullOrEmpty(ticketGrantingTicketId)) { <START> credentials.setUserProfile(null); <END> } else { final CasRestProfile profile = new CasRestProfile(ticketGrantingTicketId, credentials.getUsername()); credentials.setUserProfile(profile); } }</code><technical_language>This is necessary is null default</technical_language>

Target:
public void validate(final UsernamePasswordCredentials credentials, final WebContext context) throws HttpAction { init(context); if (credentials == null || credentials.getPassword() == null || credentials.getUsername() == null) { throw new TechnicalException("Credentials are required"); } final String ticketGrantingTicketId = requestTicketGrantingTicket(credentials.getUsername(), credentials.getPassword(), context); if (CommonHelper.isNotBlank(ticketGrantingTicketId)) { credentials.setUserProfile(new CasRestProfile(ticketGrantingTicketId, credentials.getUsername())); } }
Source:
<code>protected void onPreExecute() { <START> System.out.println("onPreExecute"); <END> Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Uploading SHR Data", Toast.LENGTH_SHORT).show(); }</code><technical_language>Logging standard output</technical_language>

Target:
protected void onPreExecute() { Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Uploading SHR Data", Toast.LENGTH_SHORT).show(); }
Source:
<code>public void setBaseGenerationPopulator(GenerationPopulator generator) { <START> this.baseGenerator = checkNotNull(generator); <END> if (this.baseGenerator instanceof IChunkProviderOverworld) { ((IChunkProviderOverworld) this.baseGenerator).setBiomeGenerator(this.biomeGenerator); } }</code><technical_language>remove param? useful encounter this exception (if do)</technical_language>

Target:
public void setBaseGenerationPopulator(GenerationPopulator generator) { this.baseGenerator = checkNotNull(generator, "generator"); if (this.baseGenerator instanceof IChunkProviderOverworld) { ((IChunkProviderOverworld) this.baseGenerator).setBiomeGenerator(this.biomeGenerator); } }
Source:
<code>public TopologyInfo getInfo(TopologySummary topologySummary) throws TException { <START> return client.getTopologyInfoByName(topologySummary.get_id()); <END> }</code><technical_language>This right</technical_language>

Target:
public TopologyInfo getInfo(TopologySummary topologySummary) throws TException { return client.getTopologyInfo(topologySummary.get_id()); }