auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static Druids.ScanQueryBuilder basicB(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); <START> final List<String> dimUniformFilterVals = new ArrayList<>(); <END> int resultNum = (int) (100000 * 0.1); int step = 100000 / resultNum; for (int i = 1; i < 100001 && dimUniformFilterVals.size() < resultNum; i += step) { dimUniformFilterVals.add(String.valueOf(i)); } List<String> dimHyperUniqueFilterVals = new ArrayList<>(); resultNum = (int) (100000 * 0.1); step = 100000 / resultNum; for (int i = 0; i < 100001 && dimHyperUniqueFilterVals.size() < resultNum; i += step) { dimHyperUniqueFilterVals.add(String.valueOf(i)); } DimFilter filter = new InDimFilter("dimHyperUnique", dimHyperUniqueFilterVals, null); return Druids.newScanQueryBuilder() .filters(filter) .intervals(intervalSpec); }</code><technical_language>dimUniformFilterVals is unused</technical_language>

Target:
private static Druids.ScanQueryBuilder basicB(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); List<String> dimHyperUniqueFilterVals = new ArrayList<>(); int numResults = (int) (100000 * 0.1); int step = 100000 / numResults; for (int i = 0; i < 100001 && dimHyperUniqueFilterVals.size() < numResults; i += step) { dimHyperUniqueFilterVals.add(String.valueOf(i)); } DimFilter filter = new InDimFilter("dimHyperUnique", dimHyperUniqueFilterVals, null); return Druids.newScanQueryBuilder() .filters(filter) .intervals(intervalSpec); }
Source:
<code>public void onLocationChanged(Location updatedLocation) { this.location = updatedLocation; Log.i("HereFunctionHandler", "location has been set to " + this.location); if (this.location.getAccuracy() <= GeoUtils.ACCEPTABLE_ACCURACY) { locationGoodEnough = true; forbidGpsUse(); } <START> if (shouldRefreshEntityList()) { <END> lastDisplayedLocation = location; entitySelectActivity.onEvalLocationChanged(); } }</code><technical_language>I argue more sense write this if (entitySelectActivity != null && shouldRefreshEntityList()), null-check part of logic implied method name; feels more separate concern/requirement. allows for short-circuiting in event entitySelectActivity is null</technical_language>

Target:
public void onLocationChanged(Location updatedLocation) { this.location = updatedLocation; Log.i("HereFunctionHandler", "location has been set to " + this.location); if (this.location.getAccuracy() <= GeoUtils.ACCEPTABLE_ACCURACY) { locationGoodEnough = true; forbidGpsUse(); } if (entitySelectActivity != null && shouldRefreshEntityList()) { lastDisplayedLocation = location; entitySelectActivity.onEvalLocationChanged(); } }
Source:
<code>private List<Object> extractParams(final Audit note, final GerritCall call, Gson gson) { final List<Object> args = new ArrayList<Object>(); final Object[] params = call.getParams(); final int[] obfuscate = note.obfuscate(); for (int i = 0; i < params.length; i++) { Object param = params[i]; if (obfuscate.length > 0) { <START> for (int id : obfuscate) { <END> if (id == i) { param="*****"; break; } } } args.add(param); } return args; }</code><technical_language>uhm. this shorter: List<Object> args = Lists.newArrayList(Arrays.asList(all.getParams()); for (int idx : note.obfuscate()) { args.set(idx, "****"); } return args;</technical_language>

Target:
private List<Object> extractParams(final Audit note, final GerritCall call, Gson gson) { List<Object> args = Lists.newArrayList(Arrays.asList(call.getParams())); for (int idx : note.obfuscate()) { args.set(idx, "*****"); } return args; }
Source:
<code>public boolean subscribe(String topic, String filter, EventHandler eventHandler, boolean headless) { <START> BundleContext bundleContext = Activator.getDefault().getBundleContext(); <END> if (bundleContext == null && logger != null) { logger.error(NLS.bind(ServiceMessages.NO_BUNDLE_CONTEXT, topic)); return false; } String[] topics = new String[] {topic}; Dictionary<String, Object> d = new Hashtable<String, Object>(); d.put(EventConstants.EVENT_TOPIC, topics); if (filter != null) d.put(EventConstants.EVENT_FILTER, filter); EventHandler wrappedHandler = new UIEventHandler(eventHandler, headless ? null : uiSync); ServiceRegistration<?> registration = bundleContext.registerService( EventHandler.class.getName(), wrappedHandler, d); Collection<ServiceRegistration<?>> handled = registrations .get(eventHandler); if (handled == null) { registrations.put(eventHandler, handled = new ArrayList<ServiceRegistration<?>>()); } handled.add(registration); return true; }</code><technical_language>is incorrect, in case logger eventAdmin is null get a NPE</technical_language>

Target:
public boolean subscribe(String topic, String filter, EventHandler eventHandler, boolean headless) { BundleContext bundleContext = Activator.getDefault().getBundleContext(); if (bundleContext == null) { if (logger != null) { logger.error(NLS.bind(ServiceMessages.NO_BUNDLE_CONTEXT, topic)); } return false; } String[] topics = new String[] {topic}; Dictionary<String, Object> d = new Hashtable<String, Object>(); d.put(EventConstants.EVENT_TOPIC, topics); if (filter != null) d.put(EventConstants.EVENT_FILTER, filter); EventHandler wrappedHandler = new UIEventHandler(eventHandler, headless ? null : uiSync); ServiceRegistration<?> registration = bundleContext.registerService( EventHandler.class.getName(), wrappedHandler, d); Collection<ServiceRegistration<?>> handled = registrations .get(eventHandler); if (handled == null) { registrations.put(eventHandler, handled = new ArrayList<ServiceRegistration<?>>()); } handled.add(registration); return true; }
Source:
<code>public boolean fetch() { ElasticSearchService ess = Framework.getService(ElasticSearchService.class); if (esScroll == null) { esScroll = ess.scroll(new NxQueryBuilder(session).nxql(request.getQuery()) .limit(request.getSize()) .onlyElasticsearchResponse(), request.getTimeout().toSeconds()); } else { esScroll = ess.scroll(esScroll); } SearchHit[] hits = esScroll.getElasticsearchResponse().getHits().getHits(); <START> if (hits == null || hits.length == 0) { <END> return false; } return true; }</code><technical_language>i wondering if esScroll.getElasticsearchResponse().getHits() null wdyt of org.apache.commons.lang3.ArrayUtils#isEmpty(java.lang.Object[])</technical_language>

Target:
protected boolean fetch() { ElasticSearchService ess = Framework.getService(ElasticSearchService.class); if (esScroll == null) { esScroll = ess.scroll(new NxQueryBuilder(session).nxql(request.getQuery()) .limit(request.getSize()) .onlyElasticsearchResponse(), request.getTimeout().toSeconds()); } else { esScroll = ess.scroll(esScroll); } SearchHit[] hits = esScroll.getElasticsearchResponse().getHits().getHits(); return hits != null && hits.length > 0; }
Source:
<code>public void readAllItemsByPageWithCosmosPagedFluxHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); <START> CosmosPagedFlux<InternalObjectNode> cosmosPagedFlux = <END> cosmosAsyncContainer.readAllItems(cosmosQueryRequestOptions, InternalObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedFlux = cosmosPagedFlux.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger itemCount = new AtomicInteger(); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedFlux.byPage().toIterable().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); int size = feedResponse.getResults().size(); itemCount.addAndGet(size); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); assertThat(itemCount.get()).isEqualTo(NUM_OF_ITEMS); }</code><technical_language>for new test please InternalObjectNode this end user. Please rely ObjectNode a simple POJO</technical_language>

Target:
public void readAllItemsByPageWithCosmosPagedFluxHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedFlux<ObjectNode> cosmosPagedFlux = cosmosAsyncContainer.readAllItems(cosmosQueryRequestOptions, ObjectNode.class); AtomicInteger handleCount = new AtomicInteger(); cosmosPagedFlux = cosmosPagedFlux.handle(feedResponse -> { CosmosDiagnostics cosmosDiagnostics = feedResponse.getCosmosDiagnostics(); if (cosmosDiagnostics != null) { handleCount.incrementAndGet(); } }); AtomicInteger feedResponseCount = new AtomicInteger(); cosmosPagedFlux.byPage().toIterable().forEach(feedResponse -> { feedResponseCount.incrementAndGet(); }); assertThat(handleCount.get() >= 1).isTrue(); assertThat(handleCount.get()).isEqualTo(feedResponseCount.get()); }
Source:
<code><START> public String toString() { <END> StringBuffer sb = new StringBuffer(); sb.append("PartitionedRegionClearReplyMessage ").append("processorid=") .append(this.processorId) .append(" bucketsCleared ").append(this.bucketsCleared).append(" exception=") .append(getException()); return sb.toString(); }</code><technical_language>implementation super.toString() append fields specific this class</technical_language>

Target:
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("PartitionedRegionClearReplyMessage ") .append("processorId=").append(this.processorId) .append(" sender=").append(sender) .append(" bucketsCleared ").append(this.bucketsCleared) .append(" exception=").append(getException()); return sb.toString(); }
Source:
<code>private void showWindow() { window = new Window(windowTitle); window.setSizeFull(); <START> Embedded embedded = new Embedded(); <END> embedded.setSizeFull(); embedded.setType(Embedded.TYPE_BROWSER); streamResource.setMIMEType("application/pdf"); embedded.setSource(streamResource); window.setContent(embedded); getUI().getCurrent().addWindow(window); }</code><technical_language>Please BrowserFrame instead of generic Embedded. of is deprecated for a frame</technical_language>

Target:
private void showWindow() { window = new Window(windowTitle); window.setSizeFull(); BrowserFrame embedded = new BrowserFrame(); embedded.setSizeFull(); streamResource.setMIMEType("application/pdf"); embedded.setSource(streamResource); window.setContent(embedded); UI.getCurrent().addWindow(window); }
Source:
<code>public final <START> <M, T> Binding <END> bindSet( IObservableSet<T> targetObservableSet, IObservableSet<M> modelObservableSet, UpdateSetStrategy<? super T, ? extends M> targetToModel, UpdateSetStrategy<? super M, ? extends T> modelToTarget) { if (targetToModel == null) targetToModel = createTargetToModelUpdateSetStrategy( targetObservableSet, modelObservableSet); if (modelToTarget == null) modelToTarget = createModelToTargetUpdateSetStrategy( modelObservableSet, targetObservableSet); targetToModel.fillDefaults(targetObservableSet, modelObservableSet); modelToTarget.fillDefaults(modelObservableSet, targetObservableSet); SetBinding<? super M, ? extends T> result = new SetBinding<>(targetObservableSet, modelObservableSet, targetToModel, modelToTarget); result.init(this); return result; }</code><technical_language>Please order everywhere</technical_language>

Target:
public final <T, M> Binding bindSet( IObservableSet<T> targetObservableSet, IObservableSet<M> modelObservableSet, UpdateSetStrategy<? super T, ? extends M> targetToModel, UpdateSetStrategy<? super M, ? extends T> modelToTarget) { if (targetToModel == null) targetToModel = createTargetToModelUpdateSetStrategy( targetObservableSet, modelObservableSet); if (modelToTarget == null) modelToTarget = createModelToTargetUpdateSetStrategy( modelObservableSet, targetObservableSet); targetToModel.fillDefaults(targetObservableSet, modelObservableSet); modelToTarget.fillDefaults(modelObservableSet, targetObservableSet); SetBinding<? super M, ? extends T> result = new SetBinding<>(targetObservableSet, modelObservableSet, targetToModel, modelToTarget); result.init(this); return result; }
Source:
<code>public void storeAttachmentForOwner(Attachment attachment, Username owner) throws MailboxException { Preconditions.checkArgument(owner != null); Preconditions.checkArgument(attachment != null); JPAAttachment jpaAttachment = getJpaAttachment(attachment); try { jpaAttachment.getOwners().add(owner.getValue()); getEntityManager().getTransaction().begin(); getEntityManager().merge(jpaAttachment); getEntityManager().getTransaction().commit(); <START> } catch (PersistenceException e) { <END> LOGGER.warn("Persist attachment for owner met an exception", e); throw new MailboxException(" Store attachment for owner " + owner.getValue() + " failed", e); } }</code><technical_language>rollback error</technical_language>

Target:
public void storeAttachmentForOwner(Attachment attachment, Username owner) throws MailboxException { Preconditions.checkArgument(owner != null, "Attachment shouldn't be null when trying to store attachment for owner!"); Preconditions.checkArgument(attachment != null, "Username shouldn't be null when trying to store attachment for the owner!"); JPAAttachment jpaAttachment = getJpaAttachment(attachment); try { jpaAttachment.getOwners().add(owner.getValue()); getEntityManager().getTransaction().begin(); getEntityManager().merge(jpaAttachment); getEntityManager().getTransaction().commit(); } catch (PersistenceException e) { getEntityManager().getTransaction().rollback(); LOGGER.error("Persist attachment" + attachment.getAttachmentId() + " for owner " + owner.getValue() +" met an exception", e); throw new MailboxException(" Store attachment for owner " + owner.getValue() + " failed", e); } }
Source:
<code>public boolean update(Address addressRecord) { LOG.trace("AddressDAO.update() - Begin"); boolean result = true; if (addressRecord != null) { <START> result = super.update(addressRecord); <END> } LOG.trace("AddressDAO.update() - End"); return result; }</code><technical_language>need for declaring result</technical_language>

Target:
public boolean update(Address addressRecord) { LOG.trace("AddressDAO.update()"); return addressRecord != null ? super.update(addressRecord) : true; }
Source:
<code>public static void setUp() { ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace(); deleteSuppFiles(trace); ((TmfTrace) trace).traceOpened(new <START> TmfTraceOpenedSignal(null, trace, <END> null)); IAnalysisModule module = null; for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) { module = mod; } assertNotNull(module); module.schedule(); module.waitForCompletion(); fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID); fTrace = trace; }</code><technical_language>"this" instead of null</technical_language>

Target:
public void setUp() { ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace(); deleteSuppFiles(trace); ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(this, trace, null)); IAnalysisModule module = null; for (IAnalysisModule mod : TmfTraceUtils.getAnalysisModulesOfClass(trace, KernelAnalysisModule.class)) { module = mod; } assertNotNull(module); module.schedule(); module.waitForCompletion(); fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID); fTrace = trace; }
Source:
<code>public Flux<String> deleteByIdsAsync(Collection<String> ids) { if (ids == null || ids.isEmpty()) { return Flux.empty(); } <START> Collection<Mono<String>> observables = new ArrayList<>(); for (String id : ids) { final String resourceGroupName = ResourceUtils.groupFromResourceId(id); final String name = ResourceUtils.nameFromResourceId(id); Mono<String> o = ReactorMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); observables.add(o); } return Flux.mergeDelayError(32, observables.toArray(new Mono[0])); <END> }</code><technical_language>Flux.fromIterable().flatMapDelayError()</technical_language>

Target:
public Flux<String> deleteByIdsAsync(Collection<String> ids) { return BatchDeletionImpl.deleteByIdsAsync(ids, this::deleteInnerAsync); }
Source:
<code>public String resolveURI(String uri) { if (uri == null) return null; String ret = null; if (_baseURL == null) { try { URI result = new URI(uri); if (result.isAbsolute()) setBaseURL(result.toString()); } catch (URISyntaxException e) { <START> } <END> if (_baseURL == null) { try { setBaseURL(new File(".").toURI().toURL().toExternalForm()); } catch (Exception e1) { XRLog.exception("The default NaiveUserAgent doesn't know how to resolve the base URL for " + uri); return null; } } } try { URI result = new URI(uri); if (!result.isAbsolute()) { XRLog.load(uri + " is not a URL; may be relative. Testing using parent URL " + _baseURL); result=new URI(_baseURL).resolve(result); } ret = result.toString(); } catch (URISyntaxException e) { XRLog.exception("The default NaiveUserAgent cannot resolve the URL " + uri + " with base URL " + _baseURL); } return ret; }</code><technical_language>Please log this exception</technical_language>

Target:
public String resolveURI(String uri) { if (uri == null) return null; String ret = null; if (_baseURL == null) { try { URI result = new URI(uri); if (result.isAbsolute()) setBaseURL(result.toString()); } catch (URISyntaxException e) { XRLog.exception("The default NaiveUserAgent could not use the URL as base url: " + uri, e); } if (_baseURL == null) { try { setBaseURL(new File(".").toURI().toURL().toExternalForm()); } catch (Exception e1) { XRLog.exception("The default NaiveUserAgent doesn't know how to resolve the base URL for " + uri); return null; } } } try { URI result = new URI(uri); if (!result.isAbsolute()) { XRLog.load(uri + " is not a URL; may be relative. Testing using parent URL " + _baseURL); result=new URI(_baseURL).resolve(result); } ret = result.toString(); } catch (URISyntaxException e) { XRLog.exception("The default NaiveUserAgent cannot resolve the URL " + uri + " with base URL " + _baseURL); } return ret; }
Source:
<code>public void afterRegionClear(RegionEvent event) { <START> Region region = event.getRegion(); <END> clears.incrementAndGet(); }</code><technical_language>Unused variable</technical_language>

Target:
public void afterRegionClear(RegionEvent event) { clears.incrementAndGet(); }
Source:
<code><START> public Map<Long, String> getAllStudiesIdAndUid() throws CatalogDBException { <END> return studyDBAdaptor.getAllStudiesIdAndUid(); }</code><technical_language>This method here. is OK auxiliary methods this, in case a private method. Otherwise, need receive a token check for permissions. that, is implement map calling studyDBAdaptor.get(query, options)</technical_language>

Target:
private Map<Long, String> getAllStudiesIdAndUid() throws CatalogDBException { Map<Long, String> allStudiesIdAndUids = new HashMap<>(); QueryOptions queryOptions = new QueryOptions(); queryOptions.put(QueryOptions.INCLUDE, Arrays.asList(StudyDBAdaptor.QueryParams.FQN.key(), StudyDBAdaptor.QueryParams.UID.key())); List<Study> studies = studyDBAdaptor.get(new Query(), queryOptions).getResult(); for (Study study : studies) { String id = study.getFqn().replace(":", "_"); long uid = study.getUid(); allStudiesIdAndUids.put(uid, id); } return allStudiesIdAndUids; }
Source:
<code>public void testVFE4() { try { T_iget_char_6 t = new T_iget_char_6(); <START> t.run(); <END> fail("expected an IllegalAccessError exception"); } catch (IllegalAccessError t) { } }</code><technical_language>etc</technical_language>

Target:
public void testVFE4() { try { new T_iget_char_6().run(); fail("expected an IllegalAccessError exception"); } catch (IllegalAccessError t) { } }
Source:
<code>private static FileArtifactValue getMetadataOrConstant( MetadataHandler metadataHandler, Artifact artifact) throws IOException { FileArtifactValue metadata = metadataHandler.getMetadata(artifact); return (metadata != null && artifact.isConstantMetadata()) <START> ? ConstantMetadataValue.INSTANACE <END> : metadata; }</code><technical_language>s/INSTANACE/INSTANCE/</technical_language>

Target:
private static FileArtifactValue getMetadataOrConstant( MetadataHandler metadataHandler, Artifact artifact) throws IOException { FileArtifactValue metadata = metadataHandler.getMetadata(artifact); return (metadata != null && artifact.isConstantMetadata()) ? ConstantMetadataValue.INSTANCE : metadata; }
Source:
<code>public ResponseInfo replace(ByteBuf content) { ResponseInfo info = new ResponseInfo(requestInfo, error, content, dataNode); <START> return info; <END> }</code><technical_language>info is redundant</technical_language>

Target:
public ResponseInfo replace(ByteBuf content) { return new ResponseInfo(requestInfo, error, content, dataNode); }
Source:
<code>private void initRadioHandlers() { radioNestedPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioNestedPresenter.isSelected(); if (selected) { tabbedPanel.setSelectedIndex(0); setPresenterType(0); } } }); radioPresenterWidget.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioPresenterWidget.isSelected(); if (selected) { tabbedPanel.setSelectedIndex(1); setPresenterType(1); } } }); radioPopupPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioPopupPresenter.isSelected(); if (selected) { <START> tabbedPanel.setSelectedIndex(2); <END> setPresenterType(2); } } }); }</code><technical_language>refactoring : wrap lines 172-173 in a private method private void someMethodName(Integer index) { tabbedPanel.setSelectedIndex(index); setPresenterType(index); } I 3 spots this method reused</technical_language>

Target:
private void initRadioHandlers() { radioNestedPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioNestedPresenter.isSelected(); if (selected) { setSelectedIndex(0); } } }); radioPresenterWidget.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioPresenterWidget.isSelected(); if (selected) { setSelectedIndex(1); } } }); radioPopupPresenter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = radioPopupPresenter.isSelected(); if (selected) { setSelectedIndex(2); } } }); }
Source:
<code>private void electionAndSetCurVote() { reconfigFlagClear(); if (shuttingDownLE) { <START> startLeaderElection(); <END> } try { setCurrentVote(makeLEStrategy().lookForLeader()); } catch (Exception e) { LOG.warn("Unexpected exception", e); setPeerState(ServerState.LOOKING); } }</code><technical_language>need set shuttingDownLE false here</technical_language>

Target:
private void electionAndSetCurVote() { reconfigFlagClear(); if (shuttingDownLE) { shuttingDownLE = false; startLeaderElection(); } try { setCurrentVote(makeLEStrategy().lookForLeader()); } catch (Exception e) { LOG.warn("Unexpected exception", e); setPeerState(ServerState.LOOKING); } }
Source:
<code>public boolean handleResponse(MessageContext messageContext) { logger.debug("Validating the API response Body content.."); org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext). getAxis2MessageContext(); try { RelayUtils.buildMessage(axis2MC); logger.info("Successfully built the response message"); } catch (IOException e) { logger.error("Error occurred while building the API response", e); } catch (XMLStreamException e) { logger.error("Error occurred while validating the API response", e); } Object objectResponse = axis2MC.getProperty(APIMgtGatewayConstants.REST_CONTENT_TYPE); if (objectResponse == null) { return true; } try { validateResponse(messageContext); } catch (APIManagementException e) { <START> logger.error("Error occurred while validating the API response", e); <END> } return true; }</code><technical_language>logging error if is exception validation get ommitted</technical_language>

Target:
public boolean handleResponse(MessageContext messageContext) { logger.debug("Validating the API response Body content.."); org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext) messageContext). getAxis2MessageContext(); try { RelayUtils.buildMessage(axis2MC); logger.debug("Successfully built the response message"); } catch (IOException e) { logger.error("Error occurred while building the API response", e); } catch (XMLStreamException e) { logger.error("Error occurred while validating the API response", e); } Object objectResponse = axis2MC.getProperty(APIMgtGatewayConstants.REST_CONTENT_TYPE); if (objectResponse == null) { return true; } try { validateResponse(messageContext); } catch (APIManagementException e) { logger.error("Error occurred while validating the API response", e); return false; } return true; }
Source:
<code>private static String getPath(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { String <START> stateTypeName = <END> String.valueOf(presentationProvider.getId()); String stateName = stateItem.getStateString(); if (isLink(stateItem)) { return PREFIX + stateTypeName + SEPARATOR + LINK + stateName; } return PREFIX + stateTypeName + SEPARATOR + stateName; }</code><technical_language>id</technical_language>

Target:
private static String getPath(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { String id = String.valueOf(presentationProvider.getId()); String stateName = stateItem.getStateString(); if (isLink(stateItem)) { return PREFIX + id + SEPARATOR + LINK + stateName; } return PREFIX + id + SEPARATOR + stateName; }
Source:
<code>void finishedWrite(String key, long length) throws MetadataPersistenceException { LOG.debug("Finished write to {}, len {}", key, length); Path p = keyToQualifiedPath(key); Preconditions.checkArgument(length >= 0, "content length is negative"); deleteUnnecessaryFakeDirectories(p.getParent()); try { if (hasMetadataStore()) { S3Guard.addAncestors(metadataStore, p, username); S3AFileStatus status = createUploadFileStatus(p, S3AUtils.objectRepresentsDirectory(key, length), length, getDefaultBlockSize(p), username); S3Guard.putAndReturn(metadataStore, status, instrumentation); } } catch (IOException e) { if (failOnMetadataWriteError) { throw new MetadataPersistenceException(p.toString(), e); } else { LOG.error("S3Guard: Error updating MetadataStore for write to {}:", <START> key, e); <END> } instrumentation.errorIgnored(); } }</code><technical_language>helpful change key -> p here, is reading error log qualified path? : end of message string is necessary</technical_language>

Target:
void finishedWrite(String key, long length) throws MetadataPersistenceException { LOG.debug("Finished write to {}, len {}", key, length); Path p = keyToQualifiedPath(key); Preconditions.checkArgument(length >= 0, "content length is negative"); deleteUnnecessaryFakeDirectories(p.getParent()); try { if (hasMetadataStore()) { S3Guard.addAncestors(metadataStore, p, username); S3AFileStatus status = createUploadFileStatus(p, S3AUtils.objectRepresentsDirectory(key, length), length, getDefaultBlockSize(p), username); S3Guard.putAndReturn(metadataStore, status, instrumentation); } } catch (IOException e) { if (failOnMetadataWriteError) { throw new MetadataPersistenceException(p.toString(), e); } else { LOG.error("S3Guard: Error updating MetadataStore for write to {}", p, e); } instrumentation.errorIgnored(); } }
Source:
<code>private <T extends Storable> List<T> getEntities(String response, Class<T> clazz) { List<T> entities = new ArrayList<>(); try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(response); Iterator<JsonNode> it = node.get("entities").elements(); while (it.hasNext()) { entities.add(mapper.treeToValue(it.next(), clazz)); } <START> while (it.hasNext()) { <END> entities.add(mapper.treeToValue(it.next(), clazz)); } } catch (Exception ex) { throw new RuntimeException(ex); } return entities; }</code><technical_language>Duplicated code. some copy/paste issue</technical_language>

Target:
private <T extends Storable> List<T> getEntities(String response, Class<T> clazz) { List<T> entities = new ArrayList<>(); try { ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readTree(response); Iterator<JsonNode> it = node.get("entities").elements(); while (it.hasNext()) { entities.add(mapper.treeToValue(it.next(), clazz)); } } catch (Exception ex) { throw new RuntimeException(ex); } return entities; }
Source:
<code>public SegmentPreIndexStatsCollector gatherStats(StatsCollectorConfig statsCollectorConfig) { try { RecordTransformer recordTransformer = CompositeTransformer .getDefaultTransformer(statsCollectorConfig.getTableConfig(), statsCollectorConfig.getSchema()); SegmentPreIndexStatsCollector collector = new SegmentPreIndexStatsCollectorImpl(statsCollectorConfig); collector.init(); ParallelRowProcessor prp = new ParallelRowProcessor( <START> _recordReader, <END> new InitRingBufferConsumer(recordTransformer, collector)); prp.Run(); collector.build(); return collector; } catch (Exception e) { LOGGER.error("Caught exception while gathering stats", e); Utils.rethrowException(e); return null; } }</code><technical_language>Pinot formatting</technical_language>

Target:
public SegmentPreIndexStatsCollector gatherStats(StatsCollectorConfig statsCollectorConfig) { try { RecordTransformer recordTransformer = CompositeTransformer .getDefaultTransformer(statsCollectorConfig.getTableConfig(), statsCollectorConfig.getSchema()); SegmentPreIndexStatsCollector collector = new SegmentPreIndexStatsCollectorImpl(statsCollectorConfig); collector.init(); CountDownLatch startupLatch = new CountDownLatch(1); ParallelRowProcessor parallelRowProcessor = new ParallelRowProcessor(_recordReader, new SegmentIndexStatsRingBufferConsumer(recordTransformer, collector, startupLatch)); parallelRowProcessor.run(startupLatch); collector.build(); return collector; } catch (Exception e) { LOGGER.error("Caught exception while gathering stats", e); Utils.rethrowException(e); return null; } }
Source:
<code>public static final URI getDocumentStructureFileEcoreURI(final IDocumentStructureGeneratorConfiguration generatorConfiguration, final String fileExtension, final String optionalVersionSuffix) { final String folderName = generatorConfiguration.getStructureFolder(); final StringBuilder documentNameBuilder = new StringBuilder(generatorConfiguration.getDocumentName()); if (null != <START> optionalVersionSuffix) { <END> documentNameBuilder.append(UNDERSCORE); documentNameBuilder.append(optionalVersionSuffix); } URI uri = URI.createURI(folderName); final String scheme = uri.scheme(); if (null != scheme && false == scheme.isEmpty()) { throw new UnsupportedOperationException("A such path for DocumentStructure is not supported: " + uri); } if (false == uri.isPlatform()) { final String projectName = generatorConfiguration.eResource().getURI().segment(1); uri = URI.createPlatformResourceURI(projectName, true).appendSegment(folderName); } if (uri.isPlatform()) { if (uri.isPlatformPlugin()) { Activator.log.warn(NLS.bind("The path {0} must not be a platform path", uri.toString())); return null; } return uri.appendSegment(documentNameBuilder.toString()).appendFileExtension(fileExtension); } return null; }</code><technical_language>test this field is empty</technical_language>

Target:
public static final URI getDocumentStructureFileEcoreURI(final IDocumentStructureGeneratorConfiguration generatorConfiguration, final String fileExtension, final String optionalVersionSuffix) { final String folderName = generatorConfiguration.getStructureFolder(); final StringBuilder documentNameBuilder = new StringBuilder(generatorConfiguration.getDocumentName()); if (null != optionalVersionSuffix && false == optionalVersionSuffix.isEmpty()) { documentNameBuilder.append(UNDERSCORE); documentNameBuilder.append(optionalVersionSuffix); } URI uri = URI.createURI(folderName); final String scheme = uri.scheme(); if (null != scheme && false == scheme.isEmpty()) { throw new UnsupportedOperationException("A such path for DocumentStructure is not supported: " + uri); } if (false == uri.isPlatform()) { final String projectName = generatorConfiguration.eResource().getURI().segment(1); uri = URI.createPlatformResourceURI(projectName, true).appendSegment(folderName); } if (uri.isPlatform()) { if (uri.isPlatformPlugin()) { Activator.log.warn(NLS.bind("The path {0} must not be a platform path", uri.toString())); return null; } return uri.appendSegment(documentNameBuilder.toString()).appendFileExtension(fileExtension); } return null; }
Source:
<code><START> public void next() throws IOException { <END> try { if (!hasTop) throw new IllegalStateException(); if (entriesLeft == 0) { currBlock.close(); if (metricsGatherer != null) metricsGatherer.startBlock(); if (iiter.hasNext()) { IndexEntry indexEntry = iiter.next(); entriesLeft = indexEntry.getNumEntries(); currBlock = getDataBlock(indexEntry); checkRange = range.afterEndKey(indexEntry.getKey()); if (!checkRange) hasTop = true; } else { rk = null; val = null; hasTop = false; return; } } prevKey = rk.getKey(); rk.readFields(currBlock); val.readFields(currBlock); if (metricsGatherer != null) metricsGatherer.addMetric(rk.getKey(), val); entriesLeft--; if (checkRange) hasTop = !range.afterEndKey(rk.getKey()); } catch (IOException ioe) { reset(); throw ioe; } }</code><technical_language>consolidation of next() _next() next()</technical_language>

Target:
public void next() throws IOException { try { _next(); } catch (IOException ioe) { reset(); throw ioe; } }
Source:
<code>public static void main(String args[]) { try { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties); dumpLogTool.doOperation(); } catch (Exception e) { <START> logger.error("Closed with exception ", e); <END> } }</code><technical_language>exception need caught</technical_language>

Target:
public static void main(String args[]) throws IOException, JSONException { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties); dumpLogTool.doOperation(); }
Source:
<code>private void testReadAndWriteDifferentRouters() { MongoDBShardedDeployment deployment = makeAndStartDeployment(); Iterator<Entity> routerIterator = deployment.getRouterCluster().getMembers().iterator(); <START> MongoDBRouter router1 = (MongoDBRouter)routerIterator.next(); <END> MongoDBRouter router2 = (MongoDBRouter)routerIterator.next(); String documentId = MongoDBTestHelper.insert(router1, "meaning-of-life", 42); DBObject docOut = MongoDBTestHelper.getById(router2, documentId); Assert.assertEquals(docOut.get("meaning-of-life"), 42); }</code><technical_language>do router1 = Iterables.get(deployment.getRouterCluster().getRouters(), 0)</technical_language>

Target:
private void testReadAndWriteDifferentRouters() { MongoDBShardedDeployment deployment = makeAndStartDeployment(); EntityTestUtils.assertAttributeEqualsEventually(deployment, Startable.SERVICE_UP, true); MongoDBRouter router1 = (MongoDBRouter) Iterables.get(deployment.getRouterCluster().getMembers(), 0); MongoDBRouter router2 = (MongoDBRouter) Iterables.get(deployment.getRouterCluster().getMembers(), 1); EntityTestUtils.assertAttributeEqualsEventually(router1, Startable.SERVICE_UP, true); EntityTestUtils.assertAttributeEqualsEventually(router2, Startable.SERVICE_UP, true); for (Entity entity : Iterables.filter(app.getManagementContext().getEntityManager().getEntitiesInApplication(app), AbstractMongoDBServer.class)) { EntityTestUtils.assertAttributeEqualsEventually(entity, Startable.SERVICE_UP, true); } String documentId = MongoDBTestHelper.insert(router1, "meaning-of-life", 42); DBObject docOut = MongoDBTestHelper.getById(router2, documentId); Assert.assertEquals(docOut.get("meaning-of-life"), 42); }
Source:
<code>public ResteasyClientBuilderImpl providerFactory(ResteasyProviderFactory providerFactory) { <START> withConfig(providerFactory); <END> return this; }</code><technical_language>convinced this. calling withConfig, effectively causing new allocations, contents provided providerFactory copied a new provider factory. Yes, a LocalResteasyProviderFactory, stuff copied, while current code, provided object is linked</technical_language>

Target:
public ResteasyClientBuilderImpl providerFactory(ResteasyProviderFactory providerFactory) { if (providerFactory instanceof LocalResteasyProviderFactory) { this.providerFactory = providerFactory; } else { this.providerFactory = new ResteasyProviderFactoryDelegate(providerFactory) { @Override public javax.ws.rs.RuntimeType getRuntimeType() { return RuntimeType.CLIENT; } }; } return this; }
Source:
<code>public <T> T getKeyAs(Class<T> keyClass) throws InvalidDataAccessApiUsageException, DataRetrievalFailureException { if (this.keyList.isEmpty()) { return null; } if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) { throw new InvalidDataAccessApiUsageException( "The getKey method should only be used when a single key is returned. " + "The current key entry contains multiple keys: " + this.keyList); } Iterator<Object> keyIter = this.keyList.get(0).values().iterator(); if (keyIter.hasNext()) { Object key = keyIter.next(); if (key == null) { return null; } if (!(keyClass.isAssignableFrom(key.getClass()))) { throw new DataRetrievalFailureException( "The generated key is not of a supported numeric type. " + "Unable to cast [" + key.getClass().getName() + "] to [" + keyClass.getName() + "]"); } return keyClass.cast(key); <START> } else { <END> throw new DataRetrievalFailureException("Unable to retrieve the generated key. " + "Check that the table has an identity column enabled."); } }</code><technical_language>In line Spring's [code style](<LINK_0>, please ensure else statements next line</technical_language>

Target:
public <T> T getKeyAs(Class<T> keyClass) throws InvalidDataAccessApiUsageException, DataRetrievalFailureException { if (this.keyList.isEmpty()) { return null; } if (this.keyList.size() > 1 || this.keyList.get(0).size() > 1) { throw new InvalidDataAccessApiUsageException( "The getKey method should only be used when a single key is returned. " + "The current key entry contains multiple keys: " + this.keyList); } Iterator<Object> keyIter = this.keyList.get(0).values().iterator(); if (keyIter.hasNext()) { Object key = keyIter.next(); if (key == null || !(keyClass.isAssignableFrom(key.getClass()))) { throw new DataRetrievalFailureException( "The generated key is not of a supported type. " + "Unable to cast [" + (key != null ? key.getClass().getName() : null) + "] to [" + keyClass.getName() + "]"); } return keyClass.cast(key); } else { throw new DataRetrievalFailureException("Unable to retrieve the generated key. " + "Check that the table has an identity column enabled."); } }
Source:
<code><START> public void loadMembers(SampleTissue target, SampleTissue source) throws IOException { <END> if (source.getTissueOrigin() != null) { target.setTissueOrigin(tissueOriginDao.getTissueOrigin(source.getTissueOrigin().getId())); ServiceUtils.throwIfNull(target.getTissueOrigin(), "SampleAdditionalInfo.tissueOriginId", source.getTissueOrigin().getId()); } if (source.getTissueType() != null) { target.setTissueType(tissueTypeDao.getTissueType(source.getTissueType().getId())); ServiceUtils.throwIfNull(target.getTissueType(), "SampleAdditionalInfo.tissueTypeId", source.getTissueType().getId()); } if (source.getLab() != null) { target.setLab(labService.get(source.getLab().getId())); ServiceUtils.throwIfNull(target.getLab(), "sampleAdditionalInfo.labId", source.getLab().getId()); } }</code><technical_language>tissueMaterial missing</technical_language>

Target:
public void loadMembers(SampleTissue target, SampleTissue source) throws IOException { if (source.getTissueOrigin() != null) { target.setTissueOrigin(tissueOriginDao.getTissueOrigin(source.getTissueOrigin().getId())); ServiceUtils.throwIfNull(target.getTissueOrigin(), "SampleAdditionalInfo.tissueOriginId", source.getTissueOrigin().getId()); } if (source.getTissueType() != null) { target.setTissueType(tissueTypeDao.getTissueType(source.getTissueType().getId())); ServiceUtils.throwIfNull(target.getTissueType(), "SampleAdditionalInfo.tissueTypeId", source.getTissueType().getId()); } if (source.getLab() != null) { target.setLab(labService.get(source.getLab().getId())); ServiceUtils.throwIfNull(target.getLab(), "sampleAdditionalInfo.labId", source.getLab().getId()); } if (source.getTissueMaterial() != null) { target.setTissueMaterial(tissueMaterialService.get(source.getTissueMaterial().getId())); } }
Source:
<code><START> public List<DataRecord> getAllMetadataRecords(String prefix) { <END> return null; }</code><technical_language>Need implement</technical_language>

Target:
public List<DataRecord> getAllMetadataRecords(String prefix) { Set<DataRecord> records = Sets.newHashSet(); Iterator<DataStore> iter = delegateHandler.getAllDelegatesIterator(); while (iter.hasNext()) { DataStore ds = iter.next(); if (ds instanceof SharedDataStore) { records.addAll(((SharedDataStore) ds).getAllMetadataRecords(prefix)); } } return Lists.newArrayList(records); }
Source:
<code>private void hideCCPopUp() { <START> try { <END> if (ccFragment != null && ccFragment.isVisible()) { ccFragment.dismiss(); } } catch (Exception e) { logger.error(e); } }</code><technical_language>need of try-catch</technical_language>

Target:
private void hideCCPopUp() { if (ccFragment != null && ccFragment.isVisible()) { ccFragment.dismiss(); } }
Source:
<code>public ResponseEntity<Map<String, Object>> getDonationsForTestBatch(@PathVariable Long id, @RequestParam(value = "bloodTypingMatchStatus", required = false) BloodTypingMatchStatus bloodTypingMatchStatus) { TestBatch testBatch = testBatchRepository.findTestBatchById(id); List<DonationSummaryViewModel> donationSummaryViewModels = new ArrayList<>(); for (DonationBatch donationBatch : testBatch.getDonationBatches()) { for (Donation donation : donationBatch.getDonations()) { if (bloodTypingMatchStatus == null || donation.getBloodTypingMatchStatus().equals(bloodTypingMatchStatus)) { donationSummaryViewModels.add(new DonationSummaryViewModel(donation, false, false, false)); } } } Map<String, Object> map = new HashMap<String, Object>(); map.put("donations", donationSummaryViewModels); <START> map.put("testBatchCreatedDate", testBatch.getCreatedDate()); <END> map.put("donationsNumber", donationSummaryViewModels.size()); return new ResponseEntity<>(map, HttpStatus.OK); }</code><technical_language>I noticed reviewing frontend code this date is a millisecond instead of a string do. Please CustomDateFormatter</technical_language>

Target:
public ResponseEntity<Map<String, Object>> getDonationsForTestBatch(@PathVariable Long id, @RequestParam(value = "bloodTypingMatchStatus", required = false) BloodTypingMatchStatus bloodTypingMatchStatus) { TestBatch testBatch = testBatchRepository.findTestBatchById(id); List<DonationSummaryViewModel> donationSummaryViewModels = donationSummaryViewModelFactory.createDonationSummaryViewModels(testBatch, bloodTypingMatchStatus); Map<String, Object> map = new HashMap<String, Object>(); map.put("donations", donationSummaryViewModels); map.put("testBatchCreatedDate", CustomDateFormatter.format(testBatch.getCreatedDate())); map.put("numberOfDonations", donationSummaryViewModels.size()); return new ResponseEntity<>(map, HttpStatus.OK); }
Source:
<code>public ITmfContext seekEvent(ITmfLocation location) { if (fFile == null) { return INVALID_CONTEXT; } final TmfContext context = new TmfContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK); if (NULL_LOCATION.equals(location)) { return context; } try { if (location == null) { fFileInput.seek(0); long lineStartOffset = fFileInput.getFilePointer(); @Nullable String line = fFileInput.readLine(); Matcher matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); <START> while (!matcher.matches() && line != null) { <END> lineStartOffset = fFileInput.getFilePointer(); line = fFileInput.readLine(); if (line == null) { break; } matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); } fFileInput.seek(lineStartOffset); } else if (location.getLocationInfo() instanceof Long) { fFileInput.seek((Long) location.getLocationInfo()); } context.setLocation(new TmfLongLocation(fFileInput.getFilePointer())); context.setRank(0); return context; } catch (final FileNotFoundException e) { Activator.getInstance().logError("Error seeking event. File not found: " + getPath(), e); return context; } catch (final IOException e) { Activator.getInstance().logError("Error seeking event. File: " + getPath(), e); return context; } }</code><technical_language>I put null check matcher line remove this null</technical_language>

Target:
public ITmfContext seekEvent(ITmfLocation location) { if (fFile == null) { return INVALID_CONTEXT; } final TmfContext context = new TmfContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK); if (NULL_LOCATION.equals(location)) { return context; } try { if (location == null) { fFileInput.seek(0); long lineStartOffset = fFileInput.getFilePointer(); @Nullable String line = fFileInput.readLine(); Matcher matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); while (line != null && !matcher.matches()) { lineStartOffset = fFileInput.getFilePointer(); line = fFileInput.readLine(); if (line == null) { break; } matcher = IGenericFtraceConstants.FTRACE_PATTERN.matcher(line); } fFileInput.seek(lineStartOffset); } else if (location.getLocationInfo() instanceof Long) { fFileInput.seek((Long) location.getLocationInfo()); } context.setLocation(new TmfLongLocation(fFileInput.getFilePointer())); context.setRank(0); return context; } catch (final FileNotFoundException e) { Activator.getInstance().logError("Error seeking event. File not found: " + getPath(), e); return context; } catch (final IOException e) { Activator.getInstance().logError("Error seeking event. File: " + getPath(), e); return context; } }
Source:
<code>private void showAppSettingSnackbar() { Snackbar snackbar = FeedbackUtil.makeSnackbar(this, getString(R.string.offline_read_final_rationale), FeedbackUtil.LENGTH_DEFAULT); <START> snackbar.setAction(getString(R.string.app_settings).toUpperCase(), (v) <END> -> goToSettings()); snackbar.show(); }</code><technical_language>snackbar action is uppercased automatically</technical_language>

Target:
private void showAppSettingSnackbar() { Snackbar snackbar = FeedbackUtil.makeSnackbar(this, getString(R.string.offline_read_final_rationale), FeedbackUtil.LENGTH_DEFAULT); snackbar.setAction(R.string.app_settings, (v) -> goToSystemAppSettings()); snackbar.show(); }