auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean canDeleteSegment(PBDSegment segment) throws IOException { for (ReadCursor cursor : m_readCursors.values()) { if (cursor.m_segment != null && (cursor.m_segment.segmentId() >= segment.segmentId())) { PBDSegmentReader segmentReader = segment.getReader(cursor.m_cursorId); if (cursor.m_segment.segmentId() == segment.segmentId()) { if (segmentReader == null) segmentReader = segment.openForRead(cursor.m_cursorId); } if (segmentReader != null) { if (!segmentReader.allReadAndDiscarded()) return false; } } else { return false; } } return true; }

Target:
private boolean canDeleteSegment(PBDSegment segment) throws IOException { for (ReadCursor cursor : m_readCursors.values()) { if (cursor.m_segment != null && (cursor.m_segment.segmentId() >= segment.segmentId())) { PBDSegmentReader segmentReader = segment.getReader(cursor.m_cursorId); if (segmentReader == null) { assert(cursor.m_segment.segmentId() == segment.segmentId()); segmentReader = segment.openForRead(cursor.m_cursorId); } if (!segmentReader.allReadAndDiscarded()) return false; } else { return false; } } return true; }
Source:
protected AbstractControllerService(final ProcessType processType, final RunningModeControl runningModeControl, final ConfigurationPersister configurationPersister, final ControlledProcessState processState, final ResourceDefinition rootResourceDefinition, final OperationStepHandler prepareStep, final ExpressionResolver expressionResolver, final ManagedAuditLogger auditLogger, final DelegatingConfigurableAuthorizer authorizer, final BootErrorCollector bootErrorCollector) { this(processType, runningModeControl, configurationPersister, processState, rootResourceDefinition, null, prepareStep, expressionResolver, auditLogger, authorizer, bootErrorCollector); }

Target:
protected AbstractControllerService(final ProcessType processType, final RunningModeControl runningModeControl, final ConfigurationPersister configurationPersister, final ControlledProcessState processState, final ResourceDefinition rootResourceDefinition, final OperationStepHandler prepareStep, final ExpressionResolver expressionResolver, final ManagedAuditLogger auditLogger, final DelegatingConfigurableAuthorizer authorizer, final BootErrorCollector bootErrorCollector) { this(processType, runningModeControl, configurationPersister, processState, rootResourceDefinition, null, prepareStep, expressionResolver, auditLogger, authorizer); }
Source:
public void withOdbc(final Command command, final String name) { withDependencies( "Preparing " + name, "Using " + name, new Dependency[] { Dependency.cranPackage("odbc", "1.1.5", true) }, true, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) command.execute(); } } ); }

Target:
public void withOdbc(final Command command, final String name) { withDependencies( "Preparing " + name, "Using " + name, new Dependency[] { Dependency.cranPackage("odbc", "1.1.5") }, true, new CommandWithArg<Boolean>() { @Override public void execute(Boolean succeeded) { if (succeeded) command.execute(); } } ); }
Source:
public void convertAndAdd(final CommonProfile profile, final AttributeLocation attributeLocation, final String name, final Object value) { if (value != null) { final Object convertedValue; final AttributeConverter<? extends Object> converter = this.converters.get(name); if (converter != null) { convertedValue = converter.convert(value); if (convertedValue != null) { logger.debug("converted to => key: / value: / {}", name, convertedValue, convertedValue.getClass()); } } else { convertedValue = value; logger.debug("no conversion => key: / value: / {}", name, convertedValue, convertedValue.getClass()); } switch (attributeLocation) { case PROFILE_ATTRIBUTE: profile.addAttribute(name, convertedValue); break; case AUTHENTICATION_ATTRIBUTE: profile.addAuthenticationAttribute(name, convertedValue); break; default: logger.debug("Unsupported attribute location {}.", attributeLocation); break; } } }

Target:
public void convertAndAdd(final CommonProfile profile, final AttributeLocation attributeLocation, final String name, final Object value) { if (value != null) { final Object convertedValue; final AttributeConverter<? extends Object> converter = this.converters.get(name); if (converter != null) { convertedValue = converter.convert(value); if (convertedValue != null) { logger.debug("converted to => key: / value: / {}", name, convertedValue, convertedValue.getClass()); } } else { convertedValue = value; logger.debug("no conversion => key: / value: / {}", name, convertedValue, convertedValue.getClass()); } if (attributeLocation.equals(AUTHENTICATION_ATTRIBUTE)) { profile.addAuthenticationAttribute(name, convertedValue); } else { profile.addAttribute(name, convertedValue); } } }
Source:
public void run() { log.info("Starting v2 pipeline template source to artifact migration"); Predicate<Pipeline> hasV2TemplateSource = p -> { Map<String, Object> template = (Map<String, Object>) p.getOrDefault("template", null); if (template == null) { return false; } String schema = (String) p.getOrDefault("schema", ""); return schema.equals("v2") && isTemplateSource(template) && StringUtils.isNotEmpty((String) template.getOrDefault("source", "")); }; pipelineDAO.all().stream() .filter(hasV2TemplateSource) .forEach(pipeline -> migrate(pipelineDAO, pipeline)); }

Target:
public void run() { log.info("Starting v2 pipeline template source to artifact migration"); Predicate<Pipeline> hasV2TemplateSource = p -> { Map<String, Object> template = (Map<String, Object>) p.get("template"); if (template == null) { return false; } String schema = (String) p.getOrDefault("schema", ""); return schema.equals("v2") && isTemplateSource(template) && StringUtils.isNotEmpty((String) template.getOrDefault("source", "")); }; pipelineDAO.all().stream() .filter(hasV2TemplateSource) .forEach(pipeline -> migrate(pipelineDAO, pipeline)); }
Source:
public void testSyncInOut() throws Exception { String routeId = "testSyncInOnlyExceptionRoute"; RouteBuilder builder = new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").routeId(routeId) .setBody(simple("${body.getParameter(\"request\")}")) .to("mock:result"); } }; context.addRoutes(builder); try { ServiceRegistry.get().register("GlobalCamelService", context); String expectedBody = "helloRequest"; resultEndpoint.expectedBodiesReceived(expectedBody); WorkItemImpl workItem = new WorkItemImpl(); workItem.setParameter("camel-endpoint-id", "start"); workItem.setParameter("request", expectedBody); TestWorkItemManager manager = new TestWorkItemManager(); AbstractCamelWorkItemHandler handler = new InOutCamelWorkItemHandler(); handler.executeWorkItem(workItem, manager); assertThat(manager.getResults().size(), equalTo(1)); resultEndpoint.assertIsSatisfied(); } finally { context.removeRoute(routeId); } }

Target:
public void testSyncInOut() throws Exception { String routeId = "testSyncInOnlyExceptionRoute"; RouteBuilder builder = new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").routeId(routeId) .setBody(simple("${body.getParameter(\"Request\")}")) .to("mock:result"); } }; context.addRoutes(builder); try { ServiceRegistry.get().register(JBPMConstants.GLOBAL_CAMEL_CONTEXT_SERVICE_KEY, context); String expectedBody = "helloRequest"; resultEndpoint.expectedBodiesReceived(expectedBody); WorkItemImpl workItem = new WorkItemImpl(); workItem.setParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM, "start"); workItem.setParameter("Request", expectedBody); TestWorkItemManager manager = new TestWorkItemManager(); AbstractCamelWorkItemHandler handler = new InOutCamelWorkItemHandler(); handler.executeWorkItem(workItem, manager); assertThat(manager.getResults().size(), equalTo(1)); resultEndpoint.assertIsSatisfied(); } finally { context.removeRoute(routeId); } }
Source:
private static Druids.ScanQueryBuilder basicB(final BenchmarkSchemaInfo basicSchema) { final QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec(Collections.singletonList(basicSchema.getDataInterval())); final List<String> dimUniformFilterVals = new ArrayList<>(); 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); }

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:
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 (shouldRefreshEntityList()) { lastDisplayedLocation = location; entitySelectActivity.onEvalLocationChanged(); } }

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:
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) { for (int id : obfuscate) { if (id == i) { param="*****"; break; } } } args.add(param); } return args; }

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:
public boolean subscribe(String topic, String filter, EventHandler eventHandler, boolean headless) { BundleContext bundleContext = Activator.getDefault().getBundleContext(); 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; }

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:
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(); if (hits == null || hits.length == 0) { return false; } return true; }

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:
public void readAllItemsByPageWithCosmosPagedFluxHandler() throws Exception { CosmosQueryRequestOptions cosmosQueryRequestOptions = new CosmosQueryRequestOptions(); CosmosPagedFlux<InternalObjectNode> cosmosPagedFlux = 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); }

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:
public String toString() { StringBuffer sb = new StringBuffer(); sb.append("PartitionedRegionClearReplyMessage ").append("processorid=") .append(this.processorId) .append(" bucketsCleared ").append(this.bucketsCleared).append(" exception=") .append(getException()); return sb.toString(); }

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:
private void showWindow() { window = new Window(windowTitle); window.setSizeFull(); Embedded embedded = new Embedded(); embedded.setSizeFull(); embedded.setType(Embedded.TYPE_BROWSER); streamResource.setMIMEType("application/pdf"); embedded.setSource(streamResource); window.setContent(embedded); getUI().getCurrent().addWindow(window); }

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:
public final <M, T> 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; }

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:
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(); } catch (PersistenceException e) { LOGGER.warn("Persist attachment for owner met an exception", e); throw new MailboxException(" Store attachment for owner " + owner.getValue() + " failed", e); } }

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:
public boolean update(Address addressRecord) { LOG.trace("AddressDAO.update() - Begin"); boolean result = true; if (addressRecord != null) { result = super.update(addressRecord); } LOG.trace("AddressDAO.update() - End"); return result; }

Target:
public boolean update(Address addressRecord) { LOG.trace("AddressDAO.update()"); return addressRecord != null ? super.update(addressRecord) : true; }
Source:
public static void setUp() { ITmfTrace trace = KERNEL_TEST_CASE.getKernelTrace(); deleteSuppFiles(trace); ((TmfTrace) trace).traceOpened(new TmfTraceOpenedSignal(null, 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; }

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:
public Flux<String> deleteByIdsAsync(Collection<String> ids) { if (ids == null || ids.isEmpty()) { return Flux.empty(); } 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])); }

Target:
public Flux<String> deleteByIdsAsync(Collection<String> ids) { return BatchDeletionImpl.deleteByIdsAsync(ids, this::deleteInnerAsync); }
Source:
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) { } 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; }

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:
public void afterRegionClear(RegionEvent event) { Region region = event.getRegion(); clears.incrementAndGet(); }

Target:
public void afterRegionClear(RegionEvent event) { clears.incrementAndGet(); }
Source:
public Map<Long, String> getAllStudiesIdAndUid() throws CatalogDBException { return studyDBAdaptor.getAllStudiesIdAndUid(); }

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:
public void testVFE4() { try { T_iget_char_6 t = new T_iget_char_6(); t.run(); fail("expected an IllegalAccessError exception"); } catch (IllegalAccessError t) { } }

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

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:
public ResponseInfo replace(ByteBuf content) { ResponseInfo info = new ResponseInfo(requestInfo, error, content, dataNode); return info; }

Target:
public ResponseInfo replace(ByteBuf content) { return new ResponseInfo(requestInfo, error, content, dataNode); }
Source:
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) { tabbedPanel.setSelectedIndex(2); setPresenterType(2); } } }); }

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:
private void electionAndSetCurVote() { reconfigFlagClear(); if (shuttingDownLE) { startLeaderElection(); } try { setCurrentVote(makeLEStrategy().lookForLeader()); } catch (Exception e) { LOG.warn("Unexpected exception", e); setPeerState(ServerState.LOOKING); } }

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:
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) { logger.error("Error occurred while validating the API response", e); } return true; }

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:
private static String getPath(ITimeGraphPresentationProvider presentationProvider, StateItem stateItem) { String stateTypeName = String.valueOf(presentationProvider.getId()); String stateName = stateItem.getStateString(); if (isLink(stateItem)) { return PREFIX + stateTypeName + SEPARATOR + LINK + stateName; } return PREFIX + stateTypeName + SEPARATOR + stateName; }

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:
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 {}:", key, e); } instrumentation.errorIgnored(); } }

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:
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)); } while (it.hasNext()) { entities.add(mapper.treeToValue(it.next(), clazz)); } } catch (Exception ex) { throw new RuntimeException(ex); } return entities; }

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:
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( _recordReader, 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; } }

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:
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) { 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; }

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:
public void next() throws IOException { 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; } }

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

Target:
public static void main(String args[]) throws IOException, JSONException { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties); dumpLogTool.doOperation(); }
Source:
private void testReadAndWriteDifferentRouters() { MongoDBShardedDeployment deployment = makeAndStartDeployment(); Iterator<Entity> routerIterator = deployment.getRouterCluster().getMembers().iterator(); MongoDBRouter router1 = (MongoDBRouter)routerIterator.next(); 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); }

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:
public ResteasyClientBuilderImpl providerFactory(ResteasyProviderFactory providerFactory) { withConfig(providerFactory); return this; }

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:
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); } else { throw new DataRetrievalFailureException("Unable to retrieve the generated key. " + "Check that the table has an identity column enabled."); } }

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:
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()); } }

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:
public List<DataRecord> getAllMetadataRecords(String prefix) { return null; }

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:
private void hideCCPopUp() { try { if (ccFragment != null && ccFragment.isVisible()) { ccFragment.dismiss(); } } catch (Exception e) { logger.error(e); } }

Target:
private void hideCCPopUp() { if (ccFragment != null && ccFragment.isVisible()) { ccFragment.dismiss(); } }
Source:
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); map.put("testBatchCreatedDate", testBatch.getCreatedDate()); map.put("donationsNumber", donationSummaryViewModels.size()); return new ResponseEntity<>(map, HttpStatus.OK); }

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); }