auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateSnapshotConfigWithoutImage(Guid imageGroupToRemove) { List<DiskImage> snapshotDisks = getDiskImageDao().getAllSnapshotsForImageGroup(imageGroupToRemove); for (DiskImage snapshotDisk : snapshotDisks) { NGuid vmSnapshotId = snapshotDisk.getvm_snapshot_id(); if (vmSnapshotId != null && !Guid.Empty.equals(vmSnapshotId.getValue())) { lockSnapshotWithWait(vmSnapshotId.getValue()); final Snapshot updated = prepareSnapshotConfigWithoutImageSingleImage(vmSnapshotId.getValue(), snapshotDisk.getImageId()); if (updated != null) { TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getSnapshotDao().update(updated); return null; } }); } freeSnapshotLock(); } } }

Target:
private void updateSnapshotConfigWithoutImage(Guid imageGroupToRemove) { List<DiskImage> snapshotDisks = getDiskImageDao().getAllSnapshotsForImageGroup(imageGroupToRemove); for (DiskImage snapshotDisk : snapshotDisks) { NGuid vmSnapshotId = snapshotDisk.getvm_snapshot_id(); if (vmSnapshotId != null && !Guid.Empty.equals(vmSnapshotId.getValue())) { try { lockSnapshotWithWait(vmSnapshotId.getValue()); final Snapshot updated = prepareSnapshotConfigWithoutImageSingleImage(vmSnapshotId.getValue(), snapshotDisk.getImageId()); if (updated != null) { TransactionSupport.executeInScope(TransactionScopeOption.RequiresNew, new TransactionMethod<Object>() { @Override public Object runInTransaction() { getSnapshotDao().update(updated); return null; } }); } } finally { freeSnapshotLock(); } } } }
Source:
public PlanWithProperties visitMarkDistinct(MarkDistinctNode node, PreferredProperties preferredProperties) { PreferredProperties preferredChildProperties = PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(node.getDistinctVariables()), grouped(node.getDistinctVariables())) .mergeWithParent(preferredProperties, !isExactPartitioningPreferred(session)); PlanWithProperties child = node.getSource().accept(this, preferredChildProperties); if (child.getProperties().isSingleNode() || !isStreamPartitionedOn(child.getProperties(), node.getDistinctVariables())) { boolean useStreamingExchangeWithMarkDistinct = SystemSessionProperties.isStreamMarkDistinctWithMaterializedExchangeEnabled(session); Scope exchangeScope = useStreamingExchangeWithMarkDistinct ? REMOTE_STREAMING : selectExchangeScopeForPartitionedRemoteExchange(child.getNode(), false); child = withDerivedProperties( partitionedExchange( idAllocator.getNextId(), exchangeScope, child.getNode(), createPartitioning(node.getDistinctVariables()), node.getHashVariable()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }

Target:
public PlanWithProperties visitMarkDistinct(MarkDistinctNode node, PreferredProperties preferredProperties) { PreferredProperties preferredChildProperties = PreferredProperties.partitionedWithLocal(ImmutableSet.copyOf(node.getDistinctVariables()), grouped(node.getDistinctVariables())) .mergeWithParent(preferredProperties, !isExactPartitioningPreferred(session)); PlanWithProperties child = node.getSource().accept(this, preferredChildProperties); if (child.getProperties().isSingleNode() || !isStreamPartitionedOn(child.getProperties(), node.getDistinctVariables())) { child = withDerivedProperties( partitionedExchange( idAllocator.getNextId(), isUseStreamingExchangeForMarkDistinctEnabled(session) ? REMOTE_STREAMING : selectExchangeScopeForPartitionedRemoteExchange(child.getNode(), false), child.getNode(), createPartitioning(node.getDistinctVariables()), node.getHashVariable()), child.getProperties()); } return rebaseAndDeriveProperties(node, child); }
Source:
public CloseableIterator<byte[]> keys() { final RocksIterator iterator = db.newIterator(optionCache); iterator.seekToFirst(); return new CloseableIterator<byte[]>() { @Override public boolean hasNext() { return iterator.isValid(); } @Override public byte[] next() { checkArgument(iterator.isValid()); byte[] key = iterator.key(); iterator.next(); return key; } @Override public void close() { iterator.close(); } }; }

Target:
public CloseableIterator<byte[]> keys() { final RocksIterator iterator = db.newIterator(optionCache); iterator.seekToFirst(); return new CloseableIterator<byte[]>() { @Override public boolean hasNext() { return iterator.isValid(); } @Override public byte[] next() { checkState(iterator.isValid()); byte[] key = iterator.key(); iterator.next(); return key; } @Override public void close() { iterator.close(); } }; }
Source:
public String toJsonWithLengthLimit(T instance, int lengthLimit) throws JsonLengthLimitExceededException { try (StringWriter stringWriter = new StringWriter(); LengthLimitedWriter lengthLimitedWriter = new LengthLimitedWriter(stringWriter, lengthLimit)) { mapper.writeValue(lengthLimitedWriter, instance); return stringWriter.getBuffer().toString(); } catch (LengthLimitedWriter.LengthLimitExceededException e) { throw new JsonLengthLimitExceededException(String.format("%s could not be converted to json string with length limit %d", instance.getClass().getName(), lengthLimit), e); } catch (IOException e) { throw new IllegalArgumentException(String.format("%s could not be converted to json", instance.getClass().getName()), e); } }

Target:
public Optional<String> toJsonWithLengthLimit(T instance, int lengthLimit) { try (StringWriter stringWriter = new StringWriter(); LengthLimitedWriter lengthLimitedWriter = new LengthLimitedWriter(stringWriter, lengthLimit)) { mapper.writeValue(lengthLimitedWriter, instance); return Optional.of(stringWriter.getBuffer().toString()); } catch (LengthLimitExceededException e) { return Optional.empty(); } catch (IOException e) { throw new IllegalArgumentException(String.format("%s could not be converted to json", instance.getClass().getName()), e); } }
Source:
public Map<TopicPartition, Errors> errors() { Map<TopicPartition, Errors> errorsMap = new HashMap<>(); for (AddPartitionsToTxnTopicResult topicResult : this.data.results()) { for (AddPartitionsToTxnPartitionResult partitionResult : topicResult.results()) { errorsMap.put(new TopicPartition( topicResult.name(), partitionResult.partitionIndex()), Errors.forCode(partitionResult.errorCode())); } } return errorsMap; }

Target:
public Map<TopicPartition, Errors> errors() { if (cachedErrorsMap != null) { return cachedErrorsMap; } cachedErrorsMap = new HashMap<>(); for (AddPartitionsToTxnTopicResult topicResult : this.data.results()) { for (AddPartitionsToTxnPartitionResult partitionResult : topicResult.results()) { cachedErrorsMap.put(new TopicPartition( topicResult.name(), partitionResult.partitionIndex()), Errors.forCode(partitionResult.errorCode())); } } return cachedErrorsMap; }
Source:
public boolean restoreTargetFields(SshMachineTarget target) { if (target == null) { return false; } final RecipeDescriptor targetRecipe = target.getRecipe(); if (targetRecipe == null) { return false; } try { final JSONObject json = JSONParser.parseStrict(targetRecipe.getScript()).isObject(); String name = targetRecipe.getName(); target.setName(name); if (json.get("host") != null) { String host = json.get("host").isString().stringValue(); target.setHost(host); } if (json.get("port") != null) { String port = json.get("port").isString().stringValue(); target.setPort(port); } if (json.get("username") != null) { String username = json.get("username").isString().stringValue(); target.setUserName(username); } if (json.get("password") != null) { String password = json.get("password").isString().stringValue(); target.setPassword(password); } } catch (Exception e) { Log.error(this.getClass(), "Unable to parse recipe JSON. " + e.getMessage()); return false; } return true; }

Target:
public boolean restoreTargetFields(SshMachineTarget target) { if (target == null) { return false; } final RecipeDescriptor targetRecipe = target.getRecipe(); if (targetRecipe == null) { return false; } try { final JSONObject json = JSONParser.parseStrict(targetRecipe.getScript()).isObject(); String name = targetRecipe.getName(); target.setName(name); if (json.get("host") != null) { String host = json.get("host").isString().stringValue(); target.setHost(host); } if (json.get("port") != null) { String port = json.get("port").isString().stringValue(); target.setPort(port); } if (json.get("username") != null) { String username = json.get("username").isString().stringValue(); target.setUserName(username); } if (json.get("password") != null) { String password = json.get("password").isString().stringValue(); target.setPassword(password); } target.setDirty(false); } catch (Exception e) { Log.error(this.getClass(), "Unable to parse recipe JSON. " + e.getMessage()); return false; } return true; }
Source:
public Map<String, List<Message>> validateProjectOntology(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); final OntologyDataManagerImpl ontology = new OntologyDataManagerImpl(this.getSessionProvider()); if (!this.isTermExists(TermId.ENTRY_NO.getId(), workbook.getFactors(), ontology)) { this.initializeIfNull(errors, Constants.MISSING_ENTRY); errors.get(Constants.MISSING_ENTRY).add(new Message("error.entry.doesnt.exist.wizard")); } if (!this.isTermExists(TermId.GID.getId(), workbook.getFactors(), ontology)) { this.initializeIfNull(errors, Constants.MISSING_GID); errors.get(Constants.MISSING_GID).add(new Message("error.gid.doesnt.exist.wizard")); } if ((workbook.getImportType() == null || workbook.getImportType() == DataSetType.PLOT_DATA.getId()) && (!this .isTermExists(TermId.PLOT_NO.getId(), workbook.getFactors(), ontology) && !this .isTermExists(TermId.PLOT_NNO.getId(), workbook.getFactors(), ontology) )) { this.initializeIfNull(errors, Constants.MISSING_PLOT); errors.get(Constants.MISSING_PLOT).add(new Message("error.plot.doesnt.exist.wizard")); } if (!workbook.isNursery() && !this.isTermExists(TermId.TRIAL_INSTANCE_FACTOR.getId(), workbook.getTrialVariables(), ontology)) { this.initializeIfNull(errors, Constants.MISSING_TRIAL); errors.get(Constants.MISSING_TRIAL).add(new Message(DataImportServiceImpl.ERROR_MISSING_TRIAL_CONDITION)); } this.checkForDuplicatePSMCombo(workbook, errors); return errors; }

Target:
public Map<String, List<Message>> validateProjectOntology(final Workbook workbook, final String programUUID) { final Map<String, List<Message>> errors = new HashMap<String, List<Message>>(); final Set<Integer> factorsTermIds = getTermIdsOfMeasurementVariables(workbook.getFactors()); final Set<Integer> trialVariablesTermIds = getTermIdsOfMeasurementVariables(workbook.getTrialVariables()); if (!factorsTermIds.contains(TermId.ENTRY_NO.getId())) { this.initializeIfNull(errors, Constants.MISSING_ENTRY); errors.get(Constants.MISSING_ENTRY).add(new Message("error.entry.doesnt.exist.wizard")); } if (!factorsTermIds.contains(TermId.GID.getId())) { this.initializeIfNull(errors, Constants.MISSING_GID); errors.get(Constants.MISSING_GID).add(new Message("error.gid.doesnt.exist.wizard")); } if ((workbook.getImportType() == null || workbook.getImportType() == DataSetType.PLOT_DATA.getId()) && ( !factorsTermIds.contains(TermId.PLOT_NO.getId()) && !factorsTermIds.contains(TermId.PLOT_NNO.getId()))) { this.initializeIfNull(errors, Constants.MISSING_PLOT); errors.get(Constants.MISSING_PLOT).add(new Message("error.plot.doesnt.exist.wizard")); } if (!workbook.isNursery() && !trialVariablesTermIds.contains(TermId.TRIAL_INSTANCE_FACTOR.getId())) { this.initializeIfNull(errors, Constants.MISSING_TRIAL); errors.get(Constants.MISSING_TRIAL).add(new Message(DataImportServiceImpl.ERROR_MISSING_TRIAL_CONDITION)); } this.checkForDuplicatePSMCombo(workbook, errors); return errors; }
Source:
public NodeDetails processOneToOne(String tenantId, Span item) throws RetryAttemptException { NodeDetails nd = new NodeDetails(); nd.setId(item.getId()); URL url = item.url(); if (url != null) { nd.setUri(url.getPath()); } if (item.clientSpan()) { nd.setId(SpanUniqueIdGenerator.toUnique(item)); nd.setType(NodeType.Producer); nd.setComponentType("Producer"); nd.getCorrelationIds().add(new CorrelationIdentifier(Scope.Interaction, item.getId())); } else if (item.serverSpan()) { nd.setType(NodeType.Consumer); nd.setComponentType("Consumer"); nd.getCorrelationIds().add(new CorrelationIdentifier(Scope.Interaction, item.getId())); } else { nd.setType(NodeType.Component); nd.setComponentType(item.componentType()); } nd.setElapsed(item.getDuration()); nd.setActual(item.getDuration()); List<Property> spanProperties = item.properties(); nd.setTimestamp(item.getTimestamp() / 1000); nd.getProperties().addAll(spanProperties); nd.setHostName(Span.ipv4Address(spanProperties)); if (log.isLoggable(Level.FINEST)) { log.finest("NodeDetailsDeriver ret=" + nd); } return nd; }

Target:
public NodeDetails processOneToOne(String tenantId, Span item) throws RetryAttemptException { NodeDetails nd = new NodeDetails(); nd.setId(item.getId()); URL url = item.url(); if (url != null) { nd.setUri(url.getPath()); } if (item.clientSpan()) { nd.setId(SpanUniqueIdGenerator.toUnique(item)); nd.setType(NodeType.Producer); nd.setComponentType("Producer"); nd.getCorrelationIds().add(new CorrelationIdentifier(Scope.Interaction, item.getId())); } else if (item.serverSpan()) { nd.setType(NodeType.Consumer); nd.setComponentType("Consumer"); nd.getCorrelationIds().add(new CorrelationIdentifier(Scope.Interaction, item.getId())); } else { nd.setType(NodeType.Component); nd.setComponentType(item.componentType()); } nd.setElapsed(item.getDuration()); nd.setActual(item.getDuration()); List<Property> spanProperties = item.properties(); nd.setTimestamp(item.getTimestamp() / 1000); nd.getProperties().addAll(spanProperties); nd.setHostAddress(Span.ipv4Address(spanProperties)); if (log.isLoggable(Level.FINEST)) { log.finest("NodeDetailsDeriver ret=" + nd); } return nd; }
Source:
public void elementTextShouldBe(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, ""); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); List<WebElement> elements = elementFind(locator, true, true); String actual = elements.get(0).getText(); String textToCompare = text; if (ignoreCase) { actual = actual.toLowerCase(); textToCompare = textToCompare.toLowerCase(); } if (!textToCompare.equals(actual)) { if (StringUtils.isBlank(message)) { message = String.format("The text of element '%s' should have been '%s', but it was '%s'.", locator, text, actual); } throw new SeleniumLibraryNonFatalException(message); } }

Target:
public void elementTextShouldBe(String locator, String text, String...params) { String message = robot.getParamsValue(params, 0, ""); Boolean ignoreCase = robot.getParamsValue(params, 1, Boolean.FALSE); List<WebElement> elements = elementFind(locator, true, true); String actual = elements.get(0).getText(); if (!textIs(actual, text, ignoreCase)) { if (StringUtils.isEmpty(message)) { message = String.format("The text of element '%s' should have been '%s', but it was '%s'.", locator, text, actual); } throw new SeleniumLibraryNonFatalException(message); } }
Source:
public static void main(String[] args) { Options options = prepareOptions(); try { CommandLine cli = new DefaultParser().parse(options, args); if (cli.hasOption("help")) { printHelp(options); System.exit(0); } if (!cli.hasOption("configDir")) { printHelp(options); System.err.println("Missing required option"); System.exit(1); } String configDir = cli.getOptionValue("configDir"); DynamicConfigValidator dynamicConfigValidator = new DynamicConfigValidator(configDir); dynamicConfigValidator.readAndValidateConfigs(); System.out.println("Configs Validation Passed!"); if (cli.hasOption("nocompile")) { System.out.println("Skipped compilation for both Model and DB configs"); System.exit(0); } if (cli.hasOption("nomodelcompile")) { System.out.println("Skipped compilation for Model configs"); } else { System.out.println("Compiling Model configs (Use '--nomodelcompile' to skip this step)."); dynamicConfigValidator.hydrateAndCompileModelConfigs(); System.out.println("Model Configs Compilation Passed!"); } if (cli.hasOption("nodbcompile")) { System.out.println("Skipped compilation for DB configs"); } else { System.out.println("Compiling DB configs (Use '--nodbcompile' to skip this step)."); dynamicConfigValidator.compileDBConfigs(); System.out.println("DB Configs Compilation Passed!"); } System.exit(0); } catch (Exception e) { String msg = isNullOrEmpty(e.getMessage()) ? "Process Failed!" : e.getMessage(); System.err.println(msg); System.exit(2); } }

Target:
public static void main(String[] args) { Options options = prepareOptions(); try { CommandLine cli = new DefaultParser().parse(options, args); if (cli.hasOption("help")) { printHelp(options); System.exit(0); } if (!cli.hasOption("configDir")) { printHelp(options); System.err.println("Missing required option"); System.exit(1); } String configDir = cli.getOptionValue("configDir"); DynamicConfigValidator dynamicConfigValidator = new DynamicConfigValidator(configDir); dynamicConfigValidator.readAndValidateConfigs(); System.out.println("Configs Validation Passed!"); if (cli.hasOption("nocompile")) { System.out.println("Skipped compilation for Model configs"); System.exit(0); } System.out.println("Compiling Model configs (Use '--nocompile' to skip this step)."); dynamicConfigValidator.hydrateAndCompileModelConfigs(new ElideDynamicInMemoryCompiler().ignoreWarnings() .useParentClassLoader(DynamicConfigValidator.class.getClassLoader())); System.out.println("Model Configs Compilation Passed!"); System.exit(0); } catch (Exception e) { String msg = isNullOrEmpty(e.getMessage()) ? "Process Failed!" : e.getMessage(); System.err.println(msg); System.exit(2); } }
Source:
public UnavailableImplementationException(final Class klass) { super(String.format(DEFAULT_NOT_FOUND_MESSAGE, klass)); }

Target:
UnavailableImplementationException(final Class klass) { super(String.format(DEFAULT_NOT_FOUND_MESSAGE, klass)); }
Source:
public String toString() { String awsRegions = ""; for (String awsRegiono : this.awsRegions) { awsRegions += awsRegions + ", "; } return "AwsSettings{" + "productTypeIsEc2=" + productTypeIsEc2 + ", isEc2Instance=" + isEc2Instance + ", productTypeIsJrsAmi=" + productTypeIsJrsAmi + ", awsRegions=" + awsRegions + ", productTypeIsMpAmi=" + productTypeIsMpAmi + ", suppressEc2CredentialsWarnings=" + suppressEc2CredentialsWarnings + '}'; }

Target:
public String toString() { return "AwsSettings{" + "productTypeIsEc2=" + productTypeIsEc2 + ", isEc2Instance=" + isEc2Instance + ", productTypeIsJrsAmi=" + productTypeIsJrsAmi + ", awsRegions=" + awsRegions + ", productTypeIsMpAmi=" + productTypeIsMpAmi + ", suppressEc2CredentialsWarnings=" + suppressEc2CredentialsWarnings + '}'; }
Source:
private void addFernFlowerInvokerDeps() { DependencyHandler deps = project.getDependencies(); Configuration buildscriptClasspath = project.getBuildscript().getConfigurations().getByName("classpath"); final Dependency fgDep = Iterables.getFirst(buildscriptClasspath.getDependencies().matching(new Spec<Dependency>() { @Override public boolean isSatisfiedBy(Dependency element) { return element.getName().equals(GROUP_FG); } }), null); if (fgDep == null) { return; } deps.add(CONFIG_FFI_DEPS, project.files(buildscriptClasspath.getResolvedConfiguration().getFiles(new Spec<Dependency>() { @Override public boolean isSatisfiedBy(Dependency element) { return element.contentEquals(fgDep); } }))); deps.add(CONFIG_FFI_DEPS, deps.localGroovy()); }

Target:
private void addFernFlowerInvokerDeps() { DependencyHandler deps = project.getDependencies(); Configuration buildscriptClasspath = project.getBuildscript().getConfigurations().getByName("classpath"); final Dependency fgDep = Iterables.getFirst(buildscriptClasspath.getDependencies().matching(new Spec<Dependency>() { @Override public boolean isSatisfiedBy(Dependency element) { return element.getName().equals(GROUP_FG); } }), null); if (fgDep == null) { throw new StopExecutionException("Missing FG dep in buildscript classpath"); } deps.add(CONFIG_FFI_DEPS, project.files(buildscriptClasspath.getResolvedConfiguration().getFiles(new Spec<Dependency>() { @Override public boolean isSatisfiedBy(Dependency element) { return element.contentEquals(fgDep); } }))); deps.add(CONFIG_FFI_DEPS, deps.localGroovy()); }
Source:
public String getProvider() { return "artemis"; }

Target:
public String getProvider() { return ArtemisUtil.PROVIDER; }
Source:
public Store getStore(PartitionId id) { createAndStartBlobStoreIfAbsent(id); return partitionToStore.get(id); }

Target:
public Store getStore(PartitionId id) { try { lock.readLock().lock(); if (partitionToStore.containsKey(id)) { return partitionToStore.get(id).isStarted() ? partitionToStore.get(id) : null; } } finally { lock.readLock().unlock(); } return createAndStartBlobStoreIfAbsent(id); }
Source:
public boolean close(final long timeout, final TimeUnit unit) { internalClose(); try { long duration = TimeUnit.MILLISECONDS.convert(timeout, unit); Thread.sleep(duration); } catch (InterruptedException e) { onErrorConsumers.forEach(consumer -> { consumer.accept(e); }); Thread.currentThread().interrupt(); return false; } return true; }

Target:
public boolean close(final long timeout, final TimeUnit unit) { internalClose(); return true; }
Source:
public void marshal( GetStoreFileRequest getStoreFileRequest, WritableChannel channel ) throws IOException { StoreIdMarshal.INSTANCE.marshal( getStoreFileRequest.expectedStoreId(), channel ); channel.putLong( getStoreFileRequest.requiredTransactionId() ); String name = getStoreFileRequest.file().getName(); channel.putInt( name.length() ); channel.put( name.getBytes(), name.length() ); }

Target:
public void marshal( GetStoreFileRequest getStoreFileRequest, WritableChannel channel ) throws IOException { StoreIdMarshal.INSTANCE.marshal( getStoreFileRequest.expectedStoreId(), channel ); channel.putLong( getStoreFileRequest.requiredTransactionId() ); String name = getStoreFileRequest.file().getName(); channel.putInt( name.length() ); channel.put( UTF8.encode( name ), name.length() ); }
Source:
void resume() { if (paused.getAndSet(false)) { synchronized (lock) { lock.notify(); } } }

Target:
void resume() { hardDeleteLock.lock(); try { if (paused.compareAndSet(true, false)) { pauseCondition.signal(); } } finally { hardDeleteLock.unlock(); } }
Source:
private Collection<JsonObject> performPagedRequest(BoundRequestBuilder requestBuilder, JsonObject body, int expectedStatusCode, String errorMessage) throws StashClientException { Collection<JsonObject> result = new ArrayList<>(); boolean doneLastPage = false; int nextPageStart = 0; while (!doneLastPage) { if (nextPageStart > 0) { requestBuilder.addQueryParam("start", String.valueOf(nextPageStart)); } JsonObject res = performRequest(requestBuilder, body, expectedStatusCode, errorMessage); JsonArray values = ((JsonArray) res.get("values")); if (values == null) { throw new StashClientException("Paged response did not include values"); } values.asCollection(result); doneLastPage = res.getBooleanOrDefault("isLastPage", true); nextPageStart = res.getIntegerOrDefault("nextPageStart", -1); } return result; }

Target:
private Collection<JsonObject> performPagedRequest(BoundRequestBuilder requestBuilder, JsonObject body, int expectedStatusCode, String errorMessage) throws StashClientException { Collection<JsonObject> result = new ArrayList<>(); boolean doneLastPage = false; int nextPageStart = 0; while (!doneLastPage) { requestBuilder.resetQuery(); if (nextPageStart > 0) { requestBuilder.addQueryParam("start", String.valueOf(nextPageStart)); } JsonObject res = performRequest(requestBuilder, body, expectedStatusCode, errorMessage); JsonArray values = ((JsonArray) res.get("values")); if (values == null) { throw new StashClientException("Paged response did not include values"); } values.asCollection(result); doneLastPage = res.getBooleanOrDefault("isLastPage", true); nextPageStart = res.getIntegerOrDefault("nextPageStart", -1); } return result; }
Source:
public org.kiji.schema.AsyncKijiBufferedWriter openAsyncBufferedWriter() throws IOException { return AsyncHBaseAsyncKijiBufferedWriter.create(mTable); }

Target:
public AsyncKijiBufferedWriter openAsyncBufferedWriter() throws IOException { return AsyncHBaseAsyncKijiBufferedWriter.create(mTable); }
Source:
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient) { if (isIngredient(ingredient)) { ItemStack result = PotionHelper.doReaction(ingredient, input); if (result != input) { return result; } return null; } return null; }

Target:
public ItemStack getOutput(@Nonnull ItemStack input, @Nonnull ItemStack ingredient) { if (!input.func_190926_b() && !ingredient.func_190926_b() && isIngredient(ingredient)) { ItemStack result = PotionHelper.doReaction(ingredient, input); if (result != input) { return result; } return ItemStack.field_190927_a; } return ItemStack.field_190927_a; }
Source:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getImportCommand()) { restore(); } else if (command == getRemoveCommand()) { remove(); } else if ("OnRemove".equals(command.getName())) { onRemove(); } else if (command.getName().equals("Cancel")) { cancel(); } }

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command == getImportCommand()) { restore(); } else if (command == getRemoveCommand()) { remove(); } else if (command.getName().equals("OnRemove")) { onRemove(); } else if (command.getName().equals("Cancel")) { cancel(); } }
Source:
private static String getMetricsVersion(final Properties config) { if (config.containsKey(StreamsConfig.BUILT_IN_METRICS_VERSION_CONFIG)) { return config.getProperty(StreamsConfig.BUILT_IN_METRICS_VERSION_CONFIG); } return DEFAULT_METRICS_VERSION; }

Target:
private static String getMetricsVersion(final Properties config) { return config.getProperty(StreamsConfig.BUILT_IN_METRICS_VERSION_CONFIG, DEFAULT_METRICS_VERSION); }
Source:
public Contest() { setContestId(null); setDescription(""); setIsVisible(false); setLength(defaultContestLength); setTime(new Timestamp(System.currentTimeMillis())); setTitle(""); setType((byte) Global.ContestType.PUBLIC.ordinal()); }

Target:
public Contest() { contestId = null; description = ""; isVisible = false; length = defaultContestLength; time = new Timestamp(System.currentTimeMillis()); title = ""; type = (byte) Global.ContestType.PUBLIC.ordinal(); }
Source:
public static Matcher<? super View> withUsageHintOnClick(final Matcher<? extends CharSequence> charSequenceMatcher) { return new TypeSafeMatcher<View>() { @Override protected boolean matchesSafely(View view) { if (!view.isClickable()) { return false; } AccessibilityNodeInfo accessibilityNodeInfo = view.createAccessibilityNodeInfo(); AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(accessibilityNodeInfo, AccessibilityNodeInfo.ACTION_CLICK); return charSequenceMatcher.matches(clickAction.getLabel()); } @Override public void describeTo(Description description) { description.appendText("is clickable and has custom usage hint for ACTION_CLICK: "); charSequenceMatcher.describeTo(description); } }; }

Target:
public static Matcher<? super View> withUsageHintOnClick(final Matcher<? extends CharSequence> charSequenceMatcher) { return new TypeSafeMatcher<View>() { @Override protected boolean matchesSafely(View view) { if (!view.isClickable()) { return false; } AccessibilityNodeInfo.AccessibilityAction clickAction = findAction(view, AccessibilityNodeInfo.ACTION_CLICK); return charSequenceMatcher.matches(clickAction.getLabel()); } @Override public void describeTo(Description description) { description.appendText("is clickable and has custom usage hint for ACTION_CLICK: "); charSequenceMatcher.describeTo(description); } }; }
Source:
public synchronized void close() { if (builder.length() > 0 || outputStreamBuffer.size() != 0) { println(); } super.close(); }

Target:
public synchronized void close() { if (outputStreamBuffer.size() > 0) { print(""); } if (builder.length() > 0 || outputStreamBuffer.size() > 0) { println(); } super.close(); }
Source:
private RevCommit getRightCommit(RevWalk revWalk, Repository repository) throws InvocationTargetException { try { String target; if (repository.getRepositoryState().equals(RepositoryState.MERGING)) { target = Constants.MERGE_HEAD; } else if (repository.getRepositoryState().equals(RepositoryState.CHERRY_PICKING)) { target = Constants.CHERRY_PICK_HEAD; } else if (repository.getRepositoryState().equals(RepositoryState.REBASING_INTERACTIVE)) { target = readFile(repository.getDirectory(), RebaseCommand.REBASE_MERGE + File.separatorChar + RebaseCommand.STOPPED_SHA); } else { target = Constants.ORIG_HEAD; } ObjectId mergeHead = repository.resolve(target); if (mergeHead == null) { throw new IOException(NLS.bind(CoreText.ValidationUtils_CanNotResolveRefMessage, target)); } return revWalk.parseCommit(mergeHead); } catch (IOException e) { throw new InvocationTargetException(e); } }

Target:
private RevCommit getRightCommit(RevWalk revWalk, Repository repository) throws InvocationTargetException { try { String target; if (repository.getRepositoryState().equals(RepositoryState.MERGING)) { target = Constants.MERGE_HEAD; } else if (repository.getRepositoryState().equals(RepositoryState.CHERRY_PICKING)) { target = Constants.CHERRY_PICK_HEAD; } else if (repository.getRepositoryState().equals(RepositoryState.REBASING_INTERACTIVE)) { target = readFile(repository.getDirectory(), RebaseCommand.REBASE_MERGE + File.separatorChar + RebaseCommand.STOPPED_SHA); } else { target = Constants.ORIG_HEAD; } ObjectId mergeHead = repository.resolve(target); if (mergeHead == null) { throw new IOException(NLS.bind( EMFCompareEGitUIMessages.getString("ValidationUtils_CanNotResolveRefMessage"), target)); } return revWalk.parseCommit(mergeHead); } catch (IOException e) { throw new InvocationTargetException(e); } }
Source:
public void close() throws BKException, InterruptedException { closeLock.writeLock().lock(); try { if (closed) { return; } closed = true; } finally { closeLock.writeLock().unlock(); } bookieClient.close(); try { ledgerManager.close(); ledgerIdGenerator.close(); ledgerManagerFactory.close(); } catch (IOException ie) { LOG.error("Failed to close ledger manager : ", ie); } scheduler.shutdown(); if (!scheduler.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The scheduler did not shutdown cleanly"); } mainWorkerPool.shutdown(); if (!mainWorkerPool.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The mainWorkerPool did not shutdown cleanly"); } if (this.bookieInfoScheduler != null) { this.bookieInfoScheduler.shutdown(); if (!bookieInfoScheduler.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The bookieInfoScheduler did not shutdown cleanly"); } } if (ownTimer) { requestTimer.stop(); } if (ownEventLoopGroup) { eventLoopGroup.shutdownGracefully(); } this.regClient.close(); this.metadataDriver.close(); }

Target:
public void close() throws BKException, InterruptedException { closeLock.writeLock().lock(); try { if (closed) { return; } closed = true; } finally { closeLock.writeLock().unlock(); } bookieClient.close(); try { ledgerManager.close(); ledgerIdGenerator.close(); } catch (IOException ie) { LOG.error("Failed to close ledger manager : ", ie); } scheduler.shutdown(); if (!scheduler.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The scheduler did not shutdown cleanly"); } mainWorkerPool.shutdown(); if (!mainWorkerPool.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The mainWorkerPool did not shutdown cleanly"); } if (this.bookieInfoScheduler != null) { this.bookieInfoScheduler.shutdown(); if (!bookieInfoScheduler.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("The bookieInfoScheduler did not shutdown cleanly"); } } if (ownTimer) { requestTimer.stop(); } if (ownEventLoopGroup) { eventLoopGroup.shutdownGracefully(); } this.metadataDriver.close(); }
Source:
public Attribute convertEmptyStringIntoNullInAttrValue(Attribute attributeToConvert) { if(attributeToConvert.getValue() == null) return attributeToConvert; String testAttributeType = attributeToConvert.getType(); if ((testAttributeType.equals(String.class.getName()) || testAttributeType.equals("java.lang.LargeString")) && attributeToConvert.getValue().equals("")) { attributeToConvert.setValue(null); } return attributeToConvert; }

Target:
public Attribute convertEmptyStringIntoNullInAttrValue(Attribute attributeToConvert) { if(attributeToConvert.getValue() == null) return attributeToConvert; String testAttributeType = attributeToConvert.getType(); if ((testAttributeType.equals(String.class.getName()) || testAttributeType.equals(BeansUtils.largeStringClassName)) && attributeToConvert.getValue().equals("")) { attributeToConvert.setValue(null); } return attributeToConvert; }
Source:
public void removeStoredQuery(StoredQuery query) { storedQueryDirByContext().get(toFilename(query.getName())).delete(); }

Target:
public void removeStoredQuery(StoredQuery query) { final String filename = toFilename(query.getName()); Resource resource = storedQueryDirByContext().get(filename); if (resource.getType() == Type.RESOURCE) { resource.delete(); } else { if (localWorkspaceDir() != null && storedQueryDir().get(filename).getType() == Type.RESOURCE) { throw new GeoServerRuntimException( "Global query can not be deleted from a virtual service."); } } }
Source:
public boolean registerClient(Client client) { try (Jedis j = pool.getResource()) { byte[] lockValue = null; byte[] lockKey = toLockKey(client.getEndpoint()); try { lockValue = RedisLock.acquire(j, lockKey); byte[] k = toEndpointKey(client.getEndpoint()); byte[] old = j.getSet(k, serialize(client)); byte[] idx = toRegKey(client.getRegistrationId()); j.set(idx, client.getEndpoint().getBytes(UTF_8)); j.expire(idx, client.getLifeTimeInSec().intValue()); if (old != null) { Client oldClient = deserialize(old); for (ClientRegistryListener l : listeners) { l.unregistered(oldClient); } } for (ClientRegistryListener l : listeners) { l.registered(client); } return true; } finally { RedisLock.release(j, lockKey, lockValue); } } }

Target:
public boolean registerClient(Client client) { try (Jedis j = pool.getResource()) { byte[] lockValue = null; byte[] lockKey = toLockKey(client.getEndpoint()); try { lockValue = RedisLock.acquire(j, lockKey); byte[] k = toEndpointKey(client.getEndpoint()); byte[] old = j.getSet(k, serialize(client)); byte[] idx = toRegKey(client.getRegistrationId()); j.set(idx, client.getEndpoint().getBytes(UTF_8)); if (old != null) { Client oldClient = deserialize(old); for (ClientRegistryListener l : listeners) { l.unregistered(oldClient); } } for (ClientRegistryListener l : listeners) { l.registered(client); } return true; } finally { RedisLock.release(j, lockKey, lockValue); } } }
Source:
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset()); HaxeLocalVarDeclaration localVarDeclaration = PsiTreeUtil.getParentOfType(elementAt, HaxeLocalVarDeclaration.class); if (localVarDeclaration == null) return; String name = localVarDeclaration.getComponentName().getName(); HaxeTypeTag typeTag = localVarDeclaration.getTypeTag(); HaxeVarInit varInit = localVarDeclaration.getVarInit(); String text = "var " + name; if (typeTag != null) { text += " " + typeTag.getText(); } text += ";"; HaxeVarDeclaration varDeclaration = HaxeElementGenerator.createVarDeclaration(project, text); if (varInit != null) { text = name + varInit.getText(); } varDeclaration.getNode().addLeaf(HaxeTokenTypes.OSEMI, "\n", null); PsiElement statementFromText = HaxeElementGenerator.createStatementFromText(project, text); statementFromText.getNode().addLeaf(HaxeTokenTypes.OSEMI, ";", null); localVarDeclaration.getParent().addBefore(varDeclaration, localVarDeclaration); PsiElement replace = localVarDeclaration.replace(statementFromText); final TextRange range = replace.getTextRange(); final PsiFile baseFile = file.getViewProvider().getPsi(file.getViewProvider().getBaseLanguage()); CodeStyleManager.getInstance(project).reformatText(baseFile, range.getStartOffset(), range.getEndOffset()); }

Target:
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset()); HaxeLocalVarDeclaration localVarDeclaration = PsiTreeUtil.getParentOfType(elementAt, HaxeLocalVarDeclaration.class); if (localVarDeclaration == null) return; String name = localVarDeclaration.getComponentName().getName(); HaxeTypeTag typeTag = localVarDeclaration.getTypeTag(); HaxeVarInit varInit = localVarDeclaration.getVarInit(); String text = "var " + name; if (typeTag != null) { text += " " + typeTag.getText(); } text += ";"; HaxeVarDeclaration varDeclaration = HaxeElementGenerator.createVarDeclaration(project, text); text = name + varInit.getText(); varDeclaration.getNode().addLeaf(HaxeTokenTypes.OSEMI, "\n", null); PsiElement statementFromText = HaxeElementGenerator.createStatementFromText(project, text); statementFromText.getNode().addLeaf(HaxeTokenTypes.OSEMI, ";", null); localVarDeclaration.getParent().addBefore(varDeclaration, localVarDeclaration); PsiElement replace = localVarDeclaration.replace(statementFromText); final TextRange range = replace.getTextRange(); final PsiFile baseFile = file.getViewProvider().getPsi(file.getViewProvider().getBaseLanguage()); CodeStyleManager.getInstance(project).reformatText(baseFile, range.getStartOffset(), range.getEndOffset()); }
Source:
public <R, X extends Exception> R withHandle(HandleCallback<R, X> callback) throws X { Handle h = JdbiUtil.getHandle(jdbi); R result = callback.withHandle(h); JdbiUtil.closeIfNeeded(h); return result; }

Target:
public <R, X extends Exception> R withHandle(HandleCallback<R, X> callback) throws X { Handle h = JdbiUtil.getHandle(jdbi); try { return callback.withHandle(h); } finally { JdbiUtil.closeIfNeeded(h); } }
Source:
protected void doTestIndexDataWithLegacyParserStableState() throws Exception { StreamEventWriter streamEventWriter = getStreamEventWriter(); final GeneratedTestConfig generatedTestConfig = new GeneratedTestConfig(); try ( final Closeable ignored1 = unloader(generatedTestConfig.getFullDatasourceName()) ) { final String taskSpec = generatedTestConfig.getStreamIngestionPropsTransform().apply(getResourceAsString(INDEXER_FILE_LEGACY_PARSER)); LOG.info("supervisorSpec: [%s]\n", taskSpec); generatedTestConfig.setSupervisorId(indexer.submitSupervisor(taskSpec)); LOG.info("Submitted supervisor"); wikipediaStreamEventGenerator.start(generatedTestConfig.getStreamName(), streamEventWriter, TOTAL_NUMBER_OF_SECOND, FIRST_EVENT_TIME); verifyIngestedData(generatedTestConfig); } finally { doMethodTeardown(generatedTestConfig, streamEventWriter); } }

Target:
protected void doTestIndexDataWithLegacyParserStableState() throws Exception { StreamEventWriter streamEventWriter = createStreamEventWriter(config); final GeneratedTestConfig generatedTestConfig = new GeneratedTestConfig(); try ( final Closeable ignored1 = unloader(generatedTestConfig.getFullDatasourceName()) ) { final String taskSpec = generatedTestConfig.getStreamIngestionPropsTransform().apply(getResourceAsString(INDEXER_FILE_LEGACY_PARSER)); LOG.info("supervisorSpec: [%s]\n", taskSpec); generatedTestConfig.setSupervisorId(indexer.submitSupervisor(taskSpec)); LOG.info("Submitted supervisor"); wikipediaStreamEventGenerator.run(generatedTestConfig.getStreamName(), streamEventWriter, TOTAL_NUMBER_OF_SECOND, FIRST_EVENT_TIME); verifyIngestedData(generatedTestConfig); } finally { doMethodTeardown(generatedTestConfig, streamEventWriter); } }
Source:
private static boolean isRequiredInjection(Element element) { return !hasAnnotationWithName(element, Nullable.class.getSimpleName()); }

Target:
private static boolean isRequiredInjection(Element element) { return !hasAnnotationWithName(element, NULLABLE_ANNOTATION_NAME); }
Source:
protected void compare(ByteString a, ByteString b) { Assert.assertTrue(underTest.compare(a, b) < 0); Assert.assertTrue(underTest.compare(b, a) > 0); Assert.assertEquals(0, underTest.compare(b, b)); }

Target:
private void compare(ByteString a, ByteString b) { Assert.assertTrue(underTest.compare(a, b) < 0); Assert.assertTrue(underTest.compare(b, a) > 0); Assert.assertTrue(underTest.compare(b, b) == 0); }
Source:
private void fireAllEvents() { for (Entry<String, Set<IZkChildListener>> entry : _childListener.entrySet()) { fireChildChangedEvents(entry.getKey(), entry.getValue(), true); } for (Entry<String, Set<IZkDataListenerEntry>> entry : _dataListener.entrySet()) { fireDataChangedEvents(entry.getKey(), entry.getValue()); } }

Target:
private void fireAllEvents() { for (Entry<String, Set<IZkChildListener>> entry : _childListener.entrySet()) { fireChildChangedEvents(entry.getKey(), entry.getValue(), true); } for (Entry<String, Set<IZkDataListenerEntry>> entry : _dataListener.entrySet()) { fireDataChangedEvents(entry.getKey(), entry.getValue(), OptionalLong.empty(), true); } }
Source:
public ObservableValue<String> getFields(OrFields fields) { ObservableValue<String> value = fieldValues.get(fields); if (value != null) { return value; } ArrayList<Observable> observables = new ArrayList<>(List.of(entry.getObservables())); observables.add(nameFormatter); value = Bindings.createStringBinding(() -> { for (Field field : fields) { if (field.getProperties().contains(FieldProperty.PERSON_NAMES) && nameFormatter.getValue().needsFormatting()) { Optional<String> name = entry.getResolvedFieldOrAlias(field, database); if (name.isPresent()) { return nameFormatter.getValue().formatNameLatexFree(name.get()); } } else { Optional<String> content = entry.getResolvedFieldOrAliasLatexFree(field, database); if (content.isPresent()) { return content.get(); } } } return ""; }, observables.toArray(Observable[]::new)); fieldValues.put(fields, value); return value; }

Target:
public ObservableValue<String> getFields(OrFields fields) { ObservableValue<String> value = fieldValues.get(fields); if (value != null) { return value; } ArrayList<Observable> observables = new ArrayList<>(List.of(entry.getObservables())); observables.add(fieldValueFormatter); value = Bindings.createStringBinding(() -> fieldValueFormatter.getValue().formatFieldsValues(fields, entry), observables.toArray(Observable[]::new)); fieldValues.put(fields, value); return value; }
Source:
public void testAvoidTimeoutDisconnectWithDefaultStatusInterval() throws Exception { exception.expect(TestTimedOutException.class); exception.expectMessage(CoreMatchers.containsString("test timed out after")); PGConnection pgConnection = (PGConnection) replConnection; PGReplicationStream stream = pgConnection .replicationStream() .logical() .withSlotName(SLOT_NAME) .withStartPosition(getCurrentLSN()) .start(); while (!Thread.interrupted()) { ByteBuffer buffer = stream.read(); System.out.println("Received: " + toString(buffer)); } }

Target:
public void testAvoidTimeoutDisconnectWithDefaultStatusInterval() throws Exception { final int statusInterval = getKeepAliveTimeout(); ExecutorService executor = Executors.newSingleThreadExecutor(); Future future = null; boolean done; try { future = executor.submit(new Callable<Object>() { @Override public Object call() throws Exception { PGConnection pgConnection = (PGConnection) replConnection; PGReplicationStream stream = pgConnection .getReplicationAPI() .replicationStream() .logical() .withSlotName(SLOT_NAME) .withStartPosition(getCurrentLSN()) .withStatusInterval(Math.round(statusInterval / 3), TimeUnit.MILLISECONDS) .start(); while (!Thread.interrupted()) { stream.read(); } return null; } }); future.get(5, TimeUnit.SECONDS); done = future.isDone(); } catch (TimeoutException timeout) { done = future.isDone(); } finally { executor.shutdownNow(); } assertThat( "ReplicationStream should periodically send keep alive message to postgresql to avoid disconnect from server", done, CoreMatchers.equalTo(false) ); }
Source:
public boolean matches(RelOptRuleCall call) { Sort sort = call.rel(0); TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); boolean onlyLimit = sort.getCollation().getFieldCollations().isEmpty() && sort.fetch != null; return onlyLimit && tableSourceTable != null && tableSourceTable.tableSource() instanceof SupportsLimitPushDown && !Arrays.stream(tableSourceTable.extraDigests()).anyMatch(str -> str.startsWith("limit=[")); }

Target:
public boolean matches(RelOptRuleCall call) { Sort sort = call.rel(0); TableSourceTable tableSourceTable = call.rel(1).getTable().unwrap(TableSourceTable.class); boolean onlyLimit = sort.getCollation().getFieldCollations().isEmpty() && sort.fetch != null; return onlyLimit && tableSourceTable != null && tableSourceTable.tableSource() instanceof SupportsLimitPushDown && Arrays.stream(tableSourceTable.extraDigests()).noneMatch(str -> str.startsWith("limit=[")); }
Source:
public abstract @Nonnull Openstack getOpenstack( @Nonnull String endPointUrl, @Nonnull OpenstackCredential openstackCredential, @CheckForNull String region ) throws FormValidation; public static @Nonnull Openstack get( @CheckForNull final String endPointUrl, @CheckForNull final OpenstackCredential auth, @CheckForNull final String region ) throws FormValidation { if (auth == null) { throw new RuntimeException("authentication is null"); } final String fingerprint = Util.getDigestOf(endPointUrl + '\n' + auth.toString() + '\n' + region); final FactoryEP ep = ExtensionList.lookup(FactoryEP.class).get(0); final Callable<Openstack> cacheMissFunction = new Callable<Openstack>() { @Override public Openstack call() throws FormValidation { return ep.getOpenstack(endPointUrl,auth, region); } }; try { return ep.cache.get(fingerprint, cacheMissFunction); } catch (UncheckedExecutionException | ExecutionException e) { final Throwable cause = e.getCause(); if (cause instanceof FormValidation) { throw (FormValidation) cause; } if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(e); } }

Target:
public abstract @Nonnull Openstack getOpenstack( @Nonnull String endPointUrl, @Nonnull OpenstackCredential openstackCredential, @CheckForNull String region ) throws FormValidation; public static @Nonnull Openstack get( @Nonnull final String endPointUrl, @Nonnull final OpenstackCredential auth, @Nonnull final String region ) throws FormValidation { final String fingerprint = Util.getDigestOf(endPointUrl + '\n' + auth.toString() + '\n' + region); final FactoryEP ep = ExtensionList.lookup(FactoryEP.class).get(0); final Callable<Openstack> cacheMissFunction = new Callable<Openstack>() { @Override public Openstack call() throws FormValidation { return ep.getOpenstack(endPointUrl,auth, region); } }; try { return ep.cache.get(fingerprint, cacheMissFunction); } catch (UncheckedExecutionException | ExecutionException e) { final Throwable cause = e.getCause(); if (cause instanceof FormValidation) { throw (FormValidation) cause; } if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } throw new RuntimeException(e); } }
Source:
public void close() throws IOException { try { writeRowGroup(); output.close(); } finally { Closer closer = Closer.create(); closer.register(keySectionOutput::destroy); for (ColumnEncoder columnEncoder : columnEncoders) { closer.register(columnEncoder::destroy); } closer.close(); } }

Target:
public void close() throws IOException { try (Closer closer = Closer.create()) { writeRowGroup(); closer.register(output); closer.register(keySectionOutput::destroy); for (ColumnEncoder columnEncoder : columnEncoders) { closer.register(columnEncoder::destroy); } } }
Source:
private static int getHashPosition(Block keyBlock, int position, MethodHandle keyBlockHashCode, int hashTableSize) { if (keyBlock.isNull(position)) { throw new IllegalArgumentException("map keys cannot be null"); } long hashCode; try { hashCode = (long) keyBlockHashCode.invokeExact(keyBlock, position); } catch (Throwable throwable) { if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } throw new RuntimeException(throwable); } return (int) Math.floorMod(hashCode, hashTableSize); }

Target:
private static int getHashPosition(Block keyBlock, int position, MethodHandle keyBlockHashCode, int hashTableSize) { if (keyBlock.isNull(position)) { throw new IllegalArgumentException("map keys cannot be null"); } long hashCode; try { hashCode = (long) keyBlockHashCode.invokeExact(keyBlock, position); } catch (RuntimeException e) { throw e; } catch (Throwable throwable) { throw new RuntimeException(throwable); } return (int) Math.floorMod(hashCode, hashTableSize); }