auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void handleTask(Task task, Map<String, Object> parameters, boolean isRetry) { long activityId = activityService.addTaskStarted(task, parameters); Map<String, Object> metadata = prepareTaskMetadata(task.getId(), activityId, isRetry); taskContext = new TaskContext(task, parameters, metadata, activityService); TaskInitializer initializer = new TaskInitializer(taskContext); try { LOGGER.info("Executing all actions from task: {}", task.getName()); if (initializer.evalConfigSteps(dataProviders)) { for (int i = 0; i < task.getActions().size(); i++) { executor.execute(task, task.getActions().get(i), i, taskContext, activityId); } } LOGGER.warn("Actions from task: weren't executed, because config steps didn't pass the evaluation", task.getName()); } catch (TaskHandlerException e) { postExecutionHandler.handleError(parameters, metadata, task, e, activityId); } catch (RuntimeException e) { postExecutionHandler.handleError(parameters, metadata, task, new TaskHandlerException(TRIGGER, "task.error.unrecognizedError", e), activityId); } }

Target:
private void handleTask(Task task, Map<String, Object> parameters, boolean isRetry) { long activityId = activityService.addTaskStarted(task, parameters); Map<String, Object> metadata = prepareTaskMetadata(task.getId(), activityId, isRetry); TaskContext taskContext = new TaskContext(task, parameters, metadata, activityService); TaskInitializer initializer = new TaskInitializer(taskContext); try { LOGGER.info("Executing all actions from task: {}", task.getName()); if (initializer.evalConfigSteps(dataProviders)) { for (int i = 0; i < task.getActions().size(); i++) { executor.execute(task, task.getActions().get(i), i, taskContext, activityId); } } LOGGER.warn("Actions from task: weren't executed, because config steps didn't pass the evaluation", task.getName()); } catch (TaskHandlerException e) { postExecutionHandler.handleError(parameters, metadata, task, e, activityId); } catch (RuntimeException e) { postExecutionHandler.handleError(parameters, metadata, task, new TaskHandlerException(TRIGGER, "task.error.unrecognizedError", e), activityId); } }
Source:
public ResponseEntity<Loan> create(@RequestBody @Valid Loan loan) { try { Loan createdLoan = loanDao.saveAndFlush(loan); return new ResponseEntity<>(createdLoan, HttpStatus.OK); } catch (DataIntegrityViolationException dive) { throw new ConflictException(dive.getMostSpecificCause().getMessage()); } }

Target:
public ResponseEntity<Loan> create(@RequestBody @Valid Loan loan) { try { loan.setActive(true); if(loan.getCounterparty().getId() == 0){ counterpartyDao.saveAndFlush(loan.getCounterparty()); } loan.setUser(userUtil.extractLoggedAppUserFromDatabase()); Loan createdLoan = loanDao.saveAndFlush(loan); return new ResponseEntity<>(createdLoan, HttpStatus.OK); } catch (DataIntegrityViolationException dive) { throw new ConflictException(dive.getMostSpecificCause().getMessage()); } }
Source:
public void setAlternativeSequenceName(final Collection<String> alternativeSequences) { if (alternativeSequences == null) { setAttribute(ALTERNATIVE_SEQUENCE_NAME_TAG, null); } else { alternativeSequences.forEach(SAMSequenceRecord::validateAltRegExp); encodeAltSequences(alternativeSequences); } }

Target:
public void setAlternativeSequenceName(final Collection<String> alternativeSequences) { if (alternativeSequences == null) { setAttribute(ALTERNATIVE_SEQUENCE_NAME_TAG, null); } else { encodeAltSequences(alternativeSequences); } }
Source:
public TemplateDataStoreVO getReadyBypassedTemplate(long templateId) { SearchCriteria<TemplateDataStoreVO> sc = directDownloadTemplateSeach.create(); sc.setParameters("template_id", templateId); sc.setParameters("download_state", Status.BYPASSED); sc.setParameters("state", State.Ready); List<TemplateDataStoreVO> list = search(sc, null); if (list == null || list.isEmpty() || list.size() > 1) { return null; } return list.get(0); }

Target:
public TemplateDataStoreVO getReadyBypassedTemplate(long templateId) { SearchCriteria<TemplateDataStoreVO> sc = directDownloadTemplateSeach.create(); sc.setParameters("template_id", templateId); sc.setParameters("download_state", Status.BYPASSED); sc.setParameters("state", State.Ready); List<TemplateDataStoreVO> list = search(sc, null); if (CollectionUtils.isEmpty(list) || list.size() > 1) { return null; } return list.get(0); }
Source:
private ICPPEvaluation deref(ICPPEvaluation ptr, boolean isRef, ActivationRecord record, ConstexprEvaluationContext context) { ICPPEvaluation derefEval = new EvalUnary(ICPPASTUnaryExpression.op_star, ptr, null, context.getPoint()).computeForFunctionCall(record, context); if(isRef) { return derefEval; } else { return new EvalFixed(derefEval.getType(null), derefEval.getValueCategory(null), derefEval.getValue(null)); } }

Target:
private static ICPPEvaluation deref(ICPPEvaluation ptr, boolean isRef, ActivationRecord record, ConstexprEvaluationContext context) { ICPPEvaluation derefEval = new EvalUnary(ICPPASTUnaryExpression.op_star, ptr, null, context.getPoint()).computeForFunctionCall(record, context); if(isRef) { return derefEval; } else { return new EvalFixed(derefEval.getType(context.getPoint()), derefEval.getValueCategory(context.getPoint()), derefEval.getValue(context.getPoint())); } }
Source:
private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Publisher) { buildStep = ((Publisher) bs).getDescriptor().getDisplayName(); } else { buildStep = bs.getClass().getName(); } if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error(buildStep + "' failed: " + e.getMessage()); } else { String msg = buildStep + "' aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }

Target:
private void reportError(BuildStep bs, Throwable e, BuildListener listener, boolean phase) { final String buildStep; if (bs instanceof Describable) { buildStep = ((Describable) bs).getDescriptor().getDisplayName(); } else { buildStep = bs.getClass().getName(); } if (e instanceof AbortException) { LOGGER.log(Level.FINE, "{0} : {1} failed", new Object[] {AbstractBuild.this, buildStep}); listener.error("Step ‘" + buildStep + "’ failed: " + e.getMessage()); } else { String msg = "Step ‘" + buildStep + "’ aborted due to exception: "; e.printStackTrace(listener.error(msg)); LOGGER.log(WARNING, msg, e); } if (phase) { setResult(Result.FAILURE); } }
Source:
public final void run() { if (allowedCpus != null) { Affinity.setAffinity(allowedCpus); BitSet actualCpus = Affinity.getAffinity(); if (!actualCpus.equals(allowedCpus)) { System.out.println(getName() + " affinity was not applied successfully. " + "Expected cpus:" + allowedCpus + ". Actual cpus:" + actualCpus); } else { System.out.println(getName() + " has affinity for cpus:" + allowedCpus); } } try { beforeRun(); executeRun(); } catch (OutOfMemoryError e) { OutOfMemoryErrorDispatcher.onOutOfMemory(e); } finally { afterRun(); } }

Target:
public final void run() { if (allowedCpus != null) { Affinity.setAffinity(allowedCpus); BitSet actualCpus = Affinity.getAffinity(); ILogger logger = Logger.getLogger(HazelcastManagedThread.class); if (!actualCpus.equals(allowedCpus)) { logger.warning(getName() + " affinity was not applied successfully. " + "Expected CPUs:" + allowedCpus + ". Actual CPUs:" + actualCpus); } else { logger.info(getName() + " has affinity for CPUs:" + allowedCpus); } } try { beforeRun(); executeRun(); } catch (OutOfMemoryError e) { OutOfMemoryErrorDispatcher.onOutOfMemory(e); } finally { afterRun(); } }
Source:
private String pathToFolder(File file) { String path = file.getAbsolutePath(); try { return path.substring(path.indexOf("GUIData") + "GUIData".length() + 1, path.lastIndexOf(File.separator)) .trim(); } catch(StringIndexOutOfBoundsException ex) { return ""; } }

Target:
private String pathToFolder(File file) { String path = file.getAbsolutePath(); try { return path.substring(path.indexOf(baseFolder) + baseFolder.length() + 1, path.lastIndexOf(File.separator)) .trim(); } catch(StringIndexOutOfBoundsException ex) { return ""; } }
Source:
private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equals(peerSegmentDownloadScheme) && !"https".equals(peerSegmentDownloadScheme)) { throw new IllegalStateException("peerSegmentDownloadScheme: " + peerSegmentDownloadScheme + " is not http nor https" ); } } } }

Target:
private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equalsIgnoreCase(peerSegmentDownloadScheme) && !"https".equalsIgnoreCase(peerSegmentDownloadScheme)) { throw new IllegalStateException("Invalid value '" + peerSegmentDownloadScheme + "' for peerSegmentDownloadScheme. Must be one of http nor https" ); } } } }
Source:
private String getFolderSizeHuman(String path) { File dir = new File(path); if(dir.exists()) { long bytes = getFolderSize(dir); if (bytes < 1024) return bytes + " B"; int exp = (int) (Math.log(bytes) / Math.log(1024)); String pre = ("KMGTPE").charAt(exp-1) + ""; return String.format("%.1f %sB", bytes / Math.pow(1024, exp), pre); } return "0 B"; }

Target:
private String getFolderSizeHuman(String path) { File dir = new File(path); if (dir.exists()) { long bytes = getFolderSize(dir); return DisplayUtils.bytesToHumanReadable(bytes); } return "0 B"; }
Source:
public Void visitTableScan(TableScanNode node, IOPlanBuilder context) { TableMetadata tableMetadata = metadata.getTableMetadata(session, node.getTable()); context.addInputTableColumnInfo(new IOPlan.TableColumnInfo( new QualifiedTablePrefix( tableMetadata.getConnectorId().getCatalogName(), tableMetadata.getTable().getSchemaName(), tableMetadata.getTable().getTableName()), parseConstraints(node.getTable(), node.getCurrentConstraint()))); node.getSources().forEach(plan -> plan.accept(this, context)); return null; }

Target:
public Void visitTableScan(TableScanNode node, IOPlanBuilder context) { TableMetadata tableMetadata = metadata.getTableMetadata(session, node.getTable()); context.addInputTableColumnInfo(new IOPlan.TableColumnInfo( new CatalogSchemaTableName( tableMetadata.getConnectorId().getCatalogName(), tableMetadata.getTable().getSchemaName(), tableMetadata.getTable().getTableName()), parseConstraints(node.getTable(), node.getCurrentConstraint()))); return null; }
Source:
Box(Corner upperLeft, Corner upperRight, Corner lowerRight, Corner lowerLeft) { this.upperLeft = upperLeft; this.upperRight = upperRight; this.lowerRight = lowerRight; this.lowerLeft = lowerLeft; top = false; right = false; bottom = false; left = false; owner = null; }

Target:
Box(Corner upperLeft, Corner upperRight, Corner lowerRight, Corner lowerLeft) { this.upperLeft = upperLeft; this.upperRight = upperRight; this.lowerRight = lowerRight; this.lowerLeft = lowerLeft; top = false; right = false; bottom = false; left = false; owner = NO_OWNER; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof JksOptions)) return false; JksOptions that = (JksOptions) o; if (password != null ? !password.equals(that.password) : that.password != null) return false; if (path != null ? !path.equals(that.path) : that.path != null) return false; if (value != null ? !value.equals(that.value) : that.value != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof JksOptions)) { return false; } JksOptions that = (JksOptions) o; if (password != null ? !password.equals(that.password) : that.password != null) { return false; } if (path != null ? !path.equals(that.path) : that.path != null) { return false; } if (value != null ? !value.equals(that.value) : that.value != null) { return false; } return true; }
Source:
public void vlanOverBond() { VdsNetworkInterface bond = createBond(null); List<VdsNetworkInterface> ifacesToBond = createBondSlaves(null); SetupNetworksParameters parameters = createParametersForBond(bond, ifacesToBond); String networkName = "net"; parameters.getInterfaces().add(createVlan(bond.getName(), 100, networkName)); SetupNetworksHelper helper = createHelper(parameters); mockExistingIfacesWithBond(bond, ifacesToBond); network network = mockExistingNetwork(networkName); validateAndExpectNoViolations(helper); assertBondModified(helper, bond); assertNetworkModified(helper, network); assertNoBondsRemoved(helper); assertNoNetworksRemoved(helper); }

Target:
public void vlanOverBond() { VdsNetworkInterface bond = createBond(BOND_NAME, null); List<VdsNetworkInterface> ifacesToBond = createNics(null); mockExistingIfacesWithBond(bond, ifacesToBond); SetupNetworksParameters parameters = createParametersForBond(bond, ifacesToBond); String networkName = "net"; parameters.getInterfaces().add(createVlan(bond.getName(), 100, networkName)); network network = mockExistingNetwork(networkName); SetupNetworksHelper helper = createHelper(parameters); validateAndExpectNoViolations(helper); assertBondModified(helper, bond); assertNetworkModified(helper, network); assertNoBondsRemoved(helper); assertNoNetworksRemoved(helper); }
Source:
synchronized public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { if (obj instanceof Reference && "javax.sql.DataSource".equals(((Reference) obj).getClassName())) { Reference ref = (Reference) obj; Set<String> hikariPropSet = PropertyElf.getPropertyNames(HikariConfig.class); Properties properties = new Properties(); Enumeration<RefAddr> enumeration = ref.getAll(); while (enumeration.hasMoreElements()) { RefAddr element = enumeration.nextElement(); String type = element.getType(); if (type.startsWith("dataSource.") || hikariPropSet.contains(type)) { properties.setProperty(type, element.getContent().toString()); } } return createDataSource(properties, nameCtx); } else { return null; } }

Target:
synchronized public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception { if (obj instanceof Reference && "javax.sql.DataSource".equals(((Reference) obj).getClassName())) { Reference ref = (Reference) obj; Set<String> hikariPropSet = PropertyElf.getPropertyNames(HikariConfig.class); Properties properties = new Properties(); Enumeration<RefAddr> enumeration = ref.getAll(); while (enumeration.hasMoreElements()) { RefAddr element = enumeration.nextElement(); String type = element.getType(); if (type.startsWith("dataSource.") || hikariPropSet.contains(type)) { properties.setProperty(type, element.getContent().toString()); } } return createDataSource(properties, nameCtx); } return null; }
Source:
public static String getObservationStrategy() { return Context.getAdministrationService().getGlobalProperty("fhit.observation.observationStrategy"); }

Target:
public static String getObservationStrategy() { return Context.getAdministrationService().getGlobalProperty("fhir.observation.observationStrategy"); }
Source:
private void parse(HwpStreamReader reader, XHTMLContentHandler xhtml) throws IOException, SAXException { StringBuffer buf = new StringBuffer(1024); TagInfo tag = new TagInfo(); while (true) { if (!readTag(reader, tag)) break; buf.setLength(0); if (HWPTAG_BEGIN + 50 == tag.id) { writeParaHeader(reader, tag.length, buf); } else if (HWPTAG_BEGIN + 51 == tag.id) { if (tag.length % 2 != 0) throw new IOException("Invalid block size"); writeParaText(reader, tag.length, buf); if (buf.length() > 0) { buf.append('\n'); xhtml.characters(buf.toString()); } } else { reader.ensureSkip(tag.length); } if (buf.length() > 0) { log.debug("TAG[{}]({}):{} [{}]", new Object[] { tag.id, tag.level, tag.length, buf }); } } }

Target:
private void parse(HwpStreamReader reader, XHTMLContentHandler xhtml) throws IOException, SAXException { StringBuffer buf = new StringBuffer(1024); TagInfo tag = new TagInfo(); while (true) { if (!readTag(reader, tag)) break; if (HWPTAG_BEGIN + 51 == tag.id) { if (tag.length % 2 != 0) throw new IOException("Invalid block size"); buf.setLength(0); writeParaText(reader, tag.length, buf); if (buf.length() > 0) { buf.append('\n'); xhtml.startElement("p"); xhtml.characters(buf.toString()); xhtml.endElement("p"); } } else { reader.ensureSkip(tag.length); } } }
Source:
Request(Builder builder) { this.uri = builder.uri; this.resourceId = builder.resourceId; this.stableKey = builder.stableKey; if (builder.transformations == null) { this.transformations = new ArrayList<>(); } else { this.transformations = Collections.unmodifiableList(new ArrayList<>(builder.transformations)); } this.targetWidth = builder.targetWidth; this.targetHeight = builder.targetHeight; this.centerCrop = builder.centerCrop; this.centerInside = builder.centerInside; this.centerCropGravity = builder.centerCropGravity; this.onlyScaleDown = builder.onlyScaleDown; this.rotationDegrees = builder.rotationDegrees; this.rotationPivotX = builder.rotationPivotX; this.rotationPivotY = builder.rotationPivotY; this.hasRotationPivot = builder.hasRotationPivot; this.purgeable = builder.purgeable; this.config = builder.config; this.priority = builder.priority; if (Looper.myLooper() == Looper.getMainLooper()) { this.key = createKey(); } else { this.key = createKey(new StringBuilder()); } this.tag = builder.tag; this.memoryPolicy = builder.memoryPolicy; this.networkPolicy = builder.networkPolicy; }

Target:
Request(Builder builder) { this.uri = builder.uri; this.resourceId = builder.resourceId; this.stableKey = builder.stableKey; if (builder.transformations == null) { this.transformations = Collections.emptyList(); } else { this.transformations = Collections.unmodifiableList(new ArrayList<>(builder.transformations)); } this.targetWidth = builder.targetWidth; this.targetHeight = builder.targetHeight; this.centerCrop = builder.centerCrop; this.centerInside = builder.centerInside; this.centerCropGravity = builder.centerCropGravity; this.onlyScaleDown = builder.onlyScaleDown; this.rotationDegrees = builder.rotationDegrees; this.rotationPivotX = builder.rotationPivotX; this.rotationPivotY = builder.rotationPivotY; this.hasRotationPivot = builder.hasRotationPivot; this.purgeable = builder.purgeable; this.config = builder.config; this.priority = builder.priority; if (Looper.myLooper() == Looper.getMainLooper()) { this.key = createKey(); } else { this.key = createKey(new StringBuilder()); } this.tag = builder.tag; this.memoryPolicy = builder.memoryPolicy; this.networkPolicy = builder.networkPolicy; }
Source:
public Object apply(AccountResource rsrc, Input input) throws OrmException, MethodNotAllowedException { if (!realm.allowsEdit(FieldName.FULL_NAME)) { throw new MethodNotAllowedException("The realm doesn't allow editing names"); } if (input == null) { input = new Input(); } Account a = rsrc.getUser().getAccount(); a.setFullName(input.name); dbProvider.get().accounts().update(Collections.singleton(a)); byIdCache.evict(a.getId()); return Strings.isNullOrEmpty(a.getFullName()) ? Response.none() : a .getFullName(); }

Target:
public Object apply(AccountResource rsrc, Input input) throws MethodNotAllowedException, ResourceNotFoundException, OrmException { if (!realm.allowsEdit(FieldName.FULL_NAME)) { throw new MethodNotAllowedException("The realm doesn't allow editing names"); } if (input == null) { input = new Input(); } Account a = dbProvider.get().accounts().get(rsrc.getUser().getAccountId()); if (a == null) { throw new ResourceNotFoundException("No such account: " + rsrc.getUser().getAccountId()); } a.setFullName(input.name); dbProvider.get().accounts().update(Collections.singleton(a)); byIdCache.evict(a.getId()); return Strings.isNullOrEmpty(a.getFullName()) ? Response.none() : a.getFullName(); }
Source:
public static void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("/Users/csuarez/Downloads/movies.txt.gz"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }

Target:
public static void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("/path/to/movies.txt.gz"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }
Source:
public Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable, boolean useFallback) throws IOException, InvalidPathException { Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } Future<Collection<UfsStatus>> prefetchJob = mActivePrefetchJobs.remove(path); if (prefetchJob != null) { try { return prefetchJob.get(); } catch (InterruptedException | ExecutionException e) { LOG.warn("Failed waiting to fetch children at {}", path); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } throw new IOException(e); } } if (useFallback) { return getChildrenIfAbsent(path, mountTable); } return null; }

Target:
public Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable, boolean useFallback) throws InterruptedException, InvalidPathException { Future<Collection<UfsStatus>> prefetchJob = mActivePrefetchJobs.get(path); if (prefetchJob != null) { try { return prefetchJob.get(); } catch (InterruptedException | ExecutionException e) { LogUtils.warnWithException(LOG, "Failed to get result for prefetch job on alluxio path {}", path, e); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); throw (InterruptedException) e; } } finally { mActivePrefetchJobs.remove(path); } } Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } if (useFallback) { return getChildrenIfAbsent(path, mountTable); } return null; }
Source:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkCallable(); if (pathFilters.size() > 0) walk.setTreeFilter(AndTreeFilter.create( PathFilterGroup.create(pathFilters), TreeFilter.ANY_DIFF)); if (skip > -1) walk.setRevFilter(SkipRevFilter.create(skip)); if (maxCount > -1) walk.setRevFilter(MaxCountRevFilter.create(maxCount)); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( JGitText.get().noHEADExistsAndNoExplicitStartingRevisionWasSpecified); add(headId); } catch (IOException e) { throw new JGitInternalException( JGitText.get().anExceptionOccurredWhileTryingToAddTheIdOfHEAD, e); } } setCallable(false); return walk; }

Target:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkCallable(); if (pathFilters.size() > 0) walk.setTreeFilter(AndTreeFilter.create( PathFilterGroup.create(pathFilters), TreeFilter.ANY_DIFF)); if (skip > -1 && maxCount > -1) walk.setRevFilter(AndRevFilter.create(SkipRevFilter.create(skip), MaxCountRevFilter.create(maxCount))); else if (skip > -1) walk.setRevFilter(SkipRevFilter.create(skip)); else if (maxCount > -1) walk.setRevFilter(MaxCountRevFilter.create(maxCount)); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( JGitText.get().noHEADExistsAndNoExplicitStartingRevisionWasSpecified); add(headId); } catch (IOException e) { throw new JGitInternalException( JGitText.get().anExceptionOccurredWhileTryingToAddTheIdOfHEAD, e); } } setCallable(false); return walk; }
Source:
protected void executeCommand() { try { reconstructOpSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpSucceeded); if (!_isLastMaster && reconstructOpSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") final List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); executeInNewTransaction(new TransactionMethod<Object>() { @Override public Void runInTransaction() { for (VM vm : vmsInPool) { getVmDAO().updateVmOvfGeneration(vm.getId(), 0); } return null; } }); } setSucceeded(reconstructOpSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }

Target:
protected void executeCommand() { try { reconstructOpSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpSucceeded); if (!_isLastMaster && reconstructOpSucceeded) { getVmAndTemplatesGenerationsDAO().incrementDbGenerationForAllInStoragePool(getStoragePoolId().getValue()); } setSucceeded(reconstructOpSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }
Source:
public boolean shouldBeRetried(URI uri, int retryCount, ClientResponse response, Throwable exception, Mode mode) { if (retryCount >= maxRetries) { LOG.warning(String.format("Retries exceeded. retryCount: %d - maxRetries: %d", retryCount+1, maxRetries)); return false; } if ((response != null) && (mode == Mode.RETRY_ALL)) { if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { LOG.info(String.format("Retrying request due to Status %d. retryCount: %d - request: %s", response.getStatus(), retryCount+1, uri)); return true; } } if (response != null) { int responseStatus = response.getStatus(); if (responseStatus == 429 || responseStatus == 502 || responseStatus == 503 || responseStatus == 504) { LOG.info(String.format("Retrying request due to status %d, retryCount: %d - request: %s", responseStatus, retryCount+1, uri)); return true; } } return shouldBeRetried(uri, exception, mode); }

Target:
public boolean shouldBeRetried(URI uri, int retryCount, ClientResponse response, Throwable exception, Mode mode) { if (retryCount >= maxRetries) { LOG.warning(String.format("Retries exceeded. retryCount: %d - maxRetries: %d", retryCount+1, maxRetries)); return false; } if (response != null) { int responseStatus = response.getStatus(); if (responseStatus == 429 || responseStatus == 503) { LOG.info(String.format("Retrying request due to status %d, retryCount: %d - request: %s", responseStatus, retryCount+1, uri)); return true; } } if ((response != null) && (mode == Mode.RETRY_ALL)) { if (response.getStatusInfo().getFamily() == Response.Status.Family.SERVER_ERROR) { LOG.info(String.format("Retrying request due to Status %d. retryCount: %d - request: %s", response.getStatus(), retryCount+1, uri)); return true; } } return shouldBeRetried(uri, exception, mode); }
Source:
public StreamTableDefinitionBuilder hashFirstNRowComponents(int numberOfComponentsHashed) { Preconditions.checkArgument(numberOfComponentsHashed <= 2, "Can hash at most two row components for any StreamStore table."); this.numberOfComponentsHashed = numberOfComponentsHashed; return this; }

Target:
public StreamTableDefinitionBuilder hashFirstNRowComponents(int numberOfComponentsHashed) { Preconditions.checkArgument(numberOfComponentsHashed <= 2, "The number of components specified must be less than two as " + "StreamStore internal tables use at most two row components."); this.numberOfComponentsHashed = numberOfComponentsHashed; return this; }
Source:
static void tryDestroy(final MultiUserChat muc) { try { if (muc != null) { muc.destroy("test fixture teardown", null); } } catch (Exception e) { } }

Target:
static void tryDestroy(final MultiUserChat muc) { if (muc == null) { return; } try { muc.destroy("test fixture teardown", null); } catch (Exception ignore) { } }
Source:
protected void awaitConsistency() { if (!initialized) { return; } if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) { Uninterruptibles.sleepUninterruptibly(AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS); } }

Target:
protected void awaitConsistency() { if (view.getConsistencyModel() == ConsistencyModel.EVENTUAL) { Uninterruptibles.sleepUninterruptibly(AWAIT_CONSISTENCY_TIMEOUT_SECONDS, TimeUnit.SECONDS); } }
Source:
public void write(final A item) { if (this.isClosed) throw new RuntimeIOException("Attempt to add record to closed writer."); this.nonBlockingCheckAndRethrow(); try { while (!this.isClosed && !this.queue.offer(item, 5, TimeUnit.SECONDS)) { } } catch (InterruptedException e) { throw new RuntimeException("Exception while placing item in queue", e); } if (queue.size() >= this.writeThreshold && this.currentTask == null) { this.drain(); } }

Target:
public void write(final A item) { if (this.isClosed) throw new RuntimeIOException("Attempt to add record to closed writer."); nonBlockingCheckAndRethrow(); try { while (!this.isClosed && !this.queue.offer(item, 5, TimeUnit.SECONDS)) { } } catch (InterruptedException e) { throw new RuntimeException("Exception while placing item in queue", e); } if (this.currentTask == null && queue.size() >= this.writeThreshold) { drain(); } }
Source:
public void testABlackHoleUrl() throws Exception { assumeThat(getAvailableNetworkInterface(), isAvailable()); Callable<String> downloadAttempt = () -> { AttachmentContent attachmentContent = mock(AttachmentContent.class); when(attachmentContent.getRemoteUrl()).thenReturn("http://" + BLACK_HOLE_ADDRESS + "/filename"); try (InputStream download = attachmentContentDownloader .download(attachmentContent, downloadTimeout)) { return CharStreams.toString(new InputStreamReader(download)); } }; ExecutorService executor = newSingleThreadExecutor(); try { Future<String> future = executor.submit(downloadAttempt); try { try { String read = future.get(1, TimeUnit.MINUTES); fail("downloader managed to escape with '" + read + "' from the black hole! " + "Try this test again with a more massive black hole"); } catch (ExecutionException e) { Throwable futureException = e.getCause(); assertThat(futureException, is(notNullValue())); assertTrue(futureException instanceof SocketTimeoutException); } } catch (TimeoutException e) { fail("downloader got stuck on a black hole"); throw e; } } finally { executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); } }

Target:
public void testABlackHoleUrl() throws Exception { assumeThat(getAvailableNetworkInterface(), isAvailable()); Callable<String> downloadAttempt = () -> { AttachmentContent attachmentContent = mock(AttachmentContent.class); when(attachmentContent.getRemoteUrl()).thenReturn("http://" + BLACK_HOLE_ADDRESS + "/filename"); try (InputStream download = attachmentContentDownloader .download(attachmentContent, downloadTimeout)) { return CharStreams.toString(new InputStreamReader(download)); } }; ExecutorService executor = newSingleThreadExecutor(); try { Future<String> future = executor.submit(downloadAttempt); try { try { String read = future.get(1, TimeUnit.MINUTES); fail("downloader managed to escape with '" + read + "' from the black hole! " + "Try this test again with a more massive black hole"); } catch (ExecutionException e) { Throwable futureException = e.getCause(); assertThat(futureException, is(notNullValue())); assertTrue(futureException instanceof SocketException || futureException instanceof SocketTimeoutException); } } catch (TimeoutException e) { fail("downloader got stuck on a black hole"); throw e; } } finally { executor.shutdown(); executor.awaitTermination(1, TimeUnit.MINUTES); } }
Source:
public IterableStream<T> getElements() { return items == null ? null : new IterableStream<T>(items); }

Target:
public IterableStream<T> getElements() { return IterableStream.of(items); }
Source:
public BitmapFontCache newFontCache () { for (int i = 0; i < regions.size; i++) { getRegion(i).getTexture().setFilter(TextureFilter.Linear, TextureFilter.Linear); } return new DistanceFieldFontCache(this, integer); }

Target:
public BitmapFontCache newFontCache () { return new DistanceFieldFontCache(this, integer); }
Source:
Mono<PagedResponse<ModelData>> createModelsSinglePageAsync(List<String> models, Context context) { List<Object> modelsPayload = new ArrayList<>(); for (String model: models) { try { modelsPayload.add(mapper.readValue(model, Object.class)); } catch (JsonProcessingException e) { logger.error("Could not parse the model payload [%s]: %s", model, e); return Mono.error(e); } } return protocolLayer.getDigitalTwinModels().addWithResponseAsync(modelsPayload, context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(object -> ModelDataConverter.map(object)) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( objectPagedResponse.getRequest(), objectPagedResponse.getStatusCode(), objectPagedResponse.getHeaders(), convertedList, null, ((PagedResponseBase) objectPagedResponse).getDeserializedHeaders()); } ); }

Target:
Mono<PagedResponse<ModelData>> createModelsSinglePageAsync(List<String> models, Context context) { List<Object> modelsPayload = new ArrayList<>(); for (String model: models) { try { modelsPayload.add(mapper.readValue(model, Object.class)); } catch (JsonProcessingException e) { logger.error("Could not parse the model payload [%s]: %s", model, e); return Mono.error(e); } } return protocolLayer.getDigitalTwinModels().addWithResponseAsync(modelsPayload, context) .map( objectPagedResponse -> { List<ModelData> convertedList = objectPagedResponse.getValue().stream() .map(ModelDataConverter::map) .filter(Objects::nonNull) .collect(Collectors.toList()); return new PagedResponseBase<>( objectPagedResponse.getRequest(), objectPagedResponse.getStatusCode(), objectPagedResponse.getHeaders(), convertedList, null, ((PagedResponseBase) objectPagedResponse).getDeserializedHeaders()); } ); }
Source:
public synchronized void run() { if (operationsAreComplete()) { setRetryComplete(); return; } try { if (retryId == null) { retryId = Long.valueOf( asyncExecutor.getOperationAccountant().registerComplexOperation(createRetryHandler())); } long start = clock.nanoTime(); mutateRowsFuture = asyncExecutor.mutateRowsAsync(currentRequestManager.build()); long now = clock.nanoTime(); BulkMutationsStats.getInstance().markThrottling(now - start); currentRequestManager.lastRpcSentTimeNanos = now; } catch (InterruptedException e) { Thread.currentThread().interrupt(); mutateRowsFuture = Futures.<List<MutateRowsResponse>> immediateFailedFuture(e); } catch (Throwable e) { mutateRowsFuture = Futures.<List<MutateRowsResponse>> immediateFailedFuture(e); } finally { addCallback(mutateRowsFuture); } }

Target:
public synchronized void run() { if (operationsAreComplete()) { setRetryComplete(); return; } try { if (retryId == null) { retryId = Long.valueOf( asyncExecutor.getOperationAccountant().registerComplexOperation(createRetryHandler())); } MutateRowsRequest request = currentRequestManager.build(); long start = clock.nanoTime(); long operationId = asyncExecutor.getOperationAccountant() .registerOperationWithHeapSize(request.getSerializedSize()); long now = clock.nanoTime(); BulkMutationsStats.getInstance().markThrottling(now - start); mutateRowsFuture = asyncExecutor.mutateRowsAsync(request, operationId); currentRequestManager.lastRpcSentTimeNanos = now; } catch (InterruptedException e) { Thread.currentThread().interrupt(); mutateRowsFuture = Futures.<List<MutateRowsResponse>> immediateFailedFuture(e); } catch (Throwable e) { mutateRowsFuture = Futures.<List<MutateRowsResponse>> immediateFailedFuture(e); } finally { addCallback(mutateRowsFuture); } }
Source:
public void addSegment(File indexDir, IndexLoadingConfig indexLoadingConfig) throws Exception { super.addSegment(indexDir, indexLoadingConfig); try { loadLookupTable(); _logger.info("Successfully loaded lookup table for {}", getTableName()); } catch (Exception e) { throw new RuntimeException( String.format("Error loading lookup table: %s", getTableName()),e); } }

Target:
public void addSegment(File indexDir, IndexLoadingConfig indexLoadingConfig) throws Exception { super.addSegment(indexDir, indexLoadingConfig); try { loadLookupTable(); _logger.info("Successfully added segment and loaded lookup table: {}", indexDir.getName(), getTableName()); } catch (Exception e) { throw new RuntimeException(String.format("Error loading lookup table: %s", getTableName()), e); } }
Source:
public static String sepConvBlock(ComputationGraphConfiguration.GraphBuilder graphBuilder, int filters, int kernelSize, int stride, String blockId, String input) { String prefix = "sepConvBlock"+blockId; graphBuilder .addLayer(prefix+"_act", new ActivationLayer(Activation.RELU), input) .addLayer(prefix+"_sepconv1", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act") .addLayer(prefix+"_conv1_bn", new BatchNormalization.Builder().eps(1e-3).build(), prefix+"_sepconv1") .addLayer(prefix+"_act2", new ActivationLayer(Activation.RELU), prefix+"_conv1_bn") .addLayer(prefix+"_sepconv2", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act2") .addLayer(prefix+"_conv2_bn", new BatchNormalization.Builder().eps(1e-3).build(), prefix+"_sepconv2"); return prefix+"_conv2_bn"; }

Target:
public static String sepConvBlock(ComputationGraphConfiguration.GraphBuilder graphBuilder, int filters, int kernelSize, int stride, String blockId, String input) { String prefix = "sepConvBlock"+blockId; graphBuilder .addLayer(prefix+"_act", new ActivationLayer(Activation.RELU), input) .addLayer(prefix+"_sepconv1", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act") .addLayer(prefix+"_conv1_bn", new BatchNormalization.Builder().eps(1e-3).gamma(0.9997).build(), prefix+"_sepconv1") .addLayer(prefix+"_act2", new ActivationLayer(Activation.RELU), prefix+"_conv1_bn") .addLayer(prefix+"_sepconv2", new SeparableConvolution2D.Builder(kernelSize, kernelSize).stride(stride, stride).nOut(filters).hasBias(false) .convolutionMode(ConvolutionMode.Same).build(), prefix+"_act2") .addLayer(prefix+"_conv2_bn", new BatchNormalization.Builder().eps(1e-3).gamma(0.9997).build(), prefix+"_sepconv2"); return prefix+"_conv2_bn"; }
Source:
public boolean forceServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException { if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "forceServicePropagation"); } return getServicesManagerBl().forceServicePropagation(sess, facility, service); }

Target:
public boolean forceServicePropagation(PerunSession sess, Facility facility, Service service) throws PrivilegeException { if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility) && !AuthzResolver.isAuthorized(sess, Role.ENGINE)) { throw new PrivilegeException(sess, "forceServicePropagation"); } return getServicesManagerBl().forceServicePropagation(sess, facility, service); }
Source:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final ItemStack stack = user.getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { throw new Exception(tl("cantSpawnItem", "Air")); } boolean canOversized = user.isAuthorized("essentials.oversizedstacks"); if (stack.getAmount() >= ((canOversized) ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) { throw new Exception(tl("fullStack")); } final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); if (!user.canSpawnItem(stack.getType())) { throw new Exception(tl("cantSpawnItem", itemname)); } int newStackSize = stack.getAmount(); if (args.length >= 1) { try { int increment = Integer.parseInt(args[0]); if (increment < 1) { throw new NumberFormatException("increment is less than or equal to zero"); } newStackSize += increment; } catch(NumberFormatException e) { throw new Exception(tl("nonZeroPosNumber")); } if (newStackSize > ((canOversized) ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) { user.sendMessage(tl(canOversized ? "fullStackDefaultOversize" : "fullStackDefault", canOversized ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())); newStackSize = canOversized ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize(); } } else if (canOversized) { newStackSize = ess.getSettings().getOversizedStackSize(); } else { newStackSize = stack.getMaxStackSize(); } stack.setAmount(newStackSize); user.getBase().updateInventory(); }

Target:
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception { final ItemStack stack = user.getItemInHand(); if (stack == null || stack.getType() == Material.AIR) { throw new Exception(tl("cantSpawnItem", "Air")); } boolean canOversized = user.isAuthorized("essentials.oversizedstacks"); if (stack.getAmount() >= ((canOversized) ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) { throw new Exception(tl("fullStack")); } final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""); if (!user.canSpawnItem(stack.getType())) { throw new Exception(tl("cantSpawnItem", itemname)); } int newStackSize = stack.getAmount(); if (args.length >= 1) { if (!NumberUtil.isPositiveInt(args[0])) { throw new Exception(tl("nonZeroPosNumber")); } newStackSize += Integer.parseInt(args[0]); if (newStackSize > ((canOversized) ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())) { user.sendMessage(tl(canOversized ? "fullStackDefaultOversize" : "fullStackDefault", canOversized ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize())); newStackSize = canOversized ? ess.getSettings().getOversizedStackSize() : stack.getMaxStackSize(); } } else if (canOversized) { newStackSize = ess.getSettings().getOversizedStackSize(); } else { newStackSize = stack.getMaxStackSize(); } stack.setAmount(newStackSize); user.getBase().updateInventory(); }
Source:
private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { ExecutorService executor = Executors.newFixedThreadPool(5); Future<Void> future = (Future<Void>) executor.submit(() -> { try { TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } }); try { future.get(); } catch (ExecutionException e) { e.printStackTrace(); } }

Target:
private void vmUpdateStatus(final VM vm, final VM.VMStatus status, final long delay, final String msg, final boolean removeClient) throws InterruptedException { ScheduledFuture<Void> future = (ScheduledFuture<Void>) scheduledExecutorService.submit(() -> { try { TimeUnit.MILLISECONDS.sleep(delay); vm.setStatus(status); sendNotification(msg, vm.getId(), removeClient); log.info("VM set to {}", vm.getId(), msg); if (isUpdateRequired(status)) { VdsmManager.getInstance().updateHost(vm.getHost()); } } catch (Exception e) { e.printStackTrace(); } }); try { future.get(); } catch (ExecutionException e) { e.printStackTrace(); } }
Source:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { IdentityService identityService = new IdentityService(); ServiceBuilder<Function<SecurityIdentity, Set<SecurityIdentity>>> serviceBuilder = context.getServiceTarget() .addService(IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName(), identityService) .setInitialMode(Mode.ACTIVE); for (String outflowSecurityDomain : outflowSecurityDomains) { serviceBuilder.addDependency(context.getCapabilityServiceName( buildDynamicCapabilityName(SECURITY_DOMAIN_CAPABILITY, outflowSecurityDomain), SecurityDomain.class), SecurityDomain.class, identityService.createOutflowSecurityDomainInjector()); } serviceBuilder.install(); }

Target:
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { IdentityService identityService = new IdentityService(); ServiceBuilder<Function<SecurityIdentity, Set<SecurityIdentity>>> serviceBuilder = context.getServiceTarget() .addService(IDENTITY_RUNTIME_CAPABILITY.getCapabilityServiceName(), identityService) .setInitialMode(Mode.ACTIVE); for (String outflowSecurityDomain : outflowSecurityDomains) { serviceBuilder.addDependency(context.getCapabilityServiceName( SECURITY_DOMAIN_CAPABILITY, outflowSecurityDomain, SecurityDomain.class), SecurityDomain.class, identityService.createOutflowSecurityDomainInjector()); } serviceBuilder.install(); }
Source:
public void testInMultiplePackages() { DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan.documented", "com.canoo.impl.server.classpathscan.resource"); assertForAnnotation(scanner); }

Target:
public void testInMultiplePackages() { final DefaultClasspathScanner scanner = new DefaultClasspathScanner("com.canoo.impl.server.classpathscan.documented", "com.canoo.impl.server.classpathscan.resource"); assertForAnnotation(scanner); }
Source:
private boolean isHost(final Permissionable permissionable) { return permissionable instanceof Host || (permissionable instanceof Contentlet && Host.class.getSimpleName().equals(((Contentlet) permissionable).getContentType().name())) || (null != permissionable && permissionable instanceof PermissionableProxy && Host.class.getName().equals(PermissionableProxy.class.cast(permissionable).getType())); }

Target:
private boolean isHost(final Permissionable permissionable) { return permissionable instanceof Host || (permissionable instanceof Contentlet && ((Contentlet) permissionable).isHost()) || (null != permissionable && permissionable instanceof PermissionableProxy && Host.class.getName().equals(PermissionableProxy.class.cast(permissionable).getType())); }
Source:
public <C> C getCredential(Class<C> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : JdbcSecurityRealm.this.queryConfiguration) { for (KeyMapper keyMapper : configuration.getColumnMappers(KeyMapper.class)) { if (keyMapper.getKeyType().isAssignableFrom(credentialType)) { return executePrincipalQuery(configuration, resultSet -> (C) keyMapper.map(resultSet)); } } } return null; }

Target:
public <C> C getCredential(Class<C> credentialType) throws RealmUnavailableException { for (QueryConfiguration configuration : JdbcSecurityRealm.this.queryConfiguration) { for (KeyMapper keyMapper : configuration.getColumnMappers(KeyMapper.class)) { if (keyMapper.getKeyType().isAssignableFrom(credentialType)) { return executePrincipalQuery(configuration, resultSet -> credentialType.cast(keyMapper.map(resultSet))); } } } return null; }
Source:
public void sendTeamPacket(Player recipient, Team team) { }

Target:
public void sendTeamPacket(Player recipient, Team team) { Preconditions.checkNotNull(recipient); Preconditions.checkNotNull(team); if (TEAM_FIELD == null) { TEAM_FIELD = NMS.getGetter(team.getClass(), "team"); } try { ScoreboardTeam nmsTeam = (ScoreboardTeam) TEAM_FIELD.invoke(team); sendPacket(recipient, new PacketPlayOutScoreboardTeam(nmsTeam, 0)); } catch (Throwable e) { e.printStackTrace(); } }