auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText; Object symbol = calledFunction.getSymbol(); if (symbol instanceof Long) { Long longAddress = (Long) symbol; Collection<ISymbolProvider> providers = SymbolProviderManager.getInstance().getSymbolProviders(trace); symbolText = providers.stream().map(p -> p.getSymbolText(longAddress)) .filter(s -> s != null) .findFirst().orElse(null); if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } long time = segment.getStart(); int pid = calledFunction.getProcessId(); if (pid > 0) { String text = providers.stream().map(p -> p.getSymbolText(pid, time, longAddress)) .filter(s -> s != null) .findFirst().orElse(null); if (text != null) { return text; } } return symbolText; } return String.valueOf(symbol); } } return null; }

Target:
public @Nullable Object resolve(@NonNull ISegment segment) { if (segment instanceof ICalledFunction) { ICalledFunction calledFunction = (ICalledFunction) segment; ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace(); if (trace != null) { String symbolText = null; Object symbol = calledFunction.getSymbol(); if (symbol instanceof Long) { Long longAddress = (Long) symbol; Collection<ISymbolProvider> providers = SymbolProviderManager.getInstance().getSymbolProviders(trace); for (ISymbolProvider provider: providers) { symbolText = provider.getSymbolText(longAddress); if (symbolText != null) { break; } } if (symbolText == null) { return "0x" + Long.toHexString(longAddress); } long time = segment.getStart(); int pid = calledFunction.getProcessId(); if (pid > 0) { for (ISymbolProvider provider: providers) { String text = provider.getSymbolText(pid, time, longAddress); if (text != null) { return text; } } } return symbolText; } return String.valueOf(symbol); } } return null; }
Source:
private void accumulateSlowOperationTracking(String actionName, Stopwatch stopwatch, Optional<Exception> failure) { if (stopwatchDescribesSlowOperation(stopwatch)) { slowestOperation.accumulateAndGet( Optional.of(ImmutableActionProfile.of(actionName, stopwatch.elapsed(), failure)), (existing, update) -> !existing.isPresent() || existing.get().duration().compareTo(stopwatch.elapsed()) < 0 ? update : existing); } }

Target:
private void accumulateSlowOperationTracking(String actionName, Stopwatch stopwatch, Optional<Exception> failure) { if (stopwatchDescribesSlowOperation(stopwatch)) { slowestOperation.accumulateAndGet( Optional.of(ImmutableActionProfile.of(actionName, stopwatch.elapsed(), failure)), (existing, update) -> { if (!existing.isPresent()) { return update; } return existing.get().duration().compareTo(stopwatch.elapsed()) < 0 ? update : existing; }); } }
Source:
private int getGaugeValueForTimeLockResource(String gaugeName) { Object value = Optional.ofNullable(metricsManager.getRegistry() .getGauges() .get(new StringJoiner(".").add(TimeLockResource.class.getCanonicalName()) .add(gaugeName) .toString()) .getValue()) .orElseThrow(() -> new IllegalStateException("Gauge with gauge name " + gaugeName + " did not exist.")); return (int) value; }

Target:
private int getGaugeValueForTimeLockResource(String gaugeName) { Object value = Optional.ofNullable(metricsManager.getRegistry() .getGauges() .get(TimeLockResource.class.getCanonicalName() + "." + gaugeName) .getValue()) .orElseThrow(() -> new IllegalStateException("Gauge with gauge name " + gaugeName + " did not exist.")); return (int) value; }
Source:
public CEPOperatorsDropdown getNewOperatorDropdown(String[] operators, SingleFieldConstraint constraint) { return new CEPOperatorsDropdown(operators, constraint); }

Target:
CEPOperatorsDropdown getNewOperatorDropdown(String[] operators, SingleFieldConstraint constraint) { return new CEPOperatorsDropdown(operators, constraint); }
Source:
private IdentifiedUser(final AccessPath accessPath, final AuthConfig authConfig, final Provider<String> canonicalUrl, final Realm realm, final AccountCache accountCache, final StarredChangesCache starredChangesCache, @Nullable final Provider<SocketAddress> remotePeerProvider, @Nullable final Provider<ReviewDb> dbProvider, final Account.Id id) { super(accessPath, authConfig); this.canonicalUrl = canonicalUrl; this.realm = realm; this.accountCache = accountCache; this.remotePeerProvider = remotePeerProvider; this.dbProvider = dbProvider; this.accountId = id; this.starredChangesCache = starredChangesCache; }

Target:
private IdentifiedUser(final AccessPath accessPath, final AuthConfig authConfig, final Provider<String> canonicalUrl, final Realm realm, final AccountCache accountCache, final StarredChangesCache starredChangesCache, @Nullable final Provider<SocketAddress> remotePeerProvider, @Nullable final Provider<ReviewDb> dbProvider, final Account.Id id) { super(accessPath, authConfig); this.canonicalUrl = canonicalUrl; this.realm = realm; this.accountCache = accountCache; this.starredChangesCache = starredChangesCache; this.remotePeerProvider = remotePeerProvider; this.dbProvider = dbProvider; this.accountId = id; }
Source:
public void onIdealStateChange(List<IdealState> idealState, NotificationContext changeContext) throws InterruptedException { if (!idealStateInitialized.get()) { logger.info("Received initial notification for IdealState change from {}", dcName); idealStateInitialized.set(true); } else { logger.info("IdealState change triggered from {}", dcName); } logger.debug("Detailed ideal states in are: {}", dcName, idealState); ConcurrentHashMap<String, String> partitionToResourceMap = new ConcurrentHashMap<>(); for (IdealState state : idealState) { String resourceName = state.getResourceName(); state.getPartitionSet().forEach(partitionName -> partitionToResourceMap.put(partitionName, resourceName)); } partitionNameToResource = partitionToResourceMap; helixClusterManagerMetrics.idealStateChangeTriggerCount.inc(); }

Target:
public void onIdealStateChange(List<IdealState> idealState, NotificationContext changeContext) { if (!idealStateInitialized) { logger.info("Received initial notification for IdealState change from {}", dcName); idealStateInitialized = true; } else { logger.info("IdealState change triggered from {}", dcName); } logger.debug("Detailed ideal states in are: {}", dcName, idealState); ConcurrentHashMap<String, String> partitionToResourceMap = new ConcurrentHashMap<>(); for (IdealState state : idealState) { String resourceName = state.getResourceName(); state.getPartitionSet().forEach(partitionName -> partitionToResourceMap.put(partitionName, resourceName)); } partitionNameToResource = partitionToResourceMap; helixClusterManagerMetrics.idealStateChangeTriggerCount.inc(); }
Source:
private static <K, V> V get(LoadingCache<K, V> cache, K key) { try { return cache.getUnchecked(key); } catch (UncheckedExecutionException e) { throwIfUnchecked(e.getCause()); throw e; } }

Target:
private static <K, V> V get(LoadingCache<K, V> cache, K key) { try { return cache.getUnchecked(key); } catch (UncheckedExecutionException e) { throwIfInstanceOf(e.getCause(), PrestoException.class); throw e; } }
Source:
private static DefaultCharset initializeDefaultCharsetSingleton() { Charset charset = Charset.defaultCharset(); String declaredCharsetName = System.getProperty(Constants.CLIENT_OPTION_CHARSET); if(declaredCharsetName != null && !declaredCharsetName.isEmpty()) { charset = Charset.forName(declaredCharsetName); } return new DefaultCharset(charset); }

Target:
private static DefaultCharset initializeDefaultCharsetSingleton() { Charset charset; final Charset systemDefault = Charset.defaultCharset(); final String declaredCharsetName = System.getProperty(Constants.CLIENT_OPTION_CHARSET); if (declaredCharsetName != null && !declaredCharsetName.isEmpty()) { try { charset = Charset.forName(declaredCharsetName); } catch (Exception ex) { charset = systemDefault; logger.warn("Requested charset '{}' is not available, the default charset '{}' will be used", declaredCharsetName, charset.name()); } } else { logger.info("No desired charset found in system properties, the default charset '{}' will be used", systemDefault.name()); charset = systemDefault; } return new DefaultCharset(charset); }
Source:
protected boolean isEnabled() { return fFormatBlocks; }

Target:
protected boolean isEnabled() { boolean formatBlocks = false; if (fProject == null) { formatBlocks = DefaultCodeFormatterConstants.TRUE .equals(CCorePlugin.getOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_BLOCK)); } else { formatBlocks = DefaultCodeFormatterConstants.TRUE .equals(fProject.getOption(DefaultCodeFormatterConstants.FORMATTER_COMMENT_BLOCK, true)); } return formatBlocks; }
Source:
private List<CertifiedProductSearchDetails> getCertifiedProductDetailsForAll( final List<CertifiedProductFlatSearchResult> certifiedProducts) { List<CertifiedProductSearchDetails> details = new ArrayList<CertifiedProductSearchDetails>(); List<Future<CertifiedProductSearchDetails>> futures = new ArrayList<Future<CertifiedProductSearchDetails>>(); for (CertifiedProductFlatSearchResult certifiedProduct : certifiedProducts) { try { futures.add(cpsdAsync.getCertifiedProductDetail(certifiedProduct.getId(), certifiedProductDetailsManager)); } catch (EntityRetrievalException e) { LOGGER.error("Could not retrieve certified product details for id: " + certifiedProduct.getId(), e); } } Date startTime = new Date(); for (Future<CertifiedProductSearchDetails> future : futures) { try { CertifiedProductSearchDetails currDetails = future.get(); details.add(future.get()); } catch (InterruptedException | ExecutionException e) { LOGGER.error("Could not retrieve certified product details for unknown id.", e); } } Date endTime = new Date(); LOGGER.info("Time to retrieve details: " + (endTime.getTime() - startTime.getTime())); return details; }

Target:
private List<CertifiedProductSearchDetails> getCertifiedProductDetailsForAll( final List<CertifiedProductFlatSearchResult> certifiedProducts) { List<CertifiedProductSearchDetails> details = new ArrayList<CertifiedProductSearchDetails>(); List<Future<CertifiedProductSearchDetails>> futures = new ArrayList<Future<CertifiedProductSearchDetails>>(); for (CertifiedProductFlatSearchResult certifiedProduct : certifiedProducts) { try { futures.add(cpsdAsync.getCertifiedProductDetail(certifiedProduct.getId(), certifiedProductDetailsManager)); } catch (EntityRetrievalException e) { LOGGER.error("Could not retrieve certified product details for id: " + certifiedProduct.getId(), e); } } Date startTime = new Date(); for (Future<CertifiedProductSearchDetails> future : futures) { try { details.add(future.get()); } catch (InterruptedException | ExecutionException e) { LOGGER.error("Could not retrieve certified product details for unknown id.", e); } } Date endTime = new Date(); LOGGER.info("Time to retrieve details: " + (endTime.getTime() - startTime.getTime())); return details; }
Source:
private static ImmutableList<Arguments> getOptionalArgs(final Ds3Request ds3Request) { final ImmutableList.Builder<Arguments> optionalArgsBuilder = ImmutableList.builder(); LOG.debug("Getting optional args..."); if (ds3Request.getOptionalQueryParams() == null) { return optionalArgsBuilder.build(); } for (final Ds3Param ds3Param : ds3Request.getOptionalQueryParams()) { final String paramType = ds3Param.getType().substring(ds3Param.getType().lastIndexOf(".") + 1); optionalArgsBuilder.add(new Arguments(paramType, ds3Param.getName())); } return optionalArgsBuilder.build(); }

Target:
private static ImmutableList<Arguments> getOptionalArgs(final Ds3Request ds3Request) { final ImmutableList.Builder<Arguments> optionalArgsBuilder = ImmutableList.builder(); LOG.debug("Getting optional args..."); if (ConverterUtil.isEmpty(ds3Request.getOptionalQueryParams())) { return optionalArgsBuilder.build(); } for (final Ds3Param ds3Param : ds3Request.getOptionalQueryParams()) { final String paramType = ds3Param.getType().substring(ds3Param.getType().lastIndexOf(".") + 1); optionalArgsBuilder.add(new Arguments(paramType, ds3Param.getName())); } return optionalArgsBuilder.build(); }
Source:
public static void initTrace(Optional<Boolean> isObservable, String traceId) { boolean observable = isObservable.or(sampler.sample()); currentTrace.set(new Trace(observable, traceId)); }

Target:
public static void initTrace(Optional<Boolean> isObservable, String traceId) { validateId(traceId, "traceId must be non-empty: %s"); boolean observable = isObservable.or(sampler.sample()); currentTrace.set(new Trace(observable, traceId)); }
Source:
private void setupArtifactInfo(Artifact artifact, XWidgetRendererItem xWidgetLayoutData, XWidget xWidget) { if (artifact == null) { return; } if (xWidget instanceof IAttributeWidget) { try { String storeName = xWidgetLayoutData.getStoreName(); if (!Strings.isValid(storeName)) { return; } AttributeTypeToken attributeType = AttributeTypeManager.getType(storeName); ((IAttributeWidget) xWidget).setAttributeType(artifact, attributeType); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } else if (xWidget instanceof IArtifactWidget) { try { ((IArtifactWidget) xWidget).setArtifact(artifact); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }

Target:
private void setupArtifactInfo(Artifact artifact, XWidgetRendererItem xWidgetLayoutData, XWidget xWidget) { if (artifact == null) { return; } if (xWidget instanceof IAttributeWidget) { try { AttributeTypeToken attributeType = AttributeTypeManager.getType(xWidgetLayoutData.getStoreName()); ((IAttributeWidget) xWidget).setAttributeType(artifact, attributeType); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } else if (xWidget instanceof IArtifactWidget) { try { ((IArtifactWidget) xWidget).setArtifact(artifact); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }
Source:
public GatewayResponse capture(CaptureGatewayRequest request) { return epdqCaptureHandler.capture(request); }

Target:
public GatewayResponse<BaseCaptureResponse> capture(CaptureGatewayRequest request) { return epdqCaptureHandler.capture(request); }
Source:
protected static void alignRead(BitBuffer input, IDeclaration declaration) { int align = (int) declaration.getAlignment(); int pos = input.position(); int mask = align - 1; if( (pos & mask) == 0 ) { return ; } pos = (pos + mask) & ~mask; input.position(pos); }

Target:
protected static void alignRead(BitBuffer input, IDeclaration declaration) { int mask = (int) declaration.getAlignment() - 1; int pos = (input.position() + mask) & ~mask; input.position(pos); }
Source:
private void setUpMapIfNeeded() { mMap.getOverlayManager().clear(); mMap.setBuiltInZoomControls(true); mMap.setMultiTouchControls(true); mMap.setMinZoomLevel(3); mMap.setMaxZoomLevel(19); mMap.getTileProvider().createTileCache(); if (null == mCompassOverlay) { mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap); } ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity()); mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10); mScaleBarOverlay.setCentred(true); if (null == mCellTowerGridMarkerClusterer) { mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity()); BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange); mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap()); } if (null == mMyLocationOverlay) { GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext()); gpsMyLocationProvider.setLocationUpdateMinDistance(100); gpsMyLocationProvider.setLocationUpdateMinTime(10000); mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap); mMyLocationOverlay.setDrawAccuracyEnabled(true); } mMap.getOverlays().add(mCellTowerGridMarkerClusterer); mMap.getOverlays().add(mMyLocationOverlay); mMap.getOverlays().add(mCompassOverlay); mMap.getOverlays().add(mScaleBarOverlay); }

Target:
private void setUpMapIfNeeded() { mMap.getOverlayManager().clear(); mMap.setBuiltInZoomControls(true); mMap.setMultiTouchControls(true); mMap.setMinZoomLevel(3); mMap.setMaxZoomLevel(19); mMap.getTileProvider().createTileCache(); if (mCompassOverlay == null) { mCompassOverlay = new CompassOverlay(getActivity(), new InternalCompassOrientationProvider(getActivity()), mMap); } ScaleBarOverlay mScaleBarOverlay = new ScaleBarOverlay(getActivity()); mScaleBarOverlay.setScaleBarOffset(getResources().getDisplayMetrics().widthPixels / 2, 10); mScaleBarOverlay.setCentred(true); if (mCellTowerGridMarkerClusterer == null) { mCellTowerGridMarkerClusterer = new CellTowerGridMarkerClusterer(getActivity()); BitmapDrawable mapPinDrawable = (BitmapDrawable) getResources().getDrawable(R.drawable.ic_map_pin_orange); mCellTowerGridMarkerClusterer.setIcon(mapPinDrawable == null ? null : mapPinDrawable.getBitmap()); } if (mMyLocationOverlay == null) { GpsMyLocationProvider gpsMyLocationProvider = new GpsMyLocationProvider(getActivity().getBaseContext()); gpsMyLocationProvider.setLocationUpdateMinDistance(100); gpsMyLocationProvider.setLocationUpdateMinTime(10000); mMyLocationOverlay = new MyLocationNewOverlay(getActivity().getBaseContext(), gpsMyLocationProvider, mMap); mMyLocationOverlay.setDrawAccuracyEnabled(true); } mMap.getOverlays().add(mCellTowerGridMarkerClusterer); mMap.getOverlays().add(mMyLocationOverlay); mMap.getOverlays().add(mCompassOverlay); mMap.getOverlays().add(mScaleBarOverlay); }
Source:
@Override protected void updateEnabledState(boolean enabled) { if (enabled != isEnabled()) { setEnabled(enabled); updateEnabledState(getWindow().getComponents(), enabled); for (final TargetDetailEditor ed : _w.detailEditor.allEditorsJava()) { if (_w.detailEditor.curDetailEdiorJava().forall(cur -> cur != ed)) { updateEnabledState(new Component[]{ed}, enabled); } } } final TargetEnvironment env = getDataObject().getTargetEnvironment(); _w.tag.setEnabled(enabled && env.getBase() != _curPos); final SPInstObsComp inst = getContextInstrumentDataObject(); _w.newMenu.setEnabled(enabled && inst != null); }

Target:
@Override protected void updateEnabledState(boolean enabled) { if (enabled != isEnabled()) { setEnabled(enabled); updateEnabledState(getWindow().getComponents(), enabled); for (final TargetDetailEditor ed : _w.detailEditor.allEditorsJava()) { if (_w.detailEditor.curDetailEditorJava().forall(cur -> cur != ed)) { updateEnabledState(new Component[]{ed}, enabled); } } } final TargetEnvironment env = getDataObject().getTargetEnvironment(); _w.tag.setEnabled(enabled && env.getBase() != _curPos); final SPInstObsComp inst = getContextInstrumentDataObject(); _w.newMenu.setEnabled(enabled && inst != null); }
Source:
public void unblockAllServicesOnDestination(PerunSession sess, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException { Destination destination = getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "unblockAllServicesOnDestination"); } getServicesManagerBl().unblockAllServicesOnDestination(sess, destinationId); }

Target:
public void unblockAllServicesOnDestination(PerunSession sess, int destinationId) throws PrivilegeException, FacilityNotExistsException, DestinationNotExistsException { Destination destination = getServicesManagerBl().getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "unblockAllServicesOnDestination"); } getServicesManagerBl().unblockAllServicesOnDestination(sess, destinationId); }
Source:
public void setEmail(String email) { databaseHelper = new DatabaseHelper(this, email); this.you = Person.getOrUpdate(this, email, null, null); setupEmoji(); }

Target:
public void setEmail(String email) { databaseHelper = new DatabaseHelper(this, email); this.you = Person.getOrUpdate(this, email, null, null); }
Source:
public String toString() { if (allowed == null) { return format( "The method `%s.%s` throws `%s`. But throwing is not allowed" + " for this kind of methods.", method.getDeclaringClass().getCanonicalName(), method.getName(), enumerateThrown() ); } return format( "The method `%s.%s` throws %s. But only `%s` is allowed for" + " this kind of methods.", method.getDeclaringClass().getCanonicalName(), method.getName(), enumerateThrown(), allowed.getName() ); }

Target:
public String toString() { if (allowed == null) { return format( "The method `%s.%s` throws `%s`. But throwing is not allowed" + " for this kind of methods.", method.getDeclaringClass().getCanonicalName(), method.getName(), enumerateThrown() ); } return format( "The method `%s.%s` throws `%s`. But only `%s` is allowed for" + " this kind of methods.", method.getDeclaringClass().getCanonicalName(), method.getName(), enumerateThrown(), allowed.getName() ); }
Source:
public ScenarioSimulationEditorPresenter(final ScenarioSimulationProducer scenarioSimulationProducer, final ScenarioSimulationResourceType type, final PlaceManager placeManager, final TestRunnerReportingPanelWrapper testRunnerReportingPanel, final ScenarioSimulationDocksHandler scenarioSimulationDocksHandler, final TextFileExport textFileExport, final ConfirmPopupPresenter confirmPopupPresenter) { this.view = scenarioSimulationProducer.getScenarioSimulationView(); this.testRunnerReportingPanel = testRunnerReportingPanel; this.scenarioSimulationDocksHandler = scenarioSimulationDocksHandler; this.type = type; this.placeManager = placeManager; this.eventBus = scenarioSimulationProducer.getEventBus(); this.textFileExport = textFileExport; this.confirmPopupPresenter = confirmPopupPresenter; view.init(); undoMenuItem = ScenarioMenuItemFactory.getUndoMenuItem(this::onUndo); redoMenuItem = ScenarioMenuItemFactory.getRedoMenuItem(this::onRedo); scenarioMainGridWidget = view.getScenarioGridWidget(); scenarioMainGridWidget.getScenarioSimulationContext().setScenarioSimulationEditorPresenter(this); scenarioBackgroundGridWidget = scenarioSimulationProducer.getScenarioBackgroundGridWidget(); scenarioBackgroundGridWidget.getScenarioSimulationContext().setScenarioSimulationEditorPresenter(this); scenarioSimulationProducer.setScenarioSimulationEditorPresenter(this); populateTestToolsCommand = createPopulateTestToolsCommand(); scenarioPresenterId = SCENARIO_PRESENTER_COUNTER.getAndIncrement(); }

Target:
public ScenarioSimulationEditorPresenter(final ScenarioSimulationProducer scenarioSimulationProducer, final ScenarioSimulationResourceType type, final PlaceManager placeManager, final TestRunnerReportingPanelWrapper testRunnerReportingPanel, final ScenarioSimulationDocksHandler scenarioSimulationDocksHandler, final TextFileExport textFileExport, final ConfirmPopupPresenter confirmPopupPresenter) { this.view = scenarioSimulationProducer.getScenarioSimulationView(); this.testRunnerReportingPanel = testRunnerReportingPanel; this.scenarioSimulationDocksHandler = scenarioSimulationDocksHandler; this.type = type; this.placeManager = placeManager; this.eventBus = scenarioSimulationProducer.getEventBus(); this.textFileExport = textFileExport; this.confirmPopupPresenter = confirmPopupPresenter; view.init(); initMenuItems(); scenarioSimulationProducer.setScenarioSimulationEditorPresenter(this); scenarioMainGridWidget = view.getScenarioGridWidget(); scenarioMainGridWidget.getScenarioSimulationContext().setScenarioSimulationEditorPresenter(this); scenarioBackgroundGridWidget = scenarioSimulationProducer.getScenarioBackgroundGridWidget(); scenarioBackgroundGridWidget.getScenarioSimulationContext().setScenarioSimulationEditorPresenter(this); populateTestToolsCommand = createPopulateTestToolsCommand(); scenarioPresenterId = SCENARIO_PRESENTER_COUNTER.getAndIncrement(); }
Source:
public void syncVisitsData(@NonNull final Patient patient, @Nullable final DefaultResponseCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Results<Visit>> call = restApi.findVisitsByPatientUUID(patient.getUuid(), "custom:(uuid,location:ref,visitType:ref,startDatetime,stopDatetime,encounters:full)"); call.enqueue(new Callback<Results<Visit>>() { @Override public void onResponse(Call<Results<Visit>> call, Response<Results<Visit>> response) { if (response.isSuccessful()) { List<Visit> visits = response.body().getResults(); VisitDAO visitDAO = new VisitDAO(); for (Visit visit : visits) { visitDAO.getVisitsIDByUUID(visit.getUuid()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(visitId -> { if (visitId > 0) { visitDAO.updateVisit(visit, visitId, patient.getId()); } else { visitDAO.saveVisit(visit, patient.getId()); } }); } if (callbackListener != null) { callbackListener.onResponse(); } } else { ToastUtil.error(response.message()); if (callbackListener != null) { callbackListener.onErrorResponse(response.message()); } } } @Override public void onFailure(Call<Results<Visit>> call, Throwable t) { ToastUtil.error(t.getMessage()); if (callbackListener != null) { callbackListener.onErrorResponse(t.getMessage()); } } }); }

Target:
public void syncVisitsData(@NonNull final Patient patient, @Nullable final DefaultResponseCallbackListener callbackListener) { RestApi restApi = RestServiceBuilder.createService(RestApi.class); Call<Results<Visit>> call = restApi.findVisitsByPatientUUID(patient.getUuid(), "custom:(uuid,location:ref,visitType:ref,startDatetime,stopDatetime,encounters:full)"); call.enqueue(new Callback<Results<Visit>>() { @Override public void onResponse(Call<Results<Visit>> call, Response<Results<Visit>> response) { if (response.isSuccessful()) { List<Visit> visits = response.body().getResults(); VisitDAO visitDAO = new VisitDAO(); for (Visit visit : visits) { visitDAO.saveOrUpdate(visit, patient.getId()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(); } if (callbackListener != null) { callbackListener.onResponse(); } } else { ToastUtil.error(response.message()); if (callbackListener != null) { callbackListener.onErrorResponse(response.message()); } } } @Override public void onFailure(Call<Results<Visit>> call, Throwable t) { ToastUtil.error(t.getMessage()); if (callbackListener != null) { callbackListener.onErrorResponse(t.getMessage()); } } }); }
Source:
public void onSuccess(@Nullable InvocationContext context, @Nullable Object result) { if (context == null) { logger.debug("Encountered null metric context likely due to exception in preInvocation"); return; } if (result != null && ListenableFuture.class.isAssignableFrom(context.getMethod().getReturnType())) { Futures.addCallback((ListenableFuture<?>) result, new FutureCallback<Object>() { @Override public void onSuccess(@NullableDecl Object result) { update(context); } @Override public void onFailure(Throwable t) { TaggedMetricsInvocationEventHandler.this.onFailure(context, t); } }, MoreExecutors.directExecutor()); } else { update(context); } }

Target:
public void onSuccess(@Nullable InvocationContext context, @Nullable Object result) { if (context == null) { logger.debug("Encountered null metric context likely due to exception in preInvocation"); return; } if (result != null && ListenableFuture.class.isAssignableFrom(context.getMethod().getReturnType()) && ListenableFuture.class.isAssignableFrom(result.getClass())) { Futures.addCallback((ListenableFuture<?>) result, new FutureCallback<Object>() { @Override public void onSuccess(@NullableDecl Object result) { update(context); } @Override public void onFailure(Throwable t) { TaggedMetricsInvocationEventHandler.this.onFailure(context, t); } }, MoreExecutors.directExecutor()); } else { update(context); } }
Source:
public void testWorkflowMissingFilesToCopy() { File cwlFile = new File(ResourceHelpers.resourceFilePath("directory/1st-workflow.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("directory/1st-workflow-job.json")); exit.expectSystemExitWithStatus(3); this.baseWorkflowTest(cwlFile, cwlJSON, true, "workflow"); systemErrRule.getLog().contains("Missing required secondary file"); }

Target:
public void testWorkflowMissingFilesToCopy() { File cwlFile = new File(ResourceHelpers.resourceFilePath("directory/1st-workflow.cwl")); File cwlJSON = new File(ResourceHelpers.resourceFilePath("directory/1st-workflow-job.json")); exit.expectSystemExitWithStatus(Client.IO_ERROR); this.baseWorkflowTest(cwlFile, cwlJSON, true, "workflow"); systemErrRule.getLog().contains("Missing required secondary file"); }
Source:
public CommandCallback getCallback() { return getParameters().isUseCinderCommandCallback() ? new ConcurrentChildCommandsExecutionCallback() : null; }

Target:
public CommandCallback getCallback() { return (getParameters().isUseCinderCommandCallback() && getFlow().isStateless()) ? new ConcurrentChildCommandsExecutionCallback() : null; }
Source:
public ItemReader<Transaction> itemReader(Resource inputData) throws UnexpectedInputException, ParseException { FlatFileItemReader<Transaction> reader = new FlatFileItemReader<>(); DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); String[] tokens = { "username", "userid", "transactiondate", "amount" }; tokenizer.setNames(tokens); reader.setResource(inputData); DefaultLineMapper<Transaction> lineMapper = new DefaultLineMapper<>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(new RecordFieldSetMapper()); reader.setLinesToSkip(1); reader.setLineMapper(lineMapper); return reader; }

Target:
public ItemReader<Transaction> itemReader(Resource inputData) throws ParseException { DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(); tokenizer.setNames(tokens); DefaultLineMapper<Transaction> lineMapper = new DefaultLineMapper<>(); lineMapper.setLineTokenizer(tokenizer); lineMapper.setFieldSetMapper(new RecordFieldSetMapper()); FlatFileItemReader<Transaction> reader = new FlatFileItemReader<>(); reader.setResource(inputData); reader.setLinesToSkip(1); reader.setLineMapper(lineMapper); return reader; }
Source:
public boolean isTransferable(Class<?> entityClass) { NonTransferable nonTransferable = getAnnotation(entityClass, NonTransferable.class); return (nonTransferable == null || nonTransferable.enabled() == false); }

Target:
public boolean isTransferable(Class<?> entityClass) { NonTransferable nonTransferable = getAnnotation(entityClass, NonTransferable.class); return (nonTransferable == null || !nonTransferable.enabled()); }
Source:
public AlluxioCachingClientFileSystem(ExtendedFileSystem fileSystem, AlluxioConfiguration alluxioConfiguration) { this.fileSystem = fileSystem; this.alluxioConfiguration = alluxioConfiguration; }

Target:
public AlluxioCachingClientFileSystem( ExtendedFileSystem fileSystem, AlluxioConfiguration alluxioConfiguration) { this.fileSystem = requireNonNull(fileSystem, "fileSystem is null"); this.alluxioConfiguration = requireNonNull(alluxioConfiguration, "alluxioConfiguration is null"); }
Source:
private static Configuration createAbfsConfiguration(UnderFileSystemConfiguration conf) { Configuration abfsConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_AZURE_ACCOUNT_KEY.matches(key)) { abfsConf.set(key, value); final String authTypeKey = key.replace(".key", ".auth.type"); abfsConf.set(authTypeKey, "SharedKey"); } } LOG.info(abfsConf.toString()); return abfsConf; }

Target:
private static Configuration createAbfsConfiguration(UnderFileSystemConfiguration conf) { Configuration abfsConf = HdfsUnderFileSystem.createConfiguration(conf); for (Map.Entry<String, String> entry : conf.toMap().entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (PropertyKey.Template.UNDERFS_ABFS_ACCOUNT_KEY.matches(key)) { abfsConf.set(key, value); final String authTypeKey = key.replace(".key", ".auth.type"); abfsConf.set(authTypeKey, "SharedKey"); } } return abfsConf; }
Source:
public SeekablePathStream(final Path path) throws IOException { this.path = path; this.sbc = Files.newByteChannel(path); ALL_INSTANCES.add(this); }

Target:
public SeekablePathStream(final Path path) throws IOException { this(path, null); }
Source:
private CompletableFuture<InternalCacheEntry> handleRemoteValue(Object key, InternalCacheEntry value, ClusteredGetCommand getCommand, RpcOptionsBuilder rpcOptionsBuilder, int lastTopologyId) { if (value != null) return CompletableFuture.completedFuture(value); final CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); final int currentTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("Perform remote get for key %s. topologyId=%s, currentTopologyId=%s", key, lastTopologyId, currentTopologyId); } List<Address> targets; int newTopologyId; if (lastTopologyId < currentTopologyId) { newTopologyId = currentTopologyId; targets = new ArrayList<>(cacheTopology.getReadConsistentHash().locateOwners(key)); } else if (lastTopologyId == currentTopologyId && cacheTopology.getPendingCH() != null) { newTopologyId = currentTopologyId + 1; targets = new ArrayList<>(cacheTopology.getPendingCH().locateOwners(key)); targets.removeAll(cacheTopology.getReadConsistentHash().locateOwners(key)); if (targets.isEmpty()) { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFuture.completedFuture(null); } } else { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFuture.completedFuture(null); } return invokeClusterGetCommandRemotely(targets, rpcOptionsBuilder, getCommand, key).thenCompose( newValue -> handleRemoteValue(key, newValue, getCommand, rpcOptionsBuilder, newTopologyId)); }

Target:
private CompletableFuture<InternalCacheEntry> handleRemoteValue(Object key, InternalCacheEntry value, ClusteredGetCommand getCommand, RpcOptionsBuilder rpcOptionsBuilder, int lastTopologyId) { if (value != null) return CompletableFuture.completedFuture(value); final CacheTopology cacheTopology = stateTransferManager.getCacheTopology(); final int currentTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("Perform remote get for key %s. topologyId=%s, currentTopologyId=%s", key, lastTopologyId, currentTopologyId); } List<Address> targets; int newTopologyId; if (lastTopologyId < currentTopologyId) { newTopologyId = currentTopologyId; targets = new ArrayList<>(cacheTopology.getReadConsistentHash().locateOwners(key)); } else if (lastTopologyId == currentTopologyId && cacheTopology.getPendingCH() != null) { newTopologyId = currentTopologyId + 1; targets = new ArrayList<>(cacheTopology.getPendingCH().locateOwners(key)); targets.removeAll(cacheTopology.getReadConsistentHash().locateOwners(key)); if (targets.isEmpty()) { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFutures.completedNull(); } } else { if (trace) { log.tracef("No valid values found for key '%s' (topologyId=%s).", key, currentTopologyId); } return CompletableFutures.completedNull(); } return invokeClusterGetCommandRemotely(targets, rpcOptionsBuilder, getCommand, key).thenCompose( newValue -> handleRemoteValue(key, newValue, getCommand, rpcOptionsBuilder, newTopologyId)); }
Source:
private Optional<Alert> findMatchingAlert(List<Alert> alerts, String journalKey) { for (Alert alert : alerts) { String source = alert.getSource(); String frequency = alert.getFrequency(); String name = alert.getName(); if (ALERT_SOURCE.equalsIgnoreCase(source) && ALERT_FREQUENCY.equalsIgnoreCase(frequency) && ALERT_NAME.equalsIgnoreCase(name)) { AlertQuery query = getAlertQuery(alert); List<String> filterJournals = query.getFilterJournals(); if (filterJournals.size() == 1 && journalKey.equalsIgnoreCase(filterJournals.get(0))) { return Optional.of(alert); } } } return Optional.empty(); }

Target:
private Optional<Alert> findMatchingAlert(List<Alert> alerts, String journalKey) { for (Alert alert : alerts) { String source = alert.getSource(); String frequency = alert.getFrequency(); String name = alert.getName(); if (ALERT_SOURCE.equalsIgnoreCase(source) && ALERT_FREQUENCY.equalsIgnoreCase(frequency) && ALERT_NAME.equalsIgnoreCase(name)) { AlertQuery query = getAlertQuery(alert); List<String> filterJournals = query.getFilterJournals(); if (filterJournals.size() == 1 && journalKey.equals(filterJournals.get(0))) { return Optional.of(alert); } } } return Optional.empty(); }
Source:
public void testTransformNullSourceResponse() throws CatalogTransformerException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); assertThat("Transformer cannot be null", transformer, notNullValue()); SourceResponse response = null; transformer.transform(response, new HashMap<>()); }

Target:
public void testTransformNullSourceResponse() throws CatalogTransformerException, MimeTypeParseException { RtfQueryResponseAndMetacardTransformer transformer = createTransformer(); SourceResponse response = null; transformer.transform(response, Collections.emptyMap()); }
Source:
private void readFromSource(InputStream in) { BufferedReader br = null; InputStreamReader inReader = null; try { inReader = new InputStreamReader(in); br = new BufferedReader(inReader); String strLine; while ((strLine = br.readLine()) != null && !strLine.equals("STOP")) { if (unique) { if (!str.contains(strLine)) { str.add(strLine); } } else { str.add(strLine); } } } catch (Exception e) { } finally { Utils.close(br); Utils.close(inReader); } }

Target:
private void readFromSource(InputStream in) { BufferedReader br = null; InputStreamReader inReader = null; try { inReader = new InputStreamReader(in); br = new BufferedReader(inReader); String strLine; while ((strLine = br.readLine()) != null) { inputStrings.add(strLine); } } catch (Exception e) { } finally { if (!in.equals(System.in)) { Utils.close(br); Utils.close(inReader); } } }
Source:
static MethodHandler<?> create(Retrofit retrofit, Method method) { CallAdapter<Object> callAdapter = (CallAdapter<Object>) createCallAdapter(method, retrofit); Type responseType = callAdapter.responseType(); Converter<ResponseBody, Object> responseConverter = (Converter<ResponseBody, Object>) createResponseConverter(method, retrofit, responseType); RequestFactory requestFactory = RequestFactoryParser.parse(method, responseType, retrofit); String infoForException = collectInfoForException(method); return new MethodHandler<>(retrofit, requestFactory, callAdapter, responseConverter, infoForException); }

Target:
static MethodHandler<?> create(Retrofit retrofit, Method method) { CallAdapter<Object> callAdapter = (CallAdapter<Object>) createCallAdapter(method, retrofit); Type responseType = callAdapter.responseType(); Converter<ResponseBody, Object> responseConverter = (Converter<ResponseBody, Object>) createResponseConverter(method, retrofit, responseType); RequestFactory requestFactory = RequestFactoryParser.parse(method, responseType, retrofit); return new MethodHandler<>(retrofit, requestFactory, callAdapter, responseConverter); }
Source:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { OpenAPI openAPI = getOpenAPI(swaggerContent); boolean isDefaultGiven = true; try { SecurityScheme checkDefault = openAPI.getComponents().getSecuritySchemes().get(OPENAPI_SECURITY_SCHEMA_KEY); if (checkDefault == null) { isDefaultGiven = false; } return isDefaultGiven; } catch (NullPointerException e) { isDefaultGiven = false; return isDefaultGiven; } }

Target:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { OpenAPI openAPI = getOpenAPI(swaggerContent); Components components = openAPI.getComponents(); if (components == null) { return false; } Map<String, SecurityScheme> securitySchemes = components.getSecuritySchemes(); if (securitySchemes == null) { return false; } SecurityScheme checkDefault = openAPI.getComponents().getSecuritySchemes().get(OPENAPI_SECURITY_SCHEMA_KEY); if (checkDefault == null) { return false; } return true; }
Source:
public boolean isAdjacent(final V v1, final V v2) { final Map<V, I> adjs = adjacent.get(v1); for (final Map.Entry<V, I> edge : adjs.entrySet()) { if (edge.getKey().equals(v2)) { return true; } } return false; }

Target:
public boolean isAdjacent(final V v1, final V v2) { final Map<V, I> adjs = adjacent.get(v1); return adjs.containsKey(v2); }
Source:
public TicketRegistry ticketRegistry(@Qualifier("ehcache3TicketCacheManager") final javax.cache.CacheManager ehcacheManager, @Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val crypto = ehcacheProperties.getCrypto(); val definitions = ticketCatalog.findAll(); definitions.forEach(t -> { val cacheName = t.getProperties().getStorageName(); if (ehcacheManager.getCache(cacheName, String.class, Ticket.class) == null) { val ehcacheConfiguration = buildCacheConfiguration(t); ehcacheManager.createCache(cacheName, Eh107Configuration.fromEhcacheCacheConfiguration(ehcacheConfiguration)); } }); return new EhCache3TicketRegistry(ticketCatalog, ehcacheManager, CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "ehcache")); }

Target:
public TicketRegistry ticketRegistry(@Qualifier("ehcache3TicketCacheManager") final javax.cache.CacheManager ehcacheManager, @Qualifier("ticketCatalog") final TicketCatalog ticketCatalog) { val ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache3(); val crypto = ehcacheProperties.getCrypto(); val definitions = ticketCatalog.findAll(); definitions.forEach(t -> { val cacheName = t.getProperties().getStorageName(); if (ehcacheManager.getCache(cacheName, String.class, Ticket.class) == null) { val ehcacheConfiguration = buildCacheConfiguration(t); ehcacheManager.createCache(cacheName, Eh107Configuration.fromEhcacheCacheConfiguration(ehcacheConfiguration)); } }); return new EhCache3TicketRegistry(ticketCatalog, ehcacheManager, CoreTicketUtils.newTicketRegistryCipherExecutor(crypto, "ehcache3")); }
Source:
public TrieNode putNode(String path, TrieNode t) { LOG.info("Entrie.put(" + path + ")"); if (path.startsWith("/")) path = path.substring(1); if (path.length() == 0) { return t; } String[] elements = path.split("/"); TrieNode existing = children.getOrDefault(elements[0], TrieNodeImpl.empty()); TrieNode newChild = existing.putNode(path.substring(elements[0].length()), t); HashMap<String, TrieNode> newChildren = new HashMap<>(children); newChildren.put(elements[0], newChild); return new TrieNodeImpl(newChildren, value, pathMappings); }

Target:
public TrieNode putNode(String path, TrieNode t) { LOG.info("Entrie.put(" + path + ")"); path = TrieNode.canonicalise(path); if (path.length() == 0) { return t; } String[] elements = path.split("/"); TrieNode existing = children.getOrDefault(elements[0], TrieNodeImpl.empty()); TrieNode newChild = existing.putNode(path.substring(elements[0].length()), t); HashMap<String, TrieNode> newChildren = new HashMap<>(children); newChildren.put(elements[0], newChild); return new TrieNodeImpl(newChildren, value); }
Source:
protected void registerAppFeature(JSONArray args, final CallbackContext callbackContext) throws JSONException { Log.i("SDKInfoPlugin.registerAppFeature", "registerAppFeature called"); JSONObject arg0 = args.getJSONObject(0); if(arg0 != null){ String appFeatureCode = arg0.getString("feature"); if(appFeatureCode != null && !appFeatureCode.isEmpty()){ SalesforceSDKManager.getInstance().registerUsedAppFeature(appFeatureCode); } } callbackContext.success(); }

Target:
protected void registerAppFeature(JSONArray args, final CallbackContext callbackContext) throws JSONException { Log.i("SDKInfoPlugin.registerAppFeature", "registerAppFeature called"); JSONObject arg0 = args.getJSONObject(0); if(arg0 != null){ String appFeatureCode = arg0.getString("feature"); if(!TextUtils.isEmpty(appFeatureCode)){ SalesforceSDKManager.getInstance().registerUsedAppFeature(appFeatureCode); } } callbackContext.success(); }
Source:
public RemoteServerConfigurationImpl(List<RemoteServerData> serverData, TaskRunner taskRunner) { remoteServerDataList = new ArrayList<>(serverData); for (RemoteServerData remoteServerData : serverData) { actualStateMap.put(remoteServerData.getServerName(), RemoteServerState.UNKNOWN); } if (taskRunner == null || !(taskRunner instanceof ScheduledTaskRunner)) { logger.error("Task runner isn't ScheduledTaskRunner. Remote server status task won't be scheduled."); } else { scheduledTaskRunner = (ScheduledTaskRunner) taskRunner; } }

Target:
public RemoteServerConfigurationImpl(List<RemoteServerData> serverData, TaskRunner taskRunner) { remoteServerDataList = new ArrayList<>(serverData); for (RemoteServerData remoteServerData : serverData) { actualStateMap.put(remoteServerData.getServerName(), RemoteServerState.UNKNOWN); } if (taskRunner == null || !(taskRunner instanceof ScheduledTaskRunner)) { logger.info("Task runner isn't ScheduledTaskRunner. Remote server status task won't be scheduled."); } else { scheduledTaskRunner = (ScheduledTaskRunner) taskRunner; } }
Source:
static OperationStepHandler checkNoOtherSibling(final String childType) { return new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress currentAddress = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)); PathAddress parentAddress = currentAddress.subAddress(0, currentAddress.size() - 1); Resource parent = context.readResourceFromRoot(parentAddress); Set<String> children = parent.getChildrenNames(childType); if (children.size() > 1) { throw MessagingLogger.ROOT_LOGGER.onlyOneChildIsAllowed(childType, children); } } }; }

Target:
static OperationStepHandler checkNoOtherSibling(final String childType) { return new OperationStepHandler() { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { PathAddress parentAddress = context.getCurrentAddress().getParent(); Resource parent = context.readResourceFromRoot(parentAddress, false); Set<String> children = parent.getChildrenNames(childType); if (children.size() > 1) { throw MessagingLogger.ROOT_LOGGER.onlyOneChildIsAllowed(childType, children); } } }; }
Source:
private static Map<Class<?>, Converter> createConvertersMap(List<Converter> converters) { Map<Class<?>, Converter> res = new HashMap<>(); for (Converter converter : converters) { Class<?> valueClass = converter.getValueClass(); if (valueClass != null) { Converter prevConverter = res.put(valueClass, converter); if (prevConverter != null) { throw new HazelcastException("Duplicate converter for class [class=" + valueClass + ", converter1=" + prevConverter.getValueClass().getName() + ", converter2=" + valueClass.getName() + ']'); } Class<?> primitiveValueClass = getPrimitiveClass(valueClass); if (primitiveValueClass != null) { res.put(primitiveValueClass, converter); } } } return res; }

Target:
private static Map<Class<?>, Converter> createConvertersMap(List<Converter> converters) { Map<Class<?>, Converter> res = new HashMap<>(converters.size()); for (Converter converter : converters) { Class<?> valueClass = converter.getValueClass(); if (valueClass != null) { Converter prevConverter = res.put(valueClass, converter); if (prevConverter != null) { throw new HazelcastException("Duplicate converter for class [class=" + valueClass + ", converter1=" + prevConverter.getValueClass().getName() + ", converter2=" + valueClass.getName() + ']'); } Class<?> primitiveValueClass = getPrimitiveClass(valueClass); if (primitiveValueClass != null) { res.put(primitiveValueClass, converter); } } } return res; }