auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onMessage(ChillModeStatus chillModeStatus, EventPublisher publisher) { isInChillMode.set(chillModeStatus.getChillModeStatus()); scmClientProtocolServer.setChillModeStatus(isInChillMode.get()); scmBlockManager.setChillModeStatus(isInChillMode.get()); if (!isInChillMode.get()) { final Thread chillModeExitThread = new Thread(() -> { try { Thread.sleep(waitTime); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } replicationManager.start(); pipelineCleanupThread.start(); }); chillModeExitThread.setDaemon(true); chillModeExitThread.start(); } }

Target:
public void onMessage(ChillModeStatus chillModeStatus, EventPublisher publisher) { isInChillMode.set(chillModeStatus.getChillModeStatus()); scmClientProtocolServer.setChillModeStatus(isInChillMode.get()); scmBlockManager.setChillModeStatus(isInChillMode.get()); if (!isInChillMode.get()) { final Thread chillModeExitThread = new Thread(() -> { try { Thread.sleep(waitTime); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } replicationManager.start(); cleanupPipelines(); }); chillModeExitThread.setDaemon(true); chillModeExitThread.start(); } }
Source:
public SynchronousDispatcherMessageHandler(Processor processor) { Assert.notNull(processor, "ReactorModule cannot be null."); this.reactorProcessor = processor; Environment.initializeIfEmpty(); Method method = ReflectionUtils.findMethod(this.reactorProcessor.getClass(), "process", Stream.class); this.inputType = ResolvableType.forMethodParameter(method, 0).getNested(2); this.stream = Streams.broadcast(); Stream<?> outputStream = processor.process(stream); outputStream.when(Throwable.class, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) { logger.error(throwable); } }); this.consume = outputStream.consume(new Consumer<Object>() { @Override public void accept(Object outputObject) { if (ClassUtils.isAssignable(Message.class, outputObject.getClass())) { getOutputChannel().send((Message) outputObject); } else { getOutputChannel().send(MessageBuilder.withPayload(outputObject).build()); } } }); if (logger.isDebugEnabled()) { logger.debug(consume.debug()); } }

Target:
public SynchronousDispatcherMessageHandler(Processor processor) { Assert.notNull(processor, "processor cannot be null."); this.reactorProcessor = processor; Environment.initializeIfEmpty(); Method method = ReflectionUtils.findMethod(this.reactorProcessor.getClass(), "process", Stream.class); this.inputType = ResolvableType.forMethodParameter(method, 0).getNested(2); this.stream = Streams.broadcast(); Stream<?> outputStream = processor.process(stream); outputStream.when(Throwable.class, new Consumer<Throwable>() { @Override public void accept(Throwable throwable) { logger.error(throwable); } }); this.consume = outputStream.consume(new Consumer<Object>() { @Override public void accept(Object outputObject) { if (ClassUtils.isAssignable(Message.class, outputObject.getClass())) { getOutputChannel().send((Message) outputObject); } else { getOutputChannel().send(MessageBuilder.withPayload(outputObject).build()); } } }); if (logger.isDebugEnabled()) { logger.debug(consume.debug()); } }
Source:
public String filter(URL sourceUrl, Map<String, String[]> sourceMetadata, String urlToFilter) { if (!ignoreOutsideHost && !ignoreOutsideDomain) { return urlToFilter; } URL tURL; try { tURL = new URL(urlToFilter); } catch (MalformedURLException e1) { return null; } String fromHost; String fromDomain = null; if (sourceUrl == previousSourceUrl) { fromHost = previousSourceHost; if (ignoreOutsideDomain) { fromDomain = previousSourceDomain; } } else { fromHost = sourceUrl.getHost(); if (ignoreOutsideDomain) { fromDomain = PaidLevelDomain.getPLD(fromHost); } previousSourceHost = fromHost; previousSourceDomain = fromDomain; previousSourceUrl = sourceUrl; } String toHost = tURL.getHost(); if (ignoreOutsideHost) { if (toHost == null || !toHost.equalsIgnoreCase(fromHost)) { return null; } } if (ignoreOutsideDomain) { String toDomain = PaidLevelDomain.getPLD(toHost); if (toDomain == null || !toDomain.equals(fromDomain)) { return null; } } return urlToFilter; }

Target:
public String filter(URL sourceUrl, Map<String, String[]> sourceMetadata, String urlToFilter) { if (sourceUrl == null || (!ignoreOutsideHost && !ignoreOutsideDomain)) { return urlToFilter; } URL tURL; try { tURL = new URL(urlToFilter); } catch (MalformedURLException e1) { return null; } String fromHost; String fromDomain = null; if (sourceUrl == previousSourceUrl) { fromHost = previousSourceHost; if (ignoreOutsideDomain) { fromDomain = previousSourceDomain; } } else { fromHost = sourceUrl.getHost(); if (ignoreOutsideDomain) { fromDomain = PaidLevelDomain.getPLD(fromHost); } previousSourceHost = fromHost; previousSourceDomain = fromDomain; previousSourceUrl = sourceUrl; } String toHost = tURL.getHost(); if (ignoreOutsideHost) { if (toHost == null || !toHost.equalsIgnoreCase(fromHost)) { return null; } } if (ignoreOutsideDomain) { String toDomain = PaidLevelDomain.getPLD(toHost); if (toDomain == null || !toDomain.equals(fromDomain)) { return null; } } return urlToFilter; }
Source:
public Stream<JacksonHandle> split(InputStream input) throws Exception { Iterator<JsonNode> nodeItr = configureObjReader().readValues(input); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(nodeItr, Spliterator.ORDERED), false) .map(JacksonHandle::new); }

Target:
public Stream<JacksonHandle> split(InputStream input) throws Exception { if(input == null) { throw new IllegalArgumentException("InputSteam cannot be null."); } Iterator<JsonNode> nodeItr = configureObjReader().readValues(input); return StreamSupport.stream(Spliterators.spliteratorUnknownSize(nodeItr, Spliterator.ORDERED), false) .map(this::wrapJacksonHandle); }
Source:
public void removeMappings(Collection<IgniteTxKey> keys) { ArrayList<UUID> clearedMappings = new ArrayList<>(); for (IgniteTxKey key : keys) { ClusterNode node = cctx.cacheContext(key.cacheId()).cache().affinity() .mapPartitionToPrimaryAndBackups(key.key().partition()).iterator().next(); GridDistributedTxMapping m = mappings.get(node.id()); if (m != null) { m.evictReaders(Collections.singletonList(key)); clearedMappings.add(node.id()); } } for (UUID id : clearedMappings) { GridDistributedTxMapping mapping = mappings.get(id); if (mapping == null || mapping.empty()) mappings.remove(id); } }

Target:
public void removeMappings(Collection<IgniteTxKey> keys) { for (IgniteTxKey key : keys) { ClusterNode node = cctx.cacheContext(key.cacheId()).cache().affinity() .mapPartitionToNode(key.key().partition()); GridDistributedTxMapping mapping = mappings.get(node.id()); if (mapping != null) { mapping.evictReaders(Collections.singletonList(key)); if (mapping.empty()) mappings.remove(node.id()); } } }
Source:
public HttpUriRequest getRedirect( final HttpRequest request, final HttpResponse response, final HttpContext context ) throws ProtocolException { final URI uri = getLocationURI( request, response, context ); final String method = request.getRequestLine().getMethod(); if ( method.equalsIgnoreCase( HttpHead.METHOD_NAME ) ) { return new HttpHead( uri ); } else if ( method.equalsIgnoreCase( HttpGet.METHOD_NAME ) ) { return new HttpGet( uri ); } else { return RequestBuilder.copy( request ).setUri( uri ).build(); } }

Target:
public HttpUriRequest getRedirect( final HttpRequest request, final HttpResponse response, final HttpContext context ) throws ProtocolException { final URI uri = getLocationURI( request, response, context ); return RequestBuilder.copy( request ).setUri( uri ).build(); }
Source:
public void afterFromProto(MessageOrBuilder proto) { condition = ZoomConvert.fromProto(proto, Condition.class); Topology.Rule rule = (Topology.Rule) proto; if (rule.getType() == Topology.Rule.Type.NAT_RULE && rule.getMatchForwardFlow()) { ForwardNatRule natRule = (ForwardNatRule) this; natRule.buildFields(); } validateProto(rule); }

Target:
public void afterFromProto(MessageOrBuilder proto) { condition = ZoomConvert.fromProto(proto, Condition.class); validateProto((Topology.Rule) proto); }
Source:
static String getUnresolvedSchemaName(final Schema schema) { String name = schema.getProp(UR_SCHEMA_ATTR); if (name == null) { throw new IllegalArgumentException("Schema " + schema + " is not a unresolved schema"); } else { return name; } }

Target:
static String getUnresolvedSchemaName(final Schema schema) { if (!isUnresolvedSchema(schema)) { throw new IllegalArgumentException("Not a unresolved schema: " + schema); } return schema.getProp(UR_SCHEMA_ATTR); }
Source:
public void killAll() throws IOException { log.info("Deleting all segment files from Azure storage location [bucket: '%s' prefix: '%s']", segmentConfig.getContainer(), segmentConfig.getPrefix() ); try { AzureUtils.deleteObjectsInPath( azureStorage, inputDataConfig, accountConfig, azureCloudBlobIterableFactory, segmentConfig.getContainer(), segmentConfig.getPrefix(), Predicates.alwaysTrue() ); } catch (Exception e) { log.error("Error occurred while deleting segment files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }

Target:
public void killAll() throws IOException { log.info( "Deleting all segment files from Azure storage location [bucket: '%s' prefix: '%s']", segmentConfig.getContainer(), segmentConfig.getPrefix() ); try { AzureUtils.deleteObjectsInPath( azureStorage, inputDataConfig, accountConfig, azureCloudBlobIterableFactory, segmentConfig.getContainer(), segmentConfig.getPrefix(), Predicates.alwaysTrue() ); } catch (Exception e) { log.error("Error occurred while deleting segment files from Azure. Error: %s", e.getMessage()); throw new IOException(e); } }
Source:
public void getSegmentFiles(DataSegment segment, File outDir) throws SegmentLoadingException { String key = (String) segment.getLoadSpec().get("key"); log.info("Pulling index from C* at path[%s] to outDir[%s]", key, outDir); if (!outDir.exists()) { outDir.mkdirs(); } if (!outDir.isDirectory()) { throw new ISE("outDir[%s] must be a directory.", outDir); } long startTime = System.currentTimeMillis(); ObjectMetadata meta = null; try { final File outFile = new File(outDir, "index.zip"); log.info("Writing to [" + outFile.getAbsolutePath() + "]"); OutputStream os = Files.newOutputStreamSupplier(outFile).getOutput(); meta = ChunkedStorage .newReader(indexStorage, key, os) .withBatchSize(BATCH_SIZE) .withConcurrencyLevel(CONCURRENCY) .call(); os.close(); CompressionUtils.unzip(outFile, outDir); } catch (Exception e) { throw Throwables.propagate(e); } log.info("Pull of file[%s] completed in %,d millis (%s bytes)", key, System.currentTimeMillis() - startTime, meta.getObjectSize()); }

Target:
public void getSegmentFiles(DataSegment segment, File outDir) throws SegmentLoadingException { String key = (String) segment.getLoadSpec().get("key"); log.info("Pulling index from C* at path[%s] to outDir[%s]", key, outDir); if (!outDir.exists()) { outDir.mkdirs(); } if (!outDir.isDirectory()) { throw new ISE("outDir[%s] must be a directory.", outDir); } long startTime = System.currentTimeMillis(); ObjectMetadata meta = null; final File outFile = new File(outDir, "index.zip"); try { try { log.info("Writing to [%s]", outFile.getAbsolutePath()); OutputStream os = Files.newOutputStreamSupplier(outFile).getOutput(); meta = ChunkedStorage .newReader(indexStorage, key, os) .withBatchSize(BATCH_SIZE) .withConcurrencyLevel(CONCURRENCY) .call(); os.close(); CompressionUtils.unzip(outFile, outDir); } catch (Exception e) { FileUtils.deleteDirectory(outDir); } } catch (Exception e) { throw new SegmentLoadingException(e, e.getMessage()); } log.info("Pull of file[%s] completed in %,d millis (%s bytes)", key, System.currentTimeMillis() - startTime, meta.getObjectSize()); }
Source:
private static InternalTask createTask(Job userJob, NativeTask task) throws JobCreationException { if (((task.getCommandLine() == null) || (task.getCommandLine().length == 0))) { String msg = "The command line is null or empty and not generated !"; logger.info(msg); throw new JobCreationException(msg); } try { String commandAndArguments = "\"" + Joiner.on("\" \"").join(task.getCommandLine()) + "\""; InternalTask scriptTask; if (isForkingTask()) { scriptTask = new InternalForkedScriptTask(new ScriptExecutableContainer( new TaskScript(new SimpleScript(commandAndArguments, "native")))); if (isRunAsMeTask()) { task.setRunAsMe(true); scriptTask.setRunAsMe(true); } } else { scriptTask = new InternalScriptTask(new ScriptExecutableContainer( new TaskScript(new SimpleScript(commandAndArguments, "native")))); } ForkEnvironment forkEnvironment = new ForkEnvironment(); scriptTask.setForkEnvironment(forkEnvironment); setTaskCommonProperties(userJob, task, scriptTask); return scriptTask; } catch (Exception e) { throw new JobCreationException(e); } }

Target:
private static InternalTask createTask(Job userJob, NativeTask task) throws JobCreationException { if (((task.getCommandLine() == null) || (task.getCommandLine().length == 0))) { String msg = "The command line is null or empty and not generated !"; logger.info(msg); throw new JobCreationException(msg); } try { String commandAndArguments = "\"" + Joiner.on("\" \"").join(task.getCommandLine()) + "\""; InternalTask scriptTask; if (isForkingTask()) { scriptTask = new InternalForkedScriptTask(new ScriptExecutableContainer( new TaskScript(new SimpleScript(commandAndArguments, "native")))); configureRunAsMe(task); } else { scriptTask = new InternalScriptTask(new ScriptExecutableContainer( new TaskScript(new SimpleScript(commandAndArguments, "native")))); } ForkEnvironment forkEnvironment = new ForkEnvironment(); scriptTask.setForkEnvironment(forkEnvironment); setTaskCommonProperties(userJob, task, scriptTask); return scriptTask; } catch (Exception e) { throw new JobCreationException(e); } }
Source:
public FEELFnResult<Boolean> invoke(@ParameterName("input") String input, @ParameterName("pattern") String pattern, @ParameterName("flags") String flags) { if ( input == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "input", "cannot be null" ) ); } if ( pattern == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "cannot be null" ) ); } try { int f = processFlags( flags ); Pattern p = Pattern.compile( pattern, f ); Matcher m = p.matcher( input ); return FEELFnResult.ofResult( m.find() ); } catch ( PatternSyntaxException e ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", e ) ); } catch ( IllegalArgumentException t ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) ); } }

Target:
public FEELFnResult<Boolean> invoke(@ParameterName("input") String input, @ParameterName("pattern") String pattern, @ParameterName("flags") String flags) { if ( input == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "input", "cannot be null" ) ); } if ( pattern == null ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "cannot be null" ) ); } try { int f = processFlags( flags ); Pattern p = Pattern.compile( pattern, f ); Matcher m = p.matcher( input ); return FEELFnResult.ofResult( m.find() ); } catch ( PatternSyntaxException e ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", e ) ); } catch ( IllegalArgumentException t ) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "flags", "contains unknown flags", t ) ); } catch ( Throwable t) { return FEELFnResult.ofError( new InvalidParametersEvent( Severity.ERROR, "pattern", "is invalid and can not be compiled", t ) ); } }
Source:
public int compare(File a, File b) { if (a.getPath().endsWith(".module.ts")) { return 1; } else if (b.getPath().endsWith(".module.ts")) { return -1; } return 0; }

Target:
public int compare(File a, File b) { boolean isAModule = a.getPath().endsWith(".module.ts"); boolean isBModule = b.getPath().endsWith(".module.ts"); if (isAModule && !isBModule) { return 1; } else if (isBModule && !isAModule) { return -1; } else { return a.getAbsolutePath().compareTo(b.getAbsolutePath()); } }
Source:
private void updateCaret() { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) { return; } StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) { Assert.isTrue(fNonDefaultCaret == null); } else if (fIsOverwriting) { fNonDefaultCaret= createOverwriteCaret(styledText); } else if (SMART_INSERT == mode) { fNonDefaultCaret= createInsertCaret(styledText); } else if (INSERT == mode) { fNonDefaultCaret= createRawInsertModeCaret(styledText); } if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) { styledText.setCaret(fInitialCaret); } }

Target:
private void updateCaret() { if (fSourceViewer == null || fSourceViewer.getTextWidget() == null) { return; } StyledText styledText= fSourceViewer.getTextWidget(); InsertMode mode= getInsertMode(); styledText.setCaret(null); disposeNonDefaultCaret(); if (getPreferenceStore() == null || !getPreferenceStore().getBoolean(PREFERENCE_USE_CUSTOM_CARETS)) Assert.isTrue(fNonDefaultCaret == null); else if (fIsOverwriting) fNonDefaultCaret= createOverwriteCaret(styledText); else if (SMART_INSERT == mode) fNonDefaultCaret= createInsertCaret(styledText); else if (INSERT == mode) fNonDefaultCaret= createRawInsertModeCaret(styledText); if (fNonDefaultCaret != null) { styledText.setCaret(fNonDefaultCaret); fNonDefaultCaretImage= fNonDefaultCaret.getImage(); } else if (fInitialCaret != styledText.getCaret()) styledText.setCaret(fInitialCaret); }
Source:
public static List<String> readStringArray(DataInput in) throws IOException { int count = WritableUtils.readVInt(in); if(count == 0) { return null; } List<String> values = Lists.newArrayListWithCapacity(count); for(int i = 0; i < count; i++) { values.add(readString(in)); } return values; }

Target:
private static List<String> readStringArray(DataInput in) throws IOException { int count = WritableUtils.readVInt(in); if (count == 0) { return null; } List<String> values = Lists.newArrayListWithCapacity(count); for (int i = 0; i < count; i++) { values.add(readString(in)); } return values; }
Source:
public void parse_shouldReturnAnMrrtTemplateObjectIfFileIsValid() throws Exception { String templateContent = getFileContent("mrrttemplates/ihe/connectathon/2015/CTChestAbdomen.html"); MrrtReportTemplate template = parser.parse(templateContent); Date dcTermsDate = new SimpleDateFormat("yyyy-MM-dd").parse(TEST_DCTERMS_DATE); assertNotNull(template); assertThat(template.getCharset(), is(CHARSET)); assertThat(template.getDcTermsTitle(), is(TEST_DCTERMS_TITLE)); assertThat(template.getDcTermsDescription(), is(TEST_DCTERMS_DESCRIPTION)); assertThat(template.getDcTermsIdentifier(), is(TEST_DCTERMS_IDENTIFIER)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsType(), is(TEST_DCTERMS_TYPE)); assertThat(template.getDcTermsPublisher(), is(TEST_DCTERMS_PUBLISHER)); assertThat(template.getDcTermsRights(), is(TEST_DCTERMS_RIGHTS)); assertThat(template.getDcTermsLicense(), is(TEST_DCTERMS_LICENSE)); assertThat(template.getDcTermsDate(), is(dcTermsDate)); assertThat(template.getDcTermsCreator(), is(TEST_DCTERMS_CREATOR)); }

Target:
public void parse_shouldReturnAnMrrtTemplateObjectIfFileIsValid() throws Exception { String templateContent = getFileContent("mrrttemplates/ihe/connectathon/2015/CTChestAbdomen.html"); MrrtReportTemplate template = parser.parse(templateContent); Date dcTermsDate = new SimpleDateFormat(MrrtReportTemplateConstants.DATE_FORMAT).parse(TEST_DCTERMS_DATE); assertNotNull(template); assertThat(template.getCharset(), is(CHARSET)); assertThat(template.getDcTermsTitle(), is(TEST_DCTERMS_TITLE)); assertThat(template.getDcTermsDescription(), is(TEST_DCTERMS_DESCRIPTION)); assertThat(template.getDcTermsIdentifier(), is(TEST_DCTERMS_IDENTIFIER)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsLanguage(), is(TEST_DCTERMS_LANGUAGE)); assertThat(template.getDcTermsType(), is(TEST_DCTERMS_TYPE)); assertThat(template.getDcTermsPublisher(), is(TEST_DCTERMS_PUBLISHER)); assertThat(template.getDcTermsRights(), is(TEST_DCTERMS_RIGHTS)); assertThat(template.getDcTermsLicense(), is(TEST_DCTERMS_LICENSE)); assertThat(template.getDcTermsDate(), is(dcTermsDate)); assertThat(template.getDcTermsCreator(), is(TEST_DCTERMS_CREATOR)); }
Source:
public String getModel() throws KuraException { synchronized (atLock) { if (this.model == null) { logger.debug("sendCommand getModelNumber :: {}", HspaModemAtCommands.getModelNumber.getCommand()); byte[] reply; CommConnection commAtConnection = openSerialPort(getAtPort()); if (!isAtReachable(commAtConnection)) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.NOT_CONNECTED, MODEM_NOT_AVAILABLE_FOR_AT_CMDS_MSG); } try { reply = commAtConnection.sendCommand(HspaModemAtCommands.getModelNumber.getCommand().getBytes(), 1000, 100); } catch (IOException e) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } closeSerialPort(commAtConnection); if (reply != null) { this.model = getResponseString(reply); } } } return this.model; }

Target:
public String getModel() throws KuraException { synchronized (this.atLock) { if (this.model == null) { logger.debug("sendCommand getModelNumber :: {}", HspaModemAtCommands.getModelNumber.getCommand()); byte[] reply; CommConnection commAtConnection = openSerialPort(getAtPort()); if (!isAtReachable(commAtConnection)) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.NOT_CONNECTED, MODEM_NOT_AVAILABLE_FOR_AT_CMDS_MSG); } try { reply = commAtConnection.sendCommand(HspaModemAtCommands.getModelNumber.getCommand().getBytes(), 1000, 100); } catch (IOException e) { closeSerialPort(commAtConnection); throw new KuraException(KuraErrorCode.CONNECTION_FAILED, e); } closeSerialPort(commAtConnection); if (reply != null) { this.model = getResponseString(reply); } } } return this.model; }
Source:
ScopePassingSpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing) { this.subscriber = subscriber; this.tracing = tracing; Span root = ctx != null ? ctx.getOrDefault(Span.class, tracing.tracer().currentSpan()) : null; this.spanTraceContext = root != null ? root.context() : null; this.context = ctx != null && root != null ? ctx.put(Span.class, root) : ctx != null ? ctx : Context.empty(); if (log.isTraceEnabled()) { log.trace("Root span [" + root + "], context [" + this.context + "]"); } }

Target:
ScopePassingSpanSubscriber(Subscriber<? super T> subscriber, Context ctx, Tracing tracing) { this.subscriber = subscriber; this.currentTraceContext = tracing.currentTraceContext(); Span root = ctx != null ? ctx.getOrDefault(Span.class, tracing.tracer().currentSpan()) : null; this.spanTraceContext = root != null ? root.context() : null; this.context = ctx != null && root != null ? ctx.put(Span.class, root) : ctx != null ? ctx : Context.empty(); if (log.isTraceEnabled()) { log.trace("Root span [" + root + "], context [" + this.context + "]"); } }
Source:
public void setTimerForDBCleanUpTask() { ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); scheduledExecutorService.scheduleWithFixedDelay(new Runnable() { public void run() { LOG.debug("Deleting expired_objects from database."); persistenceService.deleteAllExpiredObjects(); } }, configurationService.get().getDbCleanupIntervalInHours(), configurationService.get().getDbCleanupIntervalInHours(), TimeUnit.HOURS); }

Target:
public void setTimerForDBCleanUpTask() { ScheduledExecutorService scheduledExecutorService = CoreUtils.createExecutor(); scheduledExecutorService.scheduleWithFixedDelay(new Runnable() { public void run() { LOG.debug("Deleting expired_objects from database."); persistenceService.deleteAllExpiredObjects(); } }, configurationService.get().getDbCleanupIntervalInHours(), configurationService.get().getDbCleanupIntervalInHours(), TimeUnit.HOURS); }
Source:
@VisibleForTesting Call<MwQueryResponse<CreateAccountInfo>> request(@NonNull Service service, @NonNull final Callback cb) { Call<MwQueryResponse<CreateAccountInfo>> call = service.request(); call.enqueue(new retrofit2.Callback<MwQueryResponse<CreateAccountInfo>>() { @Override public void onResponse(Call<MwQueryResponse<CreateAccountInfo>> call, Response<MwQueryResponse<CreateAccountInfo>> response) { if (response.isSuccessful()) { if (response.body().success()) { String token = response.body().query().token(); String captchaId = response.body().query().captchaId(); cb.success(call, new CreateAccountInfoResult(token, captchaId)); } else if (response.body().hasError()) { cb.failure(call, new MwApiErrorException(response.body().getError())); } } else { cb.failure(call, RetrofitException.httpError(response, cachedService.retrofit())); } } @Override public void onFailure(Call<MwQueryResponse<CreateAccountInfo>> call, Throwable t) { cb.failure(call, t); } }); return call; }

Target:
@VisibleForTesting Call<MwQueryResponse<CreateAccountInfo>> request(@NonNull Service service, @NonNull final Callback cb) { Call<MwQueryResponse<CreateAccountInfo>> call = service.request(); call.enqueue(new retrofit2.Callback<MwQueryResponse<CreateAccountInfo>>() { @Override public void onResponse(Call<MwQueryResponse<CreateAccountInfo>> call, Response<MwQueryResponse<CreateAccountInfo>> response) { if (response.isSuccessful()) { if (response.body().success()) { String token = response.body().query().token(); String captchaId = response.body().query().captchaId(); cb.success(call, new CreateAccountInfoResult(token, captchaId)); } else if (response.body().hasError()) { cb.failure(call, new MwApiException(response.body().getError())); } else { cb.failure(call, new IOException("An unknown error occurred.")); } } else { cb.failure(call, RetrofitException.httpError(response, cachedService.retrofit())); } } @Override public void onFailure(Call<MwQueryResponse<CreateAccountInfo>> call, Throwable t) { cb.failure(call, t); } }); return call; }
Source:
public List<CaddisflyResource> listResources() { List<CaddisflyResource> result = new ArrayList<CaddisflyResource>(); try { InputStream stream = getClass().getClassLoader().getResourceAsStream ("resources/caddisfly/caddisfly-tests.json"); String jsonTxt = IOUtils.toString(stream); ObjectMapper mapper = new ObjectMapper(); JsonNode rootNode = mapper.readValue(jsonTxt, JsonNode.class); ArrayNode testsNode = (ArrayNode) rootNode.get("tests"); for (int i = 0; i < testsNode.size(); i++){ CaddisflyResource cr = JsonToCaddisflyResource(testsNode.get(i)); result.add(cr); } } catch (Exception e) { log.log(Level.SEVERE, "Error parsing Caddisfly resource: " + e.getMessage(), e); } return result; }

Target:
public List<CaddisflyResource> listResources() { List<CaddisflyResource> result = new ArrayList<CaddisflyResource>(); try { InputStream stream = getClass().getClassLoader() .getResourceAsStream( "resources/caddisfly/caddisfly-tests.json"); String jsonTxt = IOUtils.toString(stream); JsonNode rootNode = mapper.readValue(jsonTxt, JsonNode.class); ArrayNode testsNode = (ArrayNode) rootNode.get("tests"); for (int i = 0; i < testsNode.size(); i++) { CaddisflyResource cr = JsonToCaddisflyResource(testsNode.get(i)); result.add(cr); } } catch (Exception e) { log.log(Level.SEVERE, "Error parsing Caddisfly resource: " + e.getMessage(), e); } return result; }
Source:
public Pair<Boolean, String> restoreVMToDifferentLocation(String restorePointId, String hostIp, String dataStoreUuid) { final String restoreLocation = "CS-RSTR-" + UUID.randomUUID().toString(); final String datastoreId = dataStoreUuid.replace("-",""); final List<String> cmds = Arrays.asList( "$points = Get-VBRRestorePoint", String.format("foreach($point in $points) { if ($point.Id -eq '%s') { break; } }",restorePointId), String.format("$server = Get-VBRServer -Name \"%s\"", hostIp), String.format("$ds = Find-VBRViDatastore -Server:$server -Name \"%s\"", datastoreId), String.format("Start-VBRRestoreVM -RestorePoint:$point -Server:$server -Datastore:$ds -VMName \"%s\"", restoreLocation) ); Pair<Boolean, String> result = executePowerShellCommands(cmds); if (result == null || !result.first()) { throw new CloudRuntimeException("Failed to restore VM to location " + restoreLocation); } return new Pair<>(result.first(), restoreLocation); }

Target:
public Pair<Boolean, String> restoreVMToDifferentLocation(String restorePointId, String hostIp, String dataStoreUuid) { final String restoreLocation = RESTORE_VM_SUFFIX + UUID.randomUUID().toString(); final String datastoreId = dataStoreUuid.replace("-",""); final List<String> cmds = Arrays.asList( "$points = Get-VBRRestorePoint", String.format("foreach($point in $points) { if ($point.Id -eq '%s') { break; } }", restorePointId), String.format("$server = Get-VBRServer -Name \"%s\"", hostIp), String.format("$ds = Find-VBRViDatastore -Server:$server -Name \"%s\"", datastoreId), String.format("$job = Start-VBRRestoreVM -RestorePoint:$point -Server:$server -Datastore:$ds -VMName \"%s\" -RunAsync", restoreLocation), "while (-not (Get-VBRRestoreSession -Id $job.Id).IsCompleted) { Start-Sleep -Seconds 10 }" ); Pair<Boolean, String> result = executePowerShellCommands(cmds); if (result == null || !result.first()) { throw new CloudRuntimeException("Failed to restore VM to location " + restoreLocation); } return new Pair<>(result.first(), restoreLocation); }
Source:
public QueryResponse getBrowsableStudies(@RequestParam("species") String species) throws UnknownHostException, IllegalOpenCGACredentialsException, IOException { StudyDBAdaptor studyMongoDbAdaptor = DBAdaptorConnector.getStudyDBAdaptor(species); return setQueryResponse(studyMongoDbAdaptor.listStudies()); }

Target:
public QueryResponse getBrowsableStudies(@RequestParam("species") String species) throws IllegalOpenCGACredentialsException, IOException { StudyDBAdaptor studyMongoDbAdaptor = DBAdaptorConnector.getStudyDBAdaptor(species); return setQueryResponse(studyMongoDbAdaptor.listStudies()); }
Source:
private void toggleCompletedTasksList() { ViewPropertyAnimator viewPropertyAnimator = mChevron.animate() .rotation(mIsCompletedTaskListExpanded ? 0f : 180f) .setInterpolator(new LinearInterpolator()) .setDuration(Duration.SHORT.toMillis(mContext)); viewPropertyAnimator.setListener(new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { itemView.setClickable(false); } @Override public void onAnimationEnd(Animator animation) { if (mIsCompletedTaskListExpanded) { mTasks.removeAll(mTaskCompleted); notifyItemRangeRemoved(getAdapterPosition() + 1, mTaskCompleted.size()); } else { mTasks.addAll(mTaskCompleted); notifyItemRangeInserted(getAdapterPosition() + 1, mTaskCompleted.size()); } mIsCompletedTaskListExpanded = !mIsCompletedTaskListExpanded; itemView.setClickable(true); } @Override public void onAnimationCancel(Animator animation) { itemView.setClickable(true); } @Override public void onAnimationRepeat(Animator animation) { } }); }

Target:
private void toggleCompletedTasksList() { ViewPropertyAnimator viewPropertyAnimator = mChevron.animate() .rotation(mIsCompletedTaskListExpanded ? COLLAPSED_CHEVRON_ROTATION : EXPANDED_CHEVRON_ROTATION) .setInterpolator(new LinearInterpolator()) .setDuration(Duration.SHORT.toMillis(mContext)); viewPropertyAnimator.setListener(new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { itemView.setClickable(false); } @Override public void onAnimationEnd(Animator animation) { if (mIsCompletedTaskListExpanded) { mTasks.removeAll(mTaskCompleted); notifyItemRangeRemoved(getAdapterPosition() + 1, mTaskCompleted.size()); } else { mTasks.addAll(mTaskCompleted); notifyItemRangeInserted(getAdapterPosition() + 1, mTaskCompleted.size()); } mIsCompletedTaskListExpanded = !mIsCompletedTaskListExpanded; itemView.setClickable(true); } @Override public void onAnimationCancel(Animator animation) { itemView.setClickable(true); } @Override public void onAnimationRepeat(Animator animation) { } }); }
Source:
public long getFreshTimestamp() { return checkAndUpdate(delegate::getFreshTimestamp, x -> x, x -> x); }

Target:
public long getFreshTimestamp() { return checkAndUpdateLowerBound(delegate::getFreshTimestamp, x -> x, x -> x); }
Source:
public void doLaunch(MessageInput input) throws MisfireException { final AWSPluginConfiguration awsConfig = clusterConfigService.getOrDefault(AWSPluginConfiguration.class, AWSPluginConfiguration.createDefault()); AWSAuthProvider authProvider = new AWSAuthProvider( awsConfig, configuration.getString(CK_ACCESS_KEY), configuration.getString(CK_SECRET_KEY), configuration.getString(CK_AWS_REGION), configuration.getString(CK_ASSUME_ROLE_ARN) ); this.reader = new KinesisConsumer( configuration.getString(CK_KINESIS_STREAM_NAME), Region.getRegion(Regions.fromName(configuration.getString(CK_AWS_REGION))), kinesisCallback(input), awsConfig, authProvider, nodeId, graylogConfiguration.getHttpProxyUri() == null ? null : HttpUrl.get(graylogConfiguration.getHttpProxyUri()), this, objectMapper, configuration.intIsSet(CK_KINESIS_MAX_THROTTLED_WAIT_MS) ? configuration.getInt(CK_KINESIS_MAX_THROTTLED_WAIT_MS) : null, configuration.getInt(CK_KINESIS_RECORD_BATCH_SIZE, DEFAULT_THROTTLED_WAIT_MS) ); LOG.info("Starting Kinesis reader thread for input [{}/{}]", input.getName(), input.getId()); executor = getExecutorService(); kinesisTaskFuture = executor.submit(this.reader); }

Target:
public void doLaunch(MessageInput input) throws MisfireException { final AWSPluginConfiguration awsConfig = clusterConfigService.getOrDefault(AWSPluginConfiguration.class, AWSPluginConfiguration.createDefault()); AWSAuthProvider authProvider = new AWSAuthProvider( awsConfig, configuration.getString(CK_ACCESS_KEY), configuration.getString(CK_SECRET_KEY), configuration.getString(CK_AWS_REGION), configuration.getString(CK_ASSUME_ROLE_ARN) ); this.reader = new KinesisConsumer( configuration.getString(CK_KINESIS_STREAM_NAME), Region.getRegion(Regions.fromName(configuration.getString(CK_AWS_REGION))), kinesisCallback(input), awsConfig, authProvider, nodeId, graylogConfiguration.getHttpProxyUri() == null ? null : HttpUrl.get(graylogConfiguration.getHttpProxyUri()), this, objectMapper, configuration.intIsSet(CK_KINESIS_MAX_THROTTLED_WAIT_MS) ? configuration.getInt(CK_KINESIS_MAX_THROTTLED_WAIT_MS) : null, configuration.getInt(CK_KINESIS_RECORD_BATCH_SIZE, DEFAULT_BATCH_SIZE) ); LOG.info("Starting Kinesis reader thread for input [{}/{}]", input.getName(), input.getId()); kinesisTaskFuture = executor.submit(this.reader); }
Source:
byte[] wrapContent(byte[] message, String id, long timestamp, Schema schema, Map<String, String> externalMetadata) { try { GenericRecord genericRecord = bytesToRecord(message, schema); genericRecord.put(METADATA_MARKER, metadataMap(id, timestamp, externalMetadata)); return recordToBytes(genericRecord, schema); } catch (Exception e) { if (e instanceof AvroRuntimeException && e.getMessage().equals("Not a valid schema field: __metadata")) { throw new AvroInvalidMetadataException("Avro schema has invalid field __metadata", e); } throw new WrappingException("Could not wrap avro message", e); } }

Target:
byte[] wrapContent(byte[] message, String id, long timestamp, Schema schema, Map<String, String> externalMetadata) { try { GenericRecord genericRecord = bytesToRecord(message, schema); genericRecord.put(METADATA_MARKER, metadataMap(id, timestamp, externalMetadata)); return recordToBytes(genericRecord, schema); } catch (Exception e) { if (e instanceof AvroRuntimeException && e.getMessage().equals("Not a valid schema field: __metadata")) { throw new AvroInvalidMetadataException("Schema does not contain mandatory __metadata field for Hermes internal metadata. Please fix topic schema.", e); } throw new WrappingException("Could not wrap avro message", e); } }
Source:
public Optional<ClassOrderer> getTestClassOrderer() { ClassOrderingStrategy classOrderingStrategy = classOrderingStrategyConverter.get(configurationParameters, CLASS_ORDERING_STRATEGY_PROPERTY_NAME, ClassOrderingStrategy.DEFAULT); if (classOrderingStrategy != ClassOrderingStrategy.CUSTOM) { return Optional.empty(); } Optional<ClassOrderer> classOrderer = configurationParameters.get(CUSTOM_CLASS_ORDERER_PROPERTY_NAME).map( className -> ReflectionUtils.tryToLoadClass(className).andThenTry(ordererClass -> { Preconditions.condition(ClassOrderer.class.isAssignableFrom(ordererClass), CUSTOM_CLASS_ORDERER_PROPERTY_NAME + " does not implement " + ClassOrderer.class); return (ClassOrderer) ReflectionUtils.newInstance(ordererClass); }).getOrThrow( cause -> new JUnitException("Could not create configuration for strategy class: " + className, cause))); classOrderer.orElseThrow(() -> new JUnitException(CUSTOM_CLASS_ORDERER_PROPERTY_NAME + " must be set")); return classOrderer; }

Target:
public Optional<ClassOrderer> getTestClassOrderer() { return classOrdererConverter.get(configurationParameters, DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME); }
Source:
public static String formatPlainTextFileName(String taskName, Instant firstLogTime, String agentId) { return String.format(ENGLISH, "%s@%08x%08x.%s", taskName, firstLogTime.getEpochSecond(), firstLogTime.getNano(), agentId) + LOG_PLAIN_TEXT_FILE_SUFFIX; }

Target:
public static String formatPlainTextFileName(String taskName, Instant firstLogTime, String agentId) { return formatFileNameWithSuffix(taskName, firstLogTime, agentId, LOG_PLAIN_TEXT_FILE_SUFFIX); }
Source:
public void addConfigurations_shouldAddConfigurationsWithValue() throws Exception { ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name")); AuthorizationMetadataStore store = AuthorizationMetadataStore.newInstanceForTest(); SecurityAuthConfig profile = new SecurityAuthConfig("id", "plugin_id", store); profile.addConfigurations(Arrays.asList(property)); assertThat(profile.size(), is(1)); assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name")))); }

Target:
public void addConfigurations_shouldAddConfigurationsWithValue() throws Exception { ConfigurationProperty property = new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name")); AuthorizationMetadataStore store = mock(AuthorizationMetadataStore.class); SecurityAuthConfig profile = new SecurityAuthConfig("id", "plugin_id", store); profile.addConfigurations(Arrays.asList(property)); assertThat(profile.size(), is(1)); assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("username"), new ConfigurationValue("some_name")))); }
Source:
public void shouldGetChangeInfo() throws Exception { String url = String.format("/a/changes/%s/revisions/%s/files/", SOME_CHANGE_ID, SOME_REVISION_ID); stubFor(get(urlEqualTo(url)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream("/gerrit-changes.json"))))); List<ReviewFile> files = fixture.listFiles(); assertThat(files).hasSize(2); verify(getRequestedFor(urlMatching(url))); }

Target:
public void shouldGetChangeInfo() throws Exception { String url = String.format("/a/changes/%s/revisions/%s/files/", SOME_CHANGE_ID, SOME_REVISION_ID); stubFor(get(urlEqualTo(url)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody(IOUtils.toString(getClass().getResourceAsStream("/gerrit-changes.json"))))); List<ReviewFile> files = fixture.listFiles(); assertThat(files).hasSize(2); }
Source:
private void saveChainToTrustStore(List<? extends Certificate> chain) { if (chain != null && chain.size() > 0) { KeyStore ks = null; try { ks = ExternalTrustStoreInitializer.getTrustStore(); } catch (RuntimeException e) { handleException(e); } try { int firstCertificateIndex = chain.size() == 1 ? 0 : 1; for (int certIndex = firstCertificateIndex; certIndex < chain.size(); ++certIndex) { Certificate certificate = chain.get(certIndex); String alias = Guid.NewGuid().toString(); ks.setCertificateEntry(alias, certificate); } ExternalTrustStoreInitializer.setTrustStore(ks); setSucceeded(true); } catch (KeyStoreException e) { handleException(e); } catch (RuntimeException e) { handleException(e); } } }

Target:
private void saveChainToTrustStore(List<? extends Certificate> chain) { if (chain != null && chain.size() > 0) { KeyStore ks = null; try { ks = ExternalTrustStoreInitializer.getTrustStore(); } catch (Throwable e) { handleException(e); } try { int firstCertificateIndex = chain.size() == 1 ? 0 : 1; for (int certIndex = firstCertificateIndex; certIndex < chain.size(); ++certIndex) { Certificate certificate = chain.get(certIndex); String alias = Guid.NewGuid().toString(); ks.setCertificateEntry(alias, certificate); } ExternalTrustStoreInitializer.setTrustStore(ks); setSucceeded(true); } catch (KeyStoreException e) { handleException(e); } catch (Throwable e) { handleException(e); } } }
Source:
public Response exportApiSubscriptionsLogsAsCSV( @BeanParam SubscriptionParam subscriptionParam, @Valid @BeanParam Pageable pageable) { final PagedResult<SubscriptionEntity> subscriptions = getApiSubscriptions(subscriptionParam, pageable, null); return Response .ok(subscriptionService.exportAsCsv(subscriptions.getData(), subscriptions.getMetadata())) .header(HttpHeaders.CONTENT_DISPOSITION, format("attachment;filename=subscriptions-%s-%s.csv", api, System.currentTimeMillis())) .build(); }

Target:
public Response exportApiSubscriptionsLogsAsCSV( @BeanParam SubscriptionParam subscriptionParam, @Valid @BeanParam Pageable pageable) { final SubscriptionEntityPage subscriptions = getApiSubscriptions(subscriptionParam, pageable, null); return Response .ok(subscriptionService.exportAsCsv(subscriptions.getData(), subscriptions.getMetadata())) .header(HttpHeaders.CONTENT_DISPOSITION, format("attachment;filename=subscriptions-%s-%s.csv", api, System.currentTimeMillis())) .build(); }
Source:
public NetworkBitmapHunter(Picasso picasso, Dispatcher dispatcher, Cache cache, Stats stats, Action action, Downloader downloader) { super(picasso, dispatcher, cache, stats, action); this.downloader = downloader; this.retryCount = DEFAULT_RETRY_COUNT; if (!hasPermission(picasso.context, Manifest.permission.INTERNET)) { Picasso.HANDLER.post(new Runnable() { @Override public void run() { throw new SecurityException("INTERNET permission is required."); } }); } }

Target:
public NetworkBitmapHunter(Picasso picasso, Dispatcher dispatcher, Cache cache, Stats stats, Action action, Downloader downloader) { super(picasso, dispatcher, cache, stats, action); this.downloader = downloader; this.retryCount = DEFAULT_RETRY_COUNT; if (!hasPermission(picasso.context, Manifest.permission.INTERNET)) { Picasso.HANDLER.post(new Runnable() { @Override public void run() { throw new IllegalStateException("INTERNET permission is required."); } }); } }
Source:
private String location(ImportTableDesc tblDesc, Database parentDb) throws MetaException, SemanticException { if (tblDesc.tableType().equals(TableType.EXTERNAL_TABLE)) { return context.warehouse.getDnsPath(tblDesc.getTableLocationPath()).toString(); } else if (!tableContext.waitOnPrecursor()) { return context.warehouse.getDefaultTablePath( parentDb, tblDesc.getTableName(), tblDesc.isExternal()).toString(); } else { Path tablePath = context.warehouse.getDefaultTablePath( tblDesc.getDatabaseName(), tblDesc.getTableName(), tblDesc.isExternal()); return context.warehouse.getDnsPath(tablePath).toString(); } }

Target:
private String location(ImportTableDesc tblDesc, Database parentDb) throws MetaException, SemanticException { if (tblDesc.isExternal()) { return context.warehouse.getDnsPath(tblDesc.getSourceTableLocationPath()).toString(); } else if (!tableContext.waitOnPrecursor()) { return context.warehouse.getDefaultTablePath( parentDb, tblDesc.getTableName(), tblDesc.isExternal()).toString(); } else { Path tablePath = context.warehouse.getDefaultTablePath( tblDesc.getDatabaseName(), tblDesc.getTableName(), tblDesc.isExternal()); return context.warehouse.getDnsPath(tablePath).toString(); } }
Source:
public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("resultFormat") ResultFormat resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") long limit, @JsonProperty("order") Order order, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List<String> columns, @JsonProperty("legacy") Boolean legacy, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.resultFormat = (resultFormat == null) ? ResultFormat.RESULT_FORMAT_LIST : resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; Preconditions.checkArgument( this.batchSize > 0, "batchSize must be greater than 0" ); this.limit = (limit == 0) ? Long.MAX_VALUE : limit; Preconditions.checkArgument( this.limit > 0, "limit must be greater than 0" ); this.dimFilter = dimFilter; this.columns = columns; this.legacy = legacy; this.order = (order == null) ? Order.NONE : order; if (order != Order.NONE) { Preconditions.checkArgument( (columns.contains(ColumnHolder.TIME_COLUMN_NAME)), "The __time column must be selected if the results are time-ordered." ); } this.maxRowsQueuedForOrdering = validateAndGetMaxRowsQueuedForOrdering(); this.maxSegmentPartitionsOrderedInMemory = validateAndGetMaxSegmentPartitionsOrderedInMemory(); }

Target:
public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("virtualColumns") VirtualColumns virtualColumns, @JsonProperty("resultFormat") ResultFormat resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") long limit, @JsonProperty("order") Order order, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List<String> columns, @JsonProperty("legacy") Boolean legacy, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.virtualColumns = VirtualColumns.nullToEmpty(virtualColumns); this.resultFormat = (resultFormat == null) ? ResultFormat.RESULT_FORMAT_LIST : resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; Preconditions.checkArgument( this.batchSize > 0, "batchSize must be greater than 0" ); this.limit = (limit == 0) ? Long.MAX_VALUE : limit; Preconditions.checkArgument( this.limit > 0, "limit must be greater than 0" ); this.dimFilter = dimFilter; this.columns = columns; this.legacy = legacy; this.order = (order == null) ? Order.NONE : order; if (this.order != Order.NONE) { Preconditions.checkArgument( columns == null || columns.size() == 0 || columns.contains(ColumnHolder.TIME_COLUMN_NAME), "The __time column must be selected if the results are time-ordered." ); } this.maxRowsQueuedForOrdering = validateAndGetMaxRowsQueuedForOrdering(); this.maxSegmentPartitionsOrderedInMemory = validateAndGetMaxSegmentPartitionsOrderedInMemory(); }
Source:
public void close() throws WrongStateException, SystemException { if (confirmationHandler != null) { ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(applicationClassloader); CompensationContext.setTxContextToExtend(currentTX); ConfirmationHandler handler = instantiate(confirmationHandler); handler.confirm(); Thread.currentThread().setContextClassLoader(origClassLoader); } CompensationContextLifetimeManager.getInstance().participantDestroyed(currentTX); }

Target:
public void close() throws WrongStateException, SystemException { if (confirmationHandler != null) { ClassLoader origClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(applicationClassloader); CompensationContext.setTxContextToExtend(currentTX); ConfirmationHandler handler = instantiate(confirmationHandler); handler.confirm(); Thread.currentThread().setContextClassLoader(origClassLoader); } decrementParticipantsCounter(); }