auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateSubAccountNumber(String chartCode, String accountNumber, String subAccountNumber) { if (StringUtils.isBlank(subAccountNumber)) { return false; } SubAccount subAccount = subAccountService.getByPrimaryId(chartCode, accountNumber, subAccountNumber); if (ObjectUtils.isNull(subAccount)) { String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_ACCOUNT_NOT_FOUND); LOG.error(String.format(errorMessage, chartCode, accountNumber, subAccountNumber)); return false; } if (!subAccount.isActive()) { String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_ACCOUNT_INACTIVE); LOG.error(String.format(errorMessage, chartCode, accountNumber, subAccountNumber)); return false; } return true; }

Target:
private boolean validateSubAccountNumber(String chartCode, String accountNumber, String subAccountNumber) { if (StringUtils.isBlank(subAccountNumber)) { return true; } SubAccount subAccount = subAccountService.getByPrimaryId(chartCode, accountNumber, subAccountNumber); if (ObjectUtils.isNull(subAccount)) { String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_ACCOUNT_NOT_FOUND); LOG.error(String.format(errorMessage, chartCode, accountNumber, subAccountNumber)); return false; } if (!subAccount.isActive()) { String errorMessage = configurationService.getPropertyValueAsString(CuFPKeyConstants.ERROR_SUB_ACCOUNT_INACTIVE); LOG.error(String.format(errorMessage, chartCode, accountNumber, subAccountNumber)); return false; } return true; }
Source:
public void rootTestGetVariantsByVariantCoreString() throws URISyntaxException { String url = "/v2/variants/" + CHROMOSOME +":71822:C:G?species=mmusculus&assembly=grcm38"; List<VariantWithSamplesAndAnnotation> variantWithSamplesAndAnnotations = WSTestHelpers .testRestTemplateHelper(url,restTemplate); assertTrue(variantWithSamplesAndAnnotations.size() == 1); assertTrue(variantWithSamplesAndAnnotations.get(0).getSourceEntries().size() == 0); assertNull(variantWithSamplesAndAnnotations.get(0).getAnnotation()); assertTrue(variantWithSamplesAndAnnotations.get(0).getIds().size() > 0); }

Target:
public void rootTestGetVariantsByVariantCoreString() throws URISyntaxException { String url = "/v2/variants/" + CHROMOSOME + ":71822:C:G?species=mmusculus&assembly=grcm38"; List<VariantWithSamplesAndAnnotation> variantWithSamplesAndAnnotations = WSTestHelpers .testRestTemplateHelper(url, restTemplate); assertEquals(1, variantWithSamplesAndAnnotations.size()); assertTrue(variantWithSamplesAndAnnotations.get(0).getSourceEntries().size() == 0); assertNull(variantWithSamplesAndAnnotations.get(0).getAnnotation()); assertTrue(variantWithSamplesAndAnnotations.get(0).getIds().size() > 0); }
Source:
Optional<AllureExecutable> provide(AllureGlobalConfig globalConfig, String executableName) { return bambooExecutablesManager.getExecutableByName(executableName) .map(allureHomeDir -> { final Path cmdPath = Paths.get(allureHomeDir, "bin", "allure"); if (!cmdPath.toFile().exists() && globalConfig.isDownloadEnabled()) { final Matcher nameMatcher = EXEC_NAME_PATTERN.matcher(executableName); allureDownloader.downloadAndExtractAllureTo(allureHomeDir, nameMatcher.matches() ? nameMatcher.group(1) : DEFAULT_VERSION); } return (cmdPath.toFile().exists()) ? new AllureExecutable(cmdPath) : null; }); }

Target:
Optional<AllureExecutable> provide(AllureGlobalConfig globalConfig, String executableName) { return bambooExecutablesManager.getExecutableByName(executableName) .map(allureHomeDir -> { final Path cmdPath = Paths.get(allureHomeDir, "bin", getAllureExecutableName()); if (!cmdLine.hasCommand(cmdPath.toString()) && globalConfig.isDownloadEnabled()) { final Matcher nameMatcher = EXEC_NAME_PATTERN.matcher(executableName); allureDownloader.downloadAndExtractAllureTo(allureHomeDir, nameMatcher.matches() ? nameMatcher.group(1) : DEFAULT_VERSION); } return (cmdLine.hasCommand(cmdPath.toString())) ? new AllureExecutable(cmdPath, cmdLine) : null; }); }
Source:
public void setParams(Map<?, ?> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; for (Map.Entry<?, ?> entry : map.entrySet()) { Number probNum = (Number) entry.getValue(); double prob = probNum.doubleValue(); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + entry.getKey().toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int supportSize = 0; int count = 0; double cdf = 0.0; for (Map.Entry<?, ?> entry : map.entrySet()) { Object key = entry.getKey(); Number num = (Number) entry.getValue(); double value = num.doubleValue(); this.objects[count] = key; double prob = value / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; if (!Util.closeToZero(prob)) supportSize++; } int curSupportIndex = 0; this.finiteSupport = new Object[supportSize]; for (Map.Entry<?, ?> entry : map.entrySet()) { Object key = entry.getKey(); Number num = (Number) entry.getValue(); double value = num.doubleValue(); double prob = value / sum; if (!Util.closeToZero(prob)) { this.finiteSupport[curSupportIndex] = key; curSupportIndex++; } } this.hasMap = true; } }

Target:
public void setParams(Map<?, ?> map) { if (map != null) { if (map.size() == 0) { throw new IllegalArgumentException( "no elements within map for categorical distribution"); } double sum = 0.0; for (Map.Entry<?, ?> entry : map.entrySet()) { Number probNum = (Number) entry.getValue(); double prob = probNum.doubleValue(); if (prob < 0) { throw new IllegalArgumentException("Probability " + prob + " for key " + entry.getKey().toString() + " is negative"); } sum += prob; } if (sum < 1e-9) { throw new IllegalArgumentException( "probabilities sum to approximately zero"); } this.map = new HashMap<Object, Double>(); this.logMap = new HashMap<Object, Double>(); this.objects = new Object[map.size()]; this.cdfObjects = new double[map.size()]; int count = 0; double cdf = 0.0; for (Map.Entry<?, ?> entry : map.entrySet()) { Object key = entry.getKey(); Number num = (Number) entry.getValue(); double value = num.doubleValue(); this.objects[count] = key; double prob = value / sum; cdf += prob; this.cdfObjects[count] = cdf; this.map.put(key, prob); this.logMap.put(key, Math.log(prob)); count += 1; } this.hasMap = true; this.finiteSupport = null; } }
Source:
public ConnectionMetadata get(String connectionId) { return connections.get(connectionId); }

Target:
public synchronized ConnectionMetadata get(String connectionId) { return connections.get(connectionId); }
Source:
public String generatePassword(int policyLength) { int length = Math.max(32, policyLength); SecureTokenGenerator generator = new SecureTokenGenerator(length); return generator.nextToken() + "Br4%"; }

Target:
public String generatePassword(int policyLength) { return PasswordGenerator.INSTANCE.nextPassword(Math.max(32, policyLength)); }
Source:
private void processQueue() { if (currentHolder != null || queue.isEmpty()) { return; } LockRequest head = queue.poll(); currentHolder = head.requestId; head.result.complete(null); }

Target:
private void processQueue() { while (!queue.isEmpty() && currentHolder == null) { LockRequest head = queue.poll(); if (!head.releaseImmediately) { currentHolder = head.requestId; } completeRequest(head); } }
Source:
public Worker createWorker() { final EventLoop eventLoop = eventLoopGroup.next(); return new Worker() { private final SubscriptionList subs = new SubscriptionList(); @Override public Subscription schedule(final Action0 action) { if (isUnsubscribed()) { return Subscriptions.unsubscribed(); } if (eventLoop.inEventLoop()) { action.call(); return Subscriptions.empty(); } else { final Future<?> result = eventLoop.submit(new Runnable() { @Override public void run() { action.call(); } }); Subscription toReturn = fromFuture(result); subs.add(toReturn); return toReturn; } } @Override public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { if (delayTime <= 0) { return schedule(action); } if (isUnsubscribed()) { return Subscriptions.unsubscribed(); } final Future<?> result = eventLoop.schedule(new Runnable() { @Override public void run() { action.call(); } }, delayTime, unit); Subscription toReturn = fromFuture(result); subs.add(toReturn); return toReturn; } @Override public void unsubscribe() { subs.unsubscribe(); } @Override public boolean isUnsubscribed() { return subs.isUnsubscribed(); } private Subscription fromFuture(final Future<?> result) { return Subscriptions.create(new Action0() { @Override public void call() { result.cancel(false); } }); } }; }

Target:
public Worker createWorker() { final EventLoop eventLoop = eventLoopGroup.next(); return new EventloopWorker(eventLoop); }
Source:
public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { return new Statement() { @Override public void evaluate() throws Throwable { final List<Throwable> errors = new ArrayList<Throwable>(); adaptor.fireCustomLifecycle( new BeforeRules(target, new TestClass(method.getDeclaringClass()), base, method.getMethod(), LifecycleMethodExecutor.NO_OP)); adaptor.before(target, method.getMethod(), LifecycleMethodExecutor.NO_OP); try { TestResult result = adaptor.test(new TestMethodExecutor() { public void invoke(Object... parameters) throws Throwable { try { base.evaluate(); } catch (Throwable e) { errors.add(e); } } public Method getMethod() { return method.getMethod(); } public Object getInstance() { return target; } }); if (result.getStatus() != Status.PASSED) { throw new RuntimeException("problem: " + result); } } finally { adaptor.after(target, method.getMethod(), LifecycleMethodExecutor.NO_OP); try { adaptor.fireCustomLifecycle( new AfterRules(target, method.getMethod(), LifecycleMethodExecutor.NO_OP)); } catch (Throwable e) { errors.add(e); } } org.junit.runners.model.MultipleFailureException.assertEmpty(errors); } }; }

Target:
public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { return new Statement() { @Override public void evaluate() throws Throwable { final List<Throwable> errors = new ArrayList<Throwable>(); adaptor.fireCustomLifecycle( new BeforeRules(target, new TestClass(method.getDeclaringClass()), base, method.getMethod(), LifecycleMethodExecutor.NO_OP)); adaptor.before(target, method.getMethod(), LifecycleMethodExecutor.NO_OP); try { adaptor.test(new TestMethodExecutor() { public void invoke(Object... parameters) throws Throwable { try { base.evaluate(); } catch (Throwable e) { errors.add(e); } } public Method getMethod() { return method.getMethod(); } public Object getInstance() { return target; } }); } finally { adaptor.after(target, method.getMethod(), LifecycleMethodExecutor.NO_OP); try { adaptor.fireCustomLifecycle( new AfterRules(target, method.getMethod(), LifecycleMethodExecutor.NO_OP)); } catch (Throwable e) { errors.add(e); } } org.junit.runners.model.MultipleFailureException.assertEmpty(errors); } }; }
Source:
public CategorizedTimeGroup calc(Config cur, Option<Config> prev) { final ItemKey FPU_KEY = new ItemKey("instrument:fpu"); final double FPU_OVERHEAD = 60.0; final ItemKey FILTER_KEY = new ItemKey("instrument:filter"); final double FILTER_OVERHEAD = 20.0; final ItemKey DISPERSER_KEY = new ItemKey("instrument:disperser"); final double DISPERSER_OVERHEAD = 90.0; final Collection<CategorizedTime> times = new ArrayList<>(); double exposureTime = ExposureCalculator.instance.exposureTimeSec(cur); if (_useNS && isNodAndShuffleableObsType(cur)) { int nOverhead = (_useElectronicOffsetting ? 11 : 25); int numSteps = getPosList().size(); exposureTime = (exposureTime * numSteps * _numNSCycles) + (_numNSCycles * nOverhead); } times.add(CategorizedTime.fromSeconds(Category.EXPOSURE, exposureTime)); if (PlannedTime.isUpdated(cur, prev, FPU_KEY)) { times.add(CategorizedTime.fromSeconds(Category.CONFIG_CHANGE, FPU_OVERHEAD, "FPU")); } if (PlannedTime.isUpdated(cur, prev, FILTER_KEY)) { times.add(CategorizedTime.fromSeconds(Category.CONFIG_CHANGE, FILTER_OVERHEAD, "Filter")); } if (PlannedTime.isUpdated(cur, prev, DISPERSER_KEY)) { times.add(CategorizedTime.fromSeconds(Category.CONFIG_CHANGE, DISPERSER_OVERHEAD, "Disperser")); } double readoutTime = GmosReadoutTime.getReadoutOverhead(cur, getCustomROIs()); times.add(CategorizedTime.fromSeconds(Category.READOUT, readoutTime)); times.add(DHS_WRITE); return CommonStepCalculator.instance.calc(cur, prev).addAll(times); }

Target:
public CategorizedTimeGroup calc(Config cur, Option<Config> prev) { final Collection<CategorizedTime> times = new ArrayList<>(); double exposureTime = ExposureCalculator.instance.exposureTimeSec(cur); if (_useNS && isNodAndShuffleableObsType(cur)) { int nOverhead = (_useElectronicOffsetting ? 11 : 25); int numSteps = getPosList().size(); exposureTime = (exposureTime * numSteps * _numNSCycles) + (_numNSCycles * nOverhead); } times.add(CategorizedTime.fromSeconds(Category.EXPOSURE, exposureTime)); if (PlannedTime.isUpdated(cur, prev, GmosCommonType.FPUnit.KEY)) { times.add(CategorizedTime.fromSeconds( Category.CONFIG_CHANGE, GmosCommonType.FPUnit.CHANGE_OVERHEAD, "FPU") ); } if (PlannedTime.isUpdated(cur, prev, GmosCommonType.Filter.KEY)) { times.add(CategorizedTime.fromSeconds( Category.CONFIG_CHANGE, GmosCommonType.Filter.CHANGE_OVERHEAD, "Filter") ); } if (PlannedTime.isUpdated(cur, prev, GmosCommonType.Disperser.KEY)) { times.add(CategorizedTime.fromSeconds( Category.CONFIG_CHANGE, GmosCommonType.Disperser.CHANGE_OVERHEAD, "Disperser") ); } double readoutTime = GmosReadoutTime.getReadoutOverhead(cur, getCustomROIs()); times.add(CategorizedTime.fromSeconds(Category.READOUT, readoutTime)); times.add(DHS_WRITE); return CommonStepCalculator.instance.calc(cur, prev).addAll(times); }
Source:
public static byte[] createThumbnailFromUri(Context context, Uri imageUri, int maxWidth, String fileExtension, int orientation) { if (context == null || imageUri == null || maxWidth <= 0) return null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { boolean res = resizeImageAndWriteToStream(context, imageUri, fileExtension, maxWidth, orientation, 85, stream); if (!res) { AppLog.w(AppLog.T.MEDIA, "Failed to compress the resized image. Use the full picture instead."); return null; } } catch (IOException e) { AppLog.e(AppLog.T.MEDIA, "Failed to create resized image. Use the full picture instead."); return null; } catch (OutOfMemoryError e) { AppLog.e(AppLog.T.MEDIA, "Can't resize the picture due to low memory. Use the full picture instead."); return null; } return stream.toByteArray(); }

Target:
public static byte[] createThumbnailFromUri(Context context, Uri imageUri, int maxWidth, String fileExtension, int orientation) { if (context == null || imageUri == null || maxWidth <= 0) return null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); try { boolean res = resizeImageAndWriteToStream(context, imageUri, fileExtension, maxWidth, orientation, 75, stream); if (!res) { AppLog.w(AppLog.T.MEDIA, "Failed to compress the resized image. Use the full picture instead."); return null; } } catch (IOException e) { AppLog.e(AppLog.T.MEDIA, "Failed to create resized image. Use the full picture instead."); return null; } catch (OutOfMemoryError e) { AppLog.e(AppLog.T.MEDIA, "Can't resize the picture due to low memory. Use the full picture instead."); return null; } return stream.toByteArray(); }
Source:
private void outputIOPerformanceInfo( HashMap<String,Object> hashMapInstance, IOPerformanceCounter ioPerformance) { HashMap<String,Object> IOPerformanceInfoHash = new HashMap<>(); IOPerformanceInfoHash.put("bitrate", ioPerformance.getMessagesInBytesRate() * 8 / 1000); hashMapInstance.put("IOPerformance", IOPerformanceInfoHash); }

Target:
private void outputIOPerformanceInfo( HashMap<String,Object> hashMapInstance, IOPerformanceCounter ioPerformance) { HashMap<String,Object> IOPerformanceInfoHash = new HashMap<String,Object>(); IOPerformanceInfoHash.put("bitrate", ioPerformance.getMessagesInBytesRate() * 8 / 1000); hashMapInstance.put("IOPerformance", IOPerformanceInfoHash); }
Source:
public boolean isAnyExceptionExpected() { return matcherBuilder.expectsThrowable(); }

Target:
public final boolean isAnyExceptionExpected() { return matcherBuilder.expectsThrowable(); }
Source:
public int getTotalResults() { return 0; }

Target:
public int getTotalResults() { return getMetaDataHandler().getAsInt(ConnectionsFeedXpath.TotalResults); }
Source:
public BigtableOptions( InetAddress clusterAdminHost, InetAddress adminHost, InetAddress host, int port, Credentials credential, String projectId, String zone, String cluster, boolean retriesEnabled, String callTimingReportPath, String callStatusReportPath, ScheduledExecutorService rpcRetryExecutorService, EventLoopGroup customEventLoopGroup) { Preconditions.checkArgument( !Strings.isNullOrEmpty(projectId), "ProjectId must not be empty or null."); Preconditions.checkArgument( !Strings.isNullOrEmpty(zone), "Zone must not be empty or null."); Preconditions.checkArgument( !Strings.isNullOrEmpty(cluster), "Cluster must not be empty or null."); this.adminHost = Preconditions.checkNotNull(adminHost); this.clusterAdminHost = clusterAdminHost; this.host = Preconditions.checkNotNull(host); this.port = port; this.credential = credential; this.projectId = projectId; this.retriesEnabled = retriesEnabled; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.zone = zone; this.cluster = cluster; this.rpcRetryExecutorService = rpcRetryExecutorService; this.customEventLoopGroup = customEventLoopGroup; LOG.info("Connection Configuration: project: %s, cluster: %s, host:port %s:%s, " + "admin host:port %s:%s, using transport %s.", getProjectId(), cluster, host, port, adminHost, 443, TransportOptions.AnviltopTransports.HTTP2_NETTY_TLS); if (clusterAdminHost != null) { LOG.info("Cluster API host: %s" , clusterAdminHost); } }

Target:
private BigtableOptions( InetAddress clusterAdminHost, InetAddress adminHost, InetAddress host, int port, Credentials credential, String projectId, String zone, String cluster, boolean retriesEnabled, String callTimingReportPath, String callStatusReportPath, ScheduledExecutorService rpcRetryExecutorService, EventLoopGroup customEventLoopGroup) { Preconditions.checkArgument( !Strings.isNullOrEmpty(projectId), "ProjectId must not be empty or null."); Preconditions.checkArgument( !Strings.isNullOrEmpty(zone), "Zone must not be empty or null."); Preconditions.checkArgument( !Strings.isNullOrEmpty(cluster), "Cluster must not be empty or null."); this.adminHost = Preconditions.checkNotNull(adminHost); this.clusterAdminHost = clusterAdminHost; this.host = Preconditions.checkNotNull(host); this.port = port; this.credential = credential; this.projectId = projectId; this.retriesEnabled = retriesEnabled; this.callTimingReportPath = callTimingReportPath; this.callStatusReportPath = callStatusReportPath; this.zone = zone; this.cluster = cluster; this.rpcRetryExecutorService = rpcRetryExecutorService; this.customEventLoopGroup = customEventLoopGroup; LOG.debug("Connection Configuration: project: %s, cluster: %s, host:port %s:%s, " + "admin host:port %s:%s, using transport %s.", getProjectId(), cluster, host, port, adminHost, port, TransportOptions.AnviltopTransports.HTTP2_NETTY_TLS); if (clusterAdminHost != null) { LOG.debug("Cluster API host: %s" , clusterAdminHost); } }
Source:
private void addLabelSpan(String itemText) { Span labelSpan = new Span(); labelSpan.addStyleName(Styles.LABEL); labelSpan.addStyleName("label-info"); labelSpan.setText(itemText); add(labelSpan); }

Target:
private void addLabelSpan(String itemText) { Span labelSpan = new Span(); labelSpan.addStyleName(Styles.LABEL); labelSpan.addStyleName(PatternflyConstants.PF_LABEL_INFO); labelSpan.setText(itemText); add(labelSpan); }
Source:
public String getTableOrSubselect(Class<?> cls) { Subselect subselectAnnotation = getAnnotation(cls, Subselect.class); if (subselectAnnotation == null) { javax.persistence.Table tableAnnotation = getAnnotation(cls, javax.persistence.Table.class); return (tableAnnotation == null) ? getJsonAliasFor(cls) : tableAnnotation.name(); } else { return "(" + subselectAnnotation.value() + ")"; } }

Target:
public String getTableOrSubselect(Class<?> cls) { if (isSubselect(cls)) { return getAnnotation(cls, Subselect.class).value(); } else { javax.persistence.Table tableAnnotation = getAnnotation(cls, javax.persistence.Table.class); return (tableAnnotation == null) ? getJsonAliasFor(cls) : tableAnnotation.name(); } }
Source:
default <U extends T> CompletableFuture<T> toCompletableFuture() { CompletableFuture<T> future = new CompletableFuture<>(); onSuccess(future::complete); onFailure(future::completeExceptionally); return future; }

Target:
default <U extends T> CompletableFuture<T> toCompletableFuture() { final CompletableFuture<T> future = new CompletableFuture<>(); onSuccess(future::complete); onFailure(future::completeExceptionally); return future; }
Source:
public Node transform(Node node) { List<String> templates = getUriTemplates(((ResourceNode) node).getRelativeUri()); injectImplicitUriParameters(((ResourceNode) node).getValue(), templates); return node; }

Target:
public Node transform(Node node) { ResourceNode resourceNode = (ResourceNode) node; List<String> templates = getUriTemplates(resourceNode.getRelativeUri()); injectImplicitUriParameters(resourceNode.getValue(), templates); return node; }
Source:
private String getLooseConfigFileName(MavenProject project) { String name = project.getBuild().getFinalName() + "." + project.getPackaging(); if (stripVersion) { return stripVersionFromName(name, project.getVersion()) + ".xml"; } else { return name + ".xml"; } }

Target:
private String getLooseConfigFileName(MavenProject project) { String name = project.getBuild().getFinalName() + "." + project.getPackaging(); if (project.getPackaging().equals("liberty-assembly")) { name = project.getBuild().getFinalName() + ".war"; } if (stripVersion) { return stripVersionFromName(name, project.getVersion()) + ".xml"; } else { return name + ".xml"; } }
Source:
public BackupClearPushStatusCommand() { super(0); }

Target:
public BackupClearPushStatusCommand() { super(1); }
Source:
public Set<Type> getImportTypes() { return Collections.emptySet(); }

Target:
public Set<Type> getImportTypes() { Set<Type> types = new HashSet<Type>(); for ( MapperReference mapperReference : mapperReferences ) { types.addAll( mapperReference.getImportTypes() ); } for ( Annotation annotation : annotations ) { types.addAll( annotation.getImportTypes() ); } return types; }
Source:
public String putBlob(final String containerName, final Blob blob) throws IOException { String blobKey = blob.getMetadata().getName(); Payload payload = blob.getPayload(); filesystemContainerNameValidator.validate(containerName); filesystemBlobKeyValidator.validate(blobKey); File outputFile = getFileForBlobKey(containerName, blobKey); try { Files.createParentDirs(outputFile); if (payload.getRawContent() instanceof File) Files.copy((File) payload.getRawContent(), outputFile); else if (payload.isRepeatable()) Files.copy(payload, outputFile); else { payload = Payloads.newPayload(ByteStreams.toByteArray(payload)); Files.copy(payload, outputFile); } Payloads.calculateMD5(payload); String eTag = base16().lowerCase().encode(payload.getContentMetadata().getContentMD5()); return eTag; } catch (IOException ex) { if (outputFile != null) { if (!outputFile.delete()) { logger.debug("Could not delete %s", outputFile); } } throw ex; } finally { payload.release(); } }

Target:
public String putBlob(final String containerName, final Blob blob) throws IOException { String blobKey = blob.getMetadata().getName(); Payload payload = blob.getPayload(); filesystemContainerNameValidator.validate(containerName); filesystemBlobKeyValidator.validate(blobKey); File outputFile = getFileForBlobKey(containerName, blobKey); try { Files.createParentDirs(outputFile); if (payload.getRawContent() instanceof File) Files.copy((File) payload.getRawContent(), outputFile); else { if (!payload.isRepeatable()) { payload = Payloads.newPayload(ByteStreams.toByteArray(payload)); } Files.copy(payload, outputFile); } Payloads.calculateMD5(payload); String eTag = base16().lowerCase().encode(payload.getContentMetadata().getContentMD5()); return eTag; } catch (IOException ex) { if (outputFile != null) { if (!outputFile.delete()) { logger.debug("Could not delete %s", outputFile); } } throw ex; } finally { payload.release(); } }
Source:
private String asLocalRepo(String repoLocation) { StringBuffer b = new StringBuffer(repoLocation.length()); b.append(Utils.getPropertyFormat(PROP_FETCH_CACHE_LOCATION)).append('/'); for (int i = 0; i < repoLocation.length(); i++) { char c = repoLocation.charAt(i); if (Character.isLetterOrDigit(c)) { b.append(c); } else { b.append('_'); } } if (b.charAt(b.length() - 1) == '/') return b.substring(0, b.length() - 1); return b.toString(); }

Target:
private String asLocalRepo(String repoLocation) { final StringBuffer b = new StringBuffer(repoLocation.length()); b.append(Utils.getPropertyFormat(PROP_FETCH_CACHE_LOCATION)) .append('/'); for (int i = 0; i < repoLocation.length(); i++) { final char c = repoLocation.charAt(i); if (Character.isLetterOrDigit(c)) { b.append(c); } else { b.append('_'); } } if (b.charAt(b.length() - 1) == '/') return b.substring(0, b.length() - 1); return b.toString(); }
Source:
public void testTmpfs() throws Exception { requireDockerApiVersionAtLeast("1.22", "PidsLimit"); sut.pull(BUSYBOX_LATEST); final ImmutableMap<String, String> tmpfs = ImmutableMap.of("/tmp", "rw,noexec,nosuid,size=50m"); final ContainerConfig config = ContainerConfig.builder() .image(BUSYBOX_LATEST) .hostConfig(HostConfig.builder() .tmpfs(tmpfs) .build()) .build(); final ContainerCreation container = sut.createContainer(config, randomName()); final ContainerInfo info = sut.inspectContainer(container.id()); assertThat(info.hostConfig().tmpfs(), is(tmpfs)); }

Target:
public void testTmpfs() throws Exception { requireDockerApiVersionAtLeast("1.22", "TmpFs"); sut.pull(BUSYBOX_LATEST); final ImmutableMap<String, String> tmpfs = ImmutableMap.of("/tmp", "rw,noexec,nosuid,size=50m"); final ContainerConfig config = ContainerConfig.builder() .image(BUSYBOX_LATEST) .hostConfig(HostConfig.builder() .tmpfs(tmpfs) .build()) .build(); final ContainerCreation container = sut.createContainer(config, randomName()); final ContainerInfo info = sut.inspectContainer(container.id()); assertThat(info.hostConfig().tmpfs(), is(tmpfs)); }
Source:
Itr() { Deque<T> inputBuffer; Deque<T> outputBuffer; int innerQueueSize; Iterator<Deque<T>> queueIterator; fInputLock.lock(); try { inputBuffer = fInputBuffer; innerQueueSize = fInnerQueue.size(); queueIterator = fInnerQueue.descendingIterator(); } finally { fInputLock.unlock(); } fOutputLock.lock(); try { outputBuffer = fOutputBuffer; } finally { fOutputLock.unlock(); } Deque<Deque<T>> queues = new ArrayDeque<>(innerQueueSize + 2); queues.add(inputBuffer); boolean found = false; while (queueIterator.hasNext()) { Deque<T> queue = queueIterator.next(); queues.add(queue); if (queue == outputBuffer) { found = true; } } if (!found) { if (queues.size() <= 1 || !queues.getLast().isEmpty()) { queues.add(outputBuffer); } } fQueueIterator = checkNotNull(queues.iterator()); }

Target:
Itr() { Deque<T> inputBuffer; @Nullable Deque<T> outputBuffer = null; int innerQueueSize; Iterator<Deque<T>> queueIterator; fInputLock.lock(); try { inputBuffer = fInputBuffer; innerQueueSize = fInnerQueue.size(); queueIterator = fInnerQueue.descendingIterator(); } finally { fInputLock.unlock(); } try { if (fOutputLock.tryLock(1, TimeUnit.SECONDS)) { outputBuffer = fOutputBuffer; fOutputLock.unlock(); } } catch (InterruptedException e) { } Deque<Deque<T>> queues = new ArrayDeque<>(innerQueueSize + 2); queues.add(inputBuffer); boolean found = false; while (queueIterator.hasNext()) { Deque<T> queue = queueIterator.next(); queues.add(queue); if (queue == outputBuffer) { found = true; } } if (!found && outputBuffer != null) { if (queues.size() <= 1 || !queues.getLast().isEmpty()) { queues.add(outputBuffer); } } fQueueIterator = checkNotNull(queues.iterator()); }
Source:
public Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> parseString(CharSequence input, String startSymbol) { Parser parser = new Parser(input); Term parsed = parser.parse(grammar.get(startSymbol), 0); if (parsed.equals(Ambiguity.apply())) { Parser.ParseError errors = parser.getErrors(); throw new AssertionError("There are parsing errors: " + errors.toString()); } Set<ParseFailedException> warn = new AmbFilter().warningUnit(); Either<Set<ParseFailedException>, Term> rez = new TreeCleanerVisitor().apply(parsed); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectRewritePriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectKSeqPriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectCastPriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new PriorityVisitor(module.priorities(), module.leftAssoc(), module.rightAssoc()).apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> rez2 = new VariableTypeInferenceFilter(module.subsorts(), module.definedSorts()).apply(rez.right().get()); if (rez2._1().isLeft()) return rez2; warn = rez2._2(); Term rez3 = new PreferAvoidVisitor().apply(rez2._1().right().get()); rez2 = new AmbFilter().apply(rez.right().get()); warn = new AmbFilter().mergeWarnings(rez2._2(), warn); return new Tuple2<>(Right.apply(rez3), warn); }

Target:
public Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> parseString(CharSequence input, String startSymbol) { Parser parser = new Parser(input); Term parsed = parser.parse(grammar.get(startSymbol), 0); if (parsed.equals(Ambiguity.apply())) { Parser.ParseError errors = parser.getErrors(); throw new AssertionError("There are parsing errors: " + errors.toString()); } Set<ParseFailedException> warn = new AmbFilter().warningUnit(); Either<Set<ParseFailedException>, Term> rez = new TreeCleanerVisitor().apply(parsed); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectRewritePriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectKSeqPriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new CorrectCastPriorityVisitor().apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); rez = new PriorityVisitor(module.priorities(), module.leftAssoc(), module.rightAssoc()).apply(rez.right().get()); if (rez.isLeft()) return new Tuple2<>(rez, warn); Tuple2<Either<Set<ParseFailedException>, Term>, Set<ParseFailedException>> rez2 = new VariableTypeInferenceFilter(module.subsorts(), module.definedSorts()).apply(rez.right().get()); if (rez2._1().isLeft()) return rez2; warn = rez2._2(); Term rez3 = new PreferAvoidVisitor().apply(rez2._1().right().get()); rez2 = new AmbFilter().apply(rez.right().get()); warn = new AmbFilter().mergeWarnings(rez2._2(), warn); return new Tuple2<>(Right.apply(rez2._1().right().get()), warn); }
Source:
public int compareTo( Profile that ) { int compare = profileFile.compareTo( that.profileFile ); return compare == 0 ? Long.compare( profileCount, that.profileCount ) : compare; }

Target:
public int compareTo( Profile that ) { int compare = pagedFile.compareTo( that.pagedFile ); return compare == 0 ? Long.compare( profileSequenceId, that.profileSequenceId ) : compare; }
Source:
public void handleAction(ActionParameters params) throws ActionException { final int layerId = params.getRequiredParamInt(ActionConstants.PARAM_ID); final String srs = params.getRequiredParam(ActionConstants.PARAM_SRS); final int z = params.getRequiredParamInt(PARAM_Z); final int x = params.getRequiredParamInt(PARAM_X); final int y = params.getRequiredParamInt(PARAM_Y); final OskariLayer layer = findLayer(layerId); final WFSTileGrid grid = KNOWN_TILE_GRIDS.get(srs); validateTile(grid, z, x, y); validateScaleDenominator(layer, grid, z); final String cacheKey = getCacheKey(layerId, srs, z, x, y); final byte[] resp; try { resp = tileCache.get(cacheKey, __ -> createTile(layer, srs, grid, z, x, y)); } catch (ServiceRuntimeException e) { throw new ActionException(e.getMessage()); } params.getResponse().addHeader("Access-Control-Allow-Origin", "*"); params.getResponse().addHeader("Content-Encoding", "gzip"); ResponseHelper.writeResponse(params, 200, MVT_CONTENT_TYPE, resp); }

Target:
public void handleAction(ActionParameters params) throws ActionException { final int layerId = params.getRequiredParamInt(ActionConstants.PARAM_ID); final String srs = params.getRequiredParam(ActionConstants.PARAM_SRS); final int z = params.getRequiredParamInt(PARAM_Z); final int x = params.getRequiredParamInt(PARAM_X); final int y = params.getRequiredParamInt(PARAM_Y); final OskariLayer layer = findLayer(layerId, params.getUser()); final WFSTileGrid grid = KNOWN_TILE_GRIDS.get(srs); validateTile(grid, z, x, y); validateScaleDenominator(layer, grid, z); final String cacheKey = getCacheKey(layerId, srs, z, x, y); final byte[] resp; try { resp = tileCache.get(cacheKey, __ -> createTile(layer, srs, grid, z, x, y)); } catch (ServiceRuntimeException e) { throw new ActionException(e.getMessage()); } params.getResponse().addHeader("Access-Control-Allow-Origin", "*"); params.getResponse().addHeader("Content-Encoding", "gzip"); ResponseHelper.writeResponse(params, 200, MVT_CONTENT_TYPE, resp); }
Source:
private void handleSimpleBlob(BlobData blobData, byte[] userMetadata, ByteBuffer encryptionKey) { totalSize = blobData.getSize(); chunkSize = totalSize; boolean rangeResolutionFailure = false; if (encryptionKey == null) { rangeResolutionFailure = resolveRange(totalSize); } else { } if (!rangeResolutionFailure) { chunkIdIterator = null; dataChunks = null; chunkIndex = 0; numChunksTotal = 1; if (encryptionKey == null) { chunkIndexToBuffer.put(0, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved = 1; } else { logger.trace("Submitting decrypt job for simple blob {}", blobId); long startTimeMs = System.currentTimeMillis(); decryptCallbackResultInfo = new DecryptCallBackResultInfo(); progressTracker.initializeDecryptionTracker(); cryptoJobHandler.submitJob(new DecryptJob(blobId, encryptionKey, blobData.getStream().getByteBuffer(), userMetadata != null ? ByteBuffer.wrap(userMetadata) : null, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { routerMetrics.contentDecryptTimeMs.update(System.currentTimeMillis() - startTimeMs); logger.trace("Handling decrypt job call back for simple blob to set decrypt callback results", blobId); decryptCallbackResultInfo.setResultAndException(result, exception); routerCallback.onPollReady(); })); } } }

Target:
private void handleSimpleBlob(BlobData blobData, byte[] userMetadata, ByteBuffer encryptionKey) { totalSize = blobData.getSize(); chunkSize = totalSize; boolean rangeResolutionFailure = false; if (encryptionKey == null) { rangeResolutionFailure = resolveRange(totalSize); } else { } if (!rangeResolutionFailure) { chunkIdIterator = null; dataChunks = null; chunkIndex = 0; numChunksTotal = 1; if (encryptionKey == null) { chunkIndexToBuffer.put(0, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved = 1; } else { logger.trace("Submitting decrypt job for simple blob {}", blobId); long startTimeMs = System.currentTimeMillis(); decryptCallbackResultInfo = new DecryptCallBackResultInfo(); progressTracker.initializeDecryptionTracker(); cryptoJobHandler.submitJob(new DecryptJob(blobId, encryptionKey, blobData.getStream().getByteBuffer(), userMetadata != null ? ByteBuffer.wrap(userMetadata) : null, cryptoService, kms, (DecryptJob.DecryptJobResult result, Exception exception) -> { routerMetrics.decryptTimeMs.update(System.currentTimeMillis() - startTimeMs); logger.trace("Handling decrypt job call back for simple blob to set decrypt callback results", blobId); decryptCallbackResultInfo.setResultAndException(result, exception); routerCallback.onPollReady(); })); } } }
Source:
public void done() throws CommitFailedException { if (isTimeToUpdate()) { try { long startTime = System.currentTimeMillis(); int docCount = Integer.parseInt(luceneIndexMBean.getDocCount(indexPath)); HistogramStats docCountHistogram = statisticsProvider.getHistogram(indexPath + NO_DOCS, StatsOptions.METRICS_ONLY); docCountHistogram.update(docCount); log.trace("{} stats updated, docCount {}, timeToUpdate {}", indexPath, docCount, System.currentTimeMillis() - startTime); long indexSize = Long.parseLong(luceneIndexMBean.getSize(indexPath)); HistogramStats indexSizeHistogram = statisticsProvider.getHistogram(indexPath + INDEX_SIZE, StatsOptions.METRICS_ONLY); indexSizeHistogram.update(indexSize); long endTime = System.currentTimeMillis(); asyncIndexesSizeStatsUpdate.setLastStatsUpdateTime(indexPath, endTime); log.debug("{} stats updated; docCount {}, size {}, timeToUpdate {}", indexPath, docCount, indexSize, endTime - startTime); } catch (IOException e) { log.debug("could not update no_docs/index_size stats for index at {}", indexPath, e); } } }

Target:
public void done() { if (shouldUpdateStats()) { try { long startTime = System.currentTimeMillis(); int docCount = Integer.parseInt(luceneIndexMBean.getDocCount(indexPath)); HistogramStats docCountHistogram = statisticsProvider.getHistogram(indexPath + NO_DOCS, StatsOptions.METRICS_ONLY); docCountHistogram.update(docCount); log.trace("{} stats updated, docCount {}, timeToUpdate {}", indexPath, docCount, System.currentTimeMillis() - startTime); long indexSize = Long.parseLong(luceneIndexMBean.getSize(indexPath)); HistogramStats indexSizeHistogram = statisticsProvider.getHistogram(indexPath + INDEX_SIZE, StatsOptions.METRICS_ONLY); indexSizeHistogram.update(indexSize); long endTime = System.currentTimeMillis(); asyncIndexesSizeStatsUpdate.setLastStatsUpdateTime(indexPath, endTime); log.debug("{} stats updated; docCount {}, size {}, timeToUpdate {}", indexPath, docCount, indexSize, endTime - startTime); } catch (IOException e) { log.warn("could not update no_docs/index_size stats for index at {}", indexPath, e); } } }
Source:
public void readParameters(final CgmInputReader inputReader, final int parameterListLength) throws IOException { int data = inputReader.readEnumValue(); switch (data) { case LINE_WIDTH_MODE_ABSOLUTE: mode = CommonSpecificationModeElement.Mode.ABSOLUTE; break; case LINE_WIDTH_MODE_SCALED: mode = CommonSpecificationModeElement.Mode.SCALED; break; case LINE_WIDTH_MODE_FRACTIONAL: mode = CommonSpecificationModeElement.Mode.FRACTIONAL; break; case LINE_WIDTH_MODE_MM: mode = CommonSpecificationModeElement.Mode.MILLIMETRES; break; default: LOG.info(String.format("Unknown %s value: %d", getFriendlyName(), data)); break; } }

Target:
public void readParameters(final CgmInputReader inputReader, final int parameterListLength) throws IOException { int data = inputReader.readEnumValue(); switch (data) { case LINE_WIDTH_MODE_ABSOLUTE: mode = Mode.ABSOLUTE; break; case LINE_WIDTH_MODE_SCALED: mode = Mode.SCALED; break; case LINE_WIDTH_MODE_FRACTIONAL: mode = Mode.FRACTIONAL; break; case LINE_WIDTH_MODE_MM: mode = Mode.MILLIMETRES; break; default: LOG.info(String.format("Unknown %s value: %d", getFriendlyName(), data)); break; } }
Source:
private double getIntegrandGivenNoArtifact(final double f, final int nPlus, final int nMinus, final int xPlus, final int xMinus){ final BinomialDistribution binomFwd = new BinomialDistribution(nPlus, f); final BinomialDistribution binomRev = new BinomialDistribution(nMinus, f); return binomFwd.probability(xPlus)*binomRev.probability(xMinus); }

Target:
private double getIntegrandGivenNoArtifact(final double f, final int nPlus, final int nMinus, final int xPlus, final int xMinus){ return MathUtils.binomialProbability(nPlus, xPlus, f) * MathUtils.binomialProbability(nMinus, xMinus, f); }
Source:
public int run() throws IOException { int b; if (in != null) { while ((b = in.read()) != -1) out.write(b); in.close(); } out.close(); return -1; }

Target:
public int run() throws IOException { int b; if (in != null) { while ((b = in.read()) != -1) { out.write(b); } in.close(); } out.close(); return -1; }
Source:
private BiFunction<CircuitBreakerEvent, CircuitBreaker, String> getCircuitBreakerEventStringFunction() { ObjectMapper jsonMapper = new ObjectMapper(); return (cbEvent, cb) -> { try { return jsonMapper.writeValueAsString( new CircuitBreakerHystrixStreamEventsDTO(cbEvent, cb.getState(), cb.getMetrics(), cb.getCircuitBreakerConfig() ) ); } catch (JsonProcessingException e) { } return ""; }; }

Target:
private BiFunction<CircuitBreakerEvent, CircuitBreaker, String> getCircuitBreakerEventStringFunction() { return (cbEvent, cb) -> { try { return jsonMapper.writeValueAsString( new CircuitBreakerHystrixStreamEventsDTO(cbEvent, cb.getState(), cb.getMetrics(), cb.getCircuitBreakerConfig() ) ); } catch (JsonProcessingException e) { } return ""; }; }
Source:
private synchronized void closeAllSessionsExcept(SessionLocal except) { SessionLocal[] all = userSessions.toArray(EMPTY_SESSION_ARRAY); for (SessionLocal s : all) { if (s != except) { s.suspend(); } } int timeout = 2 * getLockTimeout(); long start = System.currentTimeMillis(); long sleep = Math.max(timeout / 20, 50); boolean done = false; while (!done) { try { wait(sleep); } catch (InterruptedException e1) { } if (System.currentTimeMillis() - start > timeout) { for (SessionLocal s : all) { if (s != except && !s.isClosed()) { try { s.close(); } catch (Throwable e) { trace.error(e, "disconnecting session #{0}", s.getId()); } } } break; } done = true; for (SessionLocal s : all) { if (s != except && !s.isClosed()) { done = false; break; } } } }

Target:
private synchronized void closeAllSessionsExcept(SessionLocal except) { SessionLocal[] all = userSessions.toArray(EMPTY_SESSION_ARRAY); for (SessionLocal s : all) { if (s != except) { s.suspend(); } } int timeout = 2 * getLockTimeout(); long start = System.currentTimeMillis(); long sleep = Math.max(timeout / 20, 1); boolean done = false; while (!done) { try { wait(sleep); } catch (InterruptedException e1) { } if (System.currentTimeMillis() - start > timeout) { for (SessionLocal s : all) { if (s != except && !s.isClosed()) { try { s.close(); } catch (Throwable e) { trace.error(e, "disconnecting session #{0}", s.getId()); } } } break; } done = true; for (SessionLocal s : all) { if (s != except && !s.isClosed()) { done = false; break; } } } }
Source:
public void repartitionTopology(final String eventTypeName, final int newPartitionsCount) throws NakadiRuntimeException { final Topology currentTopology = getTopology(); final List<Partition> partitionsList = Lists.newArrayList(currentTopology.getPartitions()); final List<Partition> newPartitionsList = new ArrayList<>(); for (final Partition partition : partitionsList) { if (!partition.getEventType().equals(eventTypeName)) { newPartitionsList.add( partition.toState(Partition.State.UNASSIGNED, null, null)); } } for (int index=0; index < newPartitionsCount; index++) { final String partition = String.valueOf(index); newPartitionsList.add(new Partition( eventTypeName, partition, null, null, Partition.State.UNASSIGNED )); try { getCurator().create().creatingParentsIfNeeded().forPath( getOffsetPath(new EventTypePartition(eventTypeName, partition))); } catch (final Exception e) { throw new NakadiRuntimeException(e); } } final Topology partitionedTopology = new Topology( newPartitionsList.toArray(new Partition[0]), currentTopology.getSessionsHash(), Optional.ofNullable(currentTopology.getVersion()).map(v -> v+1).orElse(0) ); try { getLog().info("Updating topology due to repartitioning event type: to {}", eventTypeName, partitionedTopology); getCurator().setData().forPath(getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(partitionedTopology)); } catch (final Exception exception) { throw new NakadiRuntimeException(exception); } }

Target:
public void repartitionTopology(final String eventTypeName, final int newPartitionsCount) throws NakadiRuntimeException { final Topology currentTopology = getTopology(); final List<Partition> partitionsList = Lists.newArrayList(currentTopology.getPartitions()); final int oldPartitionsCount = (int) partitionsList.stream(). filter(partition -> partition.getEventType().equals(eventTypeName)).count(); for (int index=oldPartitionsCount; index < newPartitionsCount; index++) { final String partition = String.valueOf(index); partitionsList.add(new Partition( eventTypeName, partition, null, null, Partition.State.UNASSIGNED )); try { getCurator().create().creatingParentsIfNeeded().forPath( getOffsetPath(new EventTypePartition(eventTypeName, partition))); } catch (final Exception e) { throw new NakadiRuntimeException(e); } } final Topology partitionedTopology = new Topology( partitionsList.toArray(new Partition[0]), currentTopology.getSessionsHash(), Optional.ofNullable(currentTopology.getVersion()).map(v -> v+1).orElse(0) ); try { getLog().info("Updating topology due to repartitioning event type: to {}", eventTypeName, partitionedTopology); getCurator().setData().forPath(getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(partitionedTopology)); } catch (final Exception exception) { throw new NakadiRuntimeException(exception); } }
Source:
public void addContent(HttpContent httpContent) throws ClosedChannelException { if (!RestMethod.POST.equals(getRestMethod()) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { NettyContent nettyContent = new NettyContent(httpContent); try { contentLock.lock(); if (!isOpen()) { throw new ClosedChannelException(); } requestContents.add(nettyContent); nettyContent.retain(); } finally { contentLock.unlock(); } } }

Target:
public void addContent(HttpContent httpContent) throws ClosedChannelException { if (!getRestMethod().equals(RestMethod.POST) && (!(httpContent instanceof LastHttpContent) || httpContent.content().readableBytes() > 0)) { throw new IllegalStateException("There is no content expected for " + getRestMethod()); } else { NettyContent nettyContent = new NettyContent(httpContent); contentLock.lock(); try { if (!isOpen()) { throw new ClosedChannelException(); } requestContents.add(nettyContent); nettyContent.retain(); } finally { contentLock.unlock(); } } }
Source:
protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); Drawable drawable = getTopLevelDrawable(); if (drawable != null) { drawable.setBounds(0, 0, w, h); } }

Target:
protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); Drawable drawable = getTopLevelDrawable(); if (drawable != null) { drawable.setBounds(getPaddingLeft(), getPaddingTop(), w - getPaddingLeft() - getPaddingRight(), h - getPaddingTop() - getPaddingBottom()); } }
Source:
private boolean isDeletionInProgress(EnvironmentStatus environmentStatus) { Collection<EnvironmentStatus> deleteInProgressStatuses = List.of(DELETE_INITIATED, NETWORK_DELETE_IN_PROGRESS, RDBMS_DELETE_IN_PROGRESS, FREEIPA_DELETE_IN_PROGRESS, CLUSTER_DEFINITION_CLEANUP_PROGRESS, UMS_RESOURCE_DELETE_IN_PROGRESS, IDBROKER_MAPPINGS_DELETE_IN_PROGRESS, S3GUARD_TABLE_DELETE_IN_PROGRESS, DATAHUB_CLUSTERS_DELETE_IN_PROGRESS, DATALAKE_CLUSTERS_DELETE_IN_PROGRESS, PUBLICKEY_DELETE_IN_PROGRESS); return deleteInProgressStatuses.contains(environmentStatus); }

Target:
private boolean isDeletionInProgress(EnvironmentStatus environmentStatus) { Set<EnvironmentStatus> deleteInProgressStatuses = Set.of(DELETE_INITIATED, NETWORK_DELETE_IN_PROGRESS, RDBMS_DELETE_IN_PROGRESS, FREEIPA_DELETE_IN_PROGRESS, CLUSTER_DEFINITION_CLEANUP_PROGRESS, UMS_RESOURCE_DELETE_IN_PROGRESS, IDBROKER_MAPPINGS_DELETE_IN_PROGRESS, S3GUARD_TABLE_DELETE_IN_PROGRESS, DATAHUB_CLUSTERS_DELETE_IN_PROGRESS, DATALAKE_CLUSTERS_DELETE_IN_PROGRESS, PUBLICKEY_DELETE_IN_PROGRESS); return deleteInProgressStatuses.contains(environmentStatus); }