auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean dbDelete(ContentType type) throws DotDataException { if (type.defaultType()) { throw new DotDataException("contenttype.delete.cannot.delete.default.type"); } if (type.system()) { throw new DotDataException("contenttype.delete.cannot.delete.system.type"); } <START> new FieldFactoryImpl().deleteByContentType(type); <END> updateFolderFileAssetReferences(type); APILocator.getContainerAPI().deleteContainerStructureByContentType(type); deleteContentletsByType(type); deleteWorkflowSchemeReference(type); APILocator.getPermissionAPI().removePermissions(type); deleteRelationships(type); DotConnect dc = new DotConnect(); dc.setSQL(this.contentTypeSql.DELETE_TYPE_BY_INODE).addParam(type.id()).loadResult(); dc.setSQL(this.contentTypeSql.DELETE_INODE_BY_INODE).addParam(type.id()).loadResult(); return true; }</code><technical_language>replace FactoryLocator.getFieldFactory()</technical_language>

Target:
private boolean dbDelete(ContentType type) throws DotDataException { if (type.defaultType()) { throw new DotDataException("contenttype.delete.cannot.delete.default.type"); } if (type.system()) { throw new DotDataException("contenttype.delete.cannot.delete.system.type"); } FactoryLocator.getFieldFactory().deleteByContentType(type); updateFolderFileAssetReferences(type); APILocator.getContainerAPI().deleteContainerStructureByContentType(type); deleteContentletsByType(type); deleteWorkflowSchemeReference(type); APILocator.getPermissionAPI().removePermissions(type); deleteRelationships(type); DotConnect dc = new DotConnect(); dc.setSQL(this.contentTypeSql.DELETE_TYPE_BY_INODE).addParam(type.id()).loadResult(); dc.setSQL(this.contentTypeSql.DELETE_INODE_BY_INODE).addParam(type.id()).loadResult(); return true; }
Source:
<code>public int concurrencyKey(EntityMessage entityMessage) { if (entityMessage instanceof ServerStoreOpMessage.GetMessage) { return UNIVERSAL_KEY; } else if (entityMessage instanceof ConcurrentEntityMessage) { ConcurrentEntityMessage concurrentEntityMessage = (ConcurrentEntityMessage) entityMessage; <START> return DATA_CONCURRENCY_KEY_OFFSET + Math.abs(concurrentEntityMessage.concurrencyKey() % bucketCount); <END> } else { return DEFAULT_KEY; } }</code><technical_language>exact logic in org.ehcache.clustered.server.offheap.OffHeapServerStore#segmentFor server code, I extract a method is responsible for it</technical_language>

Target:
public int concurrencyKey(EntityMessage entityMessage) { if (entityMessage instanceof ServerStoreOpMessage.GetMessage) { return UNIVERSAL_KEY; } else if (entityMessage instanceof ConcurrentEntityMessage) { ConcurrentEntityMessage concurrentEntityMessage = (ConcurrentEntityMessage) entityMessage; return DATA_CONCURRENCY_KEY_OFFSET + mapper.getSegmentForKey(concurrentEntityMessage.concurrencyKey()); } else { return DEFAULT_KEY; } }
Source:
<code>public void canMakeGetRequest() throws IOException { String url = "<LINK_0>"; String expectedResp; if (System.getenv("GOOGLE_CLOUD_PROJECT") != null) { expectedResp = "Id token query succeeded"; } else { expectedResp = "Id token query failed"; } Authentication.makeGetRequest(url); String got = bout.toString(); <START> assertThat(got, containsString(expectedResp)); <END> }</code><technical_language>This a good direction for integration test of metadata server is responding expected. However, tests variable expected behavior definition of a passing ambiguous. test log context metadata server existing</technical_language>

Target:
public void canMakeGetRequest() throws IOException { String url = "<LINK_0>"; Authentication.makeGetRequest(url); String got = bout.toString(); assertThat(got, containsString(expectedResp)); }
Source:
<code>public byte[] getCacheKey() { <START> return new CacheKeyBuilder(DimFilterUtils.SELECTOR_CACHE_ID) <END> .appendCacheablesIgnoringOrder(dimensions) .build(); }</code><technical_language>This filter a new cache id, DimFilterUtils.COLUMN_COMPARISON_CACHE_ID</technical_language>

Target:
public byte[] getCacheKey() { return new CacheKeyBuilder(DimFilterUtils.COLUMN_COMPARISON_CACHE_ID) .appendCacheablesIgnoringOrder(dimensions) .build(); }
Source:
<code>private String getSystemPassword() { String password = ""; if (StringUtils.isEmpty(this.hadoopSecurityCredentialPath)) { password = this.systemPassword; } else { try { Configuration configuration = new Configuration(); configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, this.hadoopSecurityCredentialPath); CredentialProvider provider = CredentialProviderFactory.getProviders(configuration).get(0); CredentialProvider.CredentialEntry credEntry = provider.getCredentialEntry( keystorePass); if (credEntry != null) { password = new String(credEntry.getCredential()); } } catch (Exception e) { <START> log.debug("ignored exception: " + e.getMessage()); <END> } } return password; }</code><technical_language>log.debug("", e);</technical_language>

Target:
private String getSystemPassword() { String password = ""; if (StringUtils.isEmpty(this.hadoopSecurityCredentialPath)) { password = this.systemPassword; } else { try { Configuration configuration = new Configuration(); configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, this.hadoopSecurityCredentialPath); CredentialProvider provider = CredentialProviderFactory.getProviders(configuration).get(0); CredentialProvider.CredentialEntry credEntry = provider.getCredentialEntry( keystorePass); if (credEntry != null) { password = new String(credEntry.getCredential()); } } catch (Exception e) { log.debug("ignored error from getting credential entry from keystore", e); } } return password; }
Source:
<code>public static void downloadStormYaml(StormMaster.Client client, String storm_yaml_output) { String conf_str = "Not Avaialble"; try { conf_str = client.getStormConf(); } catch (TTransportException ex) { <START> LOG.warn("Exception in downloading storm.yaml:"+ex.toString()); <END> } catch (TException e) { LOG.warn("Exception in downloading storm.yaml:"+e.toString()); } try { Object json = JSONValue.parse(conf_str); Map<?, ?> conf = (Map<?, ?>)json; Yaml yaml = new Yaml(); if (storm_yaml_output == null) { LOG.info("storm.yaml downloaded:"); System.out.println(yaml.dump(conf)); } else { FileWriter out = new FileWriter(storm_yaml_output); yaml.dump(conf, out); out.flush(); out.close(); LOG.info("storm.yaml downloaded into "+storm_yaml_output); } } catch (Exception ex) { LOG.error("Exception in storing storm.yaml. "+ ex.toString()); } }</code><technical_language>do ex.toString() put in a , ex get stack trace for debugging</technical_language>

Target:
public static void downloadStormYaml(StormMaster.Client client, String storm_yaml_output) { String conf_str = "Not Avaialble"; try { conf_str = client.getStormConf(); } catch (TTransportException ex) { LOG.error("Exception in downloading storm.yaml", ex); } catch (TException ex) { LOG.error("Exception in downloading storm.yaml", ex); } try { Object json = JSONValue.parse(conf_str); Map<?, ?> conf = (Map<?, ?>)json; Yaml yaml = new Yaml(); if (storm_yaml_output == null) { LOG.info("storm.yaml downloaded:"); System.out.println(yaml.dump(conf)); } else { FileWriter out = new FileWriter(storm_yaml_output); yaml.dump(conf, out); out.flush(); out.close(); LOG.info("storm.yaml downloaded into "+storm_yaml_output); } } catch (Exception ex) { LOG.error("Exception in storing storm.yaml. ", ex); } }
Source:
<code>private boolean isRedeployAfterRemoval(ModelNode operation) { <START> return operation.hasDefined(REMOVE) && operation.get(REMOVE).asBoolean(); <END> }</code><technical_language>I this is right. AIUI "remove" is a param operation model node, is of "operation" child node</technical_language>

Target:
private boolean isRedeployAfterRemoval(ModelNode operation) { return operation.hasDefined(DEPLOYMENT_OVERLAY_LINK_REMOVAL) && operation.get(DEPLOYMENT_OVERLAY_LINK_REMOVAL).asBoolean(); }
Source:
<code>public void initializeContinueButton(GameContainer container) { <START> mouseOverContinueButton = new MouseOverArea(container, null, <END> container.getWidth() - margin - typeFontPlayer.getWidth(gameContinueText), container.getHeight() - margin - typeFontPlayer.getHeight(), typeFontPlayer.getWidth(gameContinueText), typeFontPlayer.getHeight()); }</code><technical_language>This method private</technical_language>

Target:
private void initializeContinueButton(GameContainer container) { mouseOverContinueButton = new MouseOverArea(container, null, container.getWidth() - margin - typeFontPlayer.getWidth(gameContinueText), container.getHeight() - margin - typeFontPlayer.getHeight(), typeFontPlayer.getWidth(gameContinueText), typeFontPlayer.getHeight()); }
Source:
<code>public void initialize(PerunSession sess) { if (!this.initialized.compareAndSet(false, true)) return; ExtSourceGoogle.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceVOOT.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceUnity.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceCSV.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceISMU.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceLdap.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceSql.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourcePerun.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceREMS.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceTCS.setPerunBlImpl((PerunBlImpl) perunBl); ExtSourceSqlComplex.setPerunBlImpl((PerunBlImpl) perunBl); <START> ExtSourceXML.setPerunBlImpl((PerunBlImpl) perunBl); <END> this.extSourcesManagerImpl.initialize(sess); cacheExtSourcesInMemory(sess); }</code><technical_language>done in more general way? prevent forgetting of adding new ExtSource method for initialization</technical_language>

Target:
public void initialize(PerunSession sess) { if (!this.initialized.compareAndSet(false, true)) return; this.extSourcesManagerImpl.initialize(sess, perunBl); cacheExtSourcesInMemory(sess); }
Source:
<code>private static void checkCanceled(IProgressMonitor pm) { <START> if (pm.isCanceled()) <END> throw new OperationCanceledException(); }</code><technical_language>please for if block. I code this always, in new code do better</technical_language>

Target:
private static void checkCanceled(IProgressMonitor pm) { if (pm.isCanceled()) { throw new OperationCanceledException(); } }
Source:
<code>public List<Comment> getAllComments(PaginationRequest request,String uuid) throws CommentManagementException, SQLException { PaginationResult paginationResult = new PaginationResult(); List<Comment> comments; request = Util.validateCommentListPageSize(request); if (log.isDebugEnabled()) { log.debug("get all comments of the application release"+uuid); } try { ConnectionManagerUtil.openDBConnection(); <START> comments=commentDAO.getAllComments(uuid,request); END> int count=commentDAO.getCommentCount(request,uuid); paginationResult.setData(comments); paginationResult.setRecordsFiltered(count); paginationResult.setRecordsTotal(count); return comments; } catch (DBConnectionException e) { log.error("DB Connection Exception occurs.", e); } finally { ConnectionManagerUtil.closeDBConnection(); } return null; }</code><technical_language>Check code formatting for classes</technical_language>

Target:
public List<Comment> getAllComments(PaginationRequest request, String uuid) throws CommentManagementException { PaginationResult paginationResult = new PaginationResult(); List<Comment> comments; request = Util.validateCommentListPageSize(request); if (log.isDebugEnabled()) { log.debug("get all comments of the application release" + uuid); } try { ConnectionManagerUtil.openDBConnection(); comments = commentDAO.getAllComments(uuid, request); int count = commentDAO.getCommentCount(request, uuid); paginationResult.setData(comments); paginationResult.setRecordsFiltered(count); paginationResult.setRecordsTotal(count); return comments; } catch (DBConnectionException e) { throw new CommentManagementException( "DB Connection error occurs ,Comments of application with UUID " + uuid + "cannot get.", e); } catch (SQLException e) { throw new CommentManagementException( "SQL Exception occurs,Comments of application with UUID " + uuid + "cannot get.", e); } finally { ConnectionManagerUtil.closeDBConnection(); } }
Source:
<code>public BoundingBox(final List<Point> points) { if (points == null) { this.points = null; } else { <START> this.points = Collections.unmodifiableList(new ArrayList<>(points)); <END> } }</code><technical_language>need create a new ArrayList here</technical_language>

Target:
public BoundingBox(final List<Point> points) { if (points == null) { this.points = null; } else { this.points = Collections.unmodifiableList(points); } }
Source:
<code>public SearchResultsWrapper select(String query) { HttpURLConnection connection = null; try { URL serverAddress = new URL(solrUrl+"select?"+query); connection = (HttpURLConnection)serverAddress.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.connect(); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } catch (IOException e) { e.printStackTrace(); } return new SearchResultsWrapper(connection); }</code><technical_language>printStackTrace() in production code switch logging</technical_language>

Target:
public SearchResultsWrapper select(String query) { HttpURLConnection connection = null; try { URL serverAddress = new URL(solrUrl+"select?"+query); connection = (HttpURLConnection)serverAddress.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setConnectTimeout(5000); connection.setReadTimeout(5000); connection.connect(); } catch (MalformedURLException e) { log.error(e.getLocalizedMessage()); } catch (IOException e) { log.error(e.getLocalizedMessage()); } return new SearchResultsWrapper(connection); }
Source:
<code>public void intercept(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { if (!COMMON_STRATEGY.equals(pvcStrategy) || isEphemeral(k8sEnv.getAttributes())) { return; } String namespace = identity.getInfrastructureNamespace(); String workspaceId = identity.getWorkspaceId(); <START> RollableScalableResource<Deployment, DoneableDeployment> asyncStoragePodResource = <END> getAsyncStoragePodResource(namespace, workspaceId); if (asyncStoragePodResource.get() == null) { return; } try { deleteAsyncStoragePod(asyncStoragePodResource) .get(DELETE_POD_TIMEOUT_IN_MIN, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( format( "Interrupted while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (ExecutionException ex) { throw new InfrastructureException( format( "Error occurred while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (TimeoutException ex) { throw new InfrastructureException( format("Pod '%s' removal timeout reached " + ex.getMessage(), ASYNC_STORAGE), ex); } }</code><technical_language>asyncStorage*Deployment*Resource</technical_language>

Target:
public void intercept(KubernetesEnvironment k8sEnv, RuntimeIdentity identity) throws InfrastructureException { if (!COMMON_STRATEGY.equals(pvcStrategy) || isEphemeral(k8sEnv.getAttributes())) { return; } removeAsyncStoragePodWithoutDeployment(identity); String namespace = identity.getInfrastructureNamespace(); String workspaceId = identity.getWorkspaceId(); RollableScalableResource<Deployment, DoneableDeployment> asyncStorageDeploymentResource = getAsyncStorageDeploymentResource(namespace, workspaceId); if (asyncStorageDeploymentResource.get() == null) { return; } try { deleteAsyncStorageDeployment(asyncStorageDeploymentResource) .get(DELETE_DEPLOYMENT_TIMEOUT_IN_MIN, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( format( "Interrupted while waiting for deployment '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (ExecutionException ex) { throw new InfrastructureException( format( "Error occurred while waiting for deployment '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (TimeoutException ex) { throw new InfrastructureException( format("Pod '%s' removal timeout reached " + ex.getMessage(), ASYNC_STORAGE), ex); } }
Source:
<code>private MustacheFactory createNewMustacheFactory(Class<? extends View> key) { <START> return (fileRoot != null) ? new DefaultMustacheFactory(new FileSystemResolver(fileRoot)) <END> : new DefaultMustacheFactory(new PerClassMustacheResolver(key)); }</code><technical_language>I this initialization more terse if initialize MustacheResolver ternary operator pass DefaultMustacheFactory. java new DefaultMustacheFactory(fileRoot.isPresent() ? new FileSystemResolver(fileRoot.get()) : new PerClassMustacheResolver(key))</technical_language>

Target:
private MustacheFactory createNewMustacheFactory(Class<? extends View> key) { return new DefaultMustacheFactory( fileRoot.isPresent() ? new FileSystemResolver(fileRoot.get()) : new PerClassMustacheResolver(key)); }
Source:
<code>public void reset() { serviceProvider = null; federatedIdentityProviders = null; federatedIdentityProvidersMap.clear(); localAuthenticatorConfigs = null; requestPathAuthenticators = null; roleMap = null; claimMap = null; requestedClaims = new HashMap<String, String>(); samlIssuer = null; kerberosServiceName = null; oauthAppName = null; wstrustEp = null; passivests = null; passiveSTSWReply = null; openid = null; oauthConsumerSecret = null; attrConsumServiceIndex = null; enabledFederatedIdentityProviders = null; <START> customInbountAuthenticatorConfigs = null; <END> }</code><technical_language>empty list</technical_language>

Target:
public void reset() { serviceProvider = null; federatedIdentityProviders = null; federatedIdentityProvidersMap.clear(); localAuthenticatorConfigs = null; requestPathAuthenticators = null; roleMap = null; claimMap = null; requestedClaims = new HashMap<String, String>(); samlIssuer = null; kerberosServiceName = null; oauthAppName = null; wstrustEp = null; passivests = null; passiveSTSWReply = null; openid = null; oauthConsumerSecret = null; attrConsumServiceIndex = null; enabledFederatedIdentityProviders = null; inboundAuthenticationRequestConfigs = Collections.EMPTY_LIST; }
Source:
<code><START> public Tab(@JsonProperty("identifier") String identifier, @JsonProperty("title") String title) { <END> this.identifier = identifier; this.title = title; }</code><technical_language>public</technical_language>

Target:
private Tab(@JsonProperty("identifier") String identifier, @JsonProperty("title") String title) { this.identifier = identifier; this.title = title; }
Source:
<code>public<K> void runTopics() throws IOException { TopicReader<K> tr; SortedMap<K, Map<String, String>> topics = new TreeMap<>(); for (String singleTopicsFile : args.topics) { Path topicsFilePath = Paths.get(singleTopicsFile); if (!Files.exists(topicsFilePath) || !Files.isRegularFile(topicsFilePath) || !Files.isReadable(topicsFilePath)) { throw new IllegalArgumentException("Topics file : " + topicsFilePath + " does not exist or is not a (readable) file."); } try { tr = (TopicReader<K>) Class.forName("io.anserini.search.topicreader." + args.topicReader + "TopicReader") .getConstructor(Path.class).newInstance(topicsFilePath); topics.putAll(tr.read()); } catch (Exception e) { throw new IllegalArgumentException("Unable to load topic reader: " + args.topicReader); } } final String runTag = args.runtag == null ? "Solrini" : args.runtag; <START> final ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(args.threads); <END> executor.execute(new SolrSearcherThread<K>(topics, args.output, runTag)); executor.shutdown(); try { while (!executor.awaitTermination(1, TimeUnit.MINUTES)) } catch (InterruptedException ie) { executor.shutdownNow(); Thread.currentThread().interrupt(); } }</code><technical_language>Do need complexity of a thread pool a single SolrClient work? remove ThreadPool ObjectPool<SolrClient> - in indexing for performance, querying a single SolrClient</technical_language>

Target:
public<K> void runTopics() throws IOException { TopicReader<K> tr; SortedMap<K, Map<String, String>> topics = new TreeMap<>(); for (String singleTopicsFile : args.topics) { Path topicsFilePath = Paths.get(singleTopicsFile); if (!Files.exists(topicsFilePath) || !Files.isRegularFile(topicsFilePath) || !Files.isReadable(topicsFilePath)) { throw new IllegalArgumentException("Topics file : " + topicsFilePath + " does not exist or is not a (readable) file."); } try { tr = (TopicReader<K>) Class.forName("io.anserini.search.topicreader." + args.topicReader + "TopicReader") .getConstructor(Path.class).newInstance(topicsFilePath); topics.putAll(tr.read()); } catch (Exception e) { throw new IllegalArgumentException("Unable to load topic reader: " + args.topicReader); } } final String runTag = args.runtag == null ? "Solrini" : args.runtag; SolrSearcherThread<K> solrThread = new SolrSearcherThread<K>(topics, args.output, runTag); solrThread.run(); }
Source:
<code>protected AbstractDeployer(ZooKeeperConnection zkConnection, PagingAndSortingRepository<D, String> repository, XDParser parser, ParsingContext parsingContext) { Assert.notNull(zkConnection, "ZooKeeper connection cannot be null"); Assert.notNull(repository, "Repository cannot be null"); Assert.notNull(parsingContext, "Entity type kind cannot be null"); this.zkConnection = zkConnection; this.repository = repository; this.definitionKind = parsingContext; this.parser = parser; <START> composedJobParser = new JobParser(); <END> }</code><technical_language>this</technical_language>

Target:
protected AbstractDeployer(ZooKeeperConnection zkConnection, PagingAndSortingRepository<D, String> repository, XDParser parser, ParsingContext parsingContext) { Assert.notNull(zkConnection, "ZooKeeper connection cannot be null"); Assert.notNull(repository, "Repository cannot be null"); Assert.notNull(parsingContext, "Entity type kind cannot be null"); this.zkConnection = zkConnection; this.repository = repository; this.definitionKind = parsingContext; this.parser = parser; this.composedJobParser = new JobParser(); }
Source:
<code>void setupContainerComponent() { final SimplePanel container = getContainer(); final Style style = container.getElement().getStyle(); <START> style.setPaddingLeft(5, PX); style.setPaddingRight(5, PX); style.setPaddingTop(5, PX); style.setPaddingBottom(5, PX); <END> container.setWidget(widget); }</code><technical_language>this style.setPadding(5, PX);</technical_language>

Target:
void setupContainerComponent() { final SimplePanel container = getContainer(); final Style style = container.getElement().getStyle(); style.setPadding(5, PX); container.setWidget(widget); }
Source:
<code>public void untilSuccessful() { final ConstructModel tryModel = coreExtensionModel.getConstructModel("untilSuccessful").get(); List<ParameterModel> allParameterModels = tryModel.getAllParameterModels(); assertThat(allParameterModels, hasSize(2)); ParameterModel action = allParameterModels.get(0); assertThat(action.getName(), is("maxRetries")); <START> assertThat(action.getType(), is(instanceOf(DefaultStringType.class))); <END> assertThat(action.getExpressionSupport(), is(SUPPORTED)); assertThat(action.getDefaultValue(), is("5")); assertThat(action.isRequired(), is(false)); ParameterModel type = allParameterModels.get(1); assertThat(type.getName(), is("millisBetweenRetries")); assertThat(type.getType(), is(instanceOf(DefaultStringType.class))); assertThat(type.getExpressionSupport(), is(SUPPORTED)); assertThat(type.getDefaultValue(), is("60000")); assertThat(type.isRequired(), is(false)); }</code><technical_language>@ndinu @alegmarra Is this correct? expression return a number</technical_language>

Target:
public void untilSuccessful() { final ConstructModel tryModel = coreExtensionModel.getConstructModel("untilSuccessful").get(); List<ParameterModel> allParameterModels = tryModel.getAllParameterModels(); assertThat(allParameterModels, hasSize(2)); ParameterModel action = allParameterModels.get(0); assertThat(action.getName(), is("maxRetries")); assertThat(action.getType(), is(instanceOf(DefaultNumberType.class))); assertThat(action.getExpressionSupport(), is(SUPPORTED)); assertThat(action.getDefaultValue(), is(5)); assertThat(action.isRequired(), is(false)); ParameterModel type = allParameterModels.get(1); assertThat(type.getName(), is("millisBetweenRetries")); assertThat(type.getType(), is(instanceOf(DefaultNumberType.class))); assertThat(type.getExpressionSupport(), is(SUPPORTED)); assertThat(type.getDefaultValue(), is(60000)); assertThat(type.isRequired(), is(false)); }
Source:
<code>private DoubleArray resolveSteps(List<SchedulePeriod> periods, RollConvention rollConv) { int size = periods.size(); double[] result = new double[size]; List<ValueStep> resolvedSteps = getStepSequence().map(seq -> seq.resolve(steps, rollConv)).orElse(steps); ValueAdjustment[] expandedSteps = new ValueAdjustment[size]; for (ValueStep step : resolvedSteps) { int index = step.findIndex(periods); if (expandedSteps[index] != null && !expandedSteps[index].equals(step.getValue())) { <START> throw new IllegalArgumentException("Two ValueStep instances resolve to the same schedule period"); <END> } expandedSteps[index] = step.getValue(); } double value = initialValue; for (int i = 0; i < size; i++) { if (expandedSteps[i] != null) { value = expandedSteps[i].adjust(value); } result[i] = value; } return DoubleArray.ofUnsafe(result); }</code><technical_language>worth including steps in error message</technical_language>

Target:
private DoubleArray resolveSteps(List<SchedulePeriod> periods, RollConvention rollConv) { int size = periods.size(); double[] result = new double[size]; List<ValueStep> resolvedSteps = getStepSequence().map(seq -> seq.resolve(steps, rollConv)).orElse(steps); ValueAdjustment[] expandedSteps = new ValueAdjustment[size]; for (ValueStep step : resolvedSteps) { int index = step.findIndex(periods); if (expandedSteps[index] != null && !expandedSteps[index].equals(step.getValue())) { throw new IllegalArgumentException(Messages.format( "Invalid ValueSchedule, two steps resolved to the same schedule period starting on {}, schedule defined as {}", periods.get(index).getUnadjustedStartDate(), this)); } expandedSteps[index] = step.getValue(); } double value = initialValue; for (int i = 0; i < size; i++) { if (expandedSteps[i] != null) { value = expandedSteps[i].adjust(value); } result[i] = value; } return DoubleArray.ofUnsafe(result); }
Source:
<code>public DescriptorValue calculate(IAtomContainer mol) { try { mol = mol.clone(); } catch (CloneNotSupportedException ex) { } int nC = 0; int nCSP3 = 0; DoubleResult result; try { <START> AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); <END> for (IAtom atom: mol.atoms()) { if (atom.getAtomicNumber() == 6) { nC++; if (atom.getHybridization() == Hybridization.SP3) nCSP3++; } } result = new DoubleResult(nC == 0 ? 0 : (double)nCSP3 / nC); } catch (CDKException e) { result = new DoubleResult(Double.NaN); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result, getDescriptorNames()); }</code><technical_language>I suggest perceive atom types, apply molecule... do clone() IAtomContainer, making calculation a lot faster</technical_language>

Target:
public DescriptorValue calculate(IAtomContainer mol) { DoubleResult result; try { int nC = 0; int nCSP3 = 0; CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(mol.getBuilder()); for (IAtom atom : mol.atoms()) { if (atom.getAtomicNumber() == 6) { nC++; IAtomType matched = matcher.findMatchingAtomType(mol, atom); if (matched != null && matched.getHybridization() == IAtomType.Hybridization.SP3) { nCSP3++; } } } result = new DoubleResult(nC == 0 ? 0 : (double)nCSP3 / nC); } catch (CDKException e) { result = new DoubleResult(Double.NaN); } return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), result, getDescriptorNames()); }
Source:
<code>public void dispose() { trace = GitTraceLocation.HISTORYVIEW.isActive(); if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation()); if (myRefsChangedHandle != null) { myRefsChangedHandle.remove(); myRefsChangedHandle = null; } <START> for (ActionFactory.IWorkbenchAction action : actionsToDispose) <END> action.dispose(); actionsToDispose.clear(); cancelRefreshJob(); if (popupMgr != null) { for (final IContributionItem i : popupMgr.getItems()) { if (i instanceof ActionFactory.IWorkbenchAction) ((ActionFactory.IWorkbenchAction) i).dispose(); } for (final IContributionItem i : getSite().getActionBars() .getMenuManager().getItems()) { if (i instanceof ActionFactory.IWorkbenchAction) ((ActionFactory.IWorkbenchAction) i).dispose(); } } super.dispose(); }</code><technical_language>(import IWorkbenchAction)</technical_language>

Target:
public void dispose() { trace = GitTraceLocation.HISTORYVIEW.isActive(); if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation()); if (myRefsChangedHandle != null) { myRefsChangedHandle.remove(); myRefsChangedHandle = null; } for (IWorkbenchAction action : actionsToDispose) action.dispose(); actionsToDispose.clear(); cancelRefreshJob(); if (popupMgr != null) { for (final IContributionItem i : popupMgr.getItems()) { if (i instanceof IWorkbenchAction) ((IWorkbenchAction) i).dispose(); } for (final IContributionItem i : getSite().getActionBars() .getMenuManager().getItems()) { if (i instanceof IWorkbenchAction) ((IWorkbenchAction) i).dispose(); } } super.dispose(); }
Source:
<code><START> public double[] findMinMax(double[] rawData) { <END> double xMin = Double.MAX_VALUE; double xMax = 0; for (int i = 1; i <= rawData.length; i++) { double value = rawData[i - 1]; if (value < xMin) { xMin = value; } if (value > xMax) { xMax = value; } } double[] minMaxVal = new double[2]; minMaxVal[0] = xMin; minMaxVal[1] = xMax; return minMaxVal; }</code><technical_language>faster Math.min Math.max here</technical_language>

Target:
public List<Double> findMinMax(double[] rawData) { double xMin = Double.MAX_VALUE; double xMax = 0; for (int i = 1; i <= rawData.length; i++) { double value = rawData[i - 1]; xMin = Math.min(xMin, value); xMax = Math.max(xMax, value); } List<Double> minMaxVal = new ArrayList<Double>(); minMaxVal.add(xMin); minMaxVal.add(xMax); return minMaxVal; }
Source:
<code>private boolean isOneToOneAndSet(ReferenceChange diff, boolean mergeRightToLeft) { if (diff.getReference().getEOpposite() == null) { <START> return false; <END> } return !diff.getReference().isMany() && !diff.getReference().getEOpposite().isMany() && isSet(diff, mergeRightToLeft); }</code><technical_language>(avoiding multiple returns)</technical_language>

Target:
private boolean isOneToOneAndSet(ReferenceChange diff, boolean mergeRightToLeft) { final boolean hasOpposite = diff.getReference().getEOpposite() != null; final boolean isOneToOne = hasOpposite && !diff.getReference().isMany() && !diff.getReference().getEOpposite().isMany(); return isOneToOne && isSet(diff, mergeRightToLeft); }
Source:
<code>public void checkResultSetSelectAll(ResultSet rs) throws SQLException { <START> ArrayList<String> results = getArrayListResult(rs); <END> Assert.assertEquals( values2.size(), results.size() ); for( int i = 0; i < results.size(); i++ ) { Assert.assertEquals( values2.get(i), results.get(i) ); } }</code><technical_language>List instead of ArrayList maybe</technical_language>

Target:
public void checkResultSetSelectAll(ResultSet rs) throws SQLException { List<String> results = getListResult(rs); Assert.assertEquals( values2.size(), results.size() ); for( int i = 0; i < results.size(); i++ ) { Assert.assertEquals( values2.get(i), results.get(i) ); } }
Source:
<code>private void timeToExpireSession() { if (CommCareApplication._().isConsumerApp()) { return; <START> } <END> long currentTime = new Date().getTime(); if (logoutStartedAt != -1 && currentTime > (logoutStartedAt + LOGOUT_TIMEOUT)) { if (!CommCareSessionService.sessionAliveLock.tryLock()) { return; } try { CommCareApplication._().expireUserSession(); } finally { CommCareSessionService.sessionAliveLock.unlock(); } } else if (isActive() && logoutStartedAt == -1 && (currentTime > sessionExpireDate.getTime() || (sessionExpireDate.getTime() - currentTime > sessionLength))) { if (!CommCareSessionService.sessionAliveLock.tryLock()) { return; } try { saveFormAndCloseSession(); } finally { CommCareSessionService.sessionAliveLock.unlock(); } showLoggedOutNotification(); } }</code><technical_language>Instead of this setup/run maintenanceTimer if is a consumer app</technical_language>

Target:
private void timeToExpireSession() { long currentTime = new Date().getTime(); if (logoutStartedAt != -1 && currentTime > (logoutStartedAt + LOGOUT_TIMEOUT)) { if (!CommCareSessionService.sessionAliveLock.tryLock()) { return; } try { CommCareApplication._().expireUserSession(); } finally { CommCareSessionService.sessionAliveLock.unlock(); } } else if (isActive() && logoutStartedAt == -1 && (currentTime > sessionExpireDate.getTime() || (sessionExpireDate.getTime() - currentTime > sessionLength))) { if (!CommCareSessionService.sessionAliveLock.tryLock()) { return; } try { saveFormAndCloseSession(); } finally { CommCareSessionService.sessionAliveLock.unlock(); } showLoggedOutNotification(); } }
Source:
<code>public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { MetaData metaData; try { FileSystem fs = FileSystem.get(new Path(context.location).toUri(), context.hiveConf); metaData = EximUtil.readMetaData(fs, new Path(context.location, EximUtil.METADATA_NAME)); } catch (IOException e) { throw new SemanticException(ErrorMsg.INVALID_PATH.getMsg(), e); } Database db = metaData.getDatabase(); String destinationDBName = context.dbName == null ? db.getName() : context.dbName; CreateDatabaseDesc createDatabaseDesc = <START> new CreateDatabaseDesc(destinationDBName, db.getDescription(), db.getLocationUri(), true); <END> createDatabaseDesc.setDatabaseProperties(db.getParameters()); Task<DDLWork> createDBTask = TaskFactory.get( new DDLWork(new HashSet<>(), new HashSet<>(), createDatabaseDesc), context.hiveConf); if (StringUtils.isNotEmpty(db.getOwnerName())) { AlterDatabaseDesc alterDbDesc = new AlterDatabaseDesc(db.getName(), new PrincipalDesc(db.getOwnerName(), db.getOwnerType()), context.eventOnlyReplicationSpec()); Task<DDLWork> alterDbTask = TaskFactory .get(new DDLWork(new HashSet<>(), new HashSet<>(), alterDbDesc), context.hiveConf); createDBTask.addDependentTask(alterDbTask); } return Collections.singletonList(createDBTask); }</code><technical_language>set locationUri point source cluster's path. DDLTask set path if set here</technical_language>

Target:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { MetaData metaData; try { FileSystem fs = FileSystem.get(new Path(context.location).toUri(), context.hiveConf); metaData = EximUtil.readMetaData(fs, new Path(context.location, EximUtil.METADATA_NAME)); } catch (IOException e) { throw new SemanticException(ErrorMsg.INVALID_PATH.getMsg(), e); } Database db = metaData.getDatabase(); String destinationDBName = context.dbName == null ? db.getName() : context.dbName; CreateDatabaseDesc createDatabaseDesc = new CreateDatabaseDesc(destinationDBName, db.getDescription(), null, true); createDatabaseDesc.setDatabaseProperties(db.getParameters()); Task<DDLWork> createDBTask = TaskFactory.get( new DDLWork(new HashSet<>(), new HashSet<>(), createDatabaseDesc), context.hiveConf); if (!db.getParameters().isEmpty()) { AlterDatabaseDesc alterDbDesc = new AlterDatabaseDesc(destinationDBName, db.getParameters(), context.eventOnlyReplicationSpec()); Task<DDLWork> alterDbProperties = TaskFactory .get(new DDLWork(new HashSet<>(), new HashSet<>(), alterDbDesc), context.hiveConf); createDBTask.addDependentTask(alterDbProperties); } if (StringUtils.isNotEmpty(db.getOwnerName())) { AlterDatabaseDesc alterDbOwner = new AlterDatabaseDesc(destinationDBName, new PrincipalDesc(db.getOwnerName(), db.getOwnerType()), context.eventOnlyReplicationSpec()); Task<DDLWork> alterDbTask = TaskFactory .get(new DDLWork(new HashSet<>(), new HashSet<>(), alterDbOwner), context.hiveConf); createDBTask.addDependentTask(alterDbTask); } updatedMetadata .set(context.dmd.getEventTo().toString(), destinationDBName, null, null); return Collections.singletonList(createDBTask); }
Source:
<code>protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); } else { <START> changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Active); <END> } setSucceeded(true); }</code><technical_language>if storage domain inactive moved maintenance failed</technical_language>

Target:
protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); } else { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); } setSucceeded(true); }
Source:
<code>public void testListenerFailExecution() throws Exception { when( component.execute() ).thenReturn( false ); PentahoAsyncReportExecution exec = createMockCallable(); <START> exec.notifyTaskQueued( UUID.randomUUID(), null ); <END> assertEquals( AsyncExecutionStatus.QUEUED, exec.getState().getStatus() ); IFixedSizeStreamingContent returnStream = exec.call(); assertEquals( AsyncExecutionStatus.FAILED, exec.getState().getStatus() ); assertFalse( returnStream.equals( input ) ); verify( handler, times( 0 ) ).getStagingContent(); }</code><technical_language>This call error out. If a list parameter, pass in Null, demand API user passes in Collections.emptyList() instead</technical_language>

Target:
public void testListenerFailExecution() throws Exception { when( component.execute() ).thenReturn( false ); PentahoAsyncReportExecution exec = createMockCallable(); exec.notifyTaskQueued( UUID.randomUUID(), Collections.<ReportProgressListener>emptyList() ); assertEquals( AsyncExecutionStatus.QUEUED, exec.getState().getStatus() ); IFixedSizeStreamingContent returnStream = exec.call(); assertEquals( AsyncExecutionStatus.FAILED, exec.getState().getStatus() ); assertFalse( returnStream.equals( input ) ); verify( handler, times( 0 ) ).getStagingContent(); }
Source:
<code><START> @Override public final <P extends Job<P, B>, B extends Run<P, B>> JobDecorator<P, B> jobDecorator(Class<P> clazz) { <END> if (!isApplicable(clazz)) { return null; } return new JobDecorator<P, B>() { @NonNull @Override public List<JobProperty<? super P>> jobProperties( @NonNull List<JobProperty<? super P>> jobProperties) { List<JobProperty<? super P>> result = asArrayList(jobProperties); for (Iterator<JobProperty<? super P>> iterator = result.iterator(); iterator.hasNext(); ) { JobProperty<? super P> p = iterator.next(); if (p instanceof ParametersDefinitionProperty) { iterator.remove(); } } if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { result.add(new ParametersDefinitionProperty(parameterDefinitions)); } return result; } }; }</code><technical_language>code style</technical_language>

Target:
public final <P extends Job<P, B>, B extends Run<P, B>> JobDecorator<P, B> jobDecorator(Class<P> clazz) { if (!isApplicable(clazz)) { return null; } return new JobDecorator<P, B>() { @NonNull @Override public List<JobProperty<? super P>> jobProperties( @NonNull List<JobProperty<? super P>> jobProperties) { List<JobProperty<? super P>> result = asArrayList(jobProperties); for (Iterator<JobProperty<? super P>> iterator = result.iterator(); iterator.hasNext(); ) { JobProperty<? super P> p = iterator.next(); if (p instanceof ParametersDefinitionProperty) { iterator.remove(); } } if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { result.add(new ParametersDefinitionProperty(parameterDefinitions)); } return result; } }; }
Source:
<code>private void checkForInvalidPath() { if ( ((this.fullId.contains(FCR_ACL) || this.fullId.contains(FCR_TOMBSTONE)) && (this.fullId.contains(FCR_METADATA) || this.fullId.contains(FCR_VERSIONS))) || (this.fullId.contains(FCR_TOMBSTONE) && this.fullId.contains(FCR_ACL)) ) { throw new InvalidResourceIdentifierException(String.format("Path is invalid: %s", pathOnly)); } for (final String extension : extensions) { if (this.fullId.contains(extension)) { <START> final Pattern extPattern = Pattern.compile(extension); <END> if (extPattern.matcher(this.fullId).results().count() > 1) { throw new InvalidResourceIdentifierException(String.format("Path is invalid: %s", pathOnly)); } } } }</code><technical_language>pattern changes, extensions for else, Set<Pattern>. curious if is performance gain contains check applying regex contains scan string. If do want do check, extensions easily Map<String, Pattern></technical_language>

Target:
private void checkForInvalidPath() { if ( ((this.fullId.contains(FCR_ACL) || this.fullId.contains(FCR_TOMBSTONE)) && (this.fullId.contains(FCR_METADATA) || this.fullId.contains(FCR_VERSIONS))) || (this.fullId.contains(FCR_TOMBSTONE) && this.fullId.contains(FCR_ACL)) ) { throw new InvalidResourceIdentifierException(String.format("Path is invalid: %s", pathOnly)); } for (final Pattern extension : extensions) { if (extension.matcher(this.fullId).results().count() > 1) { throw new InvalidResourceIdentifierException(String.format("Path is invalid: %s", pathOnly)); } } }
Source:
<code>public String getFileName() { <START> if (fileName==null) setFileName(1); <END> return fileName; }</code><technical_language>{ }</technical_language>

Target:
public String getFileName() { if (fileName==null) { setFileName(1); } return fileName; }
Source:
<code>public State() { <START> } <END></code><technical_language>protected constructor added purpose a mistake</technical_language>

Target:
protected State() { }
Source:
<code>public void testLookupDataSet() throws Exception { DataSetLookup lookup = new DataSetLookup(); lookup.setDataSetUUID(PROCESS_DEFINITION_DATASET); <START> DataSetLookup consoleDataSetLookup = ConsoleDataSetLookup.fromInstance(lookup, "servereTemplateId"); <END> CoreFunctionFilter coreFunctionFilter = new CoreFunctionFilter("ProcessDefName", CoreFunctionType.LIKE_TO, "name"); DataSetFilter dataSetFilter = new DataSetFilter(); dataSetFilter.addFilterColumn(coreFunctionFilter); consoleDataSetLookup.addOperation(dataSetFilter); DataSet dataSet = processDefinitionDataSetProvider.lookupDataSet(dataSetdef, consoleDataSetLookup); assertEquals(PROCESS_DEFINITION_DATASET, dataSet.getUUID()); assertThat(dataSet.getColumns()).hasSize(5).extracting(dataColumn -> { return dataColumn.getId(); }).contains(COL_ID_PROCESSVERSION, COL_ID_PROCESSVERSION, COL_ID_PROJECT, COL_ID_PROCESSDEF, COL_DYNAMIC); }</code><technical_language>suggestion DataSetLookup consoleDataSetLookup = ConsoleDataSetLookup.fromInstance(lookup, "serverTemplateId");</technical_language>

Target:
public void testLookupDataSet() throws Exception { DataSetLookup lookup = new DataSetLookup(); lookup.setDataSetUUID(PROCESS_DEFINITION_DATASET); DataSetLookup consoleDataSetLookup = ConsoleDataSetLookup.fromInstance(lookup, SERVER_TEMPLATE_ID); CoreFunctionFilter coreFunctionFilter = new CoreFunctionFilter(SORT_COLUMN_NAME, CoreFunctionType.LIKE_TO, TEXT_SEARCH); DataSetFilter dataSetFilter = new DataSetFilter(); dataSetFilter.addFilterColumn(coreFunctionFilter); consoleDataSetLookup.addOperation(dataSetFilter); DataSet dataSet = processDefinitionDataSetProvider.lookupDataSet(dataSetdef, consoleDataSetLookup); assertEquals(PROCESS_DEFINITION_DATASET, dataSet.getUUID()); assertEquals(1, dataSet.getRowCount()); assertThat(dataSet.getColumns()).hasSize(5).extracting(dataColumn -> dataColumn.getId()).contains(COL_ID_PROCESSVERSION, COL_ID_PROCESSVERSION, COL_ID_PROJECT, COL_ID_PROCESSDEF, COL_DYNAMIC); }
Source:
<code>public void enqueue(Callback callback) { <START> DeferredTracer tracer = new DeferredTracer("acquire-limiter"); <END> ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { enqueueInternal(callback); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }</code><technical_language>nice if prefixed this</technical_language>

Target:
public void enqueue(Callback callback) { DeferredTracer tracer = new DeferredTracer("OkHttp: enqueue"); ListenableFuture<Limiter.Listener> limiterListener = limiter.acquire(); request().tag(ConcurrencyLimiterListener.class).setLimiterListener(limiterListener); Futures.addCallback(limiterListener, new FutureCallback<Limiter.Listener>() { @Override public void onSuccess(Limiter.Listener listener) { tracer.withTrace(() -> { enqueueInternal(callback); return null; }); } @Override public void onFailure(Throwable throwable) { callback.onFailure( RemotingOkHttpCall.this, new IOException(new AssertionError("This should never happen, since it implies " + "we failed when using the concurrency limiter", throwable))); } }, MoreExecutors.directExecutor()); }
Source:
<code>public void execute(Tuple tuple) { HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple .getValueByField("metadata"); String isBoolean = KeyValues.getValue(isSitemapKey, metadata); if (StringUtils.isBlank(isBoolean) || !isBoolean.equalsIgnoreCase("true")) { this.collector.emit(tuple.getValues()); this.collector.ack(tuple); return; } byte[] content = tuple.getBinaryByField("content"); String url = tuple.getStringByField("url"); String ct = KeyValues.getValue(HttpHeaders.CONTENT_TYPE, metadata); List<Values> outlinks = parseSiteMap(url, content, ct); if (outlinks == null) { <START> this.collector.fail(tuple); <END> return; } for (Values ol : outlinks) { collector.emit(statusStreamName, new Values(ol)); } this.collector.ack(tuple); }</code><technical_language>I need a stream a bolt for failing tuples. fail bolt implementation user. Unfortunately, failing a tuple spouts (including Storm's Kafka spout) replay tuple; sitemap parser fail collect outlinks source, this means tuple replayed _ad infinitum_ (I think), clogging topology</technical_language>

Target:
public void execute(Tuple tuple) { HashMap<String, String[]> metadata = (HashMap<String, String[]>) tuple .getValueByField("metadata"); String isSitemap = KeyValues.getValue(isSitemapKey, metadata); if (!Boolean.valueOf(isSitemap)) { this.collector.emit(tuple.getValues()); this.collector.ack(tuple); return; } byte[] content = tuple.getBinaryByField("content"); String url = tuple.getStringByField("url"); String ct = KeyValues.getValue(HttpHeaders.CONTENT_TYPE, metadata); List<Values> outlinks = parseSiteMap(url, content, ct); for (Values ol : outlinks) { collector.emit(Constants.StatusStreamName, ol); } collector.emit(Constants.StatusStreamName, new Values(url, metadata, Status.FETCHED)); this.collector.ack(tuple); }