auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException { PublisherService publisherService = publisherServiceFactory.createPublisher(getReactorProject(), getEnvironments()); try { List<DependencySeed> categoryIUs = new ArrayList<>(); List<RepositoryReference> categoryRepoRefs = new ArrayList<>(); for (Category category : getCategories()) { final File buildCategoryFile = prepareBuildCategory(category, getBuildDirectory()); Collection<DependencySeed> ius = publisherService.publishCategories(buildCategoryFile); categoryIUs.addAll(ius); <START> for (RepositoryRef repositoryRef : category.getRepositories()) { <END> categoryRepoRefs.add(new RepositoryReference(repositoryRef.getName(), repositoryRef.getLocation(), repositoryRef.isEnabled())); } TychoProjectUtils.getRepositoryLocations(getProject()).addAll(categoryRepoRefs); } return categoryIUs; } catch (FacadeException e) { throw new MojoExecutionException("Exception while publishing categories: " + e.getMessage(), e); } }</code><technical_language>I need here, publisherService.publishCategories() is more consume model pass categories right method get generated</technical_language>

Target:
protected Collection<DependencySeed> publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException { PublisherService publisherService = publisherServiceFactory.createPublisher(getReactorProject(), getEnvironments()); try { List<DependencySeed> categoryIUs = new ArrayList<>(); for (Category category : getCategories()) { final File buildCategoryFile = prepareBuildCategory(category, getBuildDirectory()); Collection<DependencySeed> ius = publisherService.publishCategories(buildCategoryFile); categoryIUs.addAll(ius); } return categoryIUs; } catch (FacadeException e) { throw new MojoExecutionException("Exception while publishing categories: " + e.getMessage(), e); } }
Source:
<code>private void initHeaders(final MultivaluedMap<String, String> mHeaders) { this.headers = new HashMap<>(); <START> mHeaders.keySet().forEach(key -> { <END> this.headers.put(key, mHeaders.get(key)); }); }</code><technical_language>This replaced with: headers.putAll(mHeaders);</technical_language>

Target:
private void initHeaders(final MultivaluedMap<String, String> mHeaders) { this.headers = new HashMap<String, List<String>>(); headers.putAll(mHeaders); }
Source:
<code>private String getDefaultUsername() { <START> int indexOfUserParameter = ArrayUtils.indexOf(commandLine.getArgs(), "--user"); <END> if (indexOfUserParameter >= 0 && indexOfUserParameter < commandLine.getArgs().length - 1) { return commandLine.getArgs()[indexOfUserParameter + 1]; } else { return Target.DEFAULT_USERNAME; } }</code><technical_language>Do intend pass username password commandline argument for xd-shellcommand? I working. I pass "--host xxxx" fails as: Sep 26, 2014 11:33:02 org.springframework.shell.core.SimpleParser commandNotFound WARNING: Command '--host localhost' (for assistance press TAB) this fails, I expect user sets username, password XD shell. If agree, get rid of getter methods for username/password</technical_language>

Target:
private String getDefaultUsername() { int indexOfUserParameter = ArrayUtils.indexOf(commandLine.getArgs(), "--username"); if (indexOfUserParameter >= 0 && indexOfUserParameter < commandLine.getArgs().length - 1) { return commandLine.getArgs()[indexOfUserParameter + 1]; } else { return Target.DEFAULT_USERNAME; } }
Source:
<code>private void receivedClientCertificate(final CertificateMessage message) throws HandshakeException { if (clientCertificate != null && (clientCertificate.getMessageSeq() == message.getMessageSeq())) { return; } clientCertificate = message; verifyCertificate(clientCertificate); <START> clientPublicKey = clientCertificate.getPublicKey(); <END> peerCertPath = clientCertificate.getCertificateChain(); if (clientAuthenticationRequired && clientPublicKey == null) { LOGGER.debug("Certificate validation failed: x509 could not be trusted!"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE, session.getPeer()); throw new HandshakeException("Client Certificate required!", alert); } handshakeMessages = ByteArrayUtils.concatenate(handshakeMessages, clientCertificate.getRawMessage()); }</code><technical_language>do verifyCertificate(clientCertificate); this new check</technical_language>

Target:
private void receivedClientCertificate(final CertificateMessage message) throws HandshakeException { if (clientCertificate != null && (clientCertificate.getMessageSeq() == message.getMessageSeq())) { return; } clientCertificate = message; if (clientAuthenticationRequired && clientCertificate.getCertificateChain() != null && clientCertificate.getPublicKey() == null) { LOGGER.debug("Client authentication failed: missing certificate!"); AlertMessage alert = new AlertMessage(AlertLevel.FATAL, AlertDescription.HANDSHAKE_FAILURE, session.getPeer()); throw new HandshakeException("Client Certificate required!", alert); } verifyCertificate(clientCertificate); clientPublicKey = clientCertificate.getPublicKey(); handshakeMessages = ByteArrayUtils.concatenate(handshakeMessages, clientCertificate.getRawMessage()); }
Source:
<code>public void testDateTimeBug3() { <START> final RDFDatatype XSDdateTime = TypeMapper.getInstance().getSafeTypeByName(XSD.dateTime.getURI()); <END> final String testLex = "-0001-02-03T04:05:06"; Node n = createLiteral(testLex, XSDdateTime); assertEquals("Got wrong XSDDateTime representation!", testLex, n.getLiteralValue().toString()); }</code><technical_language>More FYI else: is a constant XSDDatatype.XSDdateTime</technical_language>

Target:
public void testDateTimeBug3() { final String testLex = "-0001-02-03T04:05:06"; Node n = createLiteral(testLex, XSDDatatype.XSDdateTime); assertEquals("Got wrong XSDDateTime representation!", testLex, n.getLiteralValue().toString()); }
Source:
<code>public void processElement(ProcessContext context) throws Exception { KV<String, Iterable<Mutation>> element = context.element(); try (Table t = conn.getTable(TableName.valueOf(element.getKey()))) { List<Mutation> mutations = Lists.newArrayList(element.getValue()); LOG.trace("Persisting elements to table {}", mutations.size(), element.getKey()); Object results[] = new Object[mutations.size()]; t.batch(mutations, results); LOG.trace("Finished persisting elements to table {}", mutations.size(), element.getKey()); } catch (RetriesExhaustedWithDetailsException exception) { <START> logExceptions(context, exception); <END> retrowException(exception); } }</code><technical_language>do logExceptions() retrowException() together</technical_language>

Target:
public void processElement(ProcessContext context) throws Exception { KV<String, Iterable<Mutation>> element = context.element(); String tableName = element.getKey(); try (Table t = conn.getTable(TableName.valueOf(tableName))) { List<Mutation> mutations = Lists.newArrayList(element.getValue()); int mutationCount = mutations.size(); LOG.trace("Persisting elements to table {}.", mutationCount, tableName); t.batch(mutations, new Object[mutationCount]); LOG.trace("Finished persisting elements to table {}.", mutationCount, tableName); } catch (RetriesExhaustedWithDetailsException exception) { logExceptions(context, exception); retrowException(exception); } }
Source:
<code>public Class getColumnClass(int column) { if (column >= <START> StringResourceTableUtil.ConstantColumn.values().length) { <END> return StringResourceTableUtil.ConstantColumn.DEFAULT_VALUE.sampleData.getClass(); } else { return StringResourceTableUtil.ConstantColumn.values()[column].sampleData.getClass(); } }</code><technical_language>I this pattern repeated a lot. a static method in enum class returns constant count? This initialized once, I enum class' values() call create a copy of internal array for values() call, meaning single length lookup array copy. thinking enum Foo { FOO, BAR; static final int ourCount = values().length; public static final int getCount() { return ourCount; } }</technical_language>

Target:
public Class getColumnClass(int column) { if (column >= StringResourceTableUtil.ConstantColumn.COUNT) { return StringResourceTableUtil.ConstantColumn.DEFAULT_VALUE.sampleData.getClass(); } else { return StringResourceTableUtil.ConstantColumn.values()[column].sampleData.getClass(); } }
Source:
<code>public <T> void put(EntityId entityId, String family, String qualifier, long timestamp, T value) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot put cell to KijiTableWriter instance %s in state %s.", this, state); final KijiColumnName columnName = new KijiColumnName(family, qualifier); final WriterLayoutCapsule capsule = mWriterLayoutCapsule; final HBaseColumnName hbaseColumnName = capsule.getColumnNameTranslator().toHBaseColumnName(columnName); final KijiCellEncoder cellEncoder = capsule.getCellEncoderProvider().getEncoder(family, qualifier); final byte[] encoded = cellEncoder.encode(value); final PutRequest put = new PutRequest( <START> Bytes.toBytes(mTable.getName()), <END> entityId.getHBaseRowKey(), hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), encoded, timestamp); try { mHBClient.put(put).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }</code><technical_language>this work. Is this KijiManagedHBaseTableName? If needs of those. Also, turning table name a byte[] happen stored a field call #put need do it</technical_language>

Target:
public <T> void put(EntityId entityId, String family, String qualifier, long timestamp, T value) throws IOException { final State state = mState.get(); Preconditions.checkState(state == State.OPEN, "Cannot put cell to KijiTableWriter instance %s in state %s.", this, state); final KijiColumnName columnName = new KijiColumnName(family, qualifier); final WriterLayoutCapsule capsule = mWriterLayoutCapsule; final HBaseColumnName hbaseColumnName = capsule.getColumnNameTranslator().toHBaseColumnName(columnName); final KijiCellEncoder cellEncoder = capsule.getCellEncoderProvider().getEncoder(family, qualifier); final byte[] encoded = cellEncoder.encode(value); final PutRequest put = new PutRequest( mTableName, entityId.getHBaseRowKey(), hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), encoded, timestamp); try { mHBClient.put(put).join(); } catch (Exception e) { ZooKeeperUtils.wrapAndRethrow(e); } }
Source:
<code>public static String toProject(final Project.NameKey proj, Status status) { switch (status) { case ABANDONED: return "project,abandoned," + proj.toString() + ",n,z"; case MERGED: return "project,merged," + proj.toString() + ",n,z"; <START> default: <END> return "project,open," + proj.toString() + ",n,z"; } }</code><technical_language>Please write this as: case NEW: case SUBMITTED: default: more clear NEW SUBMITTED cases meant open view</technical_language>

Target:
public static String toProject(final Project.NameKey proj, Status status) { switch (status) { case ABANDONED: return "project,abandoned," + proj.toString() + ",n,z"; case MERGED: return "project,merged," + proj.toString() + ",n,z"; case NEW: case SUBMITTED: default: return "project,open," + proj.toString() + ",n,z"; } }
Source:
<code>public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext) { <START> return scheduleMessagesInternal(messages, scheduledEnqueueTime, transactionContext); <END> }</code><technical_language>need this internal method all. overload top call this method transaction context null</technical_language>

Target:
public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext) { if (Objects.isNull(messages)) { return fluxError(logger, new NullPointerException("'messages' cannot be null.")); } if (Objects.isNull(scheduledEnqueueTime)) { return fluxError(logger, new NullPointerException("'scheduledEnqueueTime' cannot be null.")); } return createBatch().flatMapMany(messageBatch -> { messages.forEach(message -> messageBatch.tryAdd(message)); return getSendLink().flatMapMany(link -> connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName, entityType)) .flatMapMany(managementNode -> managementNode.schedule(messageBatch.getMessages(), scheduledEnqueueTime, messageBatch.getMaxSizeInBytes(), link.getLinkName(), transactionContext))); }); }
Source:
<code>private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, <START> GLContext.getCapabilities().OpenGL20, <END> GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel, GLContext.getCapabilities().GL_ARB_shader_objects}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "OpenGL20", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel", "GL_ARB_shader_objects"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }</code><technical_language>In long run, consider linking some of (higher) requirements explicitly specific graphic options. a result, game cheap cards, fancy graphics options disabled</technical_language>

Target:
private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel, GLContext.getCapabilities().GL_ARB_shader_objects}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel", "GL_ARB_shader_objects"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }
Source:
<code>public MetaParams() { <START> this.metas = new MetaParam[]{}; <END> this.length = 0; }</code><technical_language>EMPTY_ARRAY good enough :)</technical_language>

Target:
public MetaParams() { this.metas = EMPTY_ARRAY; this.length = 0; }
Source:
<code>private ClusterState applyCreateIndexRequestWithV2Template(final ClusterState currentState, final CreateIndexClusterStateUpdateRequest request, final boolean silent, final String templateName, final BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception { <START> logger.debug("applying create index request using the composable template [{}]", templateName); <END> final Map<String, Object> mappings = resolveV2Mappings(request.mappings(), currentState, templateName, xContentRegistry); final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, MetadataIndexTemplateService.resolveSettings(currentState.metadata(), templateName), mappings, null, settings, indexScopedSettings); int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null); IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards); return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, mappings, indexService -> resolveAndValidateAliases(request.index(), request.aliases(), MetadataIndexTemplateService.resolveAliases(currentState.metadata(), templateName), currentState.metadata(), aliasValidator, xContentRegistry, indexService.newQueryShardContext(0, null, () -> 0L, null)), Collections.singletonList(templateName), metadataTransformer); }</code><technical_language>I drop "the" suggestion logger.debug("applying create index request composable template [{}]", templateName);</technical_language>

Target:
private ClusterState applyCreateIndexRequestWithV2Template(final ClusterState currentState, final CreateIndexClusterStateUpdateRequest request, final boolean silent, final String templateName, final BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception { logger.debug("applying create index request using composable template [{}]", templateName); final Map<String, Object> mappings = resolveV2Mappings(request.mappings(), currentState, templateName, xContentRegistry); final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, MetadataIndexTemplateService.resolveSettings(currentState.metadata(), templateName), mappings, null, settings, indexScopedSettings); int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null); IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards); return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, mappings, indexService -> resolveAndValidateAliases(request.index(), request.aliases(), MetadataIndexTemplateService.resolveAliases(currentState.metadata(), templateName), currentState.metadata(), aliasValidator, xContentRegistry, indexService.newQueryShardContext(0, null, () -> 0L, null)), Collections.singletonList(templateName), metadataTransformer); }
Source:
<code>public void verifyAnswerableForInstructor(FeedbackQuestionAttributes feedbackQuestionAttributes) { <START> verifyNotNull(feedbackQuestionAttributes, "feedback session's course ID"); <END> if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.INSTRUCTORS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.SELF) { throw new UnauthorizedAccessException("Feedback question is not answerable for instructors"); } }</code><technical_language>feedback session's ID -> feedback question</technical_language>

Target:
public void verifyAnswerableForInstructor(FeedbackQuestionAttributes feedbackQuestionAttributes) { verifyNotNull(feedbackQuestionAttributes, "feedback question"); if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.INSTRUCTORS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.SELF) { throw new UnauthorizedAccessException("Feedback question is not answerable for instructors"); } }
Source:
<code>public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); if (detail == null) { itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { <START> PatchSet patchSet = null; <END> PatchSetContent content = new PatchSetContent(patchSet, detail); return pull(parentObject, content, monitor); } return null; }</code><technical_language>pass null method? is this for clarity</technical_language>

Target:
public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); if (detail == null) { itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { PatchSetContent content = new PatchSetContent(null, detail); return pull(parentObject, content, monitor); } return null; }
Source:
<code><START> public void testEnumObjects() throws Exception { <END> PointerByReference peidlPTR = new PointerByReference(); int SHCONTF_FOLDERS = 0x20; int SHCONTF_NONFOLDERS = 0x40; boolean sawNames=false; WinNT.HRESULT hr = psfMyComputer.EnumObjects(null, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, peidlPTR); if (COMUtils.SUCCEEDED(hr)) { IEnumIDList peidl = IEnumIDList.Converter.PointerToIEnumIDList(peidlPTR); PointerByReference pidlItem = new PointerByReference(); while (peidl.Next(1, pidlItem, null).intValue() == COMUtils.S_OK) { PointerByReference sr = new PointerByReference(); hr = psfMyComputer.GetDisplayNameOf(pidlItem.getValue(), 0, sr); if (COMUtils.SUCCEEDED(hr)) { PointerByReference pszName = new PointerByReference(); hr = Shlwapi.INSTANCE.StrRetToStr(sr, pidlItem.getValue(), pszName); if (COMUtils.SUCCEEDED(hr)) { String wideString = pszName.getValue().getWideString(0); if (wideString != null && wideString.length() > 0) sawNames = true; Ole32.INSTANCE.CoTaskMemFree(pszName.getValue()); } Ole32.INSTANCE.CoTaskMemFree(sr.getValue()); } Ole32.INSTANCE.CoTaskMemFree(pidlItem.getValue()); } peidl.Release(); } assertTrue(sawNames); }</code><technical_language>tests needs assert something, aka fail if code is broken</technical_language>

Target:
public void testEnumObjects() throws Exception { PointerByReference peidlPTR = new PointerByReference(); int SHCONTF_FOLDERS = 0x20; int SHCONTF_NONFOLDERS = 0x40; boolean sawNames = false; WinNT.HRESULT hr = psfMyComputer.EnumObjects(null, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, peidlPTR); assertTrue(COMUtils.SUCCEEDED(hr)); IEnumIDList peidl = IEnumIDList.Converter.PointerToIEnumIDList(peidlPTR); PointerByReference pidlItem = new PointerByReference(); while (peidl.Next(1, pidlItem, null).intValue() == COMUtils.S_OK) { PointerByReference sr = new PointerByReference(); hr = psfMyComputer.GetDisplayNameOf(pidlItem.getValue(), 0, sr); assertTrue(COMUtils.SUCCEEDED(hr)); PointerByReference pszName = new PointerByReference(); hr = Shlwapi.INSTANCE.StrRetToStr(sr, pidlItem.getValue(), pszName); assertTrue(COMUtils.SUCCEEDED(hr)); String wideString = pszName.getValue().getWideString(0); if (wideString != null && wideString.length() > 0) sawNames = true; Ole32.INSTANCE.CoTaskMemFree(pszName.getValue()); Ole32.INSTANCE.CoTaskMemFree(pidlItem.getValue()); } peidl.Release(); assertTrue(sawNames); }
Source:
<code>public String[] search(QueryExpression query) throws ServerException { IndexSearcher luceneSearcher = null; try { searcherManager.maybeRefresh(); luceneSearcher = searcherManager.acquire(); Query luceneQuery = createLuceneQuery(query); ScoreDoc after = null; final int numSkipDocs = Math.max(0, query.getSkipCount()); if (numSkipDocs > 0) { after = skipScoreDocs(luceneSearcher, luceneQuery, numSkipDocs); } final int numDocs = query.getMaxItems() > 0 ? Math.min(query.getMaxItems(), RESULT_LIMIT) : RESULT_LIMIT; final TopDocs topDocs = luceneSearcher.searchAfter(after, luceneQuery, numDocs); final String[] result = new String[topDocs.scoreDocs.length]; for (int i = 0, length = result.length; i < length; i++) { result[i] = luceneSearcher.doc(topDocs.scoreDocs[i].doc).getField("path").stringValue(); } return result; } catch (IOException e) { throw new ServerException(e.getMessage(), e); } finally { try { <START> searcherManager.release(luceneSearcher); <END> } catch (IOException e) { LOG.error(e.getMessage()); } } }</code><technical_language>NPE thrown</technical_language>

Target:
public String[] search(QueryExpression query) throws ServerException { IndexSearcher luceneSearcher = null; try { searcherManager.maybeRefresh(); luceneSearcher = searcherManager.acquire(); Query luceneQuery = createLuceneQuery(query); ScoreDoc after = null; final int numSkipDocs = Math.max(0, query.getSkipCount()); if (numSkipDocs > 0) { after = skipScoreDocs(luceneSearcher, luceneQuery, numSkipDocs); } final int numDocs = query.getMaxItems() > 0 ? Math.min(query.getMaxItems(), RESULT_LIMIT) : RESULT_LIMIT; final TopDocs topDocs = luceneSearcher.searchAfter(after, luceneQuery, numDocs); final String[] result = new String[topDocs.scoreDocs.length]; for (int i = 0, length = result.length; i < length; i++) { result[i] = luceneSearcher.doc(topDocs.scoreDocs[i].doc).getField("path").stringValue(); } return result; } catch (IOException e) { throw new ServerException(e.getMessage(), e); } finally { try { if (luceneSearcher != null) { searcherManager.release(luceneSearcher); } } catch (IOException e) { LOG.error(e.getMessage()); } } }
Source:
<code>private String getContainersDescriptionForLogging() { StringBuilder sb = new StringBuilder(); <START> for (ContainerTemplate ct : getContainers()) { <END> sb.append("* ).append(ct.getName()).append( ").append(ct.getImage()); StringBuilder optional = new StringBuilder(); optionalField(optional, "resourceRequestCpu", ct.getResourceRequestCpu()); optionalField(optional, "resourceRequestMemory", ct.getResourceRequestMemory()); optionalField(optional, "resourceLimitCpu", ct.getResourceLimitCpu()); optionalField(optional, "resourceLimitMemory", ct.getResourceLimitMemory()); if (optional.length() > 0) { sb.append("(").append(optional).append(")"); } sb.append("\n"); } if (isShowRawYaml()) { for (String yaml : getYamls()) { sb.append("yaml:\n") .append(yaml) .append("\n"); } } return sb.toString(); }</code><technical_language>Is this related</technical_language>

Target:
private String getContainersDescriptionForLogging() { List<ContainerTemplate> containers = getContainers(); StringBuilder sb = new StringBuilder(); for (ContainerTemplate ct : containers) { sb.append("* ).append(ct.getName()).append( ").append(ct.getImage()); StringBuilder optional = new StringBuilder(); optionalField(optional, "resourceRequestCpu", ct.getResourceRequestCpu()); optionalField(optional, "resourceRequestMemory", ct.getResourceRequestMemory()); optionalField(optional, "resourceLimitCpu", ct.getResourceLimitCpu()); optionalField(optional, "resourceLimitMemory", ct.getResourceLimitMemory()); if (optional.length() > 0) { sb.append("(").append(optional).append(")"); } sb.append("\n"); } if (isShowRawYaml()) { for (String yaml : getYamls()) { sb.append("yaml:\n") .append(yaml) .append("\n"); } } return sb.toString(); }
Source:
<code>public boolean matches(CharSequence rawPassword, String encodedPassword) { if (rawPassword == null) { <START> throw new IllegalArgumentException("Raw password cannot be null"); <END> } if (encodedPassword == null || encodedPassword.length() == 0) { logger.warn("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }</code><technical_language>follow Spring Security conventions, please change Raw password match variable name of rawPassword</technical_language>

Target:
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (rawPassword == null) { throw new IllegalArgumentException("rawPassword cannot be null"); } if (encodedPassword == null || encodedPassword.length() == 0) { logger.warn("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
Source:
<code>public void changeDetail(final Change.Id id, final AsyncCallback<ChangeDetail> callback) { run(callback, new Action<ChangeDetail>() { public ChangeDetail run(final ReviewDb db) throws OrmException, Failure { final Account.Id me = Common.getAccountId(); final Change change = db.changes().get(id); if (change == null) { throw new Failure(new NoSuchEntityException()); } final PatchSet patch = db.patchSets().get(change.currentPatchSetId()); final Project proj = Common.getProjectCache().get(change.getDest().getParentKey()) <START> .getProject(); <END> if (patch == null || proj == null) { throw new Failure(new NoSuchEntityException()); } assertCanRead(change); final boolean anon; boolean canAbandon = false; if (me == null) { anon = true; } else { anon = canRead(null, change.getDest().getParentKey()); canAbandon = me.equals(change.getOwner()) || me.equals(patch.getUploader()) || Common.getGroupCache().isAdministrator(me) || Common.getGroupCache().isInGroup(me, proj.getOwnerGroupId()); } final ChangeDetail d = new ChangeDetail(); d.load(db, new AccountInfoCacheFactory(db), change, anon, canAbandon); return d; } }); }</code><technical_language>if project exist, get() returns null, NPE getProject() get null test line below. sadly, if want do this proj == null test, need store ProjectCache.Entry result, test for null, do getProject() obtain project entity</technical_language>

Target:
public void changeDetail(final Change.Id id, final AsyncCallback<ChangeDetail> callback) { run(callback, new Action<ChangeDetail>() { public ChangeDetail run(final ReviewDb db) throws OrmException, Failure { final Account.Id me = Common.getAccountId(); final Change change = db.changes().get(id); if (change == null) { throw new Failure(new NoSuchEntityException()); } final PatchSet patch = db.patchSets().get(change.currentPatchSetId()); final ProjectCache.Entry projEnt = Common.getProjectCache().get(change.getDest().getParentKey()); if (patch == null || projEnt == null) { throw new Failure(new NoSuchEntityException()); } final Project proj = projEnt.getProject(); assertCanRead(change); final boolean anon; boolean canAbandon = false; if (me == null) { anon = true; } else { anon = canRead(null, change.getDest().getParentKey()); canAbandon = me.equals(change.getOwner()) || me.equals(patch.getUploader()) || Common.getGroupCache().isAdministrator(me) || Common.getGroupCache().isInGroup(me, proj.getOwnerGroupId()); } final ChangeDetail d = new ChangeDetail(); d.load(db, new AccountInfoCacheFactory(db), change, anon, canAbandon); return d; } }); }
Source:
<code>void setUp() { <START> factory = shouldHaveSizeLessThan(newArrayList('a', 'b'), 4, 2); <END> }</code><technical_language>CharSequence instead of Object for actual's type</technical_language>

Target:
void setUp() { factory = shouldHaveSizeLessThan("ab", 4, 2); }
Source:
<code>public PortListOptions displayName(String displayName) { <START> return add("name", displayName); <END> }</code><technical_language>this stays "display_name", not</technical_language>

Target:
public PortListOptions displayName(String displayName) { return add("display_name", displayName); }
Source:
<code>protected boolean canDoAction() { <START> return getParameters().getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE; <END> }</code><technical_language>return a message canDoAction failure, "Cannot ${action} ${type}, this operation is supported for image disks"</technical_language>

Target:
protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE) { addCanDoActionMessage("$diskId " + getParameters().getDiskImage().getId()); addCanDoActionMessage("$storageType " + getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } else { return true; } }
Source:
<code>private LocalProc( String name, ProcessBuilder procBuilder, InputStream in, OutputStream out, OutputStream err ) throws IOException { Logger.getLogger(Proc.class.getName()).log(Level.FINE, "Running: {0}", name); this.name = name; this.out = out; this.cookie = EnvVars.createCookie(); procBuilder.environment().putAll(cookie); if (procBuilder.directory() != null && !procBuilder.directory().exists()) { <START> throw new IOException(String.format("Process working directory '%s' doesn't exists!", procBuilder.directory().getAbsolutePath())); <END> } this.proc = procBuilder.start(); InputStream procInputStream = proc.getInputStream(); if (out==SELFPUMP_OUTPUT) { stdout = procInputStream; copier = null; } else { copier = new StreamCopyThread(name+": stdout copier", procInputStream, out); copier.start(); stdout = null; } if (in == null) { stdin = null; proc.getOutputStream().close(); } else if (in==SELFPUMP_INPUT) { stdin = proc.getOutputStream(); } else { new StdinCopyThread(name+": stdin copier",in,proc.getOutputStream()).start(); stdin = null; } InputStream procErrorStream = proc.getErrorStream(); if(err!=null) { if (err==SELFPUMP_OUTPUT) { stderr = procErrorStream; copier2 = null; } else { stderr = null; copier2 = new StreamCopyThread(name+": stderr copier", procErrorStream, err); copier2.start(); } } else { if (procErrorStream!=procInputStream) { procErrorStream.close(); } copier2 = null; stderr = null; } }</code><technical_language>"doesn't exist!"</technical_language>

Target:
private LocalProc( String name, ProcessBuilder procBuilder, InputStream in, OutputStream out, OutputStream err ) throws IOException { Logger.getLogger(Proc.class.getName()).log(Level.FINE, "Running: {0}", name); this.name = name; this.out = out; this.cookie = EnvVars.createCookie(); procBuilder.environment().putAll(cookie); if (procBuilder.directory() != null && !procBuilder.directory().exists()) { throw new IOException(String.format("Process working directory '%s' doesn't exist!", procBuilder.directory().getAbsolutePath())); } this.proc = procBuilder.start(); InputStream procInputStream = proc.getInputStream(); if (out==SELFPUMP_OUTPUT) { stdout = procInputStream; copier = null; } else { copier = new StreamCopyThread(name+": stdout copier", procInputStream, out); copier.start(); stdout = null; } if (in == null) { stdin = null; proc.getOutputStream().close(); } else if (in==SELFPUMP_INPUT) { stdin = proc.getOutputStream(); } else { new StdinCopyThread(name+": stdin copier",in,proc.getOutputStream()).start(); stdin = null; } InputStream procErrorStream = proc.getErrorStream(); if(err!=null) { if (err==SELFPUMP_OUTPUT) { stderr = procErrorStream; copier2 = null; } else { stderr = null; copier2 = new StreamCopyThread(name+": stderr copier", procErrorStream, err); copier2.start(); } } else { if (procErrorStream!=procInputStream) { procErrorStream.close(); } copier2 = null; stderr = null; } }
Source:
<code>private void initFile() { String path = processingEnv.getOptions().get(DOC_OUTPUT_PROPERTY_NAME); if (path != null && path.trim().length() > 0) { file = new File(path); if (file.isDirectory()) { messager.printMessage(Diagnostic.Kind.WARNING, String.format("Specify a file path at %s to generate deep link doc.", DOC_OUTPUT_PROPERTY_NAME)); } else { final File parentDir = file.getParentFile(); if (!parentDir.exists() && !parentDir.mkdirs()) { messager.printMessage(Diagnostic.Kind.WARNING, String.format("Cannot create file specified at %s.", file)); } } } else { <START> messager.printMessage(Diagnostic.Kind.WARNING, <END> "DeepLink doc is not going to be generated."); } }</code><technical_language>I this INFO want generate doc lots of warnings</technical_language>

Target:
private void initFile() { String path = processingEnv.getOptions().get(DOC_OUTPUT_PROPERTY_NAME); if (path == null || path.trim().isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "Output path not specified, DeepLink doc is not going to be generated."); return; } file = new File(path); if (file.isDirectory()) { messager.printMessage(Diagnostic.Kind.NOTE, String.format("Specify a file path at %s to generate deep link doc.", DOC_OUTPUT_PROPERTY_NAME)); return; } File parentDir = file.getParentFile(); if (!parentDir.exists() && !parentDir.mkdirs()) { messager.printMessage(Diagnostic.Kind.NOTE, String.format("Cannot create file specified at %s.", file)); } }
Source:
<code>public BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws IOException { acquireLock(ledgerId); try { EntryLogAndLockTuple entryLogAndLockTuple = ledgerIdEntryLogMap.get(ledgerId); return entryLogAndLockTuple.getEntryLog(); } catch (Exception e) { <START> log.error("Received unexpected exception while fetching entry from map", e); <END> throw new IOException("Received unexpected exception while fetching entry from map", e); } finally { releaseLock(ledgerId); } }</code><technical_language>nit: add ledgerId log statement, is easier for troubleshooting</technical_language>

Target:
public BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws IOException { BufferedLogChannelWithDirInfo bufferedLogChannelWithDirInfo = getCurrentLogWithDirInfoForLedger(ledgerId); BufferedLogChannel bufferedLogChannel = null; if (bufferedLogChannelWithDirInfo != null) { bufferedLogChannel = bufferedLogChannelWithDirInfo.getLogChannel(); } return bufferedLogChannel; }
Source:
<code>static NotesMigration allEnabled() { Config cfg = new Config(); cfg.setBoolean("notedb", null, "write", true); <START> cfg.setBoolean("notedb", "patchSetApprovals", "read", true); <END> return new NotesMigration(cfg); }</code><technical_language>Changing this to: cfg.setBoolean("notedb", "patchSetApprovals", "read", false); tests fail</technical_language>

Target:
static NotesMigration allEnabled() { Config cfg = new Config(); cfg.setBoolean("notedb", null, "write", true); return new NotesMigration(cfg); }
Source:
<code>protected boolean addIgnoreNode(String directory) { File dir = new File(directory); <START> if (!dir.exists()) { <END> return false; } File ignoreFile = new File(directory + "/.gitignore"); if (!ignoreFile.exists()) { return false; } if (ignoreMap.get(directory) != null) { ignoreMap.get(directory).empty(); return true; } IgnoreNode n = new IgnoreNode(dir); ignoreMap.put(directory, n); return true; }</code><technical_language>style: braces for single line</technical_language>

Target:
protected boolean addIgnoreNode(String directory) { File dir = new File(directory); File ignoreFile = new File(directory + "/.gitignore"); if (!ignoreFile.exists()) { return false; } if (ignoreMap.get(directory) != null) { ignoreMap.get(directory).clear(); return true; } IgnoreNode n = new IgnoreNode(dir); ignoreMap.put(directory, n); return true; }
Source:
<code>private void processDeviceFileJobQueue(DatastoreService ds) throws InterruptedException { System.out.println("#Processing DeviceFileJobQueue"); final Filter f = new FilterPredicate("fileName", FilterOperator.LESS_THAN, "wfp"); <START> final Filter f2 = new FilterPredicate("fileName", FilterOperator.GREATER_THAN, "ff"); <END> final Query group_q = new Query("DeviceFileJobQueue"); final PreparedQuery pq = ds.prepare(group_q); for (Entity job : pq.asIterable(FetchOptions.Builder.withChunkSize(500))) { allDevicesJobs++; Long dfjId = job.getKey().getId(); String name = (String) job.getProperty("fileName"); if (name.endsWith("}")) { jsonDeviceJobs++; String name2 = name.substring(0,name.indexOf("\"")); System.out.println(name + " --> " + name2); job.setProperty("fileName", name2); fixupList.add(job); if (!doBatch) { ds.put(job); Thread.sleep(100); } else if (fixupList.size() > 99) { System.out.printf("#Fixing %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); fixupList.clear(); } } } if (doBatch) { System.out.printf("#Fixing final %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); } }</code><technical_language>filters remove them</technical_language>

Target:
private void processDeviceFileJobQueue(DatastoreService ds) throws InterruptedException { System.out.println("#Processing DeviceFileJobQueue"); final Query group_q = new Query("DeviceFileJobQueue"); final PreparedQuery pq = ds.prepare(group_q); for (Entity job : pq.asIterable(FetchOptions.Builder.withChunkSize(500))) { allDevicesJobs++; String name = (String) job.getProperty("fileName"); if (name.endsWith("}")) { jsonDeviceJobs++; String name2 = name.substring(0,name.indexOf("\"")); System.out.println(name + " --> " + name2); job.setProperty("fileName", name2); fixupList.add(job); if (!doBatch) { ds.put(job); Thread.sleep(100); } else if (fixupList.size() > 99) { System.out.printf("#Fixing %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); fixupList.clear(); } } } if (doBatch) { System.out.printf("#Fixing final %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); } }
Source:
<code>public void testTimestamp() { <START> assertNotNull(ToolTipString.fromTimestamp("", -1)); <END> }</code><technical_language>Test formatted time html link</technical_language>

Target:
public void testTimestamp() { ToolTipString ts0 = ToolTipString.fromTimestamp("", -1); ToolTipString ts1 = ToolTipString.fromTimestamp("bob", -1); ToolTipString ts2 = ToolTipString.fromTimestamp("", 1); ToolTipString ts3 = ToolTipString.fromTimestamp("bob", 1); assertEquals("", ts0.toString()); assertEquals("bob", ts1.toString()); assertEquals("", ts2.toString()); assertEquals("bob", ts3.toString()); assertEquals("<a href=time://-1></a>", ts0.toHtmlString()); assertEquals("<a href=time://-1>bob</a>", ts1.toHtmlString()); assertEquals("<a href=time://1></a>", ts2.toHtmlString()); assertEquals("<a href=time://1>bob</a>", ts3.toHtmlString()); }
Source:
<code>public Execution(ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, ExecutionStrategy subscriptionStrategy, Instrumentation instrumentation) { this.queryStrategy = queryStrategy != null ? queryStrategy : new AsyncExecutionStrategy(); <START> this.mutationStrategy = mutationStrategy != null ? mutationStrategy : new AsyncExecutionStrategy(); <END> this.subscriptionStrategy = subscriptionStrategy != null ? subscriptionStrategy : new AsyncExecutionStrategy(); this.instrumentation = instrumentation; }</code><technical_language>AsyncSerial again</technical_language>

Target:
public Execution(ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, ExecutionStrategy subscriptionStrategy, Instrumentation instrumentation) { this.queryStrategy = queryStrategy != null ? queryStrategy : new AsyncExecutionStrategy(); this.mutationStrategy = mutationStrategy != null ? mutationStrategy : new AsyncSerialExecutionStrategy(); this.subscriptionStrategy = subscriptionStrategy != null ? subscriptionStrategy : new AsyncExecutionStrategy(); this.instrumentation = instrumentation; }
Source:
<code>public boolean addAll(int index, Collection<? extends T> c) { Collection<T> uniqueValuesToAdd = getUniqueValues(c); if (uniqueValuesToAdd.isEmpty()) { return false; } try { return super.addAll(index, uniqueValuesToAdd); } catch (IndexOutOfBoundsException ioobException) { comparingSet.removeAll(uniqueValuesToAdd); <START> throw new IndexOutOfBoundsException(); <END> } }</code><technical_language>above: please pass original exception retain stacktrace message</technical_language>

Target:
public boolean addAll(int index, Collection<? extends T> c) { Collection<T> uniqueValuesToAdd = getUniqueValues(c); if (uniqueValuesToAdd.isEmpty()) { return false; } try { return super.addAll(index, uniqueValuesToAdd); } catch (IndexOutOfBoundsException ioobException) { comparingSet.removeAll(uniqueValuesToAdd); throw ioobException; } }
Source:
<code>public void stepEnded(LocalSearchStepScope stepScope) { super.stepEnded(stepScope); if (waterLevelIncrementScore != null) { currentWaterLevel = currentWaterLevel.subtract(waterLevelIncrementScore); } else { Score increment = currentWaterLevel.multiply(waterLevelIncrementRatio); currentWaterLevel = currentWaterLevel.subtract(increment); } <START> logger.debug(currentWaterLevel.toShortString()); <END> }</code><technical_language>@BorisKocian I this debug line needs away</technical_language>

Target:
public void stepEnded(LocalSearchStepScope stepScope) { super.stepEnded(stepScope); if (waterLevelIncrementScore != null) { currentWaterLevel = currentWaterLevel.subtract(waterLevelIncrementScore); } else { Score increment = currentWaterLevel.multiply(waterLevelIncrementRatio); currentWaterLevel = currentWaterLevel.subtract(increment); } }
Source:
<code>public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); <START> checkArgument(tableName.length() < 1025, "tableName is longer than 1024 characters"); <END> List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }</code><technical_language>nice place table length in a constant constant everywhere. put constant in ./core/src/main/java/org/apache/accumulo/core/Constants.java. name MAX_TABLE_NAME_LEN</technical_language>

Target:
public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); checkArgument(tableName.length() <= MAX_TABLE_NAME_LEN, "Table name is longer than " + MAX_TABLE_NAME_LEN + " characters"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }