auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initiateCall(String configName, Map<String, String> parameters) { LOGGER.debug("initiateCall(configName = {}, params = {})", configName, parameters); Map<String, String> params = new HashMap<>(parameters); if (!configService.hasConfig(configName)) { String msg = String.format("Invalid config: '%s'", configName); statusMessageService.warn(msg, MODULE_NAME); throw new CallInitiationException(msg); } Config config = configService.getConfig(configName); String motechCallId = UUID.randomUUID().toString(); Map<String, String> completeParams = new HashMap<>(params); completeParams.put("motechCallId", motechCallId); try { String protocol = new URL(config.getOutgoingCallUriTemplate()).getProtocol(); switch (protocol) { case FILE_PROTOCOL: { generateCallFile(config, params, completeParams, motechCallId); break; } case HTTP_PROTOCOL: { generateCallHttp(config, params, completeParams, motechCallId); break; } } } catch (CallInitiationException e) { throw e; } catch (Exception e) { String message = String.format("Could not initiate call, unexpected exception: %s", e.toString()); statusMessageService.warn(message, MODULE_NAME); params.put("ErrorMessage", message); addCallDetailRecord(CallDetailRecord.CALL_FAILED, config, params, motechCallId); throw new CallInitiationException(message, e); } }

Target:
public void initiateCall(String configName, Map<String, String> parameters) { LOGGER.debug("initiateCall(configName = {}, params = {})", configName, parameters); Map<String, String> params = new HashMap<>(parameters); if (!configService.hasConfig(configName)) { String msg = String.format("Invalid config: '%s'", configName); statusMessageService.warn(msg, MODULE_NAME); throw new CallInitiationException(msg); } Config config = configService.getConfig(configName); String motechCallId = UUID.randomUUID().toString(); Map<String, String> completeParams = new HashMap<>(params); completeParams.put("motechCallId", motechCallId); String protocol; try { protocol = new URL(config.getOutgoingCallUriTemplate()).getProtocol(); } catch (MalformedURLException e) { String msg = String.format("Invalid URI template: '%s'", config.getOutgoingCallUriTemplate()); statusMessageService.warn(msg, MODULE_NAME); throw new CallInitiationException(msg, e); } switch (protocol) { case FILE_PROTOCOL: { generateCallFile(config, params, completeParams, motechCallId); break; } case HTTP_PROTOCOL: { executeHttpCall(config, params, completeParams, motechCallId); break; } } }
Source:
protected List<ActionRequest> createRequests(final Transfer<Asn> transfer, final Optional<RpslObject> precedingAsBlock, final AsBlockRange originalAsBlockRange, final Optional<RpslObject> followingAsBlock) { final List<ActionRequest> requests = Lists.newArrayList(); final String blockTemplate; if (transfer.isIncoming()) { blockTemplate = RIPE_AS_BLOCK_TEMPLATE; } else { blockTemplate = NON_RIPE_AS_BLOCK_TEMPLATE; } final long begin, end; begin = end = transfer.getResource().asBigInteger().longValue(); final RpslObject newAsBlock = createAsBlock(begin, end, blockTemplate); requests.add(new ActionRequest(newAsBlock, Action.CREATE)); return requests; }

Target:
protected List<ActionRequest> createRequests(final Transfer<Asn> transfer, final Optional<RpslObject> precedingAsBlock, final AsBlockRange originalAsBlockRange, final Optional<RpslObject> followingAsBlock) { final String blockTemplate; if (transfer.isIncoming()) { blockTemplate = RIPE_AS_BLOCK_TEMPLATE; } else { blockTemplate = NON_RIPE_AS_BLOCK_TEMPLATE; } final long asn = transfer.getResource().asBigInteger().longValue(); final RpslObject newAsBlock = createAsBlock(asn, asn, blockTemplate); return Collections.singletonList(new ActionRequest(newAsBlock, Action.CREATE)); }
Source:
public void partClosed(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); if (part instanceof MultiPageEditorPart) { MultiPageEditorPart mulitPageEditorPart = (MultiPageEditorPart) part; if (activePart instanceof IEditorPart) { IEditorPart[] editorsForActivePart = mulitPageEditorPart .findEditors(((IEditorPart) activePart).getEditorInput()); if (editorsForActivePart != null && editorsForActivePart.length > 0) { clearActivePart(); } } } if (activePart != null && part == activePart) { clearActivePart(); } }

Target:
public void partClosed(IWorkbenchPartReference partRef) { IWorkbenchPart part = partRef.getPart(false); if (part instanceof MultiPageEditorPart && activePart instanceof IEditorPart) { MultiPageEditorPart mulitPageEditorPart = (MultiPageEditorPart) part; IEditorPart[] editorsForActivePart = mulitPageEditorPart .findEditors(((IEditorPart) activePart).getEditorInput()); if (editorsForActivePart != null && editorsForActivePart.length > 0) { clearActivePart(); return; } } if (activePart != null && part == activePart) { clearActivePart(); } }
Source:
private CompletionStage<RestResponse> getAllCachesConfigurationTemplates(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); try { Set<String> cacheConfigurationNames = Security.doAs(request.getSubject(), (PrivilegedAction<Set<String>>) () -> cacheManager.getCacheConfigurationNames()); List<NamedCacheConfiguration> configurations = cacheConfigurationNames.stream() .filter(n -> !internalCacheRegistry.isInternalCache(n)) .filter(n -> { Configuration cacheConfiguration = Security.doAs(request.getSubject(), (PrivilegedAction<Configuration>) () -> cacheManager.getCacheConfiguration(n)); return cacheConfiguration.isTemplate(); }) .distinct() .map(n -> { Configuration cacheConfiguration = Security.doAs(request.getSubject(), (PrivilegedAction<Configuration>) () -> cacheManager.getCacheConfiguration(n)); String json = jsonWriter.toJSON(cacheConfiguration); return new NamedCacheConfiguration(n, json); }) .sorted(Comparator.comparing(c -> c.name)) .collect(Collectors.toList()); byte[] bytes = objectMapper.writeValueAsBytes(configurations); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }

Target:
private CompletionStage<RestResponse> getAllCachesConfigurationTemplates(RestRequest request) { NettyRestResponse.Builder responseBuilder = checkCacheManager(request); if (responseBuilder.getHttpStatus() == NOT_FOUND) return completedFuture(responseBuilder.build()); EmbeddedCacheManager subjectCacheManager = cacheManager.withSubject(request.getSubject()); try { Set<String> cacheConfigurationNames = subjectCacheManager.getCacheConfigurationNames(); List<NamedCacheConfiguration> configurations = cacheConfigurationNames.stream() .filter(n -> !internalCacheRegistry.isInternalCache(n)) .filter(n -> SecurityActions.getCacheConfigurationFromManager(subjectCacheManager, n).isTemplate()) .distinct() .map(n -> { Configuration config = SecurityActions.getCacheConfigurationFromManager(subjectCacheManager, n); return new NamedCacheConfiguration(n, jsonWriter.toJSON(config)); }) .sorted(Comparator.comparing(c -> c.name)) .collect(Collectors.toList()); byte[] bytes = objectMapper.writeValueAsBytes(configurations); responseBuilder.contentType(APPLICATION_JSON).entity(bytes); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return completedFuture(responseBuilder.build()); }
Source:
static void warnOrAssert(Logger logger, String message, Object... args) { if (ASSERT) { FormattingTuple detailMessage = MessageFormatter.arrayFormat(message, args); Throwable throwable = detailMessage.getThrowable(); throw throwable == null ? new AssertionError(detailMessage.getMessage()) : new AssertionError(detailMessage.getMessage(), throwable); } else { try { LOGGER.invokeExact(logger, message, args); } catch (Throwable throwable) { throw new AssertionError(); } } }

Target:
static void warnOrAssert(Logger logger, String message, Object... args) { if (ASSERT) { FormattingTuple detailMessage = MessageFormatter.arrayFormat(message, args); Throwable throwable = detailMessage.getThrowable(); throw throwable == null ? new AssertionError(detailMessage.getMessage()) : new AssertionError(detailMessage.getMessage(), throwable); } else { try { WARN.invokeExact(logger, message, args); } catch (Throwable throwable) { throw new AssertionError(); } } }
Source:
@Test public void array() throws Exception { List<Object> root = new ArrayList<>(); root.add("s"); root.add(1.5); root.add(true); root.add(null); JsonReader reader = new ObjectJsonReader(root); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.BEGIN_ARRAY); reader.beginArray(); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.STRING); assertThat(reader.nextString()).isEqualTo("s"); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.NUMBER); assertThat(reader.nextDouble()).isEqualTo(1.5d); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.BOOLEAN); assertThat(reader.nextBoolean()).isEqualTo(true); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.NULL); assertThat(reader.nextNull()).isNull(); assertThat(reader.hasNext()).isFalse(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_ARRAY); reader.endArray(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_DOCUMENT); }

Target:
@Test public void array() throws Exception { List<Object> root = new ArrayList<>(); root.add("s"); root.add(1.5d); root.add(true); root.add(null); JsonReader reader = new ObjectJsonReader(root); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.BEGIN_ARRAY); reader.beginArray(); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.STRING); assertThat(reader.nextString()).isEqualTo("s"); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.NUMBER); assertThat(reader.nextDouble()).isEqualTo(1.5d); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.BOOLEAN); assertThat(reader.nextBoolean()).isEqualTo(true); assertThat(reader.hasNext()).isTrue(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.NULL); assertThat(reader.nextNull()).isNull(); assertThat(reader.hasNext()).isFalse(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_ARRAY); reader.endArray(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_DOCUMENT); }
Source:
public void printStuff() { System.out.println(); for (Map<Object, Integer> dim : dimensionMap.values()) { System.out.println("DIMENSION " + dim + "\n============"); Map<Object, Integer> valueMap = dim; List<Comparable> valList = new ArrayList<>(); for (Integer val : valueMap.values()) { valList.add((Comparable) val); } Collections.sort(valList); for (Comparable val : valList) { System.out.println(" VAL: " + val + " CNT: " + val); } System.out.println(); } }

Target:
public void printStuff() { System.out.println(); dimensionMap.forEach((key, valueMap) -> new TreeMap<>(valueMap).forEach((val, cnt) -> System.out.println(" VAL: " + val + " CNT: " + cnt))); }
Source:
public Optional<Response> handle(HandlerInput handlerInput, IntentRequest intentRequest) { try { JsonNode node = MAPPER.readTree(getWeatherData().getEntity().getContent()); final String temperature = node.path("main").path("temp").asText(); final String humidity = node.path("main").path("humidity").asText(); final String windSpeed = node.path("wind").path("speed").asText(); final String speechOutput = String.format("Weather in %s is with temperature %s kelvin and %s percent humidity. Wind speed is about %s miles per hour", SkillData.CITY_INFORMATION.getCity().getName(), temperature, humidity, windSpeed); return handlerInput.getResponseBuilder() .withSpeech(speechOutput) .build(); } catch (IOException ex) { throw new RuntimeException("Could not parse Weather data response", ex); } }

Target:
public Optional<Response> handle(HandlerInput handlerInput, IntentRequest intentRequest) { Map<String, String> requestParams = new HashMap<String, String>() { { put("id", CITY_ID); put("appid", API_KEY); } }; try (CloseableHttpResponse response = HttpUtils.doGet(requestParams, WEATHER_ENDPOINT)) { JsonNode node = MAPPER.readTree(response.getEntity().getContent()); final String temperature = String.valueOf(node.path("main").path("temp").doubleValue() - 273.15); final String humidity = node.path("main").path("humidity").asText(); final String windSpeed = node.path("wind").path("speed").asText(); final String speechOutput = String.format("Weather in %s is with temperature %s celsius and %s percent humidity. Wind speed is about %s miles per hour", SkillData.CITY_INFORMATION.getCity().getName(), temperature, humidity, windSpeed); return handlerInput.getResponseBuilder() .withSpeech(speechOutput) .build(); } catch (IOException ex) { throw new RuntimeException("Could not parse Weather data response", ex); } }
Source:
public void testOrderByWithAggregation() { assertQuery("" + "SELECT x, sum(cast(x AS double))\n" + "FROM (VALUES '1.0') t(x)\n" + "GROUP BY x\n" + "ORDER BY sum(cast(t.x AS double))", "VALUES ('1.0', 1.0)"); Session legacyOrderBy = Session.builder(getSession()) .setSystemProperty(LEGACY_ORDER_BY, "true") .build(); queryTemplate("select count(*) %output% from (select substr(name,1,1) letter from nation) x group by %groupBy% order by %orderBy%") .replaceAll( parameter("output").of("", ", letter", ", letter as y"), parameter("groupBy").of("x.letter", "letter"), parameter("orderBy").of("x.letter", "letter")) .forEach(query -> { assertQueryOrdered(query); assertQueryOrdered(legacyOrderBy, query); }); }

Target:
public void testOrderByWithAggregation() { assertQuery("" + "SELECT x, sum(cast(x AS double))\n" + "FROM (VALUES '1.0') t(x)\n" + "GROUP BY x\n" + "ORDER BY sum(cast(t.x AS double))", "VALUES ('1.0', 1.0)"); Session legacyOrderBy = Session.builder(getSession()) .setSystemProperty(LEGACY_ORDER_BY, "true") .build(); queryTemplate("SELECT count(*) %output% FROM (SELECT substr(name,1,1) letter FROM nation) x GROUP BY %groupBy% ORDER BY %orderBy%") .replaceAll( parameter("output").of("", ", letter", ", letter AS y"), parameter("groupBy").of("x.letter", "letter"), parameter("orderBy").of("x.letter", "letter")) .forEach(query -> { assertQueryOrdered(query); assertQueryOrdered(legacyOrderBy, query); }); }
Source:
public static Map<String, String> getCommonLabels(String clusterId) { Map<String, String> commonLabels = new HashMap<>(); commonLabels.put(Constants.LABEL_TYPE_KEY, Constants.LABEL_TYPE_NATIVE_TYPE); commonLabels.put(Constants.LABEL_APP_KEY, clusterId); return Collections.unmodifiableMap(commonLabels); }

Target:
public static Map<String, String> getCommonLabels(String clusterId) { final Map<String, String> commonLabels = new HashMap<>(); commonLabels.put(Constants.LABEL_TYPE_KEY, Constants.LABEL_TYPE_NATIVE_TYPE); commonLabels.put(Constants.LABEL_APP_KEY, clusterId); return commonLabels; }
Source:
public void onPartitionsRevoked(Collection<TopicPartition> topicPartitions) { _logger.info("Partition ownership revoked for {}, checkpointing.", topicPartitions); _kafkaPositionTracker.ifPresent(tracker -> tracker.onPartitionsRevoked(topicPartitions)); if (!_shutdown && !topicPartitions.isEmpty()) { try { maybeCommitOffsets(_consumer, true); } catch (Exception e) { _logger.warn("Caught exception while trying to commit offsets in onPartitionsRevoked with partitions {}.", topicPartitions, e); } } Set<TopicPartition> newAssignment = new HashSet<>(_consumerAssignment); newAssignment.removeAll(topicPartitions); updateConsumerAssignment(newAssignment); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); }

Target:
public void onPartitionsRevoked(Collection<TopicPartition> topicPartitions) { _logger.info("Partition ownership revoked for {}, checkpointing.", topicPartitions); _kafkaPositionTracker.ifPresent(tracker -> tracker.onPartitionsRevoked(topicPartitions)); if (!_shutdown && !topicPartitions.isEmpty()) { try { maybeCommitOffsets(_consumer, true); } catch (Exception e) { _logger.warn("Caught exception while trying to commit offsets in onPartitionsRevoked with partitions {}.", topicPartitions, e); } } updateConsumerAssignment(_consumer.assignment()); _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); }
Source:
public void runApplication(StreamApplication streamApplication, String appName, Map<String, String> overriddenConfigs) { Map<String, String> configs = new HashMap<>(); configs.put("job.factory.class", "org.apache.samza.job.local.ThreadJobFactory"); configs.put("job.name", appName); configs.put("app.class", streamApplication.getClass().getCanonicalName()); configs.put("serializers.registry.json.class", "org.apache.samza.serializers.JsonSerdeFactory"); configs.put("serializers.registry.string.class", "org.apache.samza.serializers.StringSerdeFactory"); configs.put("systems.kafka.samza.factory", "org.apache.samza.system.kafka.KafkaSystemFactory"); configs.put("systems.kafka.consumer.zookeeper.connect", zkConnect()); configs.put("systems.kafka.producer.bootstrap.servers", bootstrapUrl()); configs.put("systems.kafka.samza.key.serde", "string"); configs.put("systems.kafka.samza.msg.serde", "string"); configs.put("systems.kafka.samza.offset.default", "oldest"); configs.put("job.coordinator.system", "kafka"); configs.put("job.default.system", "kafka"); configs.put("job.coordinator.replication.factor", "1"); configs.put("task.window.ms", "1000"); configs.put("task.checkpoint.factory", TestStreamManager.MockCheckpointManagerFactory.class.getName()); configs.put("task.shutdown.ms", "1"); if (overriddenConfigs != null) { configs.putAll(overriddenConfigs); } app = streamApplication; runner = (RemoteApplicationRunner) ApplicationRunner.fromConfig(new MapConfig(configs)); runner.run(streamApplication); StreamAssert.waitForComplete(); }

Target:
public void runApplication(StreamApplication streamApplication, String appName, Map<String, String> overriddenConfigs) { Map<String, String> configs = new HashMap<>(); configs.put("job.factory.class", "org.apache.samza.job.local.ThreadJobFactory"); configs.put("job.name", appName); configs.put("app.class", streamApplication.getClass().getCanonicalName()); configs.put("serializers.registry.json.class", "org.apache.samza.serializers.JsonSerdeFactory"); configs.put("serializers.registry.string.class", "org.apache.samza.serializers.StringSerdeFactory"); configs.put("systems.kafka.samza.factory", "org.apache.samza.system.kafka.KafkaSystemFactory"); configs.put("systems.kafka.consumer.zookeeper.connect", zkConnect()); configs.put("systems.kafka.producer.bootstrap.servers", bootstrapUrl()); configs.put("systems.kafka.samza.key.serde", "string"); configs.put("systems.kafka.samza.msg.serde", "string"); configs.put("systems.kafka.samza.offset.default", "oldest"); configs.put("job.coordinator.system", "kafka"); configs.put("job.default.system", "kafka"); configs.put("job.coordinator.replication.factor", "1"); configs.put("task.window.ms", "1000"); configs.put("task.checkpoint.factory", TestStreamManager.MockCheckpointManagerFactory.class.getName()); configs.put("task.shutdown.ms", "1"); if (overriddenConfigs != null) { configs.putAll(overriddenConfigs); } app = streamApplication; runner = (AbstractApplicationRunner) ApplicationRunner.fromConfig(new MapConfig(configs)); runner.run(streamApplication); StreamAssert.waitForComplete(); }
Source:
public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final InputStream is = inputStream; if (future.isStreamConsumed()) { if (is.markSupported()) is.reset(); else { LOGGER.warn("Stream has already been consumed and cannot be reset"); return; } } else { future.setStreamConsumed(true); } channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener( new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(is); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { if (cause instanceof IOException && StackTraceInspector.recoverOnChunkedUploadFailed(cause)) return false; return super.abortOnThrowable(channel, cause); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }

Target:
public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final InputStream is = inputStream; if (future.isStreamConsumed()) { if (is.markSupported()) is.reset(); else { LOGGER.warn("Stream has already been consumed and cannot be reset"); return; } } else { future.setStreamConsumed(true); } channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener( new WriteProgressListener(future, false, getContentLength()) { @Override public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(is); super.operationComplete(cf); } @Override protected boolean abortOnThrowable(Channel channel, Throwable cause) { return StackTraceInspector.recoverOnChunkedUploadFailed(cause) || super.abortOnThrowable(channel, cause); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); }
Source:
public PairSupplier<Q, E> create(Iterable<Q> queries, Iterable<E> endpoints) { LinkedList<Pair<Q, E>> tempList = new LinkedList<>(); Iterator<E> endpointIt = endpoints.iterator(); checkState(endpointIt.hasNext(), "Empty EndpointProvider"); if (queries == null) { while (endpointIt.hasNext()) { tempList.add(Pair.of(null, endpointIt.next())); } } else { Iterator<Q> queryIt = queries.iterator(); E currentEndpoint; Q currentQuery; while (endpointIt.hasNext() || queryIt.hasNext()) { if (!endpointIt.hasNext()) { endpointIt = endpoints.iterator(); } if (!queryIt.hasNext()) { queryIt = queries.iterator(); } currentEndpoint = endpointIt.next(); currentQuery = queryIt.next(); tempList.add(Pair.of(currentQuery, currentEndpoint)); } } return new PairSupplierImpl<>(ImmutableList.copyOf(tempList)); }

Target:
public PairSupplier<Q, E> create(Iterable<Q> queries, Iterable<E> endpoints) { ArrayList<Pair<Q, E>> tempList = new ArrayList<>(); Iterator<E> endpointIt = endpoints.iterator(); checkState(endpointIt.hasNext(), "Empty EndpointProvider"); if (queries == null) { while (endpointIt.hasNext()) { tempList.add(Pair.of(null, endpointIt.next())); } } else { Iterator<Q> queryIt = queries.iterator(); E currentEndpoint; Q currentQuery; while (endpointIt.hasNext() || queryIt.hasNext()) { if (!endpointIt.hasNext()) { endpointIt = endpoints.iterator(); } if (!queryIt.hasNext()) { queryIt = queries.iterator(); } currentEndpoint = endpointIt.next(); currentQuery = queryIt.next(); tempList.add(Pair.of(currentQuery, currentEndpoint)); } } return new PairSupplierImpl<>(ImmutableList.copyOf(tempList)); }
Source:
private ExtensionScript getExtScript() { if (extScript == null) { extScript = (ExtensionScript) Control .getSingleton() .getExtensionLoader() .getExtension(ExtensionScript.NAME); } return extScript; }

Target:
private ExtensionScript getExtScript() { if (extScript == null) { extScript = Control .getSingleton() .getExtensionLoader() .getExtension(ExtensionScript.class); } return extScript; }
Source:
private void saveProgramUrl(String programUrl) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences( context); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(context.getResources().getString(R.string.program_configuration_url), programUrl); editor.commit(); }

Target:
private void saveProgramUrl(String programUrl) { savePreference(context, R.string.program_configuration_url, programUrl); }
Source:
public Optional<Table> getTable(String databaseName, String tableName) { try { return retry() .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) .stopOnIllegalExceptions() .run("getTable", stats.getGetTable().wrap(() -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { Table table = client.getTable(databaseName, tableName); if (table.getTableType().equals(TableType.VIRTUAL_VIEW.name()) && !isPrestoView(table)) { throw new HiveViewNotSupportedException(new SchemaTableName(databaseName, tableName)); } return Optional.of(table); } })); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }

Target:
public Optional<Table> getTable(String databaseName, String tableName) { try { return retry() .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) .stopOnIllegalExceptions() .run("getTable", stats.getGetTable().wrap(() -> wrapMetastoreCallable((HiveMetastoreClient client, ThriftHiveMetastoreStats stat) -> stat.getGetTable().wrapCall(() -> { Table table = client.getTable(databaseName, tableName); if (table.getTableType().equals(TableType.VIRTUAL_VIEW.name()) && !isPrestoView(table)) { throw new HiveViewNotSupportedException(new SchemaTableName(databaseName, tableName)); } return Optional.of(table); })))); } catch (NoSuchObjectException e) { return Optional.empty(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }
Source:
public ScannerForMSBuild setUseDotNetCore(boolean useDotnetCore) { if (useDotnetCore && scannerVersion != null) { checkState(scannerVersion.isGreaterThanOrEquals(DOT_NET_CORE_INTRODUCTION_VERSION), "Version of ScannerForMSBuild should be higher than or equals to %s to be able to use .Net Core.", DOT_NET_CORE_INTRODUCTION_VERSION); } this.useDotnetCore = useDotnetCore; return this; }

Target:
public ScannerForMSBuild setUseDotNetCore(boolean useDotnetCore) { this.useDotnetCore = useDotnetCore; return this; }
Source:
public Set<Product> getProductsByUuidCached(Set<String> productUuids) { if (productUuids.size() == 0) { return new HashSet<>(); } Set<Product> products = new HashSet<>(); Set<String> productsNotInCache = new HashSet<>(); for (String uuid :productUuids) { if (currentSession().getSessionFactory().getCache().contains(this.entityType(), uuid)) { products.add(currentSession().get(Product.class, uuid)); } else { productsNotInCache.add(uuid); } } if (productsNotInCache.size() > 0) { log.debug("Loading objects that were not already in the cache: " + productsNotInCache.size()); Session session = this.currentSession(); java.util.List entities = session.byMultipleIds(this.entityType()) .enableSessionCheck(true) .multiLoad(new ArrayList(productsNotInCache)); products.addAll(entities); } for (Product product : products) { product.getAttributes().size(); product.getDependentProductIds().size(); for (ProductContent pc : product.getProductContent()) { pc.getContent().getModifiedProductIds().size(); } } return products; }

Target:
public Set<Product> getProductsByUuidCached(Set<String> productUuids) { if (productUuids.size() == 0) { return new HashSet<>(); } Set<Product> products = new HashSet<>(); Set<String> productsNotInCache = new HashSet<>(); Cache cache = currentSession().getSessionFactory().getCache(); for (String uuid : productUuids) { if (cache.contains(this.entityType(), uuid)) { products.add(currentSession().get(Product.class, uuid)); } else { productsNotInCache.add(uuid); } } if (productsNotInCache.size() > 0) { log.debug("Loading objects that were not already in the cache: " + productsNotInCache.size()); Session session = this.currentSession(); java.util.List entities = session.byMultipleIds(this.entityType()) .enableSessionCheck(true) .multiLoad(productsNotInCache.toArray(new String[productsNotInCache.size()])); products.addAll(entities); } for (Product product : products) { product.getAttributes().size(); product.getDependentProductIds().size(); for (ProductContent pc : product.getProductContent()) { pc.getContent().getModifiedProductIds().size(); } } return products; }
Source:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions = parseSpec.getDimensionsSpec().hasCustomDimensions() ? parseSpec.getDimensionsSpec().getDimensionNames() : Lists.newArrayList( Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: " + theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }

Target:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions = parseSpec.getDimensionsSpec().hasCustomDimensions() ? parseSpec.getDimensionsSpec().getDimensionNames() : Lists.newArrayList( Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }
Source:
public int write(ByteBuffer src) throws ClosedChannelException { if (!src.hasArray()) { throw new IllegalArgumentException( "NettyResponseChannel does not work with ByteBuffers that are not backed by " + "byte arrrays"); } return addToResponseBody(src); }

Target:
public int write(ByteBuffer src) throws ClosedChannelException { if (!src.hasArray()) { throw new IllegalArgumentException( "NettyResponseChannel does not work with ByteBuffers that are not backed by byte arrays"); } if (!responseMetadataWritten.get()) { maybeWriteResponseMetadata(responseMetadata); } verifyChannelActive(); int bytesWritten = 0; if (ctx.channel().isWritable()) { emptyingFlushRequired.set(true); int bytesToWrite = Math.min(src.remaining(), ctx.channel().config().getWriteBufferLowWaterMark()); logger.trace("Adding bytes of data to response on channel {}", bytesToWrite, ctx.channel()); ByteBuf buf = Unpooled.wrappedBuffer(src.array(), src.arrayOffset() + src.position(), bytesToWrite).order(src.order()); ChannelFuture writeFuture = writeToChannel(new DefaultHttpContent(buf), ChannelWriteType.Safe); if (!writeFuture.isDone() || writeFuture.isSuccess()) { bytesWritten = bytesToWrite; src.position(src.position() + bytesToWrite); } } else if (emptyingFlushRequired.compareAndSet(true, false)) { flush(); } return bytesWritten; }
Source:
public void play() { if (hasMediaSession()) { LOGD(TAG, "Start PLAY"); if (isEnded) { load(0); isEnded = false; stopTimer(); startTimer(); updateState(State.Playing); return; } mRemoteMediaPlayer.play(mApiClient).setResultCallback(new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() { @Override public void onResult(RemoteMediaPlayer.MediaChannelResult mediaChannelResult) { Status status = mediaChannelResult.getStatus(); LOGD(TAG, "play status " + status.isSuccess()); if (status.isSuccess()) { startTimer(); updateState(State.Playing); } } }); } }

Target:
public void play() { if (!hasMediaSession()) { return; } LOGD(TAG, "Start PLAY"); if (isEnded) { load(0); isEnded = false; stopTimer(); startTimer(); updateState(State.Playing); return; } mRemoteMediaPlayer.play(mApiClient).setResultCallback(new ResultCallback<RemoteMediaPlayer.MediaChannelResult>() { @Override public void onResult(RemoteMediaPlayer.MediaChannelResult mediaChannelResult) { Status status = mediaChannelResult.getStatus(); LOGD(TAG, "play status " + status.isSuccess()); if (status.isSuccess()) { startTimer(); updateState(State.Playing); } } }); }
Source:
public void test_IborInterpolatedRateObservation() { PricingEnvironment mockEnv = mock(PricingEnvironment.class); double rate3M = 0.0123d; double rate6M = 0.0234d; when(mockEnv.iborIndexRate(GBP_LIBOR_3M, FIXING_DATE)) .thenReturn(rate3M); when(mockEnv.iborIndexRate(GBP_LIBOR_6M, FIXING_DATE)) .thenReturn(rate6M); IborInterpolatedRateObservation ro = IborInterpolatedRateObservation.of(GBP_LIBOR_3M, GBP_LIBOR_6M, FIXING_DATE); ForwardIborInterpolatedRateObservationFn obs = ForwardIborInterpolatedRateObservationFn.DEFAULT; LocalDate fixingStartDate = ro.getShortIndex().calculateEffectiveFromFixing(ro.getFixingDate()); LocalDate fixingEndDate3M = ro.getShortIndex().calculateMaturityFromEffective(fixingStartDate); LocalDate fixingEndDate6M = ro.getLongIndex().calculateMaturityFromEffective(fixingStartDate); double days3M = fixingEndDate3M.toEpochDay() - ro.getFixingDate().toEpochDay(); double days6M = fixingEndDate6M.toEpochDay() - ro.getFixingDate().toEpochDay(); double daysCpn = ACCRUAL_END_DATE.toEpochDay() - ro.getFixingDate().toEpochDay(); double weight3M = (days6M - daysCpn) / (days6M - days3M); double weight6M = (daysCpn - days3M) / (days6M - days3M); double rateExpected = (weight3M * rate3M + weight6M * rate6M); double rateComputed = obs.rate(mockEnv, ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE); assertEquals(rateExpected, rateComputed, TOLERANCE_RATE, "DefaultIborInterpolatedRateProviderFn: rate on fixing date"); }

Target:
public void test_IborInterpolatedRateObservation() { PricingEnvironment mockEnv = mock(PricingEnvironment.class); double rate3M = 0.0123d; double rate6M = 0.0234d; when(mockEnv.iborIndexRate(GBP_LIBOR_3M, FIXING_DATE)) .thenReturn(rate3M); when(mockEnv.iborIndexRate(GBP_LIBOR_6M, FIXING_DATE)) .thenReturn(rate6M); IborInterpolatedRateObservation ro = IborInterpolatedRateObservation.of(GBP_LIBOR_3M, GBP_LIBOR_6M, FIXING_DATE); ForwardIborInterpolatedRateObservationFn obs = ForwardIborInterpolatedRateObservationFn.DEFAULT; LocalDate fixingStartDate = ro.getShortIndex().calculateEffectiveFromFixing(ro.getFixingDate()); LocalDate fixingEndDate3M = ro.getShortIndex().calculateMaturityFromEffective(fixingStartDate); LocalDate fixingEndDate6M = ro.getLongIndex().calculateMaturityFromEffective(fixingStartDate); double days3M = fixingEndDate3M.toEpochDay() - ro.getFixingDate().toEpochDay(); double days6M = fixingEndDate6M.toEpochDay() - ro.getFixingDate().toEpochDay(); double daysCpn = ACCRUAL_END_DATE.toEpochDay() - ro.getFixingDate().toEpochDay(); double weight3M = (days6M - daysCpn) / (days6M - days3M); double weight6M = (daysCpn - days3M) / (days6M - days3M); double rateExpected = (weight3M * rate3M + weight6M * rate6M); double rateComputed = obs.rate(mockEnv, ro, ACCRUAL_START_DATE, ACCRUAL_END_DATE); assertEquals(rateExpected, rateComputed, TOLERANCE_RATE); }
Source:
private void set(BigDecimal amount, final User player, final CommandSource sender) throws MaxMoneyException { BigDecimal minBalance = ess.getSettings().getMinMoney(); BigDecimal maxBalance = ess.getSettings().getMaxMoney(); boolean underMinimum = (amount.compareTo(minBalance) < 0); boolean aboveMax = (amount.compareTo(maxBalance) > 0); if (isPercent) { player.percentHandler(amount, sender, UserBalanceUpdateEvent.Cause.COMMAND_ECO, 2); } else { player.setMoney(underMinimum ? minBalance : aboveMax ? maxBalance : amount, UserBalanceUpdateEvent.Cause.COMMAND_ECO); player.sendMessage(tl("setBal", NumberUtil.displayCurrency(player.getMoney(), ess))); if (sender != null) { sender.sendMessage(tl("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess))); } } }

Target:
private void set(BigDecimal amount, final User player, final CommandSource sender) throws MaxMoneyException { BigDecimal minBalance = ess.getSettings().getMinMoney(); BigDecimal maxBalance = ess.getSettings().getMaxMoney(); boolean underMinimum = (amount.compareTo(minBalance) < 0); boolean aboveMax = (amount.compareTo(maxBalance) > 0); player.setMoney(underMinimum ? minBalance : aboveMax ? maxBalance : amount, UserBalanceUpdateEvent.Cause.COMMAND_ECO); player.sendMessage(tl("setBal", NumberUtil.displayCurrency(player.getMoney(), ess))); if (sender != null) { sender.sendMessage(tl("setBalOthers", player.getDisplayName(), NumberUtil.displayCurrency(player.getMoney(), ess))); } }
Source:
private String getWorldText(Future<ServerInfoMessage> info) { try { List<String> codedWorldInfo = new ArrayList<>(); ServerInfoMessage serverInfoMessage = info.get(); if(serverInfoMessage == null) return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); for (WorldInfo wi : serverInfoMessage.getWorldInfoList()) { float timeInDays = wi.getTime() / (float) WorldTime.DAY_LENGTH; codedWorldInfo.add(String.format("%s (%.2f days)", wi.getTitle(), timeInDays)); } return Joiner.on('\n').join(codedWorldInfo); } catch (ExecutionException | InterruptedException e) { return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); } }

Target:
private String getWorldText(Future<ServerInfoMessage> info) { try { List<String> codedWorldInfo = new ArrayList<>(); ServerInfoMessage serverInfoMessage = info.get(); if (serverInfoMessage == null) { return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); } for (WorldInfo wi : serverInfoMessage.getWorldInfoList()) { float timeInDays = wi.getTime() / (float) WorldTime.DAY_LENGTH; codedWorldInfo.add(String.format("%s (%.2f days)", wi.getTitle(), timeInDays)); } return Joiner.on('\n').join(codedWorldInfo); } catch (ExecutionException | InterruptedException e) { return FontColor.getColored(translationSystem.translate("${engine:menu#connection-failed}"), Color.RED); } }
Source:
private RTCPReportBlock[] makeReportBlocks() { if (stream == null) { logger.warn("stream is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } StreamRTPManager streamRTPManager = stream.getStreamRTPManager(); if (streamRTPManager == null) { logger.warn("streamRTPManager is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } Collection<ReceiveStream> receiveStreams = stream.getReceiveStreams(); if (receiveStreams == null || receiveStreams.isEmpty()) { logger.info( "There are no receive streams to build report blocks for."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } SSRCCache cache = stream.getRTPTranslator().getSSRCCache(); if (cache == null) { logger.info("cache is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } Collection<RTCPReportBlock> reportBlocks = new ArrayList<>(); for (ReceiveStream receiveStream : receiveStreams) { SSRCInfo info = cache.cache.get((int) receiveStream.getSSRC()); if (info == null) { logger.warn("We have a ReceiveStream but not an SSRCInfo for " + "that ReceiveStream."); continue; } if (!info.ours && info.sender) { RTCPReportBlock reportBlock = info.makeReceiverReport(getLastProcessTime()); reportBlocks.add(reportBlock); } } return reportBlocks.toArray(new RTCPReportBlock[reportBlocks.size()]); }

Target:
private RTCPReportBlock[] makeReportBlocks() { if (stream == null) { logger.warn("stream is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } StreamRTPManager streamRTPManager = stream.getStreamRTPManager(); if (streamRTPManager == null) { logger.warn("streamRTPManager is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } Collection<ReceiveStream> receiveStreams = stream.getReceiveStreams(); if (receiveStreams == null || receiveStreams.isEmpty()) { logger.debug( "There are no receive streams to build report blocks for."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } SSRCCache cache = stream.getRTPTranslator().getSSRCCache(); if (cache == null) { logger.info("cache is null."); return MIN_RTCP_REPORT_BLOCKS_ARRAY; } Collection<RTCPReportBlock> reportBlocks = new ArrayList<>(); for (ReceiveStream receiveStream : receiveStreams) { SSRCInfo info = cache.cache.get((int) receiveStream.getSSRC()); if (info == null) { logger.warn("We have a ReceiveStream but not an SSRCInfo for " + "that ReceiveStream."); continue; } if (!info.ours && info.sender) { RTCPReportBlock reportBlock = info.makeReceiverReport(getLastProcessTime()); reportBlocks.add(reportBlock); } } return reportBlocks.toArray(new RTCPReportBlock[reportBlocks.size()]); }
Source:
public void testAllThreadsAreStopped() throws Exception { PooledExecutionServiceConfiguration configuration = new PooledExecutionServiceConfiguration(); configuration.addDefaultPool("dflt", 0, 1); PooledExecutionService pooledExecutionService = new PooledExecutionService(configuration); pooledExecutionService.start(null); pooledExecutionService.getScheduledExecutor("dflt") .schedule(new Runnable() { @Override public void run() { }}, 10, TimeUnit.HOURS); pooledExecutionService.stop(); Set<Thread> threadSet = Thread.getAllStackTraces().keySet(); for(Thread thread : threadSet) { assertThat(thread.getName()).doesNotContain("pool"); } }

Target:
public void testAllThreadsAreStopped() throws Exception { PooledExecutionServiceConfiguration configuration = new PooledExecutionServiceConfiguration(); configuration.addDefaultPool("dflt", 0, 1); pooledExecutionService = new PooledExecutionService(configuration); pooledExecutionService.start(null); final CountDownLatch latch = new CountDownLatch(1); pooledExecutionService.getScheduledExecutor("dflt") .execute(new Runnable() { @Override public void run() { latch.countDown(); }}); latch.await(30, TimeUnit.SECONDS); pooledExecutionService.stop(); detectLeakingThreads(); }
Source:
public static List<URL> readAllDepsAsUrls(List<String> prjDeps) { List<URL> deps = new ArrayList<>(); for(String dep:prjDeps){ try { deps.add(new URL(dep)); }catch (MalformedURLException e){ logger.error(e.getMessage()); } } if(deps.size()>0) { return deps; }else{ return Collections.emptyList(); } }

Target:
public static List<URL> readAllDepsAsUrls(List<String> prjDeps) { List<URL> deps = new ArrayList<>(); for (String dep : prjDeps) { try { deps.add(new URL(dep)); } catch (MalformedURLException e) { logger.error(e.getMessage()); } } return deps; }
Source:
public MutableRate getApplyTransactionLatency() { return applyTransactionLatency; }

Target:
public MutableRate getApplyTransactionLatency() { return applyTransaction; }
Source:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/applications"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); String jsonResponse = clientResponse.getEntity(String.class); List<Application> applications = getJsonParser().readValue(jsonResponse, new TypeReference<List<Application>>() { }); for (Application application : applications) { getOut().printf("%20s %10s\n",application.getSpec().getName(), application.getStatus()); } }

Target:
public void run() throws Exception { WebResource webResource = getClient().resource(endpoint + "/v1/applications"); ClientResponse clientResponse = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); if (clientResponse.getStatus() != Response.Status.OK.getStatusCode()) { String err = getErrorMessage(clientResponse); throw new CommandExecutionException(err); } String jsonResponse = clientResponse.getEntity(String.class); List<Application> applications = getJsonParser().readValue(jsonResponse, new TypeReference<List<Application>>() {}); for (Application application : applications) { getOut().printf("%s [%s]\n",application.getSpec().getName(), application.getStatus()); } }
Source:
public boolean isContainerRunning(String container) throws IOException, InterruptedException { ProcessBuilder pBuilder = cmd("ps").add("-q", "--filter", "\"id=" + container + '"').build(); Process psProcess = pBuilder.start(); psProcess.waitFor(); if (psProcess.exitValue() == 0) { String psOutput = IOUtils.toString(psProcess.getInputStream()); if (psOutput.contains(container)) { return true; } } return false; }

Target:
public boolean isContainerRunning(String container) throws IOException, InterruptedException { ProcessBuilder pBuilder = cmd("ps").add("-q", "--filter", "\"id=" + container + '"').build(); Process psProcess = pBuilder.start(); String psOutput = IOUtils.toString(psProcess.getInputStream()); int pExit = psProcess.waitFor(); if (pExit == 0) { return psOutput.contains(container); } System.err.println("docker ps failed with code: " + pExit + (psOutput != null ? " and output: " + psOutput : " and provided no output")); return false; }
Source:
public void afterPropertiesSet() throws Exception { try { String[] flowIds = flowDefinitionRegistry.getFlowDefinitionIds(); flowIds = (String[]) ArrayUtils.removeElement(flowIds, FLOW_ID_LOGIN); LOGGER.debug("Detected flow configurations: [{}]", flowIds.length, Arrays.toString(flowIds)); LOGGER.debug("Configuring webflow for multifactor authentication..."); setupWebflow(flowIds); LOGGER.debug("Configured webflow for multifactor authentication."); LOGGER.debug("Registering default credentials-to-principal resolver..."); final List resolvers = this.context.getBean("mfaCredentialsToPrincipalResolvers", List.class); final UsernamePasswordCredentialsToPrincipalResolver defaultResolver = new UsernamePasswordCredentialsToPrincipalResolver(); final IPersonAttributeDao attributeRepository = this.context.getBean("attributeRepository", IPersonAttributeDao.class); defaultResolver.setAttributeRepository(attributeRepository); resolvers.add(defaultResolver); LOGGER.debug("Registered default credentials-to-principal resolver."); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } }

Target:
public void afterPropertiesSet() throws Exception { try { String[] flowIds = flowDefinitionRegistry.getFlowDefinitionIds(); flowIds = (String[]) ArrayUtils.removeElement(flowIds, FLOW_ID_LOGIN); LOGGER.debug("Detected flow configurations: [{}]", flowIds.length, Arrays.toString(flowIds)); LOGGER.debug("Configuring webflow for multifactor authentication..."); setupWebflow(flowIds); LOGGER.debug("Configured webflow for multifactor authentication."); LOGGER.debug("Registering default credentials-to-principal resolver..."); registerDefaultCredentialsToPrincipalResolver(); LOGGER.debug("Registered default credentials-to-principal resolver."); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } }
Source:
public void removePreAllocation(QueryId queryId) { synchronized (this) { preAllocations.remove(queryId); } MemoryPoolInfo info = pools.get(GENERAL_POOL).getInfo(); for (Consumer<MemoryPoolInfo> listener : changeListeners.get(GENERAL_POOL)) { listenerExecutor.execute(() -> listener.accept(info)); } }

Target:
public synchronized void removePreAllocation(QueryId queryId) { preAllocations.remove(queryId); MemoryPoolInfo info = pools.get(GENERAL_POOL).getInfo(); for (Consumer<MemoryPoolInfo> listener : changeListeners.get(GENERAL_POOL)) { listenerExecutor.execute(() -> listener.accept(info)); } }
Source:
public static void serialize(ByteBuffer outputBuffer, UpdateRecord updateRecord) { int startOffset = outputBuffer.position(); outputBuffer.putShort(Update_Version_V3); outputBuffer.putShort(updateRecord.getAccountId()); outputBuffer.putShort(updateRecord.getContainerId()); outputBuffer.putLong(updateRecord.getUpdateTimeInMs()); outputBuffer.putShort((short) updateRecord.getType().ordinal()); switch (updateRecord.getType()) { case DELETE: Delete_Format_V1.serialize(outputBuffer, updateRecord.getDeleteRecord()); break; default: throw new IllegalArgumentException("Unknown update record type: " + updateRecord.getType()); } Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getRecordSize(updateRecord.getType()) - Crc_Size); outputBuffer.putLong(crc.getValue()); }

Target:
public static void serialize(ByteBuffer outputBuffer, UpdateRecord updateRecord) { int startOffset = outputBuffer.position(); outputBuffer.putShort(Update_Version_V3); outputBuffer.putShort(updateRecord.getAccountId()); outputBuffer.putShort(updateRecord.getContainerId()); outputBuffer.putLong(updateRecord.getUpdateTimeInMs()); outputBuffer.putShort((short) updateRecord.getType().ordinal()); switch (updateRecord.getType()) { case DELETE: Delete_Sub_Format_V1.serialize(outputBuffer, updateRecord.getDeleteSubRecord()); break; default: throw new IllegalArgumentException("Unknown update record type: " + updateRecord.getType()); } Crc32 crc = new Crc32(); crc.update(outputBuffer.array(), startOffset, getRecordSize(updateRecord.getType()) - Crc_Size); outputBuffer.putLong(crc.getValue()); }