auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void putSchemaMetadata(String schemaName, SchemaMetadata schemaMetadata) { byte[] serializedMetadata = schemaMetadata.persistToBytes(); while (!Thread.currentThread().isInterrupted()) { Optional<byte[]> existingMetadata = loadMetadataCellFromKeyValueService(schemaName); CheckAndSetRequest request = existingMetadata.map(existingData -> CheckAndSetRequest.singleCell( AtlasDbConstants.DEFAULT_SCHEMA_METADATA_TABLE, createCellForGivenSchemaName(schemaName), existingData, serializedMetadata)) .orElse(CheckAndSetRequest.newCell( AtlasDbConstants.DEFAULT_SCHEMA_METADATA_TABLE, createCellForGivenSchemaName(schemaName), serializedMetadata)); try { keyValueService.checkAndSet(request); return; } catch (CheckAndSetException e) { log.info("Failed to update the schema metadata: {}. Retrying.", UnsafeArg.of("attemptedUpdate", request)); } } }

Target:
public void putSchemaMetadata(String schemaName, SchemaMetadata schemaMetadata) { byte[] serializedMetadata = schemaMetadata.persistToBytes(); while (!Thread.currentThread().isInterrupted()) { Optional<byte[]> existingMetadata = loadMetadataCellFromKeyValueService(schemaName); CheckAndSetRequest request = existingMetadata.map(existingData -> CheckAndSetRequest.singleCell( AtlasDbConstants.DEFAULT_SCHEMA_METADATA_TABLE, createCellForGivenSchemaName(schemaName), existingData, serializedMetadata)) .orElse(CheckAndSetRequest.newCell( AtlasDbConstants.DEFAULT_SCHEMA_METADATA_TABLE, createCellForGivenSchemaName(schemaName), serializedMetadata)); try { keyValueService.checkAndSet(request); log.info("Successfully updated the schema metadata to {}.", UnsafeArg.of("committedUpdate", request)); return; } catch (CheckAndSetException e) { log.info("Failed to update the schema metadata: {}. Retrying.", UnsafeArg.of("attemptedUpdate", request)); } } }
Source:
private static boolean hasSuppressed(Throwable exception) { if (getSuppressed != null) { try { Throwable[] suppressed = (Throwable[]) getSuppressed.invoke(exception); return suppressed.length != 0; } catch (Throwable e) { return false; } } else { return false; } }

Target:
private static boolean hasSuppressed(Throwable exception) { if (getSuppressed == null) { return false; } try { Throwable[] suppressed = (Throwable[]) getSuppressed.invoke(exception); return suppressed.length != 0; } catch (Throwable e) { return false; } }
Source:
private ITransformedNetwork getFinalTransformedNetwork(ITransformedNetwork transformedNetwork, List<String> alternativeIdsForConceptList) { List<Node> searchedNodes = new ArrayList<Node>(); Set<String> statementIdSet = new HashSet<String>(); for (Node node : transformedNetwork.getNodes().values()) { for (String alternativeIdsForConcept : alternativeIdsForConceptList) { if (alternativeIdsForConcept.equals(node.getConceptId())) { searchedNodes.add(node); statementIdSet.addAll(node.getStatementIds()); break; } } } List<Link> finalLinks = new ArrayList<Link>(); Set<Link> finalLinksSet = new HashSet<Link>(); Map<String, Node> finalNodes = new HashMap<String, Node>(); Set<Node> addedNodes = new HashSet<Node>(); for (Link link : transformedNetwork.getLinks()) { if (statementIdSet.contains(link.getStatementId())) { finalLinksSet.add(link); Node subjectNode = link.getSubject(); Node objectNode = link.getObject(); if (!addedNodes.contains(subjectNode)) { finalNodes.put(subjectNode.getId(), subjectNode); addedNodes.add(subjectNode); } if (!addedNodes.contains(objectNode)) { finalNodes.put(objectNode.getId(), objectNode); addedNodes.add(objectNode); } } } for (Node node : searchedNodes) { if (!searchedNodes.contains(node)) { finalNodes.put(node.getId(), node); } } finalLinks.addAll(finalLinksSet); return new TransformedNetwork(finalNodes, finalLinks); }

Target:
private ITransformedNetwork getFinalTransformedNetwork(ITransformedNetwork transformedNetwork, List<String> alternativeIdsForConceptList) { List<Node> searchedNodes = new ArrayList<Node>(); Set<String> statementIdSet = new HashSet<String>(); for (Node node : transformedNetwork.getNodes().values()) { for (String alternativeIdsForConcept : alternativeIdsForConceptList) { if (alternativeIdsForConcept.equals(node.getConceptId())) { searchedNodes.add(node); statementIdSet.addAll(node.getStatementIds()); break; } } } Set<Link> finalLinksSet = new HashSet<Link>(); Map<String, Node> finalNodes = new HashMap<String, Node>(); Set<Node> addedNodes = new HashSet<Node>(); for (Link link : transformedNetwork.getLinks()) { if (statementIdSet.contains(link.getStatementId())) { finalLinksSet.add(link); Node subjectNode = link.getSubject(); Node objectNode = link.getObject(); if (!addedNodes.contains(subjectNode)) { finalNodes.put(subjectNode.getId(), subjectNode); addedNodes.add(subjectNode); } if (!addedNodes.contains(objectNode)) { finalNodes.put(objectNode.getId(), objectNode); addedNodes.add(objectNode); } } } for (Node node : searchedNodes) { if (!searchedNodes.contains(node)) { finalNodes.put(node.getId(), node); } } List<Link> finalLinks = new ArrayList<Link>(finalLinksSet); return new TransformedNetwork(finalNodes, finalLinks); }
Source:
protected @Nullable List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) { List<ITimeEvent> eventList = null; if (!(tgentry instanceof ControlFlowEntry)) { return eventList; } ControlFlowEntry entry = (ControlFlowEntry) tgentry; final long realStart = Math.max(startTime, entry.getStartTime()); final long realEnd = Math.min(endTime, entry.getEndTime()); if (realEnd <= realStart) { return null; } LttngKernelAnalysis kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(entry.getTrace(), LttngKernelAnalysis.class, LttngKernelAnalysis.ID); if (kernelAnalysis == null) { return null; } try { List<ITmfStateInterval> statusIntervals = kernelAnalysis.getStatusIntervalsForThread(entry.getThreadQuark(), realStart, realEnd, resolution, monitor); eventList = new ArrayList<>(statusIntervals.size()); long lastEndTime = -1; for (ITmfStateInterval statusInterval : statusIntervals) { if (monitor.isCanceled()) { return null; } long time = statusInterval.getStartTime(); long duration = statusInterval.getEndTime() - time + 1; int status = -1; try { status = statusInterval.getStateValue().unboxInt(); } catch (StateValueTypeException e) { e.printStackTrace(); } if (lastEndTime != time && lastEndTime != -1) { eventList.add(new TimeEvent(entry, lastEndTime, time - lastEndTime)); } eventList.add(new TimeEvent(entry, time, duration, status)); lastEndTime = time + duration; } } catch (TimeRangeException e) { Activator.getDefault().logError(e.getMessage()); } return eventList; }

Target:
protected @Nullable List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) { List<ITimeEvent> eventList = null; if (!(tgentry instanceof ControlFlowEntry)) { return eventList; } ControlFlowEntry entry = (ControlFlowEntry) tgentry; final long realStart = Math.max(startTime, entry.getStartTime()); final long realEnd = Math.min(endTime, entry.getEndTime()); if (realEnd <= realStart) { return null; } LttngKernelAnalysis kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(entry.getTrace(), LttngKernelAnalysis.class, LttngKernelAnalysis.ID); if (kernelAnalysis == null) { return null; } try { List<ITmfStateInterval> statusIntervals = LttngKernelThreadInformationProvider.getStatusIntervalsForThread(kernelAnalysis, entry.getThreadId(), realStart, realEnd, resolution, monitor); eventList = new ArrayList<>(statusIntervals.size()); long lastEndTime = -1; for (ITmfStateInterval statusInterval : statusIntervals) { if (monitor.isCanceled()) { return null; } long time = statusInterval.getStartTime(); long duration = statusInterval.getEndTime() - time + 1; int status = -1; try { status = statusInterval.getStateValue().unboxInt(); } catch (StateValueTypeException e) { e.printStackTrace(); } if (lastEndTime != time && lastEndTime != -1) { eventList.add(new TimeEvent(entry, lastEndTime, time - lastEndTime)); } eventList.add(new TimeEvent(entry, time, duration, status)); lastEndTime = time + duration; } } catch (TimeRangeException e) { Activator.getDefault().logError(e.getMessage()); } return eventList; }
Source:
public void setMaximumPoolSize(int newMaximumPoolSize) { final int oldMaxWorkers = maxWorkers.get(); long current; int workPermits; if (newMaximumPoolSize < 0) { throw new IllegalArgumentException("Maximum number of workers must not be negative"); } int deltaWorkPermits = newMaximumPoolSize - oldMaxWorkers; if (!maxWorkers.compareAndSet(oldMaxWorkers, newMaximumPoolSize)) { throw new IllegalStateException("Maximum pool size has been changed while resizing"); } if (deltaWorkPermits == 0) return; do { current = permits.get(); workPermits = workPermits(current); } while (!permits.compareAndSet(current, updateWorkPermits(current, workPermits + deltaWorkPermits))); logger.info("Resized maximum pool size from to {}", name, oldMaxWorkers, newMaximumPoolSize); updatedMaxWorkers.onUpdateMaximumPoolSize(newMaximumPoolSize); }

Target:
public synchronized void setMaximumPoolSize(int newMaximumPoolSize) { final int oldMaximumPoolSize = maximumPoolSize.get(); if (newMaximumPoolSize < 0) { throw new IllegalArgumentException("Maximum number of workers must not be negative"); } int deltaWorkPermits = newMaximumPoolSize - oldMaximumPoolSize; if (!maximumPoolSize.compareAndSet(oldMaximumPoolSize, newMaximumPoolSize)) { throw new IllegalStateException("Maximum pool size has been changed while resizing"); } if (deltaWorkPermits == 0) return; permits.updateAndGet(cur -> updateWorkPermits(cur, workPermits(cur) + deltaWorkPermits)); logger.info("Resized maximum pool size from to {}", name, oldMaximumPoolSize, newMaximumPoolSize); maximumPoolSizeListener.onUpdateMaximumPoolSize(newMaximumPoolSize); }
Source:
public void process(Node externsNode, Node rootNode) { if (rootNode.hasChildren()) { if (instrumentOption == InstrumentOption.BRANCH_ONLY) { NodeTraversal.traverse( compiler, rootNode, new BranchCoverageInstrumentationCallback(compiler, instrumentationData)); } else if (instrumentOption == InstrumentOption.ADVANCED) { NodeTraversal.traverse( compiler, rootNode, new AdvancedCoverageInstrumentationCallback(compiler, new HashMap<>())); return; } else { NodeTraversal.traverse( compiler, rootNode, new CoverageInstrumentationCallback(instrumentationData, reach)); } Node firstScript = rootNode.getFirstChild(); checkState(firstScript.isScript()); if (firstScript.hasChildren() && firstScript.getFirstChild().isModuleBody()) { firstScript = firstScript.getFirstChild(); } addHeaderCode(firstScript); } }

Target:
public void process(Node externsNode, Node rootNode) { if (rootNode.hasChildren()) { if (instrumentOption == InstrumentOption.BRANCH_ONLY) { NodeTraversal.traverse( compiler, rootNode, new BranchCoverageInstrumentationCallback(compiler, instrumentationData)); } else if (instrumentOption == InstrumentOption.PRODUCTION) { NodeTraversal.traverse( compiler, rootNode, new ProductionCoverageInstrumentationCallback(compiler)); return; } else { NodeTraversal.traverse( compiler, rootNode, new CoverageInstrumentationCallback(instrumentationData, reach)); } Node firstScript = rootNode.getFirstChild(); checkState(firstScript.isScript()); if (firstScript.hasChildren() && firstScript.getFirstChild().isModuleBody()) { firstScript = firstScript.getFirstChild(); } addHeaderCode(firstScript); } }
Source:
public Task<?> expunge(final Entity entity, final boolean release) { return mgmt.getExecutionManager().submit( MutableMap.of("displayName", "expunging " + entity, "description", "REST call to expunge entity " + entity.getDisplayName() + " (" + entity + ")"), new Runnable() { @Override public void run() { if (release) Entities.destroyCatching(entity); mgmt.getEntityManager().unmanage(entity); } }); }

Target:
public Task<?> expunge(final Entity entity, final boolean release) { return mgmt.getExecutionManager().submit( MutableMap.of("displayName", "expunging " + entity, "description", "REST call to expunge entity " + entity.getDisplayName() + " (" + entity + ")"), new Runnable() { @Override public void run() { if (release) Entities.destroyCatching(entity); else mgmt.getEntityManager().unmanage(entity); } }); }
Source:
public void mouseHover(MouseEvent e) { if ((getChartViewer().getWindowDuration() != 0) && (e != null)) { IAxis xAxis = getChart().getAxisSet().getXAxis(0); IAxis yAxis = getChart().getAxisSet().getYAxis(0); ISeries[] series = getChart().getSeriesSet().getSeries(); double smallestDistance = Double.MAX_VALUE; int seriesIndex = 0; int dataIndex = 0; for (int k = 0; k < series.length; k++) { ISeries serie = series[k]; double[] xS = serie.getXSeries(); double[] yS = serie.getYSeries(); if ((xS == null) || (yS == null)) { return; } for (int i = 0; i < xS.length; i++) { int xs = xAxis.getPixelCoordinate(xS[i]); int ys = yAxis.getPixelCoordinate(yS[i]); double currentDistance = Math.sqrt(Math.pow((e.x - xs), 2) + Math.pow((e.y - ys), 2)); if (currentDistance < smallestDistance) { smallestDistance = currentDistance; fHighlightX = xs; fHighlightY = ys; seriesIndex = k; dataIndex = i; } } } String tooltip = createToolTipText(seriesIndex, dataIndex); if (tooltip != null) { getChart().getPlotArea().setToolTipText(tooltip); fIsHighlight = true; getChart().redraw(); } } }

Target:
public void mouseHover(MouseEvent e) { if ((getChartViewer().getWindowDuration() != 0) && (e != null)) { IAxis xAxis = getChart().getAxisSet().getXAxis(0); IAxis yAxis = getChart().getAxisSet().getYAxis(0); ISeries[] series = getChart().getSeriesSet().getSeries(); double smallestDistance = Double.MAX_VALUE; Parameter param = null; for (int k = 0; k < series.length; k++) { ISeries serie = series[k]; double[] xS = serie.getXSeries(); double[] yS = serie.getYSeries(); if ((xS == null) || (yS == null)) { continue; } for (int i = 0; i < xS.length; i++) { int xs = xAxis.getPixelCoordinate(xS[i]) - e.x; int ys = yAxis.getPixelCoordinate(yS[i]) - e.y; double currentDistance = Math.sqrt(xs * xs + ys * ys); if ((currentDistance < smallestDistance) && (currentDistance < HIGHLIGHT_RADIUS)) { smallestDistance = currentDistance; fHighlightX = xs + e.x; fHighlightY = ys + e.y; if (param == null) { param = new Parameter(); } param.setSeriesIndex(k); param.setDataIndex(i); } } } String tooltip = null; if (param != null) { tooltip = createToolTipText(param); if (tooltip != null) { fIsHighlight = true; getChart().redraw(); } } getChart().getPlotArea().setToolTipText(tooltip); } }
Source:
public IASTImplicitName[] getImplicitNames() { if (implicitNames == null) { IBinding ctor = CPPSemantics.findImplicitlyCalledConstructor(this); if (ctor == null) { implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; } else { CPPASTImplicitName ctorName = new CPPASTImplicitName(ctor.getNameCharArray(), this); ctorName.setBinding(ctor); IASTName id = name; if (id instanceof ICPPASTQualifiedName) { id = id.getLastName(); } ctorName.setOffsetAndLength((ASTNode) id); implicitNames = new IASTImplicitName[] { ctorName }; } } return implicitNames; }

Target:
public IASTImplicitName[] getImplicitNames() { if (implicitNames == null) { IBinding ctor = CPPSemantics.findImplicitlyCalledConstructor(this); if (ctor == null) { implicitNames = IASTImplicitName.EMPTY_NAME_ARRAY; } else { CPPASTImplicitName ctorName = new CPPASTImplicitName(ctor.getNameCharArray(), this); ctorName.setBinding(ctor); IASTName id = name.getLastName(); ctorName.setOffsetAndLength((ASTNode) id); implicitNames = new IASTImplicitName[] { ctorName }; } } return implicitNames; }
Source:
private boolean isConsiderSuccessful() { return getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.AUTO_GENERATED_SNAPSHOT_REMOVE_END; }

Target:
private boolean isConsiderSuccessful() { return getParameters().getLiveDiskMigrateStage() == LiveDiskMigrateStage.SOURCE_IMAGE_DELETION; }
Source:
private Statement addScopeToMethodCallExpr(PreprocessPhaseResult result, Expression scope, Statement e) { if (e != null && e.isExpressionStmt()) { Expression expression = e.asExpressionStmt().getExpression(); if (expression.isMethodCallExpr()) { MethodCallExpr mcExpr = expression.asMethodCallExpr(); Expression enclosed = new EnclosedExpr(scope); mcExpr.setScope(enclosed); final String methodName = mcExpr.getName().asString(); String set = methodName.replace("set", ""); if (scope.isNameExpr() || scope instanceof DrlNameExpr) { result.addModifyProperties(printConstraint(scope)); } return new ExpressionStmt(mcExpr); } } return e; }

Target:
private Statement addScopeToMethodCallExpr(PreprocessPhaseResult result, Expression scope, Statement e) { if (e != null && e.isExpressionStmt()) { Expression expression = e.asExpressionStmt().getExpression(); if (expression.isMethodCallExpr()) { MethodCallExpr mcExpr = expression.asMethodCallExpr(); Expression enclosed = new EnclosedExpr(scope); mcExpr.setScope(enclosed); if (scope.isNameExpr() || scope instanceof DrlNameExpr) { result.addUsedBinding(printConstraint(scope)); } return new ExpressionStmt(mcExpr); } } return e; }
Source:
protected Resource getInputType(Object input) { if (input instanceof EditPart) { input = ((EditPart) input).getModel(); } if (input instanceof Resource) { return (Resource) input; } return null; }

Target:
protected Resource getInputType(Object input) { if (input instanceof EditPart && ((EditPart) input).getModel() instanceof Resource) return (Resource) input; }
Source:
public CompletableFuture<?> readRecoveredState(ExecutorService executor, ChannelStateReader reader) throws IOException { synchronized (requestLock) { if (closeFuture.isDone()) { return FutureUtils.completedVoidFuture(); } for (InputChannel inputChannel : inputChannels.values()) { if (inputChannel instanceof RemoteRecoveredInputChannel) { ((RemoteRecoveredInputChannel) inputChannel).assignExclusiveSegments(); } } } List<CompletableFuture<?>> futures = getStateConsumedFuture(); executor.submit(() -> { Collection<InputChannel> channels; synchronized (requestLock) { channels = inputChannels.values(); } internalReadRecoveredState(reader, channels); }); return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); }

Target:
public CompletableFuture<?> readRecoveredState(ExecutorService executor, ChannelStateReader reader) throws IOException { synchronized (requestLock) { if (closeFuture.isDone()) { return FutureUtils.completedVoidFuture(); } for (InputChannel inputChannel : inputChannels.values()) { if (inputChannel instanceof RecoveredInputChannel) { ((RecoveredInputChannel) inputChannel).assignExclusiveSegments(); } } } List<CompletableFuture<?>> futures = getStateConsumedFuture(); executor.submit(() -> { Collection<InputChannel> channels; synchronized (requestLock) { channels = inputChannels.values(); } internalReadRecoveredState(reader, channels); }); return CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); }
Source:
void processRoads() throws IOException { DataStore dataStore = null; FeatureIterator<SimpleFeature> roads = null; try { dataStore = openShapefileDataStore(roadsFile); roads = getFeatureIerator(dataStore); while (roads.hasNext()) { SimpleFeature road = roads.next(); for (Coordinate[] points : getCoords(road.getDefaultGeometry())) { Coordinate startTowerPnt = null; List<Coordinate> pillars = new ArrayList<Coordinate>(); for (Coordinate point : points) { if (startTowerPnt == null) { startTowerPnt = point; } else { int state = coordState.get(point); if (state >= FIRST_NODE_ID) { int fromTowerNodeId = coordState.get(startTowerPnt); int toTowerNodeId = state; double distance = getWayLength(startTowerPnt, pillars, point); GHPoint estmCentre = new GHPoint(0.5 * (lat(startTowerPnt) + lat(point)), 0.5 * (lng(startTowerPnt) + lng(point))); PointList pillarNodes = new PointList(pillars.size(), false); for (Coordinate pillar : pillars) { pillarNodes.add(lat(pillar), lng(pillar)); } addEdge(fromTowerNodeId, toTowerNodeId, road, distance, estmCentre, pillarNodes); startTowerPnt = point; pillars.clear(); } else { pillars.add(point); } } } } } } catch (Exception e) { LOGGER.error("Exception while processing for roads: ", e); } finally { if (roads != null) { roads.close(); } if (dataStore != null) { dataStore.dispose(); } } }

Target:
void processRoads() { DataStore dataStore = null; FeatureIterator<SimpleFeature> roads = null; try { dataStore = openShapefileDataStore(roadsFile); roads = getFeatureIterator(dataStore); while (roads.hasNext()) { SimpleFeature road = roads.next(); for (Coordinate[] points : getCoords(road.getDefaultGeometry())) { Coordinate startTowerPnt = null; List<Coordinate> pillars = new ArrayList<Coordinate>(); for (Coordinate point : points) { if (startTowerPnt == null) { startTowerPnt = point; } else { int state = coordState.get(point); if (state >= FIRST_NODE_ID) { int fromTowerNodeId = coordState.get(startTowerPnt); int toTowerNodeId = state; double distance = getWayLength(startTowerPnt, pillars, point); GHPoint estmCentre = new GHPoint( 0.5 * (lat(startTowerPnt) + lat(point)), 0.5 * (lng(startTowerPnt) + lng(point))); PointList pillarNodes = new PointList(pillars.size(), false); for (Coordinate pillar : pillars) { pillarNodes.add(lat(pillar), lng(pillar)); } addEdge(fromTowerNodeId, toTowerNodeId, road, distance, estmCentre, pillarNodes); startTowerPnt = point; pillars.clear(); } else { pillars.add(point); } } } } } } finally { if (roads != null) { roads.close(); } if (dataStore != null) { dataStore.dispose(); } } }
Source:
private String extractMessageRecursively(final Throwable t) { if (t.getCause() == null) { return t.getMessage(); } return t.getMessage() + " Caused by: " + extractMessageRecursively(t.getCause()); }

Target:
protected static String extractMessageRecursively(final Throwable t) { if (t == null) { return ""; } if (t.getCause() == null) { return t.getMessage(); } return t.getMessage() + " Caused by: " + extractMessageRecursively(t.getCause()); }
Source:
public RadiologyReport createAndClaimRadiologyReport(RadiologyOrder radiologyOrder) throws IllegalArgumentException { if (radiologyOrder == null) { throw new IllegalArgumentException("radiologyOrder cannot be null"); } if (radiologyOrder.getStudy().isCompleted() == false) { throw new IllegalArgumentException("Cannot create report for uncompleted order"); } if (radiologyReportDAO.hasRadiologyOrderCompletedRadiologyReport(radiologyOrder)) { throw new UnsupportedOperationException( "Cannot create a radiologyReport for this radiologyOrder because it is already " + "completed"); } if (radiologyReportDAO.hasRadiologyOrderClaimedRadiologyReport(radiologyOrder)) { throw new UnsupportedOperationException( "Cannot create a radiologyReport for this radiologyOrder because it is already claimed"); } RadiologyReport radiologyReport = new RadiologyReport(radiologyOrder); radiologyReport.setCreator(Context.getAuthenticatedUser()); return radiologyReportDAO.saveRadiologyReport(radiologyReport); }

Target:
public RadiologyReport createAndClaimRadiologyReport(RadiologyOrder radiologyOrder) throws IllegalArgumentException, UnsupportedOperationException { if (radiologyOrder == null) { throw new IllegalArgumentException("radiologyOrder cannot be null"); } if (radiologyOrder.getStudy() == null) { throw new IllegalArgumentException("study cannot be null"); } if (radiologyOrder.getStudy().isCompleted() == false) { throw new IllegalArgumentException("cannot create RadiologyReport for uncompleted radiologyOrder"); } if (radiologyReportDAO.hasRadiologyOrderCompletedRadiologyReport(radiologyOrder)) { throw new UnsupportedOperationException( "cannot create radiologyReport for this radiologyOrder because it is already completed"); } if (radiologyReportDAO.hasRadiologyOrderClaimedRadiologyReport(radiologyOrder)) { throw new UnsupportedOperationException( "cannot create radiologyReport for this radiologyOrder because it is already claimed"); } RadiologyReport radiologyReport = new RadiologyReport(radiologyOrder); radiologyReport.setCreator(Context.getAuthenticatedUser()); return radiologyReportDAO.saveRadiologyReport(radiologyReport); }
Source:
public void onTaskCompleted(SonarQubeWebHook.Payload payload, String receivedSignature) { if (payload.getTaskId().equals(step.taskId)) { try { PauseAction.endCurrentPause(getContextClass(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); if (step.webhookSecretId != null) { if (validateWebhook(receivedSignature, payload.getPayloadAsString())) { checkQualityGate(payload.getTaskStatus(), payload.getQGStatus()); } } else { checkQualityGate(payload.getTaskStatus(), payload.getQGStatus()); } } catch (IOException e) { getContext().onFailure(e); throw new IllegalStateException(e); } } }

Target:
public void onTaskCompleted(SonarQubeWebHook.Payload payload, String receivedSignature) { if (payload.getTaskId().equals(step.taskId)) { try { PauseAction.endCurrentPause(getContextClass(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); if (step.webhookSecretId != null && !step.webhookSecretId.isEmpty()) { if (validateWebhook(receivedSignature, payload.getPayloadAsString())) { checkQualityGate(payload.getTaskStatus(), payload.getQualityGateStatus()); } } else { checkQualityGate(payload.getTaskStatus(), payload.getQualityGateStatus()); } } catch (IOException e) { getContext().onFailure(e); throw new IllegalStateException(e); } } }
Source:
public void testDoTransferAsAnon() { User ticketOwner = createUser(); User ticketReceiver = createUser(); Ticket ticket = createTicketForUser(ticketOwner); TicketTransferToken ttt = ticketService.setupForTransfer(ticket.getId(), ticketReceiver.getEmail()); given(). body(ttt.getToken()). when(). put(TRANSFER_ENDPOINT). then(). statusCode(HttpStatus.SC_FORBIDDEN); ttt = tttRepository.findByToken(ttt.getToken()).get(); ticket = ticketRepository.findById(ticket.getId()).orElse(new Ticket()); Assert.assertTrue(ttt.isValid()); Assert.assertTrue(ticket.getOwner().equals(ticketOwner)); }

Target:
public void testDoTransferAsAnon() { User ticketOwner = createUser(); User ticketReceiver = createUser(); Ticket ticket = createTicketForUser(ticketOwner); TicketTransferToken ttt = ticketService.setupForTransfer(ticket.getId(), ticketReceiver.getEmail()); given(). body(ttt.getToken()). when(). put(TRANSFER_ENDPOINT). then(). statusCode(HttpStatus.SC_FORBIDDEN); ttt = tttRepository.findByToken(ttt.getToken()).get(); ticket = ticketRepository.findById(ticket.getId()).orElseThrow(TicketNotFoundException::new); Assert.assertTrue(ttt.isValid()); Assert.assertEquals(ticket.getOwner(), ticketOwner); }
Source:
public Collection<Ticket> getOwnedTicketsAndFromTeamMembers(User u) { if (u == null) { throw new UserNotFoundException("null"); } Collection<Ticket> ownedTickets = ticketRepository.findAllByOwnerUsernameIgnoreCase(u.getUsername()). stream(). filter(Ticket::isValid). collect(Collectors.toList()); Collection<Ticket> captainedTickets = getCaptainedTickets(u); Collection<Ticket> ticketsInControl = new ArrayList<>(); ticketsInControl.addAll(ownedTickets); ticketsInControl.addAll(captainedTickets); return ticketsInControl; }

Target:
public Collection<Ticket> getOwnedTicketsAndFromTeamMembers(User u) { if (u == null) { throw new IllegalArgumentException("User can't be null"); } Collection<Ticket> ownedTickets = ticketRepository.findAllByOwnerUsernameIgnoreCase(u.getUsername()). stream(). filter(Ticket::isValid). collect(Collectors.toList()); Collection<Ticket> captainedTickets = getCaptainedTickets(u); Collection<Ticket> ticketsInControl = new ArrayList<>(); ticketsInControl.addAll(ownedTickets); ticketsInControl.addAll(captainedTickets); return ticketsInControl; }
Source:
public InMemoryCircuitBreakerRegistry(CircuitBreakerConfig defaultCircuitBreakerConfig) { this.defaultCircuitBreakerConfig = Objects.requireNonNull(defaultCircuitBreakerConfig, "CircuitBreakerConfig must not be null"); this.circuitBreakers = new ConcurrentHashMap<>(); this.postCreationConsumers = new ArrayList<>(); this.sharedCircuitBreakerConfiguration = new ConcurrentHashMap<>(); this.sharedCircuitBreakerConfiguration.put(DEFAULT_CONFIG, defaultCircuitBreakerConfig); }

Target:
public InMemoryCircuitBreakerRegistry(CircuitBreakerConfig defaultCircuitBreakerConfig) { super(); this.defaultCircuitBreakerConfig = Objects.requireNonNull(defaultCircuitBreakerConfig, "CircuitBreakerConfig must not be null"); this.circuitBreakers = new ConcurrentHashMap<>(); this.configurations.put(DEFAULT_CONFIG, defaultCircuitBreakerConfig); }
Source:
public List<InternalJob> loadJobs(final boolean fullState, final JobId... jobIds) { return executeReadOnlyTransaction(session -> { List<Long> ids = new ArrayList<>(jobIds.length); for (JobId jobId : jobIds) { ids.add(jobId(jobId)); } return loadInternalJobs(fullState, session, ids); }); }

Target:
public List<InternalJob> loadJobs(final boolean fullState, final JobId... jobIds) { return executeReadOnlyTransaction(session -> { final List<Long> ids = Stream.of(jobIds).map(SchedulerDBManager::jobId).collect(Collectors.toList()); return loadInternalJobs(fullState, session, ids); }); }
Source:
void flushStoredSession(File storedFile) { Session payload = new Session(storedFile); if (payload.isV2Payload()) { payload.setApp(client.getAppDataCollector().generateApp()); payload.setDevice(client.getDeviceDataCollector().generateDevice()); } DeliveryStatus deliveryStatus = deliverSessionPayload(payload); switch (deliveryStatus) { case DELIVERED: sessionStore.deleteStoredFiles(Collections.singletonList(storedFile)); break; case UNDELIVERED: sessionStore.cancelQueuedFiles(Collections.singletonList(storedFile)); logger.w("Leaving session payload for future delivery"); break; case FAILURE: logger.w("Deleting invalid session tracking payload"); sessionStore.deleteStoredFiles(Collections.singletonList(storedFile)); break; default: break; } }

Target:
void flushStoredSession(File storedFile) { Session payload = new Session(storedFile); if (!payload.isV2Payload()) { payload.setApp(client.getAppDataCollector().generateApp()); payload.setDevice(client.getDeviceDataCollector().generateDevice()); } DeliveryStatus deliveryStatus = deliverSessionPayload(payload); switch (deliveryStatus) { case DELIVERED: sessionStore.deleteStoredFiles(Collections.singletonList(storedFile)); break; case UNDELIVERED: sessionStore.cancelQueuedFiles(Collections.singletonList(storedFile)); logger.w("Leaving session payload for future delivery"); break; case FAILURE: logger.w("Deleting invalid session tracking payload"); sessionStore.deleteStoredFiles(Collections.singletonList(storedFile)); break; default: break; } }
Source:
public void getCourseComponentFromServer(boolean showProgress) { final TaskProgressCallback progressCallback = showProgress ? new TaskProgressCallback.ProgressViewController(loadingIndicator) : null; final String courseId = courseData.getCourse().getId(); getHierarchyCall = courseApi.getCourseStructureWithoutStale(courseId); getHierarchyCall.enqueue(new CourseAPI.GetCourseStructureCallback(getActivity(), courseId, progressCallback, errorNotification, null, this) { @Override protected void onResponse(@NonNull final CourseComponent courseComponent) { courseManager.addCourseDataInAppLevelCache(courseId, courseComponent); loadData(validateCourseComponent(courseComponent)); swipeContainer.setRefreshing(false); } @Override protected void onFailure(@NonNull Throwable error) { super.onFailure(error); if (error instanceof CourseContentNotValidException) { errorNotification.showError(getContext(), error); logger.error(error, true); swipeContainer.setRefreshing(false); } } @Override protected void onFinish() { if (!EventBus.getDefault().isRegistered(CourseOutlineFragment.this)) { EventBus.getDefault().registerSticky(CourseOutlineFragment.this); swipeContainer.setRefreshing(false); } } }); }

Target:
public void getCourseComponentFromServer(boolean showProgress) { final TaskProgressCallback progressCallback = showProgress ? new TaskProgressCallback.ProgressViewController(loadingIndicator) : null; final String courseId = courseData.getCourse().getId(); getHierarchyCall = courseApi.getCourseStructureWithoutStale(courseId); getHierarchyCall.enqueue(new CourseAPI.GetCourseStructureCallback(getActivity(), courseId, progressCallback, errorNotification, null, this) { @Override protected void onResponse(@NonNull final CourseComponent courseComponent) { courseManager.addCourseDataInAppLevelCache(courseId, courseComponent); loadData(validateCourseComponent(courseComponent)); swipeContainer.setRefreshing(false); } @Override protected void onFailure(@NonNull Throwable error) { super.onFailure(error); if (error instanceof CourseContentNotValidException) { errorNotification.showError(getContext(), error); logger.error(error, true); } swipeContainer.setRefreshing(false); } @Override protected void onFinish() { if (!EventBus.getDefault().isRegistered(CourseOutlineFragment.this)) { EventBus.getDefault().registerSticky(CourseOutlineFragment.this); } swipeContainer.setRefreshing(false); } }); }
Source:
public FutureResult<Warehouse> createWarehouse(Warehouse warehouse) { final WarehouseTask task; try { task = restTemplate.postForObject(Warehouses.URI, warehouse, WarehouseTask.class); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to create Warehouse", e); } if (task == null) { throw new GoodDataException("Empty response when Warehouse POSTed to API"); } return new FutureResult<>(this, new PollHandler<WarehouseTask,Warehouse>(task.getPollLink(), WarehouseTask.class, Warehouse.class) { @Override protected boolean isFinished(ClientHttpResponse response) throws IOException { return HttpStatus.CREATED.equals(response.getStatusCode()); } @Override protected void onFinish() { if (!getResult().isEnabled()) { throw new GoodDataException("Created warehouse is not enabled!"); } } @Override protected void handlePollResult(WarehouseTask pollResult) { try { final Warehouse warehouse = restTemplate.getForObject(pollResult.getWarehouseLink(), Warehouse.class); setResult(setWarehouseConnection(warehouse)); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Warehouse creation finished, but can't get created warehouse", e); } } }); }

Target:
public FutureResult<Warehouse> createWarehouse(Warehouse warehouse) { notNull(warehouse, "warehouse"); final WarehouseTask task; try { task = restTemplate.postForObject(Warehouses.URI, warehouse, WarehouseTask.class); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to create Warehouse", e); } if (task == null) { throw new GoodDataException("Empty response when Warehouse POSTed to API"); } return new FutureResult<>(this, new PollHandler<WarehouseTask,Warehouse>(task.getPollLink(), WarehouseTask.class, Warehouse.class) { @Override protected boolean isFinished(ClientHttpResponse response) throws IOException { return HttpStatus.CREATED.equals(response.getStatusCode()); } @Override protected void onFinish() { if (!getResult().isEnabled()) { throw new GoodDataException("Created warehouse, uri: " + getResult().getSelfLink() + " is not enabled!"); } } @Override protected void handlePollResult(WarehouseTask pollResult) { try { final Warehouse warehouse = restTemplate.getForObject(pollResult.getWarehouseLink(), Warehouse.class); setResult(setWarehouseConnection(warehouse)); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Warehouse creation finished, but can't get created warehouse, uri: " + pollResult.getWarehouseLink(), e); } } }); }
Source:
public String exportPipeline(Request req, Response res) { PipelineConfig pipelineConfig = pipelineConfigFromRequest(req); String pluginId = requiredQueryParam(req, "pluginId"); String groupName = requiredQueryParam(req, "groupName"); if (!crPluginService.supportsPipelineExport(pluginId)) { throw haltBecauseOfReason("Plugin `%s` does not support pipeline config export or is not a config-repo plugin.", pluginId); } ConfigRepoPlugin repoPlugin = crPlugin(pluginId); String etag = repoPlugin.etagForExport(pipelineConfig, groupName); if (fresh(req, etag)) { return notModified(res); } else { setEtagHeader(res, etag); ExportedConfig export = repoPlugin.pipelineExport(pipelineConfig, groupName); res.header("Content-Type", export.getContentType()); res.header("Content-Disposition", format("attachment; filename=\"%s\"", export.getFilename())); return export.getContent(); } }

Target:
public String exportPipeline(Request req, Response res) { PipelineConfig pipelineConfig = pipelineConfigFromRequest(req); String pluginId = requiredQueryParam(req, "pluginId"); String groupName = requiredQueryParam(req, "groupName"); if (pipelineConfig.hasTemplate()) { throw haltBecauseOfReason("Pipeline `%s` cannot be exported because pipelines defined by templates are not yet supported by config-repo plugins.", pipelineConfig.name()); } if (!crPluginService.isConfigRepoPlugin(pluginId)) { throw haltBecauseOfReason("Plugin `%s` is not a config-repo plugin.", pluginId); } if (!crPluginService.supportsPipelineExport(pluginId)) { throw haltBecauseOfReason("Plugin `%s` does not support pipeline config export.", pluginId); } ConfigRepoPlugin repoPlugin = crPlugin(pluginId); String etag = repoPlugin.etagForExport(pipelineConfig, groupName); if (fresh(req, etag)) { return notModified(res); } else { setEtagHeader(res, etag); ExportedConfig export = repoPlugin.pipelineExport(pipelineConfig, groupName); res.header("Content-Type", export.getContentType()); res.header("Content-Disposition", format("attachment; filename=\"%s\"", export.getFilename())); return export.getContent(); } }
Source:
private void confirmRemovePerson() { if (mSelectedPerson == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Calypso_AlertDialog); builder.setTitle(getString(R.string.person_remove_confirmation_title, mSelectedPerson.getDisplayName())); builder.setMessage(getString(R.string.person_remove_confirmation_message, mSelectedPerson.getDisplayName())); builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.remove, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeSelectedPerson(); } }); builder.show(); }

Target:
private void confirmRemovePerson() { Person person = getCurrentPerson(); if (person == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.Calypso_AlertDialog); builder.setTitle(getString(R.string.person_remove_confirmation_title, person.getDisplayName())); builder.setMessage(getString(R.string.person_remove_confirmation_message, person.getDisplayName())); builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.remove, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { removeSelectedPerson(); } }); builder.show(); }
Source:
public <T extends Message> MessageCodec<T> find(Class<T> clazz) { for(MessageCodec<?> codec : getCodecs()) { if (codec.getType().equals(clazz)) { return (MessageCodec<T>) codec; } } return null; }

Target:
public <T extends Message> MessageCodec<T> find(Class<T> clazz) { return (MessageCodec<T>) classTable.get(clazz); }
Source:
protected boolean mergeTrees(AbstractTreeIterator baseTree, RevTree headTree, RevTree mergeTree, boolean ignoreConflicts) throws IOException { builder = dircache.builder(); DirCacheBuildIterator buildIt = new DirCacheBuildIterator(builder); tw = new NameConflictTreeWalk(db, reader); tw.addTree(baseTree); tw.addTree(headTree); tw.addTree(mergeTree); tw.addTree(buildIt); if (workingTreeIterator != null) { tw.addTree(workingTreeIterator); } else { tw.setFilter(TreeFilter.ANY_DIFF); } if (!mergeTreeWalk(tw, ignoreConflicts)) { return false; } if (!inCore) { checkout(); if (!builder.commit()) { cleanUp(); throw new IndexWriteException(); } builder = null; } else { builder.finish(); builder = null; } if (getUnmergedPaths().isEmpty() && !failed()) { resultTree = dircache.writeTree(getObjectInserter()); return true; } else { resultTree = null; return false; } }

Target:
protected boolean mergeTrees(AbstractTreeIterator baseTree, RevTree headTree, RevTree mergeTree, boolean ignoreConflicts) throws IOException { builder = dircache.builder(); DirCacheBuildIterator buildIt = new DirCacheBuildIterator(builder); tw = new NameConflictTreeWalk(reader); tw.addTree(baseTree); tw.addTree(headTree); tw.addTree(mergeTree); tw.addTree(buildIt); if (workingTreeIterator != null) { tw.addTree(workingTreeIterator); } else { tw.setFilter(TreeFilter.ANY_DIFF); } if (!mergeTreeWalk(tw, ignoreConflicts)) { return false; } if (!inCore) { checkout(); if (!builder.commit()) { cleanUp(); throw new IndexWriteException(); } builder = null; } else { builder.finish(); builder = null; } if (getUnmergedPaths().isEmpty() && !failed()) { resultTree = dircache.writeTree(getObjectInserter()); return true; } else { resultTree = null; return false; } }
Source:
public void testParseMetadata() throws Exception { String json = IOUtils.toString(getClass().getResourceAsStream("vectorLayers.json")); VectorLayersMetadata layersMetadata = VectorLayersMetadata.parseMetadata(json); List<VectorLayerMetadata> layers = layersMetadata.getLayers(); assertEquals(15, layers.size()); VectorLayerMetadata water = layers.get(1); assertEquals("waterway", water.getId()); assertEquals(Integer.valueOf(0), water.getMinZoom()); assertEquals(Integer.valueOf(14), water.getMaxZoom()); assertEquals("String", water.getFields().get("class")); VectorLayerMetadata mountainPeak = layers.get(4); assertEquals("mountain_peak", mountainPeak.getId()); assertEquals(Integer.valueOf(0), mountainPeak.getMinZoom()); assertEquals(Integer.valueOf(14), mountainPeak.getMaxZoom()); assertEquals("Number", mountainPeak.getFields().get("rank")); }

Target:
public void testParseMetadata() throws Exception { String json = IOUtils.toString( getClass().getResourceAsStream("vectorLayers.json"), Charset.forName("UTF-8")); VectorLayersMetadata layersMetadata = VectorLayersMetadata.parseMetadata(json); List<VectorLayerMetadata> layers = layersMetadata.getLayers(); assertEquals(15, layers.size()); VectorLayerMetadata water = layers.get(1); assertEquals("waterway", water.getId()); assertEquals(Integer.valueOf(0), water.getMinZoom()); assertEquals(Integer.valueOf(14), water.getMaxZoom()); assertEquals("String", water.getFields().get("class")); VectorLayerMetadata mountainPeak = layers.get(4); assertEquals("mountain_peak", mountainPeak.getId()); assertEquals(Integer.valueOf(0), mountainPeak.getMinZoom()); assertEquals(Integer.valueOf(14), mountainPeak.getMaxZoom()); assertEquals("Number", mountainPeak.getFields().get("rank")); }
Source:
public boolean checkCommitInfo() { updateStateFromUI(); if (commitMessage.trim().length() == 0) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoMessage, UIText.CommitDialog_ErrorMustEnterCommitMessage); return false; } boolean authorValid = false; if (author.length() > 0) { authorValid = RawParseUtils.parsePersonIdent(author) != null; } if (!authorValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified); return false; } boolean committerValid = false; if (committer.length() > 0) { committerValid = RawParseUtils.parsePersonIdent(committer) != null; } if (!committerValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidCommitterSpecified); return false; } authorHandler.updateProposals(); committerHandler.updateProposals(); return true; }

Target:
public boolean checkCommitInfo() { updateStateFromUI(); if (commitMessage.trim().length() == 0) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoMessage, UIText.CommitDialog_ErrorMustEnterCommitMessage); return false; } boolean authorValid = false; if (author.length() > 0) authorValid = RawParseUtils.parsePersonIdent(author) != null; if (!authorValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified); return false; } boolean committerValid = false; if (committer.length() > 0) committerValid = RawParseUtils.parsePersonIdent(committer) != null; if (!committerValid) { MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidCommitterSpecified); return false; } authorHandler.updateProposals(); committerHandler.updateProposals(); return true; }
Source:
public void basicTest() throws InstantiationException { StoreKeyConverterFactory storeKeyConverterFactory = new StoreKeyConverterFactoryImpl(); StoreKeyConverter storeKeyConverter = storeKeyConverterFactory.getStoreKeyConverter(); assertTrue(storeKeyConverter instanceof StoreKeyConverterImplNoOp); }

Target:
public void basicTest() throws InstantiationException { StoreKeyConverterFactory storeKeyConverterFactory = new StoreKeyConverterFactoryImpl(); StoreKeyConverter storeKeyConverter = storeKeyConverterFactory.getStoreKeyConverter(); assertTrue("StoreKeyConverter should have been StoreKeyConverterImplNoOp impl", storeKeyConverter instanceof StoreKeyConverterImplNoOp); }
Source:
private void commitCreate(AsyncFileEntry entry, boolean success) { LOGGER.debug("commitCreate({},{}): Starting...", entry.getName(), success); if (success) { entry.commit(); entry.getParent().ifPresent(e -> e.addChild(entry)); } removeFromProcessors(entry); }

Target:
private void commitCreate(AsyncFileEntry entry, boolean success) { LOGGER.debug("commitCreate({},{}): Starting...", entry.getName(), success); if (success) { entry.commit(); entry.getParent().ifPresent(e -> e.addChild(entry)); } onFinish(); }
Source:
public List<List<WebElement>> getRows() { return getWrappedElement() .findElements(By.cssSelector("tr")) .stream() .map(rowElement -> rowElement.findElements(By.cssSelector("td"))) .filter(row -> row.size() > 0) .collect(toList()); }

Target:
public List<List<WebElement>> getRows() { return getWrappedElement() .findElements(By.xpath(". .stream() .map(rowElement -> rowElement.findElements(By.xpath(". .filter(row -> row.size() > 0) .collect(toList()); }
Source:
public KafkaPoller(Consumer<String, ChangeEvent> consumer, Uris uris, Instant firstStartTime, int batchSize, Collection<String> topics, RdfRepository rdfRepo) { this.consumer = consumer; this.uris = uris; this.firstStartTime = firstStartTime; this.batchSize = batchSize; this.topics = topics; this.rdfRepo = rdfRepo; try { this.root = uris.builder().build(); } catch (URISyntaxException e) { throw new RuntimeException(e); } this.topicPartitions = setUpTopicPartitions(); }

Target:
public KafkaPoller(Consumer<String, ChangeEvent> consumer, Uris uris, Instant firstStartTime, int batchSize, Collection<String> topics, RdfRepository rdfRepo) { this.consumer = consumer; this.uris = uris; this.firstStartTime = firstStartTime; this.batchSize = batchSize; this.topics = topics; this.rdfRepo = rdfRepo; try { this.root = uris.builder().build(); } catch (URISyntaxException e) { throw new RuntimeException(e); } this.topicPartitions = topicsToPartitions(); }
Source:
private <T> T executeInTimerContext(Supplier<T> supplier) { try (Timer.Context timer = this.conjureTimelockServiceBlockingMetrics.startTransactions().time()) { return supplier.get(); } }

Target:
private <T> T executeInTimerContext(Supplier<T> supplier) { try (Timer.Context timer = conjureTimelockServiceBlockingMetrics.startTransactions().time()) { return supplier.get(); } }
Source:
Optional<CollectorRegistry> register(List<Gauge> gauges, Supplier<CollectorRegistry> collectorRegistryCreator) { Supplier<CollectorRegistry> collectorRegistrySupplier = () -> { try { CollectorRegistry collectorRegistry = collectorRegistryCreator.get(); gauges.forEach(collectorRegistry::register); return collectorRegistry; } catch (Exception e) { logger.error("Gauges registration failed."); e.printStackTrace(); return null; } }; return register(collectorRegistrySupplier); }

Target:
Optional<CollectorRegistry> register(List<Gauge> gauges, Supplier<CollectorRegistry> collectorRegistryCreator) { Supplier<CollectorRegistry> collectorRegistrySupplier = () -> { try { CollectorRegistry collectorRegistry = collectorRegistryCreator.get(); gauges.forEach(collectorRegistry::register); return collectorRegistry; } catch (Exception e) { logger.error("Gauges registration failed.", e); return null; } }; return register(collectorRegistrySupplier); }