auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void beforeCreateCollection(DBBroker broker, Txn txn, XmldbURI uri) throws TriggerException { if (!triggersSuspended) { for (CollectionTrigger trigger : triggers) { trigger.beforeCreateCollection(broker, txn, uri); } } }

Target:
public void beforeCreateCollection(DBBroker broker, Txn txn, XmldbURI uri) throws TriggerException { for (CollectionTrigger trigger : triggers) { trigger.beforeCreateCollection(broker, txn, uri); } }
Source:
private void ensureKeyspace(String keyspace) { ResultSet resultset = session.execute("SELECT * FROM system_schema.keyspaces WHERE keyspace_name = '" + keyspace + "';"); if (!resultset.iterator().hasNext()) { session.execute("CREATE KEYSPACE " + keyspace + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;"); } }

Target:
private void ensureKeyspace(String keyspace) { session.execute("CREATE KEYSPACE IF NOT EXISTS " + keyspace + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;"); }
Source:
private void fillLicenseList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> lts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); XWPFRun licenseHeaderRun = document.createParagraph().createRun(); addFormattedText(licenseHeaderRun, "License texts", FONT_SIZE + 2, true); addNewLines(document.createParagraph().createRun(), 0); lts.forEach(lt -> { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle(STYLE_HEADING); String licenseName = lt.isSetLicenseName() ? lt.getLicenseName() : UNKNOWN_LICENSE_NAME; addBookmark(licenseParagraph, licenseName, licenseName); setText(document.createParagraph().createRun(), nullToEmptyString(lt.getLicenseText())); addNewLines(document.createParagraph().createRun(), 1); }); }

Target:
private void fillLicenseList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { List<LicenseNameWithText> licenseNameWithTexts = OutputGenerator.getSortedLicenseNameWithTexts(projectLicenseInfoResults); XWPFRun licenseHeaderRun = document.createParagraph().createRun(); addFormattedText(licenseHeaderRun, "License texts", FONT_SIZE + 2, true); addNewLines(document, 0); for (LicenseNameWithText licenseNameWithText : licenseNameWithTexts) { XWPFParagraph licenseParagraph = document.createParagraph(); licenseParagraph.setStyle(STYLE_HEADING); String licenseName = licenseNameWithText.isSetLicenseName() ? licenseNameWithText.getLicenseName() : UNKNOWN_LICENSE_NAME; addBookmark(licenseParagraph, licenseName, licenseName); setText(document.createParagraph().createRun(), nullToEmptyString(licenseNameWithText.getLicenseText())); addNewLines(document, 1); } }
Source:
private static String readUmask() { Process p; try { p = Runtime.getRuntime().exec( new String[] { "sh", "-c", "umask" }, null, null); try (BufferedReader lineRead = new BufferedReader( new InputStreamReader(p.getInputStream(), Charset .defaultCharset().name()))) { p.waitFor(); return lineRead.readLine(); } } catch (Exception e) { return null; } }

Target:
private static String readUmask() { return FS.readPipe(null, new String[] { "sh", "-c", "umask" }, System.getProperty("file.encoding")); }
Source:
public void createOrUpdateNonRDFResource(final String path, final InputStream content, final String contentType) { LOGGER.info("createOrUpdateNonRDFResource: " + path + ", " + contentType); final String ocflObject = objFromPath(path); final String ocflFilename = filenameFromPath(path); final File stagingObj = new File(stagingRoot, ocflObject); if (!stagingObj.exists() && !stagingObj.mkdirs()) { throw new RuntimeException("Unable to create staging object: " + stagingObj); } final File stagingFile = new File(stagingObj, ocflFilename); try { if (!stagingFile.createNewFile()) { LOGGER.debug("File already exists, {}", stagingFile); } } catch (IOException e) { throw new RuntimeException(e); } try { final FileOutputStream outputStream = new FileOutputStream(stagingFile, false); try { IOUtils.copy(content, outputStream); } catch (IOException e) { throw new RuntimeException(e); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }

Target:
public void createOrUpdateNonRDFResource(final String path, final InputStream content, final String contentType) { LOGGER.debug("createOrUpdateNonRDFResource: {}, {}", path, contentType); final String ocflObject = objFromPath(path); final String ocflFilename = filenameFromPath(path); final File stagingObj = new File(stagingRoot, ocflObject); if (!stagingObj.exists() && !stagingObj.mkdirs()) { throw new RuntimeException("Unable to create staging object: " + stagingObj); } final File stagingFile = new File(stagingObj, ocflFilename); try { if (!stagingFile.createNewFile()) { LOGGER.debug("File already exists, {}", stagingFile); } } catch (IOException e) { throw new RuntimeException(e); } try { final FileOutputStream outputStream = new FileOutputStream(stagingFile, false); try { IOUtils.copy(content, outputStream); } catch (IOException e) { throw new RuntimeException(e); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
Source:
public JsonNode get(String name) { return JsonNodeUtils.fromGsonElement(jsonObject.get(name)); }

Target:
public JsonNode get(String name) { JsonElement jsonElement = jsonObject.get(name); return (jsonElement == null) ? null : JsonNodeUtils.fromGsonElement(jsonElement); }
Source:
public App createApp(AppReference appReference, String contextPath) { DependencyNode rootNode = DependencyTreeParser.parse(appReference.getDependencyTree()); Map<?, ?> rawConfiguration = ConfigurationParser.parse(appReference.getConfiguration()); final Lookup lookup = new Lookup(getFlattenedDependencies(rootNode), new Configuration(rawConfiguration)); final Map<String, Component> createdComponents = new HashMap<>(); rootNode.traverse(dependencyNode -> { if (createdComponents.containsKey(dependencyNode.getArtifactId())) { return; } String componentName = dependencyNode.getArtifactId(); String componentVersion = dependencyNode.getVersion(); String componentContextPath; if (dependencyNode == rootNode) { componentContextPath = Component.ROOT_COMPONENT_CONTEXT_PATH; } else { componentContextPath = dependencyNode.getContextPath(); } ComponentReference componentReference = appReference.getComponentReference(componentContextPath); ClassLoader classLoader = classLoaderProvider.getClassLoader(componentName, componentVersion, componentReference); Component component = createComponent(componentName, componentVersion, componentContextPath, componentReference, classLoader, lookup); lookup.add(component); createdComponents.put(componentName, component); }); Set<Theme> themes = appReference.getThemeReferences().map(this::createTheme).collect(Collectors.toSet()); String appName = rootNode.getArtifactId(); String appContextPath = (contextPath == null) ? rootNode.getContextPath() : contextPath; return new App(appName, appContextPath, lookup, themes, new SessionRegistry(appName)); }

Target:
public App createApp(AppReference appReference, String contextPath) { DependencyNode rootNode = DependencyTreeParser.parse(appReference.getDependencyTree()); Map<?, ?> rawConfiguration = ConfigurationParser.parse(appReference.getConfiguration()); final Lookup lookup = new Lookup(getFlattenedDependencies(rootNode), new Configuration(rawConfiguration)); final Map<String, Component> createdComponents = new HashMap<>(); rootNode.traverse(dependencyNode -> { if (createdComponents.containsKey(dependencyNode.getArtifactId())) { return; } String componentName = dependencyNode.getArtifactId(); String componentVersion = dependencyNode.getVersion(); String componentContextPath = (dependencyNode == rootNode) ? Component.ROOT_COMPONENT_CONTEXT_PATH : dependencyNode.getContextPath(); ComponentReference componentReference = appReference.getComponentReference(componentContextPath); ClassLoader classLoader = classLoaderProvider.getClassLoader(componentName, componentVersion, componentReference); Component component = createComponent(componentName, componentVersion, componentContextPath, componentReference, classLoader, lookup); lookup.add(component); createdComponents.put(componentName, component); }); Set<Theme> themes = appReference.getThemeReferences().map(this::createTheme).collect(Collectors.toSet()); String appName = rootNode.getArtifactId(); String appContextPath = (contextPath == null) ? rootNode.getContextPath() : contextPath; return new App(appName, appContextPath, lookup, themes, new SessionRegistry(appName)); }
Source:
public InstallerImpl(String id, String name, String version, String description, List<String> dependencies, Map<String, String> properties, String script, Map<String, ? extends ServerConfig> servers) { Version.validate(version); this.id = id; this.name = name; this.version = version; this.description = description; this.dependencies = dependencies; this.properties = properties; this.script = script; if (servers != null) { this.servers = servers.entrySet() .stream() .collect(Collectors.toMap(Map.Entry::getKey, e -> new InstallerServerConfigImpl(e.getValue()))); } }

Target:
public InstallerImpl( String id, String name, String version, String description, List<String> dependencies, Map<String, String> properties, String script, Map<String, ? extends ServerConfig> servers) { this.id = id; this.name = name; this.version = version; this.description = description; this.dependencies = dependencies; this.properties = properties; this.script = script; if (servers != null) { this.servers = servers .entrySet() .stream() .collect( Collectors.toMap( Map.Entry::getKey, e -> new InstallerServerConfigImpl(e.getValue()))); } }
Source:
public static int trimTrailingWhitespace(byte[] raw, int start, int end) { while (end > start && isWhitespace(raw[end - 1])) end--; return end; }

Target:
public static int trimTrailingWhitespace(byte[] raw, int start, int end) { int ptr = end - 1; while (start <= ptr && isWhitespace(raw[ptr])) ptr--; return ptr + 1; }
Source:
public double overlapPercentWith(StatisticRange other) { if (this.equals(other)) { return 1.0; } if (isEmpty() || other.isEmpty()) { return 0.0; } double lengthOfIntersect = min(high, other.high) - max(low, other.low); if (isInfinite(lengthOfIntersect)) { if (isFinite(this.distinctValues) && isFinite(other.distinctValues)) { return min(other.distinctValues / this.distinctValues, 1); } return INFINITE_TO_INFINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect == 0) { return 1 / max(distinctValues, 1); } if (lengthOfIntersect < 0) { return 0; } if (isInfinite(length()) && isFinite(lengthOfIntersect)) { return INFINITE_TO_FINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect > 0) { return lengthOfIntersect / length(); } return NaN; }

Target:
public double overlapPercentWith(StatisticRange other) { requireNonNull(other, "other is null"); if (this.equals(other)) { return 1.0; } if (this.isEmpty() || other.isEmpty()) { return 0.0; } double lengthOfIntersect = min(this.high, other.high) - max(this.low, other.low); if (isInfinite(lengthOfIntersect)) { if (isFinite(this.distinctValues) && isFinite(other.distinctValues)) { return min(other.distinctValues / this.distinctValues, 1); } return INFINITE_TO_INFINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect == 0) { return 1 / max(this.distinctValues, 1); } if (lengthOfIntersect < 0) { return 0; } if (isInfinite(length()) && isFinite(lengthOfIntersect)) { return INFINITE_TO_FINITE_RANGE_INTERSECT_OVERLAP_HEURISTIC_FACTOR; } if (lengthOfIntersect > 0) { return lengthOfIntersect / length(); } return NaN; }
Source:
public void setDisabledRules(Set<String> disabledRuleNames) { ctx.rulesFilter(rulesSet -> { List<RelOptRule> newSet = new ArrayList<>(); for (RelOptRule r : rulesSet) { if (!disabledRuleNames.contains(r.toString())) newSet.add(r); } return RuleSets.ofList(newSet); }); }

Target:
public void setDisabledRules(Set<String> disabledRuleNames) { ctx.rulesFilter(rulesSet -> { List<RelOptRule> newSet = new ArrayList<>(); for (RelOptRule r : rulesSet) { if (!disabledRuleNames.contains(shortRuleName(r.toString()))) newSet.add(r); } return RuleSets.ofList(newSet); }); }
Source:
public void setTopics(List<String> topics) throws IOException { Requester requester = root.retrieve().method("POST"); requester.with("names", topics); requester.method("PUT").withPreview(MERCY).withUrlPath(getApiTailUrl("topics")).to(); }

Target:
public void setTopics(List<String> topics) throws IOException { root.createRequest() .method("PUT") .with("names", topics) .withPreview(MERCY) .withUrlPath(getApiTailUrl("topics")) .send(); }
Source:
public static short zCrystalMove(short item) { if (item < 3000 || item > 3028) { return 0; } return zMoves[item - 3000]; }

Target:
public static short zCrystalMove(short item) { if (item < 3000 || item >= 4000) { return 0; } return zMoves[item - 3000]; }
Source:
public void allBindingsChanged(BindingProvider provider) { logger.debug("Plex all bindings changed"); if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; setInitialState(plexProvider); } }

Target:
public void allBindingsChanged(BindingProvider provider) { logger.trace("Plex all bindings changed"); if (provider instanceof PlexBindingProvider) { PlexBindingProvider plexProvider = (PlexBindingProvider) provider; setInitialState(plexProvider); } }
Source:
public boolean isExternalVm() { return VmActionByVmOriginValidator.isExternalVm(getOrigin()); }

Target:
public boolean isExternalVm() { return OriginType.EXTERNAL.equals(getOrigin()); }
Source:
void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. This lock expiration thread will be restarted.", t); errorReporter.reportUncaughtError(t); metrics.increment(Category.DEFAULT, "uncaughtErrors"); } }

Target:
void expireLocks() { try { int c = autoCommit((handle, dao) -> { if (isEmbededDatabase()) { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < :expireTime" ) .bind("expireTime", Instant.now().getEpochSecond()) .execute(); } else { return handle.createStatement( "update queued_task_locks" + " set lock_expire_time = NULL, lock_agent_id = NULL, retry_count = retry_count + 1" + " where lock_expire_time is not null" + " and lock_expire_time < " + statementUnixTimestampSql() ) .execute(); } }); if (c > 0) { logger.warn("{} task locks are expired. Tasks will be retried.", c); } } catch (Throwable t) { logger.error("An uncaught exception is ignored. This lock expiration thread will be restarted.", t); errorReporter.reportUncaughtError(t); metrics.increment(Category.DB, "uncaughtErrors"); } }
Source:
public boolean isConstantExpression(IASTNode point) { return allConstantExpressions(fArguments, point) && (getOverload(point) == null || getOverload(point).isConstexpr()); }

Target:
public boolean isConstantExpression(IASTNode point) { return areAllConstantExpressions(fArguments, point) && isConstexprFuncOrNull(getOverload(point)); }
Source:
public boolean parseArguments(List<String> argsList) throws Exception { ParametersParser parser = new ParametersParser( CoreUtil.loadProperties(getClass(), "arguments.properties"), CoreUtil.loadProperties(getClass(), "defaults.properties") ); args = parser.parse(argsList); return args.containsKey("help"); }

Target:
public void parseArguments(List<String> argsList) throws Exception { args = new ParametersParser( CoreUtil.loadProperties(getClass(), "arguments.properties") ).parse(argsList); }
Source:
public ManagementNodeSyncRecord apply(@Nullable ManagementNodeSyncRecord input) { if (input == null) return null; if (isHeartbeatOk(input, currentTimeMillis())) return input; return BasicManagementNodeSyncRecord.builder() .from(input) .status(ManagementNodeState.FAILED) .build(); }

Target:
public ManagementNodeSyncRecord apply(@Nullable ManagementNodeSyncRecord input) { if (input == null) return null; if (!(input.getStatus() == ManagementNodeState.STANDBY || input.getStatus() == ManagementNodeState.MASTER)) return input; if (isHeartbeatOk(input, currentTimeMillis())) return input; return BasicManagementNodeSyncRecord.builder() .from(input) .status(ManagementNodeState.FAILED) .build(); }
Source:
protected void doHealthCheck(Builder builder) throws Exception { CosmosDatabaseResponse response = this.cosmosClient.getDatabase(dbName).read(); if (response != null) { LOGGER.info("The health indicator cost RUs, cosmos uri: {}, dbName: {}", response.getRequestCharge(), uri, dbName); } if (response == null) { builder.down(); } else { builder.up().withDetail("database", response.getProperties().getId()); } }

Target:
protected void doHealthCheck(Builder builder) throws Exception { CosmosDatabaseResponse response = this.cosmosAsyncClient.getDatabase(dbName).read().block(); if (response != null) { LOGGER.info("The health indicator cost RUs, cosmos uri: {}, dbName: {}", response.getRequestCharge(), uri, dbName); } if (response == null) { builder.down(); } else { builder.up().withDetail("database", response.getProperties().getId()); } }
Source:
private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) throws IOException { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); try { return new StoppableCheck( _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (HttpHostConnectException ex) { String msg = "Custom client side instance level health check for {}/{} failed " + "because of connection refused."; LOG.error(msg, clusterId, instanceName, ex); return new StoppableCheck(false, Arrays.asList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException e) { LOG.error("Failed to perform custom client side instance level health checks for {}/{}", clusterId, instanceName, e); throw e; } }

Target:
private StoppableCheck performCustomInstanceCheck(String clusterId, String instanceName, String baseUrl, Map<String, String> customPayLoads) { LOG.info("Perform instance level client side health checks for {}/{}", clusterId, instanceName); try { return new StoppableCheck( _customRestClient.getInstanceStoppableCheck(baseUrl, customPayLoads), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } catch (IOException ex) { LOG.error("Custom client side instance level health check for {}/{} failed.", clusterId, instanceName, ex); return new StoppableCheck(false, Arrays.asList(instanceName), StoppableCheck.Category.CUSTOM_INSTANCE_CHECK); } }
Source:
public RangedBeacon(Beacon beacon) { try { Constructor cons = BeaconManager.getRssiFilterImplClass().getConstructors()[0]; filter = (RssiFilter)cons.newInstance(); } catch (Exception e) { e.printStackTrace(); } updateBeacon(beacon); }

Target:
public RangedBeacon(Beacon beacon) { try { Constructor cons = BeaconManager.getRssiFilterImplClass().getConstructors()[0]; filter = (RssiFilter)cons.newInstance(); if ((filter != null) && (filter instanceof RunningAverageRssiFilter)) ((RunningAverageRssiFilter)filter).setSampleExpirationMilliseconds(sampleExpirationMilliseconds); } catch (Exception e) { LogManager.e(TAG, "Could not construct RssiFilterImplClass %s", BeaconManager.getRssiFilterImplClass().getName()); } updateBeacon(beacon); }
Source:
Mono<Response<SearchIndex>> createWithResponse(SearchIndex index, RequestOptions requestOptions, Context context) { Objects.requireNonNull(index, "'Index' cannot be null"); try { return restClient.indexes() .createWithRestResponseAsync(index, requestOptions, context) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
Mono<Response<SearchIndex>> createWithResponse(SearchIndex index, RequestOptions requestOptions, Context context) { Objects.requireNonNull(index, "'Index' cannot be null"); try { return restClient .createWithRestResponseAsync(index, requestOptions, context) .map(Function.identity()); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public void testListContainerMarker() throws InterruptedException { String containerName = getContainerName(); try { addAlphabetUnderRoot(containerName); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1)); assert container.getNextMarker() != null; assertEquals(container.size(), 1); String marker = container.getNextMarker(); container = view.getBlobStore().list(containerName, afterMarker(marker)); assertEquals(container.getNextMarker(), null); assert container.size() == 25 : String.format("size should have been 25, but was %d: %s", container.size(), container); assert container.getNextMarker() == null; container = view.getBlobStore().list(containerName, afterMarker("z")); assert container.getNextMarker() == null; } finally { returnContainer(containerName); } }

Target:
public void testListContainerMarker() throws InterruptedException { String containerName = getContainerName(); try { addAlphabetUnderRoot(containerName); PageSet<? extends StorageMetadata> container = view.getBlobStore().list(containerName, maxResults(1)); assert container.getNextMarker() != null; assertEquals(container.size(), 1); String marker = container.getNextMarker(); container = view.getBlobStore().list(containerName, afterMarker(marker)); assertEquals(container.getNextMarker(), null); assert container.size() == 25 : String.format("size should have been 25, but was %d: %s", container.size(), container); assert container.getNextMarker() == null; container = view.getBlobStore().list(containerName, afterMarker("z")); assertThat(container.getNextMarker()).isNull(); } finally { returnContainer(containerName); } }
Source:
public String getWorkDir() { return _workDir == null ? "./" : _workDir; }

Target:
public String getWorkDir() { return _workDir; }
Source:
protected String locateSql(final Handle h) { return h.getConfig(SqlObjects.class).getSqlLocator().locate(sqlObjectType, method); }

Target:
String locateSql(final Handle h) { return h.getConfig(SqlObjects.class).getSqlLocator().locate(sqlObjectType, method); }
Source:
void doExecute(GitFlowRepository gfRepo, final String startCommitSha1, Shell activeShell) { InputDialog inputDialog = new StartDialog( activeShell, UIText.ReleaseStartHandler_provideReleaseName, UIText.ReleaseStartHandler_provideANameForTheNewRelease, "", new ReleaseNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return; } final String releaseName = inputDialog.getValue(); ReleaseStartOperation releaseStartOperation = new ReleaseStartOperation( gfRepo, startCommitSha1, releaseName); JobUtil.scheduleUserWorkspaceJob(releaseStartOperation, UIText.ReleaseStartHandler_startingNewRelease, JobFamilies.GITFLOW_FAMILY); BranchOperationUI.handleSingleRepositoryCheckoutOperationResult( gfRepo.getRepository(), releaseStartOperation.getCheckoutResult(), gfRepo.getConfig().getFullReleaseBranchName(releaseName)); }

Target:
void doExecute(GitFlowRepository gfRepo, final String startCommitSha1, Shell activeShell) { InputDialog inputDialog = new StartDialog( activeShell, UIText.ReleaseStartHandler_provideReleaseName, UIText.ReleaseStartHandler_provideANameForTheNewRelease, "", new ReleaseNameValidator(gfRepo)); if (inputDialog.open() != Window.OK) { return; } final String releaseName = inputDialog.getValue(); ReleaseStartOperation operation = new ReleaseStartOperation( gfRepo, startCommitSha1, releaseName); String fullBranchName = gfRepo.getConfig() .getFullReleaseBranchName(releaseName); JobUtil.scheduleUserWorkspaceJob(operation, UIText.ReleaseStartHandler_startingNewRelease, JobFamilies.GITFLOW_FAMILY, new PostBranchCheckoutUiTask(gfRepo, fullBranchName, operation)); }
Source:
public String getDisplayString() { if (branch.ref().startsWith("refs/heads/")) { return branch.ref().substring( branch.ref().indexOf("refs/heads/") + "refs/heads/".length()); } return branch.ref(); }

Target:
public String getDisplayString() { final String refsHeads = "refs/heads/"; if (branch.ref().startsWith(refsHeads)) { return branch.ref().substring(refsHeads.length()); } return branch.ref(); }
Source:
public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Copying files in Windows is only supported if a LocalController is in use. Test will be skipped."); } addBatchStep("xcopy " + file.getAbsolutePath() + " %cd% /E /Y"); } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }

Target:
public void copyFile(File file) { File tmp = null; try { tmp = File.createTempFile("jenkins-acceptance-tests", "dir"); ZipUtil.pack(file, tmp); byte[] archive = IOUtils.toByteArray(new FileInputStream(tmp)); if (SystemUtils.IS_OS_WINDOWS) { if (!(controller instanceof LocalController)) { throw new AssumptionViolatedException("Copying files in Windows is only supported if a LocalController is in use. Test will be skipped."); } addBatchStep(xCopy(file.getAbsolutePath(), "%cd%")); } else { addShellStep(String.format( "base64 --decode << ENDOFFILE > archive.zip && unzip -o archive.zip \n%s\nENDOFFILE", new String(Base64.encodeBase64Chunked(archive)) )); } } catch (IOException e) { throw new AssertionError(e); } finally { if (tmp != null) { tmp.delete(); } } }
Source:
protected AuthoritativeResource fetchAuthoritativeResource(String sourceName) throws IOException { final AuthoritativeResource authoritativeResource = new AuthoritativeResourceJsonLoader(LOGGER).load( OBJECT_MAPPER.readValue( client.target(baseUrl) .path("/rsng-stat/stat/rirstats") .request() .get(String.class), JsonNode.class) ); LOGGER.info("Downloaded {}; asn: {}, ipv4: {}, ipv6: {}", sourceName, authoritativeResource.getNrAutNums(), authoritativeResource.getNrInetnums(), authoritativeResource.getNrInet6nums()); return authoritativeResource; }

Target:
protected AuthoritativeResource fetchAuthoritativeResource(String sourceName) throws IOException { final AuthoritativeResource authoritativeResource = new AuthoritativeResourceJsonLoader(LOGGER).load( OBJECT_MAPPER.readValue( client.target(rsngBaseUrl) .path("/rsng-stat/stat/rirstats") .request() .get(String.class), JsonNode.class) ); LOGGER.info("Downloaded {}; asn: {}, ipv4: {}, ipv6: {}", sourceName, authoritativeResource.getNrAutNums(), authoritativeResource.getNrInetnums(), authoritativeResource.getNrInet6nums()); return authoritativeResource; }
Source:
public Map<String, Integer> getInstanceCapacityMap() { Map<String, String> capacityData = _record.getMapField(InstanceConfigProperty.INSTANCE_CAPACITY_MAP.name()); Map<String, Integer> capacityDataMap = new HashMap<>(); if (capacityData != null && !capacityData.isEmpty()) { for (String key: capacityData.keySet()) { capacityDataMap.put(key, Integer.parseInt(capacityData.get(key))); } } return capacityDataMap; }

Target:
public Map<String, Integer> getInstanceCapacityMap() { Map<String, String> capacityData = _record.getMapField(InstanceConfigProperty.INSTANCE_CAPACITY_MAP.name()); if (capacityData != null) { return capacityData.entrySet().stream().collect( Collectors.toMap(entry -> entry.getKey(), entry -> Integer.parseInt(entry.getValue()))); } return Collections.emptyMap(); }
Source:
private void setAlarmVolume(float volume) { try { if (BuildConfig.DEBUG) { Log.d(TAG, "Setting volume to "+volume); } itsPlayerService.SetVolume(volume); } catch (Exception e) { Log.e(TAG, "Couldn't set volume "+e); } }

Target:
private void setAlarmVolume(float volume) throws RemoteException { if (BuildConfig.DEBUG) { Log.d(TAG, "Setting volume to " + volume); } if (itsPlayerService.isPlaying()) { itsPlayerService.SetVolume(volume); } }
Source:
public int compareTo(LfsPointer o) { int x = getOid().compareTo(o.getOid()); if (x != 0) { return 0; } return (int) (getSize() - o.getSize()); }

Target:
public int compareTo(LfsPointer o) { int x = getOid().compareTo(o.getOid()); if (x != 0) { return x; } return (int) (getSize() - o.getSize()); }
Source:
private void updateClusterMapInHelix() { info("Initializing admins and possibly adding cluster in Helix (if non-existent)"); maybeAddCluster(); info("Initialized"); info("Populating resources and partitions set"); info("Populated resources and partitions set"); populateInstancesAndPartitionsMap(); for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { info("\n=======Starting datacenter: {}=========\n", dc.getName()); Map<String, Set<String>> partitionsToInstancesInDc = new HashMap<>(); addUpdateInstances(dc.getName(), partitionsToInstancesInDc); info( "Done adding all instances in {}, now scanning resources in Helix and ensuring instance set for partitions are the same.", dc.getName()); addUpdateResources(dc.getName(), partitionsToInstancesInDc); } }

Target:
private void updateClusterMapInHelix() { info("Initializing admins and possibly adding cluster in Helix (if non-existent)"); maybeAddCluster(); info("Initialized"); info("Populating resources and partitions set"); populateInstancesAndPartitionsMap(); info("Populated resources and partitions set"); for (Datacenter dc : staticClusterMap.hardwareLayout.getDatacenters()) { info("\n=======Starting datacenter: {}=========\n", dc.getName()); Map<String, Set<String>> partitionsToInstancesInDc = new HashMap<>(); addUpdateInstances(dc.getName(), partitionsToInstancesInDc); info( "Done adding all instances in {}, now scanning resources in Helix and ensuring instance set for partitions are the same.", dc.getName()); addUpdateResources(dc.getName(), partitionsToInstancesInDc); } }
Source:
private String adjustDebuggerPath(String path) { IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); return (breakpoints instanceof MIBreakpoints) ? ((MIBreakpoints)breakpoints).adjustDebuggerPath(path) : path; }

Target:
private String adjustDebuggerPath(String path) { IBreakpoints breakpoints = getServicesTracker().getService(IBreakpoints.class); return (breakpoints instanceof IMIBreakpointPathAdjuster) ? ((IMIBreakpointPathAdjuster)breakpoints).adjustDebuggerPath(path) : path; }
Source:
private void sendData(HttpServletResponse httpResp, ResponseToken respToken, String action, String authenticatedIdPs) throws ServletException, IOException { if (stsRedirectPage == null || stsRedirectPage.trim().length() == 0) { stsRedirectPage = readPassiveSTSHtmlRedirectPage(); } String finalPage = null; String htmlPage = stsRedirectPage; String pageWithReply = htmlPage.replace("$url", String.valueOf(respToken.getReplyTo())); String pageWithReplyAction = pageWithReply.replace("$action", String.valueOf(action)); String pageWithReplyActionResult = pageWithReplyAction.replace("$result", StringEscapeUtils.escapeHtml(String.valueOf(respToken.getResults()))); String pageWithReplyActionResultContext; if(respToken.getContext() !=null) { pageWithReplyActionResultContext = pageWithReplyActionResult.replace( "<!--$additionalParams-->", "<!--$additionalParams-->" + "<input type='hidden' name='wctx' value='" +respToken.getContext() + "'>"); } else { pageWithReplyActionResultContext = pageWithReplyActionResult; } if (authenticatedIdPs == null || authenticatedIdPs.isEmpty()) { finalPage = pageWithReplyActionResultContext; } else { finalPage = pageWithReplyActionResultContext.replace("<!--$additionalParams-->", "<input type='hidden' name='AuthenticatedIdPs' value='" + Encode.forHtmlAttribute(authenticatedIdPs) + "'>"); } PrintWriter out = httpResp.getWriter(); out.print(Encode.forHtml(finalPage)); if (log.isDebugEnabled()) { log.debug("sts_response.html : " + finalPage); } return; }

Target:
private void sendData(HttpServletResponse httpResp, ResponseToken respToken, String action, String authenticatedIdPs) throws ServletException, IOException { if (stsRedirectPage == null || stsRedirectPage.trim().length() == 0) { stsRedirectPage = readPassiveSTSHtmlRedirectPage(); } String finalPage = null; String htmlPage = stsRedirectPage; String pageWithReply = htmlPage.replace("$url", String.valueOf(respToken.getReplyTo())); String pageWithReplyAction = pageWithReply.replace("$action", Encode.forHtml(String.valueOf(action))); String pageWithReplyActionResult = pageWithReplyAction.replace("$result", Encode.forHtml(String.valueOf(respToken.getResults()))); String pageWithReplyActionResultContext; if(respToken.getContext() !=null) { pageWithReplyActionResultContext = pageWithReplyActionResult.replace( "<!--$additionalParams-->", "<!--$additionalParams-->" + "<input type='hidden' name='wctx' value='" + Encode.forHtmlAttribute(respToken.getContext())+ "'>"); } else { pageWithReplyActionResultContext = pageWithReplyActionResult; } if (authenticatedIdPs == null || authenticatedIdPs.isEmpty()) { finalPage = pageWithReplyActionResultContext; } else { finalPage = pageWithReplyActionResultContext.replace("<!--$additionalParams-->", "<input type='hidden' name='AuthenticatedIdPs' value='" + Encode.forHtmlAttribute(authenticatedIdPs) + "'>"); } PrintWriter out = httpResp.getWriter(); out.print(finalPage); if (log.isDebugEnabled()) { log.debug("sts_response.html : " + finalPage); } return; }
Source:
public static String getStudentProfile(String userId) { Map<String, String[]> params = new HashMap<>(); params.put(Const.ParamsNames.STUDENT_ID, new String[] { userId }); return executeGetRequest(Const.ResourceURIs.STUDENT_PROFILE, params).responseBody; }

Target:
public static StudentProfileAttributes getStudentProfile(String userId) { Map<String, String[]> params = new HashMap<>(); params.put(Const.ParamsNames.STUDENT_ID, new String[] { userId }); JSONObject jsonObj = new JSONObject(executeGetRequest(Const.ResourceURIs.STUDENT_PROFILE, params).responseBody); return JsonUtils.fromJson(jsonObj.getJSONObject("studentProfile").toString(), StudentProfileAttributes.class); }
Source:
public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); }

Target:
public void init(Map<String, String> options, ConfigurationSource cfg) { super.initCfg(cfg); FormattingPreferences prefs = new FormattingPreferences(); String maxLineLength = options.get("maxLineLength"); String wrapLongLines = options.get("wrapLongLines"); String tabInsteadOfSpaces = options.get("tabInsteadOfSpaces"); String tabWidth = options.get("tabWidth"); String splitMultiAttrs = options.get("splitMultiAttrs"); prefs.setMaxLineLength(maxLineLength != null ? Integer.valueOf(maxLineLength) : null); prefs.setWrapLongLines(wrapLongLines != null ? Boolean.valueOf(wrapLongLines) : null); prefs.setTabInsteadOfSpaces(tabInsteadOfSpaces != null ? Boolean.valueOf(tabInsteadOfSpaces) : null); prefs.setTabWidth(tabWidth != null ? Integer.valueOf(tabWidth) : null); prefs.setSplitMultiAttrs(splitMultiAttrs != null ? Boolean.valueOf(splitMultiAttrs) : null); this.formatter = new XmlDocumentFormatter(options.getOrDefault("lineending", System.lineSeparator()), prefs); }
Source:
private void initAlerts() { hostOptionChangeAlert = new AlertWithIcon(AlertType.INFO, constants.hostOptionChangeInfo(), PatternflyConstants.PFICON_INFO); }

Target:
private void initAlerts() { hostOptionChangeAlert = new AlertWithIcon(AlertType.INFO); }
Source:
public void followPeergos() throws Exception { UserContext u1 = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); UserContext u2 = PeergosNetworkUtils.ensureSignedUp("w", "w", network, crypto); List<FollowRequestWithCipherText> u1Requests = u1.processFollowRequests().get(); assertTrue("Receive a follow request", u1Requests.size() > 0); String feedback = "Here's some constructive feedback!"; CompletableFuture<Boolean> testFeedbackSubmission = u2.submitFeedback(feedback); assertTrue("Feedback submission was successful!", testFeedbackSubmission.get() == true); Path filePath = Paths.get(u1.username, "feedback"); Optional<FileWrapper> feedbackFile = u1.getByPath(filePath).get(); assertTrue("Feedback file present", feedbackFile.isPresent()); AsyncReader inputStream = feedbackFile .get() .getInputStream(u1.network, u1.crypto.random, l -> {}) .get(); byte[] fileContents = Serialize.readFully(inputStream, feedbackFile.get().getFileProperties().size).get(); assertTrue("Feedback file contents correct", feedback.getBytes() == fileContents); }

Target:
public void followPeergos() throws Exception { UserContext u1 = PeergosNetworkUtils.ensureSignedUp("peergos", "testpassword", network, crypto); UserContext u2 = PeergosNetworkUtils.ensureSignedUp("w", "w", network, crypto); List<FollowRequestWithCipherText> u1Requests = u1.processFollowRequests().get(); assertTrue("Receive a follow request", u1Requests.size() > 0); }
Source:
public void dropView(String view) { try { super.run("DROP VIEW " + view); } catch (Exception e) { } }

Target:
public void dropView(String view) { try { super.run("DROP VIEW " + view); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }
Source:
public void nodeDelete(String vdc, String nodeName, String token) throws NodeExecutionException { log.info("deleting node"); try { puppetDelete(vdc, nodeName, token); chefClientDelete(vdc, nodeName, token); } catch (Exception e) { try { chefClientDelete(vdc, nodeName, token); } catch (Exception e2) { throw new NodeExecutionException(e2); } } List<ProductInstance> productInstances = null; String hostname = nodeName.split("\\.")[0]; try { productInstances = productInstanceDao.findByHostname(nodeName); for (int i = 0; i < productInstances.size(); i++) { productInstanceDao.remove(productInstances.get(i)); } } catch (EntityNotFoundException enfe) { String errorMsg = "The hostname " + hostname + " does not have products installed " + enfe.getMessage(); log.warn(errorMsg); } }

Target:
public void nodeDelete(String vdc, String nodeName, String token) throws NodeExecutionException { log.info("deleting node"); boolean error = false; try { puppetDelete(vdc, nodeName, token); } catch (Exception e) { log.warn("The node cannot be deleted in Puppet master"); error = true; } try { chefClientDelete(vdc, nodeName, token); } catch (Exception e2) { log.warn("The node cannot be deleted in Chef-server"); error = true; } List<ProductInstance> productInstances = null; String hostname = nodeName.split("\\.")[0]; try { productInstances = productInstanceDao.findByHostname(nodeName); for (int i = 0; i < productInstances.size(); i++) { productInstanceDao.remove(productInstances.get(i)); } } catch (EntityNotFoundException enfe) { String errorMsg = "The hostname " + hostname + " does not have products installed " + enfe.getMessage(); log.warn(errorMsg); } if (error) { throw new NodeExecutionException ("Error to delete the node"); } }
Source:
protected LinkedHashSet<ArtifactCoordinatesValidator> versionValidators() { return new LinkedHashSet<>(versionValidators); }

Target:
LinkedHashSet<ArtifactCoordinatesValidator> versionValidators() { return new LinkedHashSet<>(versionValidators); }
Source:
void raiseIssue(CallExpressionTree tree) { String functionName = ((IdentifierTree) tree.callee()).name(); addIssue(tree.callee(), String.format(MESSAGE, functionName, functionName)); }

Target:
void raiseIssue(CallExpressionTree tree) { String functionName = "this function"; if (tree.callee().is(IDENTIFIER_REFERENCE)) { functionName = "\"" + ((IdentifierTree) tree.callee()).name() + "\""; } addIssue(tree.callee(), String.format(MESSAGE, functionName, functionName)); }
Source:
public void nextTerminal() { if (terminals_.terminalCount() > 0 && activeTerminalHandle_ != null) { boolean foundCurrent = false; for (final String handle : terminals_) { if (foundCurrent == true) { eventBus_.fireEvent(new SwitchToTerminalEvent(handle)); } if (activeTerminalHandle_.equals(handle)) { foundCurrent = true; } } } }

Target:
public void nextTerminal() { if (terminals_.terminalCount() > 0 && activeTerminalHandle_ != null) { boolean foundCurrent = false; for (final String handle : terminals_) { if (foundCurrent == true) { eventBus_.fireEvent(new SwitchToTerminalEvent(handle)); return; } if (activeTerminalHandle_.equals(handle)) { foundCurrent = true; } } } }
Source:
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { Logger.LOGGER.deprecatedRegionFactory(this.getClass().getName(), this.getClass().getSuperclass().getSuperclass().getName(), SHARED, this.shared); properties.put(SHARED, this.shared); super.start(settings, properties); }

Target:
public void start(SessionFactoryOptions settings, Properties properties) throws CacheException { Logger.LOGGER.deprecatedRegionFactory(this.getClass().getName(), this.getClass().getSuperclass().getSuperclass().getName(), SHARED, this.shared); properties.setProperty(SHARED, this.shared); super.start(settings, properties); }
Source:
public void testContinuousQueryFilterDeploymentFailed() throws Exception { startGrids(2).cluster().state(ClusterState.ACTIVE); grid(0).createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)); ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); Class<Factory<CacheEntryEventFilter<Integer, Integer>>> remoteFilterFactoryCls = (Class<Factory<CacheEntryEventFilter<Integer, Integer>>>)getExternalClassLoader() .loadClass(EXT_FILTER_FACTORY_CLS); Factory<CacheEntryEventFilter<Integer, Integer>> remoteFilterFactory = remoteFilterFactoryCls.newInstance(); qry.setRemoteFilterFactory(remoteFilterFactory); spi(grid(1)).blockMessages((node, msg) -> msg instanceof GridDeploymentRequest); assertThrowsAnyCause( log, () -> grid(0).cache(DEFAULT_CACHE_NAME).query(qry), CacheException.class, "Failed to start continuous query." ); assertEquals(0, grid(0).context().systemView().view(CQ_SYS_VIEW).size()); assertEquals(0, grid(1).context().systemView().view(CQ_SYS_VIEW).size()); }

Target:
public void testContinuousQueryFilterDeploymentFailed() throws Exception { startGrids(NODES_CNT - 1); IgniteEx cli = startClientGrid(NODES_CNT - 1); IgniteCache<Integer, Integer> cache = cli.createCache(DEFAULT_CACHE_NAME); ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>(); Class<Factory<CacheEntryEventFilter<Integer, Integer>>> rmtFilterFactoryCls = (Class<Factory<CacheEntryEventFilter<Integer, Integer>>>)getExternalClassLoader() .loadClass("org.apache.ignite.tests.p2p.CacheDeploymentEntryEventFilterFactory"); qry.setRemoteFilterFactory(rmtFilterFactoryCls.newInstance()); spi(grid(1)).blockMessages((node, msg) -> msg instanceof GridDeploymentRequest); assertThrowsWithCause(() -> cache.query(qry), CacheException.class); assertTrue(stopRoutineLatch.await(getTestTimeout(), MILLISECONDS)); assertTrue(allGrids().stream().allMatch(g -> ((IgniteEx)g).context().systemView().view(CQ_SYS_VIEW).size() == 0)); }
Source:
public LeaderInformation(@Nullable UUID leaderSessionID, @Nullable String leaderAddress) { this.leaderSessionID = leaderSessionID; this.leaderAddress = leaderAddress; }

Target:
private LeaderInformation(@Nullable UUID leaderSessionID, @Nullable String leaderAddress) { this.leaderSessionID = leaderSessionID; this.leaderAddress = leaderAddress; }
Source:
public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); return bits; }

Target:
public int hashCode() { int bits = 1; bits = 31 * bits + this.type.ordinal(); bits = 31 * bits + getToX(); bits = 31 * bits + getToY(); bits = 31 * bits + getToZ(); return bits ^ (bits >> 31); }
Source:
public Object[][] configurationFiles() { return new Object[][] { {"configs/unified/7.0.S"}, {"configs/unified/7.1.xml"}, {"configs/unified/7.2.xml"}, {"configs/unified/8.0.xml"}, {"configs/unified/8.1.xml"}, {"configs/unified/8.2.xml"}, {"configs/unified/9.0.xml"}, {"configs/unified/9.1.xml"}, {"configs/unified/9.2.xml"} }; }

Target:
public Object[][] configurationFiles() { return new Object[][] { {"configs/unified/7.0.xml"}, {"configs/unified/7.1.xml"}, {"configs/unified/7.2.xml"}, {"configs/unified/8.0.xml"}, {"configs/unified/8.1.xml"}, {"configs/unified/8.2.xml"}, {"configs/unified/9.0.xml"}, {"configs/unified/9.1.xml"}, {"configs/unified/9.2.xml"} }; }
Source:
public ChargeEntity lockChargeForProcessing(String chargeId, OperationType operationType) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { try { chargeEntity.setStatus(operationType.getLockingStatus()); } catch (InvalidStateTransitionException e) { logger.warn("Could not transition charge from status to status - exception is {}", chargeEntity.getId(), chargeEntity.getStatus(), operationType.getLockingStatus(), e.getMessage()); if (chargeEntity.hasStatus(operationType.getLockingStatus())) { throw new OperationAlreadyInProgressRuntimeException(operationType.getValue(), chargeEntity.getExternalId()); } throw new IllegalStateRuntimeException(chargeEntity.getExternalId()); } return chargeEntity; }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }

Target:
public ChargeEntity lockChargeForProcessing(String chargeId, OperationType operationType) { return chargeDao.findByExternalId(chargeId).map(chargeEntity -> { try { chargeEntity.setStatus(operationType.getLockingStatus()); } catch (InvalidStateTransitionException e) { if (chargeEntity.hasStatus(operationType.getLockingStatus())) { throw new OperationAlreadyInProgressRuntimeException(operationType.getValue(), chargeEntity.getExternalId()); } throw new IllegalStateRuntimeException(chargeEntity.getExternalId()); } return chargeEntity; }).orElseThrow(() -> new ChargeNotFoundRuntimeException(chargeId)); }