auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { boolean retValue = true; List<OVirtNodeInfo> info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); retValue = false; } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); retValue = false; } else if (isOvirtReInstallOrUpgrade()) { StringBuilder isoFile = new StringBuilder(getParameters().getoVirtIsoFile()); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); retValue = false; } VdsValidator.IsoValidStatus isoStat; RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); VdsValidator validator = new VdsValidator(getVds()); isoStat = validator.isIsoFileValid(isoFile, info, ovirtHostOsVersion); switch(isoStat) { case VALID: _isoFullPath = isoFile.toString(); retValue = true; break; case NOTCOMPATIBLE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION); addCanDoActionMessage(String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor())); retValue = false; break; case MISSINGFILE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE); retValue = true; break; } } return retValue; }

Target:
protected boolean canDoAction() { boolean retValue = false; List<OVirtNodeInfo> info = OVirtNodeInfo.get(); if (getVdsId() == null || getVdsId().equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.VDS_INVALID_SERVER_ID); } else if (getVds() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_HOST_NOT_EXIST); } else if (isOvirtReInstallOrUpgrade()) { StringBuilder isoFile = new StringBuilder(getParameters().getoVirtIsoFile()); if (getVds().getStatus() == VDSStatus.NonOperational) { addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_STATUS_ILLEGAL); } VdsValidator.IsoValidStatus isoStat; RpmVersion ovirtHostOsVersion = VdsHandler.getOvirtHostOsVersion(getVds()); VdsValidator validator = new VdsValidator(getVds()); isoStat = validator.isIsoFileValid(isoFile, info, ovirtHostOsVersion); switch(isoStat) { case VALID: _isoFullPath = isoFile.toString(); retValue = true; break; case NOTCOMPATIBLE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_UPGRADE_BETWEEN_MAJOR_VERSION); addCanDoActionMessage(String.format("$IsoVersion %1$s", ovirtHostOsVersion.getMajor())); break; case MISSINGFILE: addCanDoActionMessage(VdcBllMessages.VDS_CANNOT_INSTALL_MISSING_IMAGE_FILE); break; } } return retValue; }
Source:
public NameServer flush() { return new NameServer(this.nameServerEntity.getEntity()); }

Target:
public NameServer flush() { return new NameServer(nameServerEntity.getEntity()); }
Source:
private void saveLabelSections(Config rc) { List<String> existing = Lists.newArrayList(rc.getSubsections(LABEL)); if (!Lists.newArrayList(labelSections.keySet()).equals(existing)) { for (String name : existing) { rc.unsetSection(LABEL, name); } } Set<String> toUnset = Sets.newHashSet(existing); for (Map.Entry<String, LabelType> e : labelSections.entrySet()) { String name = e.getKey(); LabelType label = e.getValue(); toUnset.remove(name); rc.setString(LABEL, name, KEY_FUNCTION, label.getFunctionName()); if (!LabelType.defaultAbbreviation(name) .equals(label.getAbbreviatedName())) { rc.setString( LABEL, name, KEY_ABBREVIATION, label.getAbbreviatedName()); } else { rc.unset(LABEL, name, KEY_ABBREVIATION); } if (label.isCopyMinScore()) { rc.setBoolean(LABEL, name, KEY_COPY_MIN_SCORE, true); } else { rc.unset(LABEL, name, KEY_COPY_MIN_SCORE); } if (label.isBlock()) { rc.setBoolean(LABEL, name, KEY_BLOCK, true); } else { rc.unset(LABEL, name, KEY_BLOCK); } List<String> values = Lists.newArrayListWithCapacity(label.getValues().size()); for (LabelValue value : label.getValues()) { values.add(value.format()); } rc.setStringList(LABEL, name, KEY_VALUE, values); } for (String name : toUnset) { rc.unsetSection(LABEL, name); } }

Target:
private void saveLabelSections(Config rc) { List<String> existing = Lists.newArrayList(rc.getSubsections(LABEL)); if (!Lists.newArrayList(labelSections.keySet()).equals(existing)) { for (String name : existing) { rc.unsetSection(LABEL, name); } } Set<String> toUnset = Sets.newHashSet(existing); for (Map.Entry<String, LabelType> e : labelSections.entrySet()) { String name = e.getKey(); LabelType label = e.getValue(); toUnset.remove(name); rc.setString(LABEL, name, KEY_FUNCTION, label.getFunctionName()); if (!LabelType.defaultAbbreviation(name) .equals(label.getAbbreviatedName())) { rc.setString( LABEL, name, KEY_ABBREVIATION, label.getAbbreviatedName()); } else { rc.unset(LABEL, name, KEY_ABBREVIATION); } if (label.isCopyMinScore()) { rc.setBoolean(LABEL, name, KEY_COPY_MIN_SCORE, true); } else { rc.unset(LABEL, name, KEY_COPY_MIN_SCORE); } if (!label.canOverride()) { rc.setBoolean(LABEL, name, KEY_CAN_OVERRIDE, false); } else { rc.unset(LABEL, name, KEY_CAN_OVERRIDE); } List<String> values = Lists.newArrayListWithCapacity(label.getValues().size()); for (LabelValue value : label.getValues()) { values.add(value.format()); } rc.setStringList(LABEL, name, KEY_VALUE, values); } for (String name : toUnset) { rc.unsetSection(LABEL, name); } }
Source:
private Optional<Calibration> getRemotely(final String senseId, final Boolean strict) { final HashMap<String, AttributeValue> key = Maps.newHashMap(); key.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(senseId)); final GetItemRequest getItemRequest = new GetItemRequest() .withTableName(calibrationTableName) .withKey(key); final GetItemResult getItemResult = dynamoDBClient.getItem(getItemRequest); final Map<String, AttributeValue> item = getItemResult.getItem(); if (item == null) { if (strict.equals(Boolean.TRUE)) { LOGGER.warn("Sense does not have calibration", senseId); return Optional.absent(); } LOGGER.warn("Not in strict mode, returning default calibration for sense {}", senseId); return Optional.of(Calibration.createDefault(senseId)); } return Optional.of(Calibration.create(senseId, Integer.valueOf(item.get(DUST_OFFSET_ATTRIBUTE_NAME).getN()), item.get(METADATA_ATTRIBUTE_NAME).getS())); }

Target:
private Optional<Calibration> getRemotely(final String senseId, final Boolean strict) { final HashMap<String, AttributeValue> key = Maps.newHashMap(); key.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(senseId)); final GetItemRequest getItemRequest = new GetItemRequest() .withTableName(calibrationTableName) .withKey(key); final GetItemResult getItemResult = dynamoDBClient.getItem(getItemRequest); final Map<String, AttributeValue> item = getItemResult.getItem(); if (item == null) { if (strict) { LOGGER.warn("Sense does not have calibration", senseId); return Optional.absent(); } LOGGER.warn("Not in strict mode, returning default calibration for sense {}", senseId); return Optional.of(Calibration.createDefault(senseId)); } return Optional.of(Calibration.create(senseId, Integer.valueOf(item.get(DUST_OFFSET_ATTRIBUTE_NAME).getN()), item.get(METADATA_ATTRIBUTE_NAME).getS())); }
Source:
public static void killJobOnCluster(String applicationId, Logger log) { try { YarnConfiguration yarnConf = new YarnConfiguration(); YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(yarnConf); yarnClient.start(); String[] split = applicationId.split("_"); ApplicationId aid = ApplicationId.newInstance(Long.parseLong(split[1]), Integer.parseInt(split[2])); log.info("start klling application: " + aid); yarnClient.killApplication(aid); log.info("successfully killed application: " + aid); } catch (Exception e) { log.error("Failure while try to kill the hadoop job. Will skip and continue", e); } }

Target:
public static void killJobOnCluster(String applicationId, Logger log) throws YarnException, IOException { YarnConfiguration yarnConf = new YarnConfiguration(); YarnClient yarnClient = YarnClient.createYarnClient(); yarnClient.init(yarnConf); yarnClient.start(); String[] split = applicationId.split("_"); ApplicationId aid = ApplicationId.newInstance(Long.parseLong(split[1]), Integer.parseInt(split[2])); log.info("start klling application: " + aid); yarnClient.killApplication(aid); log.info("successfully killed application: " + aid); }
Source:
public Map<String, List<Integer>> readLineCoverage() { JacocoBuildAction jacocoAction = getJacocoBuildAction(); if (jacocoAction == null) { return null; } PathResolver pathResolver = new PathResolver(getWorkspace(), getSourceDirs()); HashMap<String, List<Integer>> lineCoverage = new HashMap<String, List<Integer>>(); try { ExecutionFileLoader executionFileLoader = jacocoAction.getJacocoReport().parse(null, null); for (IPackageCoverage packageCoverage : executionFileLoader.getBundleCoverage().getPackages()) { for (ISourceFileCoverage fileCoverage : packageCoverage.getSourceFiles()) { String relativePathFromProjectRoot = getRelativePathFromProjectRoot(pathResolver, fileCoverage); if (relativePathFromProjectRoot != null) { lineCoverage.put(relativePathFromProjectRoot, getPerLineCoverage(fileCoverage)); } } } } catch (IOException e) { e.printStackTrace(); return null; } return lineCoverage; }

Target:
public Map<String, List<Integer>> readLineCoverage() { JacocoBuildAction jacocoAction = getJacocoBuildAction(); JacocoPublisher jacocoPublisher = getJacocoPublisher(); if (jacocoAction == null || jacocoPublisher == null) { return null; } PathResolver pathResolver = new PathResolver(getWorkspace(), getSourceDirs()); HashMap<String, List<Integer>> lineCoverage = new HashMap<String, List<Integer>>(); String[] includes = null; if (jacocoPublisher.getInclusionPattern() != null) { includes = new String[]{ jacocoPublisher.getInclusionPattern() }; } String[] excludes = null; if (jacocoPublisher.getExclusionPattern() != null) { excludes = new String[]{jacocoPublisher.getExclusionPattern()}; } try { ExecutionFileLoader executionFileLoader = jacocoAction.getJacocoReport().parse(includes, excludes); for (IPackageCoverage packageCoverage : executionFileLoader.getBundleCoverage().getPackages()) { for (ISourceFileCoverage fileCoverage : packageCoverage.getSourceFiles()) { String relativePathFromProjectRoot = getRelativePathFromProjectRoot(pathResolver, fileCoverage); if (relativePathFromProjectRoot != null) { lineCoverage.put(relativePathFromProjectRoot, getPerLineCoverage(fileCoverage)); } } } } catch (IOException e) { e.printStackTrace(); return null; } return lineCoverage; }
Source:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof DockerTemplateOptions) { DockerTemplateOptions eTo = DockerTemplateOptions.class.cast(to); if (!volumes.isEmpty()) { eTo.volumes(volumes); } if (hostname != null) { eTo.hostname(hostname); } if (!dns.isEmpty()) { eTo.dns(dns); } if (memory != null) { eTo.memory(memory); } if (commands.isEmpty()) { eTo.commands(commands); } if (cpuShares != null) { eTo.cpuShares(cpuShares); } if (!env.isEmpty()) { eTo.env(env); } if (!portBindings.isEmpty()) { eTo.portBindings(portBindings); } } }

Target:
public void copyTo(TemplateOptions to) { super.copyTo(to); if (to instanceof DockerTemplateOptions) { DockerTemplateOptions eTo = DockerTemplateOptions.class.cast(to); if (!volumes.isEmpty()) { eTo.volumes(volumes); } eTo.hostname(hostname); if (!dns.isEmpty()) { eTo.dns(dns); } eTo.memory(memory); eTo.cpuShares(cpuShares); if (commands.isEmpty()) { eTo.commands(commands); } if (!env.isEmpty()) { eTo.env(env); } if (!portBindings.isEmpty()) { eTo.portBindings(portBindings); } } }
Source:
private static Map<String, String> extractGenericInformation(JSONValue jsonGenericInformation) { Map<String, String> genericInformation = new HashMap<>(); if (jsonGenericInformation != null) { JSONArray genericInformationArray = jsonGenericInformation.isArray(); if (genericInformationArray != null) { for (int i = 0; i < genericInformationArray.size(); i++) { JSONObject genericInformationObject = genericInformationArray.get(i).isObject(); genericInformation.put(genericInformationObject.get("key").isString().stringValue(), genericInformationObject.get("value").isString().stringValue()); } } } return genericInformation; }

Target:
private static Map<String, String> extractGenericInformation(JSONValue jsonGenericInformation) { if (jsonGenericInformation != null) { JSONArray genericInformationArray = jsonGenericInformation.isArray(); if (genericInformationArray != null) { Map<String, String> genericInformation = new HashMap<>(genericInformationArray.size()); for (int i = 0; i < genericInformationArray.size(); i++) { JSONObject genericInformationObject = genericInformationArray.get(i).isObject(); genericInformation.put(getJsonStringValue(genericInformationObject, "key"), getJsonStringValue(genericInformationObject, "value")); } return genericInformation; } } return Collections.emptyMap(); }
Source:
private String findCscCommand() throws MojoExecutionException { if (!windowsModus) { return cscCommand; } if (cscFolderLocation != null) { return cscFolderLocation.getAbsolutePath(); } for (File sdk : findAllInstalledSDKs(DEFAULT_CSC_PATHS)) { File file = new File(sdk, cscCommand); getLog().info( "Trying to find " + cscCommand + " in " + sdk.getAbsolutePath()); if (file.exists()) { cscFolderLocation = file.getAbsoluteFile(); return file.getAbsolutePath(); } } throw new MojoExecutionException("unable to find " + cscCommand + " in paths " + Arrays.toString(DEFAULT_CSC_PATHS) + "\n " + "You can specify the path manually by adding the argument \n" + " -DcscFolderLocation=\"C:\\path\\to\\csc.exe\""); }

Target:
private String findCscCommand() throws MojoExecutionException { if (isLinux()) { List<String> commands = new LinkedList<String>(); commands.add(cscCommand); commands.add("/help"); if (isMonoCommandInstalled(commands)) { return cscCommand; } throw new MojoExecutionException("The program '" + cscCommand + "' is currently not installed. You can install it by typing: " + "sudo apt-get install mono-" + cscCommand); } if (cscFolderLocation != null) { return cscFolderLocation.getAbsolutePath(); } for (File sdk : findAllInstalledSDKs(DEFAULT_CSC_PATHS)) { File file = new File(sdk, cscCommand); getLog().info( "Trying to find " + cscCommand + " in " + sdk.getAbsolutePath()); if (file.exists()) { cscFolderLocation = file.getAbsoluteFile(); return file.getAbsolutePath(); } } throw new MojoExecutionException("unable to find " + cscCommand + " in paths " + Arrays.toString(DEFAULT_CSC_PATHS) + "\n " + "You can specify the path manually by adding the argument \n" + " -DcscFolderLocation=\"C:\\path\\to\\csc.exe\""); }
Source:
public static FastqQualityFormat detect(final long maxRecords, final CloseableIterator<SAMRecord> iterator) { final QualityEncodingDetector detector = new QualityEncodingDetector(); final long recordCount = detector.add(maxRecords, iterator); log.debug(String.format("Read %s records from %s.", recordCount, iterator)); return detector.generateBestGuess(FileContext.SAM, null); }

Target:
public static FastqQualityFormat detect(final long maxRecords, final CloseableIterator<SAMRecord> iterator) { final QualityEncodingDetector detector = new QualityEncodingDetector(); final long recordCount = detector.add(maxRecords, iterator); log.debug(String.format("Read %s records.", recordCount)); return detector.generateBestGuess(FileContext.SAM, null); }
Source:
protected <A extends AccountingLine> void validateAndPopulateAccountingLineWithDebitCreditAmounts( A accountingLine, AccountingXmlDocumentAccountingLine xmlLine) { if (hasAmountBeenSpecified(xmlLine.getAmount())) { throw new ValidationException( "AV accounting line cannot use the 'amount' element to specify an amount; use the relevant debit/credit amount element instead"); } KualiDecimal debitAmount = xmlLine.getDebitAmount(); KualiDecimal creditAmount = xmlLine.getCreditAmount(); if (hasAmountBeenSpecified(debitAmount)) { if (hasAmountBeenSpecified(creditAmount)) { throw new ValidationException("AV accounting line cannot specify both a debit amount and a credit amount"); } accountingLine.setDebitCreditCode(KFSConstants.GL_DEBIT_CODE); accountingLine.setAmount(debitAmount); } else if (hasAmountBeenSpecified(creditAmount)) { accountingLine.setDebitCreditCode(KFSConstants.GL_CREDIT_CODE); accountingLine.setAmount(creditAmount); } else { throw new ValidationException("AV accounting line did not specify a debit or credit amount"); } }

Target:
protected <A extends AccountingLine> void validateAndPopulateAccountingLineWithDebitCreditAmounts( A accountingLine, AccountingXmlDocumentAccountingLine xmlLine) { if (hasAmountBeenSpecified(xmlLine.getAmount())) { throw buildNewValidationException(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_AV_INVALID_AMOUNT_TYPE); } KualiDecimal debitAmount = xmlLine.getDebitAmount(); KualiDecimal creditAmount = xmlLine.getCreditAmount(); if (hasAmountBeenSpecified(debitAmount)) { if (hasAmountBeenSpecified(creditAmount)) { throw buildNewValidationException(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_AV_DEBIT_AND_CREDIT_AMOUNT); } accountingLine.setDebitCreditCode(KFSConstants.GL_DEBIT_CODE); accountingLine.setAmount(debitAmount); } else if (hasAmountBeenSpecified(creditAmount)) { accountingLine.setDebitCreditCode(KFSConstants.GL_CREDIT_CODE); accountingLine.setAmount(creditAmount); } else { throw buildNewValidationException(CuFPKeyConstants.ERROR_CREATE_ACCOUNTING_DOCUMENT_AV_AMOUNT_REQUIRED); } }
Source:
protected ConstraintDescriptor readNonStandardConstraint( ConstraintRule rule, String errorMessage ) { if ( !rule.getConstraintDescriptor().type().enforcesPropertyExistence() ) { throw new IllegalStateException( "Unsupported constraint type: " + rule ); } return rule.getConstraintDescriptor(); }

Target:
protected ConstraintDescriptor readNonStandardConstraint( ConstraintRule rule, String errorMessage ) { if ( !rule.getConstraintDescriptor().enforcesPropertyExistence() ) { throw new IllegalStateException( "Unsupported constraint type: " + rule ); } return rule.getConstraintDescriptor(); }
Source:
public void getAvailableContextAssistantTest(){ TextEditor javaTextEditor = TextEditorTest.openJavaFile(); assertFalse(javaTextEditor.getAvailableContentAssistants().isEmpty()); AbstractWait.sleep(TimePeriod.SHORT); }

Target:
public void getAvailableContextAssistantTest() { TextEditor javaTextEditor = TextEditorTest.openJavaFile(); assertFalse(javaTextEditor.getAvailableContentAssistants().isEmpty()); }
Source:
private LuceneQuery<PersonAttribute> getPersonAttributeLuceneQuery(String query, boolean includeVoided) { StringBuilder newQuery = new StringBuilder(); newQuery.append("value:\"").append(query).append("\""); LuceneQuery<PersonAttribute> luceneQuery = LuceneQuery .newQuery(PersonAttribute.class, sessionFactory.getCurrentSession(), newQuery.toString()); if(!includeVoided){ luceneQuery.include("voided", false); } luceneQuery.skipSame("person.personId"); return luceneQuery; }

Target:
private LuceneQuery<PersonAttribute> getPersonAttributeLuceneQuery(String query, boolean includeVoided) { StringBuilder newQuery = new StringBuilder(); newQuery.append("value:\"").append(query).append("\""); LuceneQuery<PersonAttribute> luceneQuery = LuceneQuery .newQuery(PersonAttribute.class, sessionFactory.getCurrentSession(), newQuery.toString()); if(!includeVoided){ luceneQuery.include("voided", false); luceneQuery.include("person.voided", false); } return luceneQuery; }
Source:
public void testDeterminismReadOnlyNoWarning() throws Exception { HSQLInterface hsql = HSQLInterface.loadHsqldb(); VoltCompiler compiler = new VoltCompiler(false); VoltCompiler.DdlProceduresToLoad all_procs = DdlProceduresToLoad.NO_DDL_PROCEDURES; URL path = TestDeterminism.class.getResource("testplans-determinism-read-only.sql"); String pathStr = URLDecoder.decode(path.getPath(), "UTF-8"); compiler.loadSchema(hsql, all_procs, pathStr); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); compiler.summarizeSuccess(new PrintStream(outputStream), null, ""); System.out.println(outputStream.toString()); String msg = outputStream.toString(); assert(!msg.contains("ND")); assert(!msg.contains("WARN")); outputStream.close(); }

Target:
public void testDeterminismReadOnlyNoWarning() throws Exception { HSQLInterface hsql = HSQLInterface.loadHsqldb(); VoltCompiler compiler = new VoltCompiler(false); VoltCompiler.DdlProceduresToLoad all_procs = DdlProceduresToLoad.NO_DDL_PROCEDURES; URL path = TestDeterminism.class.getResource("testplans-determinism-read-only.sql"); String pathStr = URLDecoder.decode(path.getPath(), "UTF-8"); compiler.loadSchema(hsql, all_procs, pathStr); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); compiler.summarizeSuccess(new PrintStream(outputStream), null, ""); System.out.println(outputStream.toString()); String msg = outputStream.toString(); assertFalse(stringContains(msg, "ND")); assertFalse(stringContains(msg, "WARN")); assertTrue(stringContains(msg, "Successfully created")); assertTrue(stringContains(msg, "Catalog contains")); outputStream.close(); }
Source:
private void initPanel() { initGeneralForm(); initDisksTable(); initNicsTable(); initAppsTable(); add(new ScrollPanel(generalForm), constants.generalLabel()); add(new ScrollPanel(disksTable), constants.disksLabel()); add(new ScrollPanel(nicsTable), constants.nicsLabel()); add(new ScrollPanel(appsTable), constants.applicationsLabel()); vmSnapshotListModel.getSelectedItemChangedEvent().addListener(new IEventListener() { @SuppressWarnings("unchecked") @Override public void eventRaised(Event ev, Object sender, EventArgs args) { Snapshot snapshot = (Snapshot) vmSnapshotListModel.getSelectedItem(); } }); }

Target:
private void initPanel() { initGeneralForm(); initDisksTable(); initNicsTable(); initAppsTable(); add(new ScrollPanel(generalForm), constants.generalLabel()); add(new ScrollPanel(disksTable), constants.disksLabel()); add(new ScrollPanel(nicsTable), constants.nicsLabel()); add(new ScrollPanel(appsTable), constants.applicationsLabel()); }
Source:
private Thread getStuckThread (Thread mainThread) { if (threadGroup == null) return null; Thread[] threadsInGroup = getThreadArray(threadGroup); if (threadsInGroup == null) return null; Thread stuckThread = null; long maxCpuTime = 0; for (Thread thread : threadsInGroup) { if (thread.getState() == Thread.State.RUNNABLE) { long threadCpuTime = cpuTime(thread); if (stuckThread == null || threadCpuTime > maxCpuTime) { stuckThread = thread; maxCpuTime = threadCpuTime; } } } return (stuckThread == mainThread) ? null : stuckThread; }

Target:
private Thread getStuckThread (Thread mainThread) { if (threadGroup == null){ return null; } Thread[] threadsInGroup = getThreadArray(threadGroup); if (threadsInGroup == null){ return null; } Thread stuckThread = null; long maxCpuTime = 0; for (Thread thread : threadsInGroup) { if (thread.getState() == Thread.State.RUNNABLE) { long threadCpuTime = cpuTime(thread); if (stuckThread == null || threadCpuTime > maxCpuTime) { stuckThread = thread; maxCpuTime = threadCpuTime; } } } return (stuckThread == mainThread) ? null : stuckThread; }
Source:
protected final void validateTrade(final ISign sign, final int costIndex, final int amountIndex, final ItemStack item, final double scale, final IEssentials ess) throws SignException { final String line = sign.getLine(costIndex).trim(); if (line.isEmpty()) { return; } if (line.equalsIgnoreCase("$$")) { double price = ess.getWorth().getPrice(item) ; if (Double.isNaN(price)) { throw new SignException("no price set for item") ; } else { price = Math.round(price * scale * 100) / 100.0 ; int amount = getIntegerPositive(sign.getLine(amountIndex)); price *= amount ; sign.setLine(costIndex, "<" + Util.shortCurrency(price, ess) + ">") ; } } else { final Trade trade = getTrade(sign, costIndex, 0, ess); final Double money = trade.getMoney(); if (money != null) { sign.setLine(costIndex, Util.shortCurrency(money, ess)); } } }

Target:
protected final void validateTrade(final ISign sign, final int costIndex, final int amountIndex, final ItemStack item, final double scale, final IEssentials ess) throws SignException { final String line = sign.getLine(costIndex).trim(); if (line.isEmpty()) { return; } if (line.equalsIgnoreCase("$$")) { double price = ess.getWorth().getPrice(item) ; if (Double.isNaN(price)) { throw new SignException("no price set for item") ; } else { price = Math.round(price * scale * 100) / 100.0 ; int amount = getIntegerPositive(sign.getLine(amountIndex)); price *= amount ; String linestr = "<" + Util.shortCurrency(price, ess) + ">"; if (linestr.length() > 15) throw new SignException("price is too large to print on sign") ; sign.setLine(costIndex, linestr) ; } } else { final Trade trade = getTrade(sign, costIndex, 0, ess); final Double money = trade.getMoney(); if (money != null) { sign.setLine(costIndex, Util.shortCurrency(money, ess)); } } }
Source:
public List<String> showAllLocks() { List<String> returnValue; log.warn("All in memory locks will be shown"); globalLock.lock(); try { returnValue = new ArrayList<String>(); for(Map.Entry<String, InternalLockView> entry : locks.entrySet()) { String lock = new StringBuilder("The object id is : ").append(entry.getKey()).append(' ').append(entry.getValue()).toString(); returnValue.add(lock); } } finally { globalLock.unlock(); } log.warn("All in memory locks were shown"); return returnValue; }

Target:
public List<String> showAllLocks() { List<String> returnValue; log.debug("All in memory locks will be shown"); globalLock.lock(); try { returnValue = new ArrayList<String>(); for(Map.Entry<String, InternalLockView> entry : locks.entrySet()) { String lock = new StringBuilder("The object id is : ").append(entry.getKey()).append(' ').append(entry.getValue()).toString(); returnValue.add(lock); } } finally { globalLock.unlock(); } log.debug("All in memory locks were shown"); return returnValue; }
Source:
private int getExclusiveBottomIndexEndOffset() { if (fViewer != null && fViewer.getTextWidget() != null && !fViewer.getTextWidget().isDisposed()) { int bottom= JFaceTextUtil.getPartialBottomIndex(fViewer); try { IDocument document= fViewer.getDocument(); if (bottom >= document.getNumberOfLines()) bottom= document.getNumberOfLines() - 1; return document.getLineOffset(bottom) + document.getLineLength(bottom); } catch (BadLocationException x) { } } return -1; }

Target:
private int getExclusiveBottomIndexEndOffset() { if (fViewer != null && fViewer.getTextWidget() != null && !fViewer.getTextWidget().isDisposed()) { int bottom= JFaceTextUtil.getPartialBottomIndex(fViewer); try { IDocument document= fViewer.getDocument(); if (bottom >= document.getNumberOfLines()) { bottom= document.getNumberOfLines() - 1; } return document.getLineOffset(bottom) + document.getLineLength(bottom); } catch (BadLocationException x) { } } return -1; }
Source:
private void verifyState(QueryPlan queryPlan) throws LockException { if(!isTxnOpen()) { throw new LockException("No transaction context for operation: " + queryPlan.getOperationName() + " for " + getQueryIdWaterMark(queryPlan)); } if(queryPlan.getOperation() == null) { throw new IllegalStateException("Unkown HiveOperation(null) for " + getQueryIdWaterMark(queryPlan)); } numStatements++; switch (queryPlan.getOperation()) { case START_TRANSACTION: markExplicitTransaction(queryPlan); break; case COMMIT: case ROLLBACK: if(!isTxnOpen()) { throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_WITHOUT_TXN, queryPlan.getOperationName()); } if(!isExplicitTransaction) { throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_IN_IMPLICIT_TXN, queryPlan.getOperationName()); } break; default: if(!queryPlan.getOperation().isAllowedInTransaction() && isExplicitTransaction) { if(allowOperationInATransaction(queryPlan)) { break; } throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_IN_TXN, queryPlan.getOperationName(), JavaUtils.txnIdToString(getCurrentTxnId()), queryPlan.getQueryId()); } } }

Target:
private void verifyState(QueryPlan queryPlan) throws LockException { if(!isTxnOpen()) { throw new LockException("No transaction context for operation: " + queryPlan.getOperationName() + " for " + getQueryIdWaterMark(queryPlan)); } if(queryPlan.getOperation() == null) { throw new IllegalStateException("Unknown HiveOperation(null) for " + getQueryIdWaterMark(queryPlan)); } numStatements++; switch (queryPlan.getOperation()) { case START_TRANSACTION: markExplicitTransaction(queryPlan); break; case COMMIT: case ROLLBACK: if(!isTxnOpen()) { throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_WITHOUT_TXN, queryPlan.getOperationName()); } if(!isExplicitTransaction) { throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_IN_IMPLICIT_TXN, queryPlan.getOperationName()); } break; default: if(!queryPlan.getOperation().isAllowedInTransaction() && isExplicitTransaction) { if(allowOperationInATransaction(queryPlan)) { break; } throw new LockException(null, ErrorMsg.OP_NOT_ALLOWED_IN_TXN, queryPlan.getOperationName(), JavaUtils.txnIdToString(getCurrentTxnId()), queryPlan.getQueryId()); } } }
Source:
protected void setUpTaskList() { if (filter == null) return; String joinedTaskRabbitQuery = Join.left(Metadata.TABLE, Criterion.and(Metadata.KEY.eq(TaskRabbitMetadata.METADATA_KEY), Task.ID.eq(Metadata.TASK))) + filter.getSqlQuery(); sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort( joinedTaskRabbitQuery, sortFlags, sortSort)); TodorooCursor<Task> currentCursor; try { currentCursor = taskService.fetchFiltered( sqlQueryTemplate.get(), null, taskProperties()); } catch (SQLiteException e) { StartupService.handleSQLiteColumnMissing(getActivity(), e); return; } taskAdapter = createTaskAdapter(currentCursor); setListAdapter(taskAdapter); getListView().setOnScrollListener(this); registerForContextMenu(getListView()); loadTaskListContent(true); }

Target:
protected void setUpTaskList() { if (filter == null) return; String joinedTaskRabbitQuery = Join.left(Metadata.TABLE.as(TR_METADATA_JOIN), Criterion.and(Field.field(TR_METADATA_JOIN + "." + Metadata.KEY.name).eq(TaskRabbitMetadata.METADATA_KEY), Task.ID.eq(Field.field(TR_METADATA_JOIN) + "." + Metadata.TASK.name))) + filter.getSqlQuery(); sqlQueryTemplate.set(SortHelper.adjustQueryForFlagsAndSort( joinedTaskRabbitQuery, sortFlags, sortSort)); TodorooCursor<Task> currentCursor; try { currentCursor = taskService.fetchFiltered( sqlQueryTemplate.get(), null, taskProperties()); } catch (SQLiteException e) { StartupService.handleSQLiteColumnMissing(getActivity(), e); return; } taskAdapter = createTaskAdapter(currentCursor); setListAdapter(taskAdapter); getListView().setOnScrollListener(this); registerForContextMenu(getListView()); loadTaskListContent(true); }
Source:
public double[] getGranulesNativeResolutionIfSame(GranuleSource granuleSource) throws IOException { Map<String, DimensionDescriptor> descriptors = crsRequestHandler.getDescriptors(); DimensionDescriptor resDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION); DimensionDescriptor resXDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION_X); DimensionDescriptor resYDescriptor = descriptors.get(DimensionDescriptor.RESOLUTION_Y); final String resXAttribute = hasBothResolutions ? resXDescriptor.getStartAttribute() : resDescriptor.getStartAttribute(); final String resYAttribute = hasBothResolutions ? resYDescriptor.getStartAttribute() : resDescriptor.getStartAttribute(); SimpleFeatureCollection granules = granuleSource.getGranules(Query.ALL); SimpleFeatureIterator iterator = granules.features(); TreeSet<Double> resolutionsX = new TreeSet<>(); TreeSet<Double> resolutionsY = new TreeSet<>(); while (iterator.hasNext()) { SimpleFeature feature = iterator.next(); resolutionsX.add((Double) feature.getAttribute(resXAttribute)); resolutionsY.add((Double) feature.getAttribute(resYAttribute)); } if (resolutionsX.size() > 1 || resolutionsY.size() > 1) return null; return new double[] {resolutionsX.first(), resolutionsY.first()}; }

Target:
public double[] getGranulesNativeResolutionIfSame(GranuleSource granuleSource) throws IOException, TransformException, FactoryException { Query query = initQuery(granuleSource); SimpleFeatureCollection granules = granuleSource.getGranules(query); return getGranulesNativeResolutionIfSame(granules); }
Source:
public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); if (!"".equals(value) && !"{}".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; String str = FileUtils.readFileToString(xmlFile); Source src = new SAXSource(xr, new InputSource(new StringReader(str))); final ByteArrayOutputStream result = new ByteArrayOutputStream(); Result res = new StreamResult(result); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, OUTPUT_ENCODING); try { transformer.transform(src, res); return result.toString("UTF-8"); } catch (TransformerException e) { return findSecretFallback(str); } }

Target:
public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); if (!"".equals(value) && !"{}".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; String str = FileUtils.readFileToString(xmlFile); Source src = new SAXSource(xr, new InputSource(new StringReader(str))); final ByteArrayOutputStream result = new ByteArrayOutputStream(); Result res = new StreamResult(result); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, OUTPUT_ENCODING); try { transformer.transform(src, res); return result.toString("UTF-8"); } catch (TransformerException e) { if (ENABLE_FALLBACK) { return findSecretFallback(str); } else { throw e; } } }
Source:
private static WorkProcessor<Page> buildPage( WorkProcessor<PageWithPosition> pageWithPositions, List<Integer> outputChannels, List<Type> outputTypes, BiPredicate<PageBuilder, PageWithPosition> pageBreakPredicate, boolean updateMemoryAfterEveryPosition, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); PageBuilder pageBuilder = new PageBuilder(outputTypes); return pageWithPositions.transform(pageWithPositionOptional -> { if (yieldSignal.isSet()) { return TransformationState.yield(); } boolean finished = !pageWithPositionOptional.isPresent(); if (finished && pageBuilder.isEmpty()) { memoryContext.close(); return TransformationState.finished(); } if (finished || pageBreakPredicate.test(pageBuilder, pageWithPositionOptional.get())) { if (!updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } Page page = pageBuilder.build(); pageBuilder.reset(); if (!finished) { pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); } if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.ofResult(page, !finished); } pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.needsMoreData(); }); }

Target:
private static WorkProcessor<Page> buildPage( WorkProcessor<PageWithPosition> pageWithPositions, List<Integer> outputChannels, List<Type> outputTypes, BiPredicate<PageBuilder, PageWithPosition> pageBreakPredicate, boolean updateMemoryAfterEveryPosition, AggregatedMemoryContext aggregatedMemoryContext, DriverYieldSignal yieldSignal) { LocalMemoryContext memoryContext = aggregatedMemoryContext.newLocalMemoryContext(MergeSortedPages.class.getSimpleName()); PageBuilder pageBuilder = new PageBuilder(outputTypes); return pageWithPositions .yielding(yieldSignal::isSet) .transform(pageWithPositionOptional -> { boolean finished = !pageWithPositionOptional.isPresent(); if (finished && pageBuilder.isEmpty()) { memoryContext.close(); return TransformationState.finished(); } if (finished || pageBreakPredicate.test(pageBuilder, pageWithPositionOptional.get())) { if (!updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } Page page = pageBuilder.build(); pageBuilder.reset(); if (!finished) { pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); } if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.ofResult(page, !finished); } pageWithPositionOptional.get().appendTo(pageBuilder, outputChannels, outputTypes); if (updateMemoryAfterEveryPosition) { memoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } return TransformationState.needsMoreData(); }); }
Source:
static StreamsAddressResponse aggregateLogAddressSpace(Set<StreamsAddressResponse> responses) { Map<UUID, StreamAddressSpace> streamAddressSpaceMap = new HashMap<>(); long logTail = Address.NON_ADDRESS; for (StreamsAddressResponse res : responses) { logTail = Math.max(logTail, res.getLogTail()); streamAddressSpaceMap = aggregateStreamAddressMap(res.getAddressMap(), streamAddressSpaceMap); } return new StreamsAddressResponse(logTail, streamAddressSpaceMap); }

Target:
static StreamsAddressResponse aggregateLogAddressSpace(Set<StreamsAddressResponse> responses) { Map<UUID, StreamAddressSpace> streamAddressSpace = new HashMap<>(); long logTail = Address.NON_ADDRESS; for (StreamsAddressResponse res : responses) { logTail = Math.max(logTail, res.getLogTail()); streamAddressSpace = aggregateStreamAddressMap(res.getAddressMap(), streamAddressSpace); } return new StreamsAddressResponse(logTail, streamAddressSpace); }
Source:
private void removeDuplicates(List<TaggedValuePointable> pointables) { int size = pointables.size(); for (int i = 0; i < size - 1; i++) { for (int j = i + 1; j < size; j++) { if (!FunctionHelper.arraysEqual(pointables.get(j), pointables.get(i))) continue; pointables.remove(j); j--; size--; } } }

Target:
private void removeDuplicates(List<TaggedValuePointable> pointables) { int size = pointables.size(); for (int i = 0; i < size - 1; i++) { for (int j = i + 1; j < size; j++) { if (!FunctionHelper.arraysEqual(pointables.get(j), pointables.get(i))) { continue; } pointables.remove(j); j--; size--; } } }
Source:
public Schema inferSchema(CSVRecord record) { Schema schema = Schema.createRecord(RECORD_NAME, "", NAMESPACE, false); List<Schema.Field> fields = new ArrayList(); if (runtimeHeaders != null) { for (Entry<String, Integer> f : runtimeHeaders.entrySet()) { Schema.Field field = new Schema.Field(f.getKey(), AvroUtils._string(), "", null); fields.add(field); } } else { for (int i = 0; i < record.size(); i++) { Schema.Field field = new Schema.Field("newColumn" + i, AvroUtils._string(), "", null); fields.add(field); } } schema.setFields(fields); return schema; }

Target:
public Schema inferSchema(CSVRecord record) { final Schema schema = Schema.createRecord(RECORD_NAME, "", NAMESPACE, false); final Schema nullableString = SchemaBuilder.nullable().stringType(); List<Schema.Field> fields = new ArrayList<>(); if (runtimeHeaders != null) { for (Entry<String, Integer> f : runtimeHeaders.entrySet()) { Schema.Field field = new Schema.Field(normalizeName(f.getKey()), nullableString, "", null); fields.add(field); } } else { for (int i = 0; i < record.size(); i++) { Schema.Field field = new Schema.Field("newColumn" + i, nullableString, "", null); fields.add(field); } } schema.setFields(fields); return schema; }
Source:
private void sendToSocket(Socket socket, String cmdString) throws IOException { byte[] sendBytes = ("A" + cmdString.trim().replaceAll("\\s+", " ") + "\n").getBytes(); socket.getInputStream().skip(tcpSocket.getInputStream().available()); socket.getOutputStream().write(sendBytes); socket.getOutputStream().flush(); AstericsErrorHandling.instance.reportInfo(this, "IRTrans sent data: " + cmdString); }

Target:
private void sendToSocket(Socket socket, String cmdString) throws IOException { byte[] sendBytes = ("A" + cmdString.trim().replaceAll("\\s+", " ") + "\n").getBytes(); socket.getInputStream().skip(socket.getInputStream().available()); socket.getOutputStream().write(sendBytes); socket.getOutputStream().flush(); AstericsErrorHandling.instance.reportInfo(this, "IRTrans sent data: " + cmdString); }
Source:
private void addCustomMapping(final String indexName) { final RelationshipAPI relationshipAPI = APILocator.getRelationshipAPI(); final Set<String> mappedRelationships = addCustomMappingFromFieldVariables(indexName, relationshipAPI); addCustomMappingForRelationships(indexName, relationshipAPI, mappedRelationships); }

Target:
private void addCustomMapping(final String indexName) { final Set<String> mappedRelationships = addCustomMappingFromFieldVariables(indexName); addCustomMappingForRelationships(indexName, mappedRelationships); }
Source:
public void thenTheyAreEquals() { assertEquals("they are equals", first, second); }

Target:
public void thenTheyAreEquals() { assertThat(first, is(equalTo(second))); }
Source:
private void layoutWikiDataDescription(String description) { pageDescriptionText.setText(description); pageDescriptionText.post(new Runnable() { @Override public void run() { if (!parentFragment.isAdded()) { return; } if (pageDescriptionText.getLineCount() > 2) { pageDescriptionText.setVisibility(View.GONE); } else { pageDescriptionText.setVisibility(View.VISIBLE); } } }); }

Target:
private void layoutWikiDataDescription(String description) { pageDescriptionText.setText(description); pageDescriptionText.post(new Runnable() { @Override public void run() { if (!parentFragment.isAdded()) { return; } pageDescriptionText.setVisibility(pageDescriptionText.getLineCount() > 2 ? View.GONE : View.VISIBLE); } }); }
Source:
private void deselectParentIfNoChildSelected(final CheckStateChangedEvent event, final FieldToContractInputMapping mapping, final CheckboxTreeViewer checkboxTreeViewer) { if (!event.getChecked() && mapping.getParent() != null) { boolean deselect = true; for (final FieldToContractInputMapping m : mapping.getParent().getChildren()) { if (checkboxTreeViewer.getChecked(m)) { deselect = false; } } if (deselect) { checkboxTreeViewer.setChecked(mapping.getParent(), false); } } }

Target:
private void deselectParentIfNoChildSelected(final CheckStateChangedEvent event, final FieldToContractInputMapping mapping, final CheckboxTreeViewer checkboxTreeViewer) { final FieldToContractInputMapping parentMapping = mapping.getParent(); if (!event.getChecked() && parentMapping != null) { boolean deselect = true; for (final FieldToContractInputMapping m : parentMapping.getChildren()) { if (checkboxTreeViewer.getChecked(m)) { deselect = false; } } if (deselect) { checkboxTreeViewer.setChecked(parentMapping, false); } } }
Source:
private static void bindPositional(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { boolean moreArgumentsProvidedThanDeclared = binding.findForPosition(params.getParameterCount()).isPresent(); if (moreArgumentsProvidedThanDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException("Superfluous positional param at (0 based) position " + params.getParameterCount(), context); } for (int i = 0; i < params.getParameterCount(); i++) { Optional<Argument> argument = binding.findForPosition(i); if (argument.isPresent()) { try { argument.get().apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException("Exception while binding positional param at (0 based) position " + i, e, context); } } else { throw new UnableToCreateStatementException("Missing positional param at (0 based) position " + i, context); } } }

Target:
private static void bindPositional(ParsedParameters params, Binding binding, PreparedStatement statement, StatementContext context) { boolean moreArgumentsProvidedThanDeclared = binding.findForPosition(params.getParameterCount()).isPresent(); if (moreArgumentsProvidedThanDeclared && !context.getConfig(SqlStatements.class).isUnusedBindingAllowed()) { throw new UnableToCreateStatementException("Superfluous positional param at (0 based) position " + params.getParameterCount(), context); } for (int i = 0; i < params.getParameterCount(); i++) { Optional<Argument> argument = binding.findForPosition(i); try { int index = i; argument.orElseThrow(() -> new UnableToCreateStatementException("Missing positional param at (0 based) position " + index, context)).apply(i + 1, statement, context); } catch (SQLException e) { throw new UnableToCreateStatementException("Exception while binding positional param at (0 based) position " + i, e, context); } } }
Source:
private Object metadata() throws IOException { if (metadata == null && !resolved) { try { switch (info) { case DIRECTORY_ASSUMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; break; case DIRECTORY_CONFIRMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case NON_DIRECTORY_CONFIRMED: metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case UNRESOLVED: checkOpen(); try { metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.NON_DIRECTORY_CONFIRMED; resolved = true; } catch (IOException e) { if (e.getCause() instanceof JsonMappingException || e.getCause().getCause() instanceof JsonMappingException ) { metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; } else { throw e; } } break; } } catch (FileNotFoundException e) { metadata = null; resolved = true; } } return metadata; }

Target:
private Object metadata() throws IOException { if (metadata == null && !resolved) { try { switch (info) { case DIRECTORY_ASSUMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; break; case DIRECTORY_CONFIRMED: metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case NON_DIRECTORY_CONFIRMED: metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); resolved = true; break; case UNRESOLVED: checkOpen(); try { metadata = repo.getFileContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.NON_DIRECTORY_CONFIRMED; resolved = true; } catch (IOException e) { if (e.getCause() instanceof JsonMappingException || e.getCause() != null && e.getCause().getCause() instanceof JsonMappingException ) { metadata = repo.getDirectoryContent(getPath(), ref.indexOf('/') == -1 ? ref : Constants.R_REFS + ref); info = TypeInfo.DIRECTORY_CONFIRMED; resolved = true; } else { throw e; } } break; } } catch (FileNotFoundException e) { metadata = null; resolved = true; } } return metadata; }