auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CandidateDTO getCandidateByApplicationID(Long applicationID) { Assert.notNull(applicationID); ApplicationEntity applicationEntity = applicationsRepository.findOne(applicationID); CandidateEntity candidateEntity = (applicationEntity != null ? applicationEntity.getCandidateEntity() : null); return converterService.convert(candidateEntity, CandidateDTO.class); }

Target:
public CandidateDTO getCandidateByApplicationID(Long applicationID) { Assert.notNull(applicationID); ApplicationEntity applicationEntity = applicationsRepository.findOne(applicationID); CandidateDTO candidateDTO = (applicationEntity != null ? converterService .convert(applicationEntity.getCandidateEntity(), CandidateDTO.class) : null); return candidateDTO; }
Source:
private void testQueryCancel(int keyCnt, int valSize, String sql, int timeoutUnits, TimeUnit timeUnit, boolean timeout, boolean checkCanceled) throws Exception { try (Ignite client = startGrid("client")) { IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME); assertEquals(0, cache.localSize()); int p = 1; for (int i = 1; i <= keyCnt; i++) { char[] tmp = new char[valSize]; Arrays.fill(tmp, ' '); cache.put(i, new String(tmp)); if (i/(float)keyCnt >= p/10f) { log().info("Loaded " + i + " of " + keyCnt); p++; } } assertEquals(0, cache.localSize()); SqlFieldsQuery qry = new SqlFieldsQuery(sql); final QueryCursor<List<?>> cursor; if (timeout) { qry.setTimeout(timeoutUnits, timeUnit); cursor = cache.query(qry); } else { cursor = cache.query(qry); client.scheduler().runLocal(new Runnable() { @Override public void run() { cursor.close(); } }, timeoutUnits, timeUnit); } try (QueryCursor<List<?>> ignored = cursor) { cursor.getAll(); if (checkCanceled) fail("Query not canceled"); } catch (CacheException ex) { log().error("Got expected exception", ex); assertNotNull("Must throw correct exception", X.cause(ex, QueryCancelledException.class)); } Thread.sleep(TimeUnit.MILLISECONDS.convert(timeoutUnits, timeUnit) + 3_000); checkCleanState(); } }

Target:
private void testQueryCancel(int keyCnt, int valSize, String sql, int timeoutUnits, TimeUnit timeUnit, boolean timeout, boolean checkCanceled) throws Exception { try (Ignite client = startGrid("client")) { IgniteCache<Object, Object> cache = client.cache(DEFAULT_CACHE_NAME); assertEquals(0, cache.localSize()); int p = 1; for (int i = 1; i <= keyCnt; i++) { char[] tmp = new char[valSize]; Arrays.fill(tmp, ' '); cache.put(i, new String(tmp)); if (i/(float)keyCnt >= p/10f) { log().info("Loaded " + i + " of " + keyCnt); p++; } } assertEquals(0, cache.localSize()); SqlFieldsQuery qry = new SqlFieldsQuery(sql); final QueryCursor<List<?>> cursor; if (timeout) { qry.setTimeout(timeoutUnits, timeUnit); cursor = cache.query(qry); } else { cursor = cache.query(qry); client.scheduler().runLocal(new Runnable() { @Override public void run() { cursor.close(); } }, timeoutUnits, timeUnit); } try (QueryCursor<List<?>> ignored = cursor) { cursor.getAll(); if (checkCanceled) fail("Query not canceled"); } catch (CacheException ex) { error("Got expected exception", ex); assertNotNull("Must throw correct exception", X.cause(ex, QueryCancelledException.class)); } Thread.sleep(TimeUnit.MILLISECONDS.convert(timeoutUnits, timeUnit) + 3_000); checkCleanState(); } }
Source:
public static void main(String args[]) { try { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); ConsistencyCheckerTool consistencyCheckerTool = new ConsistencyCheckerTool(verifiableProperties); consistencyCheckerTool.checkConsistency(); } catch (Exception e) { System.err.println("Consistency checker exited with Exception: " + e); } }

Target:
public static void main(String args[]) throws Exception { VerifiableProperties verifiableProperties = StoreToolsUtil.getVerifiableProperties(args); ConsistencyCheckerTool consistencyCheckerTool = new ConsistencyCheckerTool(verifiableProperties); consistencyCheckerTool.checkConsistency(); }
Source:
public void tag(CoreSession session, String docId, String label) throws DocumentSecurityException { if (session.hasPermission(new IdRef(docId), SecurityConstants.WRITE)) { CoreInstance.doPrivileged(session, s -> { doTag(s, docId, cleanLabel(label, true, false)); }); fireUpdateEvent(session, docId); } else { String principalName = session.getPrincipal().getName(); throw new DocumentSecurityException("User '" + principalName + "' is not allowed to add tag '" + label + "' on document '" + docId + "'"); } }

Target:
public void tag(CoreSession session, String docId, String label) throws DocumentSecurityException { if (session.hasPermission(new IdRef(docId), SecurityConstants.WRITE)) { String cleanLabel = cleanLabel(label, true, false); CoreInstance.doPrivileged(session, s -> { doTag(s, docId, cleanLabel); }); fireUpdateEvent(session, docId); } else { String principalName = session.getPrincipal().getName(); throw new DocumentSecurityException("User '" + principalName + "' is not allowed to add tag '" + label + "' on document '" + docId + "'"); } }
Source:
public boolean setInput(Object object) { try { Object useAsInput = object; ISelection selection = getSite().getPage().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; HistoryPageInput mostFittingInput = SelectionUtils .getMostFittingInput(structuredSelection, object); if (mostFittingInput != null) { useAsInput = mostFittingInput; } } setWarningText(null); trace = GitTraceLocation.HISTORYVIEW.isActive(); if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), useAsInput); if (useAsInput == getInput()) return true; this.input = null; return super.setInput(useAsInput); } finally { if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); } }

Target:
public boolean setInput(Object object) { try { Object useAsInput = getMostFittingInput(object); setWarningText(null); trace = GitTraceLocation.HISTORYVIEW.isActive(); if (trace) GitTraceLocation.getTrace().traceEntry( GitTraceLocation.HISTORYVIEW.getLocation(), useAsInput); if (useAsInput == getInput()) return true; this.input = null; return super.setInput(useAsInput); } finally { if (trace) GitTraceLocation.getTrace().traceExit( GitTraceLocation.HISTORYVIEW.getLocation()); } }
Source:
protected boolean isSpanMarkup(char character) { return SPAN_MARKUP_CHARACTERS.matches(character); }

Target:
private boolean isSpanMarkup(char character) { return SPAN_MARKUP_CHARACTERS.matches(character); }
Source:
public void shouldDecorateFutureAndCallerRequestCancelled() { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = executor.submit(() -> "Hello World"); future.cancel(true); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); Throwable thrown = catchThrowable(() -> decoratedFuture.get()); assertThat(thrown).isInstanceOf(CancellationException.class); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); }

Target:
public void shouldDecorateFutureAndCallerRequestCancelled() throws Exception { CircuitBreaker circuitBreaker = CircuitBreaker.ofDefaults("testName"); final Future<String> future = mock(Future.class); when(future.get()).thenThrow(new CancellationException()); CircuitBreakerFuture<String> decoratedFuture = new CircuitBreakerFuture<>(circuitBreaker, future); Throwable thrown = catchThrowable(() -> decoratedFuture.get()); assertThat(thrown).isInstanceOf(CancellationException.class); assertThat(circuitBreaker.getMetrics().getNumberOfBufferedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfFailedCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()).isEqualTo(0); assertThat(circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()).isEqualTo(0); assertThat(circuitBreaker.getState()).isEqualTo(CircuitBreaker.State.CLOSED); then(future).should().get(); }
Source:
public URLStreamHandler createURLStreamHandler(final String protocol) { if(KUBERNETES_PROTOCOL.equals(protocol)) { new URLStreamHandler(){ @Override protected URLConnection openConnection(final URL u) throws IOException { Assert.requireNonNull(u, "u"); final String serviceName = u.getHost(); if(serviceName.contains(":")) { final String namespace = serviceName.split(":")[0]; final String name = serviceName.split(":")[1]; try { return discoveryService.getAddress(namespace, name).get().openConnection(); } catch (Exception e) { throw new IOException("Can not convert service URL", e); } } else { final String name = serviceName; try { return discoveryService.getAddress(name).get().openConnection(); } catch (Exception e) { throw new IOException("Can not convert service URL", e); } } } }; } return null; }

Target:
public URLStreamHandler createURLStreamHandler(final String protocol) { if(KUBERNETES_PROTOCOL.equals(protocol)) { new URLStreamHandler(){ @Override protected URLConnection openConnection(final URL url) throws IOException { Assert.requireNonNull(url, "url"); final String serviceName = url.getHost(); if(serviceName.contains(":")) { final String namespace = serviceName.split(":")[0]; final String name = serviceName.split(":")[1]; try { return discoveryService.getAddress(namespace, name).get().openConnection(); } catch (final Exception e) { throw new IOException("Can not convert service URL", e); } } else { final String name = serviceName; try { return discoveryService.getAddress(name).get().openConnection(); } catch (final Exception e) { throw new IOException("Can not convert service URL", e); } } } }; } return null; }
Source:
public void testLayoutVisitor () throws JSONException { JSONObject params = new JSONObject(); params.put("verb", 0); params.put("anchor", RelativeLayout.TRUE); final ViewVisitor layoutVisitor = new ViewVisitor.LayoutSetVisitor(mRelativeLayoutButtonPath, params); layoutVisitor.visit(mRootView); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mRootView.mRelativeLayoutButton.getLayoutParams(); int[] rules = layoutParams.getRules(); assertEquals(rules[0], -1); }

Target:
public void testLayoutVisitor () { ViewVisitor.LayoutRule params = new ViewVisitor.LayoutRule(0, RelativeLayout.TRUE); final ViewVisitor layoutVisitor = new ViewVisitor.LayoutUpdateVisitor(mRelativeLayoutButtonPath, params); layoutVisitor.visit(mRootView); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mRootView.mRelativeLayoutButton.getLayoutParams(); int[] rules = layoutParams.getRules(); assertEquals(rules[0], -1); }
Source:
public void testListenSocketAddress() { server = vertx.createHttpServer().requestHandler(noOpHandler()); server.listen(testAddress, onSuccess(server -> { testComplete(); })); await(); }

Target:
public void testListenSocketAddress() { NetClient netClient = vertx.createNetClient(); server = vertx.createHttpServer().requestHandler(req -> req.response().end()); SocketAddress sockAddress = SocketAddress.inetSocketAddress(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST); server.listen(sockAddress, onSuccess(server -> { netClient.connect(sockAddress, onSuccess(sock -> { sock.handler(buf -> { assertTrue("Response is not an http 200", buf.toString("UTF-8").startsWith("HTTP/1.1 200 OK")); testComplete(); }); sock.write("GET / HTTP/1.1\r\n\r\n"); })); })); try { await(); } finally { netClient.close(); } }
Source:
static <E,T> Validation<E,T> invalid(E error) { return new Invalid<>(error); }

Target:
static <E,T> Validation<E,T> invalid(E error) { Objects.requireNonNull(error, "error is null"); return new Invalid<>(error); }
Source:
public RealmConfiguration getSystemDefaultSyncConfiguration() { SyncUser currentUser; try { currentUser = SyncUser.currentUser(); } catch (IllegalStateException e ) { throw new IllegalStateException("Could not create a default sync configuration as " + "multiple users are logged in. Use Realm.getInstance() instead of se", e); } if (currentUser == null) { throw new IllegalStateException("No user is logged in. Login a user using SyncUser.login() first."); } if (cachedDefaultConfiguration != null && !currentUser.equals(cachedDefaultConfiguration.getUser())) { cachedDefaultConfiguration = null; } if (cachedDefaultConfiguration == null) { cachedDefaultConfiguration = new SyncConfiguration.Builder(currentUser, createUrl(currentUser)) .partialRealm() .build(); } return cachedDefaultConfiguration; }

Target:
public RealmConfiguration getSystemDefaultSyncConfiguration() { SyncUser currentUser; try { currentUser = SyncUser.currentUser(); } catch (IllegalStateException e ) { throw new IllegalStateException("Could not create a default sync configuration as " + "multiple users are logged in. Use 'Realm.getInstance()' instead of 'Realm.getDefaultInstance()' " + "in order to specify the specific users configuration." , e); } if (currentUser == null) { throw new IllegalStateException("No user is logged in. Login a user using SyncUser.login() first."); } if (cachedDefaultConfiguration != null && !currentUser.equals(cachedDefaultConfiguration.getUser())) { cachedDefaultConfiguration = null; } if (cachedDefaultConfiguration == null) { cachedDefaultConfiguration = new SyncConfiguration.Builder(currentUser, createUrl(currentUser)) .partialRealm() .build(); } return cachedDefaultConfiguration; }
Source:
TagMatcher matcher(TagCache cache, Repository db, Collection<Ref> include) { include = Lists.newArrayList(Iterators.filter(include.iterator(), new Predicate<Ref>() { @Override public boolean apply(Ref ref) { return !TagSet.skip(ref); } })); TagSet tags = this.tags; if (tags == null) { tags = build(cache, db); } TagMatcher m = new TagMatcher(this, cache, db, include, tags, false); tags.prepare(m); if (!m.newRefs.isEmpty() || !m.lostRefs.isEmpty()) { tags = rebuild(cache, db, tags, m); m = new TagMatcher(this, cache, db, include, tags, true); tags.prepare(m); } return m; }

Target:
TagMatcher matcher(TagCache cache, Repository db, Collection<Ref> include) { include = FluentIterable.from(include).filter(new Predicate<Ref>() { @Override public boolean apply(Ref ref) { return !TagSet.skip(ref); } }).toList(); TagSet tags = this.tags; if (tags == null) { tags = build(cache, db); } TagMatcher m = new TagMatcher(this, cache, db, include, tags, false); tags.prepare(m); if (!m.newRefs.isEmpty() || !m.lostRefs.isEmpty()) { tags = rebuild(cache, db, tags, m); m = new TagMatcher(this, cache, db, include, tags, true); tags.prepare(m); } return m; }
Source:
static AllelicCount createAllelicCountWithVerbosity(final DataLine dataLine, final AllelicCountTableColumn.AllelicCountTableVerbosity verbosity) { final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final SimpleInterval interval = new SimpleInterval(dataLine.get(AllelicCountTableColumn.CONTIG), position, position); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); if (verbosity == AllelicCountTableColumn.AllelicCountTableVerbosity.BASIC) { return new AllelicCount(interval, refReadCount, altReadCount); } else { final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE).getBytes()[0]); final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE).getBytes()[0]); final int readDepth = dataLine.getInt(AllelicCountTableColumn.READ_DEPTH); if (verbosity == AllelicCountTableColumn.AllelicCountTableVerbosity.INTERMEDIATE) { return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide, readDepth); } else { final double hetLogOdds = dataLine.getDouble(AllelicCountTableColumn.HET_LOG_ODDS); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide, readDepth, hetLogOdds); } } }

Target:
static AllelicCount createAllelicCountWithVerbosity(final DataLine dataLine, final AllelicCountTableColumn.AllelicCountTableVerbosity verbosity) { final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final SimpleInterval interval = new SimpleInterval(dataLine.get(AllelicCountTableColumn.CONTIG), position, position); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); if (verbosity == AllelicCountTableColumn.AllelicCountTableVerbosity.BASIC) { return new AllelicCount(interval, refReadCount, altReadCount); } else { final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]); final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]); final int readDepth = dataLine.getInt(AllelicCountTableColumn.READ_DEPTH.name()); if (verbosity == AllelicCountTableColumn.AllelicCountTableVerbosity.INTERMEDIATE) { return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide, readDepth); } else { final double hetLogOdds = dataLine.getDouble(AllelicCountTableColumn.HET_LOG_ODDS.name()); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide, readDepth, hetLogOdds); } } }
Source:
public void onResume() { super.onResume(); mPresenter.updateConceptsInDBTextView(); LocalBroadcastManager.getInstance(this.getActivity()).registerReceiver(bReceiver, new IntentFilter(ApplicationConstants.BroadcastActions.CONCEPT_DOWNLOAD_BROADCAST_INTENT_ID)); contactUs(); }

Target:
public void onResume() { super.onResume(); mPresenter.updateConceptsInDBTextView(); LocalBroadcastManager.getInstance(this.getActivity()).registerReceiver(bReceiver, new IntentFilter(ApplicationConstants.BroadcastActions.CONCEPT_DOWNLOAD_BROADCAST_INTENT_ID)); }
Source:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand() is called!"); for (FreeswitchBindingProvider provider : providers) { FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName); switch(config.getType()){ case CMD_API:{ if (!(command instanceof StringType)){ logger.error("API commands must be a StringType"); return; } String str = ((StringType) command).toString().toLowerCase(); String response = executeApiCommand(str); eventPublisher.postUpdate(itemName, new StringType(response)); } break; default: break; } } }

Target:
protected void internalReceiveCommand(String itemName, Command command) { logger.trace("Received command for item '{}' with command '{}'",itemName, command); for (FreeswitchBindingProvider provider : providers) { FreeswitchBindingConfig config = provider.getFreeswitchBindingConfig(itemName); switch(config.getType()){ case CMD_API:{ if (!(command instanceof StringType)){ logger.warn("could not process command '{}' for item '{}': command is not a StringType", command, itemName); return; } String str = ((StringType) command).toString().toLowerCase(); String response = executeApiCommand(str); eventPublisher.postUpdate(itemName, new StringType(response)); } break; default: break; } } }
Source:
public Variable getVariable(final String identifier) { if (identifier == null || identifier.isEmpty()) return null; for (Variable variable : fVariables) { if (identifier.equals(variable.getName())) { return variable; } } return null; }

Target:
public Variable getVariable(final String identifier) { for (Variable variable : fVariables) { if (variable.getName().equals(identifier)) return variable; } return null; }
Source:
public ExecutionResult run(String command, File workingDir, Map<String, String> env) throws ToolException, IOException, InterruptedException { String[] commandArray = createCommandArray(command); try { ProcessBuilder pb = fs.runInShell(commandArray[0], Arrays.copyOfRange(commandArray, 1, commandArray.length)); pb.directory(workingDir); Map<String, String> envp = pb.environment(); if (env != null) { envp.putAll(env); } ExecutionResult result = fs.execute(pb, null); int rc = result.getRc(); if (rc != 0) { boolean execError = isCommandExecutionError(rc); if (checkExitCode || execError) { throw new ToolException( new String(result.getStderr().toByteArray()), result, execError); } } return result; } finally { deleteCommandArray(); } }

Target:
public ExecutionResult run(String command, File workingDir, Map<String, String> env) throws ToolException, IOException, InterruptedException { String[] commandArray = createCommandArray(command); try { ProcessBuilder pb = fs.runInShell(commandArray[0], Arrays.copyOfRange(commandArray, 1, commandArray.length)); pb.directory(workingDir); Map<String, String> envp = pb.environment(); if (env != null) { envp.putAll(env); } ExecutionResult result = fs.execute(pb, null); int rc = result.getRc(); if (rc != 0) { boolean execError = isCommandExecutionError(rc); if (checkExitCode || execError) { throw new ToolException( "JGit: tool execution return code: " + rc + "\n" + "checkExitCode: " + checkExitCode + "\n" + "execError: " + execError + "\n" + "stderr: \n" + new String( result.getStderr().toByteArray()), result, execError); } } return result; } finally { deleteCommandArray(); } }
Source:
public void testSearchFirewallPolicies() { firewallPolicyList.add(createFirewallPolicy()); firewallPolicyList.add(createFirewallPolicy()); List<FirewallPolicyMetadata> firewallPolicyMetadataList = firewallPolicyService.find( new FirewallPolicyFilter().dataCenters(DataCenter.DE_FRANKFURT) ); assertNotNull(firewallPolicyMetadataList); assertEquals(firewallPolicyMetadataList.size(), 2); FirewallPolicyMetadata firewallPolicy1Metadata = firewallPolicyService.findByRef(firewallPolicyList.get(0)); assertNotNull(firewallPolicy1Metadata); }

Target:
public void testSearchFirewallPolicies() { firewallPolicyList.add(createFirewallPolicy()); firewallPolicyList.add(createFirewallPolicy()); List<FirewallPolicyMetadata> firewallPolicyMetadataList = firewallPolicyService.find( new FirewallPolicyFilter().dataCenters(DataCenter.DE_FRANKFURT) ); assertNotNull(firewallPolicyMetadataList); assertEquals(firewallPolicyMetadataList.size(), 2); assertEquals(firewallPolicyMetadataList.get(0).getDataCenterId(), DataCenter.DE_FRANKFURT.getId()); assertEquals(firewallPolicyMetadataList.get(1).getDataCenterId(), DataCenter.DE_FRANKFURT.getId()); FirewallPolicyMetadata firewallPolicy1Metadata = firewallPolicyService.findByRef(firewallPolicyList.get(0)); assertNotNull(firewallPolicy1Metadata); assertEquals(firewallPolicy1Metadata.getDataCenterId(), DataCenter.DE_FRANKFURT.getId()); }
Source:
public static void endRequest(HttpRequest request) { if (IS_DEBUGGING_ENABLED) { logEvent(EventType.END_PAGE, request); lastRequestLogEvents = LOG_EVENTS.get(); REQUEST_ID.remove(); SEQUENCE_ID.remove(); LOG_EVENTS.remove(); } }

Target:
public static void endRequest(HttpRequest request) { if (IS_DEBUGGING_ENABLED) { logEvent(EventType.END_REQUEST, request); lastRequestLogEvents = LOG_EVENTS.get(); REQUEST_ID.remove(); SEQUENCE_ID.remove(); LOG_EVENTS.remove(); } }
Source:
boolean getBackgroundImageZoomIn() { boolean on = settings.getBoolean("zoominBackgroundImage", false); if (slideshowStyle == SLIDESHOW_STYLE_ANIMATED) { on = true; setBackgroundZoomIn(true); setSlideShowStyle(SLIDESHOW_STYLE_CENTER); } return on; }

Target:
boolean getBackgroundImageZoomIn() { boolean on = settings.getBoolean("backgroundImageZoomIn", false); if (slideshowStyle == SLIDESHOW_STYLE_ANIMATED) { on = true; setBackgroundZoomIn(true); setSlideShowStyle(SLIDESHOW_STYLE_CENTER); } return on; }
Source:
public static void main(String[] args) throws Exception { GenomicsDatasetOptions opts = PipelineOptionsFactory.fromArgs(args) .withValidation().as(GenomicsDatasetOptions.class); GenomicsFactory.OfflineAuth auth = GenomicsOptions.Methods.getGenomicsAuth(opts); Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); List<String> callSetIds = ImmutableList.copyOf(opts.getCallSetIds().split(",")); List<String> transcriptSetIds = validateAnnotationSetsFlag(genomics, opts.getTranscriptSetIds(), "TRANSCRIPT"); List<String> variantAnnotationSetIds = validateAnnotationSetsFlag(genomics, opts.getVariantAnnotationSetIds(), "VARIANT"); String refsetId = validateRefsetForAnnotationSets(genomics, transcriptSetIds); Iterable<Contig> contigs = opts.isAllReferences() ? Contig.getContigsInVariantSet( genomics, opts.getDatasetId(), SexChromosomeFilter.INCLUDE_XY) : Contig.parseContigsFromCommandLine(opts.getReferences()); Pipeline p = Pipeline.create(opts); DataflowWorkarounds.registerGenomicsCoders(p); DataflowWorkarounds.getPCollection(ImmutableList.copyOf(contigs), p, opts.getNumWorkers()) .apply(ParDo.of(new AnnotateVariants(auth, opts.getDatasetId(), refsetId, callSetIds, transcriptSetIds, variantAnnotationSetIds))) .apply(GroupByKey.<String, VariantAnnotation>create()) .apply(ParDo.of(new DoFn<KV<String, Iterable<VariantAnnotation>>, String>() { @Override public void processElement(ProcessContext c) { c.output(c.element().getKey() + ": " + c.element().getValue()); } })) .apply(TextIO.Write.to(opts.getOutput())); p.run(); }

Target:
public static void main(String[] args) throws Exception { GenomicsDatasetOptions opts = PipelineOptionsFactory.fromArgs(args) .withValidation().as(GenomicsDatasetOptions.class); GenomicsFactory.OfflineAuth auth = GenomicsOptions.Methods.getGenomicsAuth(opts); Genomics genomics = auth.getGenomics(auth.getDefaultFactory()); List<String> callSetIds = ImmutableList.of(); if (!Strings.isNullOrEmpty(opts.getCallSetIds().trim())) { callSetIds = ImmutableList.copyOf(opts.getCallSetIds().split(",")); } List<String> transcriptSetIds = validateAnnotationSetsFlag(genomics, opts.getTranscriptSetIds(), "TRANSCRIPT"); List<String> variantAnnotationSetIds = validateAnnotationSetsFlag(genomics, opts.getVariantAnnotationSetIds(), "VARIANT"); validateRefsetForAnnotationSets(genomics, transcriptSetIds); Iterable<Contig> contigs = opts.isAllReferences() ? Contig.getContigsInVariantSet( genomics, opts.getDatasetId(), SexChromosomeFilter.INCLUDE_XY) : Contig.parseContigsFromCommandLine(opts.getReferences()); Pipeline p = Pipeline.create(opts); DataflowWorkarounds.registerGenomicsCoders(p); p.begin() .apply(Create.of(contigs)) .apply(ParDo.of(new AnnotateVariants(auth, opts.getDatasetId(), callSetIds, transcriptSetIds, variantAnnotationSetIds))) .apply(GroupByKey.<String, VariantAnnotation>create()) .apply(ParDo.of(new DoFn<KV<String, Iterable<VariantAnnotation>>, String>() { @Override public void processElement(ProcessContext c) { c.output(c.element().getKey() + ": " + c.element().getValue()); } })) .apply(TextIO.Write.to(opts.getOutput())); p.run(); }
Source:
protected OAuthRequest createAccessTokenRequest(AccessTokenRequestParams params) { final OAuthRequest request = new OAuthRequest(getApi().getAccessTokenVerb(), getApi().getAccessTokenEndpoint()); getApi().getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); request.addBodyParameter(OAuthConstants.CODE, params.getCode()); final String callback = getCallback(); if (callback != null) { request.addBodyParameter(OAuthConstants.REDIRECT_URI, callback); } request.addBodyParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE); final String pkceCodeVerifier = params.getPkceCodeVerifier(); if (pkceCodeVerifier != null) { request.addBodyParameter(PKCE.PKCE_CODE_VERIFIER_PARAM, pkceCodeVerifier); } if (isDebug()) { log("created access token request with body params [%s], query string params [%s]", request.getBodyParams().asFormUrlEncodedString(), request.getQueryStringParams().asFormUrlEncodedString()); } return request; }

Target:
protected OAuthRequest createAccessTokenRequest(AccessTokenRequestParams params) { final OAuthRequest request = new OAuthRequest(getApi().getAccessTokenVerb(), getApi().getAccessTokenEndpoint()); getApi().getClientAuthentication().addClientAuthentication(request, getApiKey(), getApiSecret()); request.addParameter(OAuthConstants.CODE, params.getCode()); final String callback = getCallback(); if (callback != null) { request.addParameter(OAuthConstants.REDIRECT_URI, callback); } request.addParameter(OAuthConstants.GRANT_TYPE, OAuthConstants.AUTHORIZATION_CODE); final String pkceCodeVerifier = params.getPkceCodeVerifier(); if (pkceCodeVerifier != null) { request.addParameter(PKCE.PKCE_CODE_VERIFIER_PARAM, pkceCodeVerifier); } if (isDebug()) { log("created access token request with body params [%s], query string params [%s]", request.getBodyParams().asFormUrlEncodedString(), request.getQueryStringParams().asFormUrlEncodedString()); } return request; }
Source:
public Observable<Void> shutdown() { return delegateRegistry.shutdown(); }

Target:
public Observable<Void> shutdown() { remoteBatchingRegistry.shutdown(); return delegateRegistry.shutdown(); }
Source:
public void initialize(String file) throws ServiceException, IOException { RandomAccessInputStream jpegFile = new RandomAccessInputStream(file); try { Metadata metadata = ImageMetadataReader.readMetadata(jpegFile); directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class); } catch (Throwable e) { jpegFile.close(); throw new ServiceException("Could not read EXIF data", e); } }

Target:
public void initialize(String file) throws ServiceException, IOException { try (RandomAccessInputStream jpegFile = new RandomAccessInputStream(file)) { try { Metadata metadata = ImageMetadataReader.readMetadata(jpegFile); directory = metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class); } catch (Throwable e) { throw new ServiceException("Could not read EXIF data", e); } } }
Source:
protected void initSelectedType() { Integer selectedNicType = getNic().getType(); ArrayList<VmInterfaceType> nicTypes = (ArrayList<VmInterfaceType>) getNicType().getItems(); nicTypes = nicTypes == null ? new ArrayList<VmInterfaceType>() : nicTypes; if (selectedNicType == null || !nicTypes.contains(VmInterfaceType.forValue(selectedNicType))) { selectedNicType = AsyncDataProvider.getDefaultNicType(nicTypes).getValue(); } getNicType().setSelectedItem(VmInterfaceType.forValue(selectedNicType)); }

Target:
protected void initSelectedType() { VmInterfaceType selectedNicType = VmInterfaceType.forValue(getNic().getType()); ArrayList<VmInterfaceType> nicTypes = (ArrayList<VmInterfaceType>) getNicType().getItems(); nicTypes = nicTypes == null ? new ArrayList<VmInterfaceType>() : nicTypes; if (selectedNicType == null || !nicTypes.contains(selectedNicType)) { selectedNicType = AsyncDataProvider.getDefaultNicType(nicTypes); } getNicType().setSelectedItem(selectedNicType); }
Source:
@Override public SqlNode getCastSpec(final RelDataType type) { if (type instanceof BasicSqlType) { SqlUserDefinedTypeNameSpec typeNameSpec; switch (type.getSqlTypeName()) { case BIGINT: return createSqlDataTypeSpecByName("INT64"); case DOUBLE: return createSqlDataTypeSpecByName("FLOAT64"); case DECIMAL: return createSqlDataTypeSpecByName("NUMERIC"); case BOOLEAN: return createSqlDataTypeSpecByName("BOOL"); case VARCHAR: return createSqlDataTypeSpecByName("STRING"); case VARBINARY: return createSqlDataTypeSpecByName("BYTES"); case DATE: return createSqlDataTypeSpecByName("DATE"); case TIME: return createSqlDataTypeSpecByName("TIME"); case TIMESTAMP: return createSqlDataTypeSpecByName("TIMESTAMP"); } } return super.getCastSpec(type); }

Target:
@Override public SqlNode getCastSpec(final RelDataType type) { if (type instanceof BasicSqlType) { switch (type.getSqlTypeName()) { case BIGINT: return createSqlDataTypeSpecByName("INT64"); case DOUBLE: return createSqlDataTypeSpecByName("FLOAT64"); case DECIMAL: return createSqlDataTypeSpecByName("NUMERIC"); case BOOLEAN: return createSqlDataTypeSpecByName("BOOL"); case VARCHAR: return createSqlDataTypeSpecByName("STRING"); case VARBINARY: return createSqlDataTypeSpecByName("BYTES"); case DATE: return createSqlDataTypeSpecByName("DATE"); case TIME: return createSqlDataTypeSpecByName("TIME"); case TIMESTAMP: return createSqlDataTypeSpecByName("TIMESTAMP"); } } return super.getCastSpec(type); }
Source:
protected void listDeployments(CommandContext ctx, boolean l) throws CommandFormatException { if(!l) { printList(ctx, Util.getDeployments(ctx.getModelControllerClient()), l); return; } final ModelControllerClient client = ctx.getModelControllerClient(); final List<String> names = Util.getDeployments(client); if(names.isEmpty()) { return; } final StrictSizeTable table = new StrictSizeTable(names.size()); try { final List<Property> descriptions = getDeploymentDescriptions(ctx, names).asPropertyList(); for(Property prop : descriptions) { final ModelNode step = prop.getValue(); if(step.hasDefined(Util.RESULT)) { final ModelNode result = step.get(Util.RESULT); table.addCell(Util.NAME, result.get(Util.NAME).asString()); table.addCell(Util.RUNTIME_NAME, result.get(Util.RUNTIME_NAME).asString()); if(result.has(Util.ENABLED)) { table.addCell(Util.ENABLED, result.get(Util.ENABLED).asString()); } if(result.has(Util.STATUS)) { table.addCell(Util.STATUS, result.get(Util.STATUS).asString()); } } if(!table.isAtLastRow()) { table.nextRow(); } } ctx.printLine(table.toString()); } catch (Exception e) { throw new CommandFormatException(table.toString()); } }

Target:
protected void listDeployments(CommandContext ctx, boolean l) throws CommandFormatException { if(!l) { printList(ctx, Util.getDeployments(ctx.getModelControllerClient()), l); return; } final ModelControllerClient client = ctx.getModelControllerClient(); final List<String> names = Util.getDeployments(client); if(names.isEmpty()) { return; } final StrictSizeTable table = new StrictSizeTable(names.size()); final List<Property> descriptions = getDeploymentDescriptions(ctx, names).asPropertyList(); for(Property prop : descriptions) { final ModelNode step = prop.getValue(); if(step.hasDefined(Util.RESULT)) { final ModelNode result = step.get(Util.RESULT); table.addCell(Util.NAME, result.get(Util.NAME).asString()); table.addCell(Util.RUNTIME_NAME, result.get(Util.RUNTIME_NAME).asString()); if(result.has(Util.ENABLED)) { table.addCell(Util.ENABLED, result.get(Util.ENABLED).asString()); } if(result.has(Util.STATUS)) { table.addCell(Util.STATUS, result.get(Util.STATUS).asString()); } } if(!table.isAtLastRow()) { table.nextRow(); } } ctx.printLine(table.toString()); }
Source:
public void createPartControl(Composite parent) { fTree = new Tree(parent, SWT.NONE); TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0); TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1); nameCol.setText("Synchronization Information"); valueCol.setText("Value"); fTree.setItemCount(0); fTree.setHeaderVisible(true); nameCol.pack(); valueCol.pack(); }

Target:
public void createPartControl(Composite parent) { fTree = new Tree(parent, SWT.NONE); TreeColumn nameCol = new TreeColumn(fTree, SWT.NONE, 0); TreeColumn valueCol = new TreeColumn(fTree, SWT.NONE, 1); nameCol.setText(Messages.TmfSynchronizationView_NameColumn); valueCol.setText(Messages.TmfSynchronizationView_ValueColumn); fTree.setItemCount(0); fTree.setHeaderVisible(true); nameCol.pack(); valueCol.pack(); }
Source:
public String getToken() { Random randomSize = new Random(); int randomByteSize = randomSize.nextInt(251) + 5; ByteBuffer byteBuffer = ByteBuffer.allocate(randomByteSize); SecureRandom secureRandom = new SecureRandom(); secureRandom.ints(Byte.MIN_VALUE, Byte.MAX_VALUE).limit(randomByteSize).forEach((randInt) -> byteBuffer.put((byte) randInt)); byte[] randomBytes = byteBuffer.array(); byte[] xoredCsrf = xorCsrf(randomBytes, Utf8.encode(this.token)); ByteBuffer combinedBuffer = ByteBuffer.allocate(randomByteSize + xoredCsrf.length); combinedBuffer.put(randomBytes); combinedBuffer.put(xoredCsrf); return Base64.getEncoder().encodeToString(combinedBuffer.array()); }

Target:
public String getToken() { return this.token; }
Source:
public void testSubSelectWhere() throws Exception { setup.setUpCharacters(); execute("select id, name " + "from (select * from characters where female = true) as ch " + "where name like 'Arthur'"); assertThat(printedTable(response.rows()), is("4| Arthur\n")); assertThat(printedTable(response.rows()), is("4| Arthur\n")); }

Target:
public void testSubSelectWhere() throws Exception { setup.setUpCharacters(); execute("select id, name " + "from (select * from characters where female = true) as ch " + "where name like 'Arthur'"); assertThat(printedTable(response.rows()), is("4| Arthur\n")); }
Source:
static int calculateBlockResetBytes(int currentBytes) { long newBytes = (long) ceil(currentBytes * BLOCK_RESET_SKEW); if (newBytes > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } return (int) newBytes; }

Target:
static int calculateBlockResetBytes(int currentBytes) { long newBytes = (long) ceil(currentBytes * BLOCK_RESET_SKEW); if (newBytes > MAX_ARRAY_SIZE) { return MAX_ARRAY_SIZE; } return (int) newBytes; }
Source:
protected void onResume() { super.onResume(); Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.container); if (currentFragment instanceof SearchFragment) { mNavigationView.setCheckedItem(R.id.item_dashboard); } else if (currentFragment instanceof ClientListFragment) { mNavigationView.setCheckedItem(R.id.item_clients); } else if (currentFragment instanceof GroupsListFragment) { mNavigationView.setCheckedItem(R.id.item_groups); } else if (currentFragment instanceof CenterListFragment) { mNavigationView.setCheckedItem(R.id.item_centers); } else if (currentFragment instanceof OfflineDashboardFragment) { mNavigationView.setCheckedItem(R.id.item_offline); } }

Target:
protected void onResume() { super.onResume(); String currentFragment = getSupportFragmentManager().findFragmentById(R.id.container) .getClass().getSimpleName(); switch (currentFragment) { case "SearchFragment": mNavigationView.setCheckedItem(R.id.item_dashboard); break; case "ClientListFragment": mNavigationView.setCheckedItem(R.id.item_clients); break; case "GroupsListFragment": mNavigationView.setCheckedItem(R.id.item_groups); break; case "CenterListFragment": mNavigationView.setCheckedItem(R.id.item_centers); break; case "OfflineDashboardFragment": mNavigationView.setCheckedItem(R.id.item_offline); } }
Source:
public static <T> void decodeNullable(ClientMessage.ForwardFrameIterator iterator, Function<ClientMessage.ForwardFrameIterator, T> decodeFunction, Consumer<T> consumer) { if (nextFrameIsNullEndFrame(iterator)) { decode(iterator, decodeFunction, consumer); } }

Target:
public static <T> void decodeNullable(ClientMessage.ForwardFrameIterator iterator, Function<ClientMessage.ForwardFrameIterator, T> decodeFunction, Consumer<T> consumer) { if (!nextFrameIsNullEndFrame(iterator)) { decode(iterator, decodeFunction, consumer); } }
Source:
int calculateReplicationFactorForDC(List<HostToken> allHostTokens, String dataCenter) { Map<Long, Integer> groups = new HashMap<>(); Set<HostToken> uniqueHostTokens = new HashSet<>(allHostTokens); if (dataCenter == null) { if(localRack != null) { dataCenter = localRack.substring(0, localRack.length() - 1); } } for (HostToken hostToken: uniqueHostTokens) { if(dataCenter == null || hostToken.getHost().getRack().contains(dataCenter)) { Long token = hostToken.getToken(); if (groups.containsKey(token)) { int current = groups.get(token); groups.put(token, current + 1); } else { groups.put(token, 1); } } } Set<Integer> uniqueCounts = new HashSet<>(groups.values()); if (uniqueCounts.size() > 1) { throw new RuntimeException("Invalid configuration - replication factor cannot be asymmetric"); } int rf = uniqueCounts.toArray(new Integer[uniqueCounts.size()])[0]; if (rf > 3) { logger.warn("Replication Factor is high: " + uniqueHostTokens); } return rf; }

Target:
int calculateReplicationFactorForDC(List<HostToken> allHostTokens, String dataCenter) { Map<Long, Integer> groups = new HashMap<>(); Set<HostToken> uniqueHostTokens = new HashSet<>(allHostTokens); if (dataCenter == null) { if(localRack != null) { dataCenter = localRack.substring(0, localRack.length() - 1); } else { dataCenter = allHostTokens.get(0).getHost().getRack().substring(0, localRack.length() - 1); } } for (HostToken hostToken: uniqueHostTokens) { if(hostToken.getHost().getRack().contains(dataCenter)) { Long token = hostToken.getToken(); if (groups.containsKey(token)) { int current = groups.get(token); groups.put(token, current + 1); } else { groups.put(token, 1); } } } Set<Integer> uniqueCounts = new HashSet<>(groups.values()); if (uniqueCounts.size() > 1) { throw new RuntimeException("Invalid configuration - replication factor cannot be asymmetric"); } int rf = uniqueCounts.toArray(new Integer[uniqueCounts.size()])[0]; if (rf > 3) { logger.warn("Replication Factor is high: " + uniqueHostTokens); } return rf; }
Source:
public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) { GlowBlockState state = block.getState(); MaterialData data = state.getData(); if (!(data instanceof FlowerPot)) { warnMaterialData(FlowerPot.class, data); return false; } if (state instanceof GlowFlowerPot) { GlowFlowerPot pot = (GlowFlowerPot) state; if (pot.getContents() == null) { pot.setContents(player.getItemInHand().getData().clone()); pot.update(); return true; } } return false; }

Target:
public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) { GlowBlockState state = block.getState(); MaterialData data = state.getData(); if (!(data instanceof FlowerPot)) { warnMaterialData(FlowerPot.class, data); return false; } if (state instanceof GlowFlowerPot) { GlowFlowerPot pot = (GlowFlowerPot) state; ItemStack heldItem = player.getItemInHand(); if (pot.getContents() == null && heldItem != null && isValidContents(heldItem.getData())) { pot.setContents(heldItem.getData().clone()); return pot.update(); } } return false; }
Source:
private static void findFiles(IResource resource, List<IResource> files) throws CoreException { if (resource instanceof IFile) { files.add(resource); return; } if (resource instanceof IContainer) { for (IResource resource1 : ((IContainer) resource).members()) { findFiles(resource1, files); } } }

Target:
private static void findFiles(IResource resource, List<IResource> files) throws CoreException { if (resource instanceof IFile) { files.add(resource); return; } if (resource instanceof IContainer) { for (IResource res : ((IContainer) resource).members()) { findFiles(res, files); } } }
Source:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { int lineCount = 0; int matches = 0; String line = readNextEventString(() -> (char) rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventEvent.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> (char) rafile.read()); } if(matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a traceevevnt trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }

Target:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { int lineCount = 0; int matches = 0; String line = readNextEventString(() -> (char) rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventEvent.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> (char) rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a traceevent trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }
Source:
private Map<String, String> getStatementSessionProperties() { if (queryTimeoutSeconds.get() > 0) { String queryTimeoutDuration = queryTimeoutSeconds.longValue() + "s"; PrestoConnection.checkSessionProperty(QUERY_MAX_RUN_TIME, queryTimeoutDuration); return ImmutableMap.of(QUERY_MAX_RUN_TIME, queryTimeoutDuration); } return ImmutableMap.of(); }

Target:
private Map<String, String> getStatementSessionProperties() { ImmutableMap.Builder<String, String> sessionProperties = ImmutableMap.builder(); if (queryTimeoutSeconds.get() > 0) { sessionProperties.put("query_max_run_time", queryTimeoutSeconds.longValue() + "s"); } return sessionProperties.build(); }
Source:
protected OpenstackImageProviderProxy getProviderProxy() { if (providerProxy == null) { StorageDomain storageDomain = DbFacade.getInstance().getStorageDomainDao().get( getEnclosingCommand().getParameters().getSourceStorageDomainId()); Provider provider = DbFacade.getInstance().getProviderDao().get(new Guid(storageDomain.getStorage())); providerProxy = ProviderProxyFactory.getInstance().create(provider); } return providerProxy; }

Target:
protected OpenstackImageProviderProxy getProviderProxy() { if (providerProxy == null) { providerProxy = OpenstackImageProviderProxy .getFromStorageDomainId(getEnclosingCommand().getParameters().getSourceStorageDomainId()); } return providerProxy; }
Source:
private void checkIndexRebuild(String cacheName, boolean rebuild) { String idxSql = "SELECT IS_INDEX_REBUILD_IN_PROGRESS FROM " + systemSchemaName() + ".TABLES " + "WHERE TABLE_NAME='" + cacheName + "'"; List<List<?>> res = execSql(grid(), idxSql); assertFalse(res.isEmpty()); assertTrue(res.stream().allMatch(row -> { assertEquals(1, row.size()); Boolean isIndexRebuildInProgress = (Boolean)row.get(0); return isIndexRebuildInProgress == rebuild; })); }

Target:
private void checkIndexRebuild(String cacheName, boolean rebuild) { String idxSql = "SELECT IS_INDEX_REBUILD_IN_PROGRESS FROM " + systemSchemaName() + ".TABLES " + "WHERE TABLE_NAME = ?"; List<List<?>> res = execSql(grid(), idxSql, cacheName); assertFalse(res.isEmpty()); assertTrue(res.stream().allMatch(row -> { assertEquals(1, row.size()); Boolean isIndexRebuildInProgress = (Boolean)row.get(0); return isIndexRebuildInProgress == rebuild; })); }
Source:
public void setControllerRoute( IPathItem fast, boolean zeroOut ) { if( zeroOut ) { this.usedChannels &= ~0xffffffff; } int idx = this.connections.indexOf( fast ); if( idx > 0 ) { this.connections.remove( fast ); this.connections.add( 0, (IGridConnection) fast ); } }

Target:
public void setControllerRoute( IPathItem fast, boolean zeroOut ) { if( zeroOut ) { this.usedChannels = 0; } int idx = this.connections.indexOf( fast ); if( idx > 0 ) { this.connections.remove( fast ); this.connections.add( 0, (IGridConnection) fast ); } }