auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void shouldUpdateChargeToUserCancel_IfEpdqStatusIs6WithRelevantChargeStatus() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(USER_CANCEL_SUBMITTED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); final boolean result = notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES); assertTrue(result); verify(mockChargeNotificationProcessor).invoke(payId, charge, USER_CANCELLATION_FLOW.getSuccessTerminalState(), null); }

Target:
void shouldUpdateChargeToUserCancel_IfEpdqStatusIs6WithRelevantChargeStatus() { final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(USER_CANCEL_SUBMITTED) .build()); setUpGatewayAccountToReturnGatewayAccountEntity(Optional.of(gatewayAccountEntity)); setUpChargeServiceToReturnCharge(Optional.of(charge)); assertTrue(notificationService.handleNotificationFor(payload, FORWARDED_IP_ADDRESSES)); verify(mockChargeNotificationProcessor).invoke(payId, charge, USER_CANCELLATION_FLOW.getSuccessTerminalState(), null); }
Source:
public void close() throws IOException { retryOnRateLimit(() -> { client.shutdown(); return true; }); }

Target:
public void close() throws IOException { retryOnRateLimit(() -> { client.shutdown(); return null; }); }
Source:
public void callsSupplierAgainAfterTimeElapses() { try (TimestampTracker tracker = new TimestampTracker(mockClock)) { when(mockClock.getTick()).thenReturn(0L, CACHE_RETRIGGER_NANOS / 2, CACHE_RETRIGGER_NANOS); AtomicLong timestampValue = new AtomicLong(0L); tracker.registerTimestampForTracking(FAKE_METRIC, timestampValue::incrementAndGet); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(1L); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(1L); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(2L); } }

Target:
public void callsSupplierAgainAfterTimeElapses() { try (TimestampTrackerImpl tracker = createTrackerWithClock(mockClock)) { when(mockClock.getTick()).thenReturn(0L, CACHE_INTERVAL_NANOS - 1, CACHE_INTERVAL_NANOS + 1); AtomicLong timestampValue = new AtomicLong(0L); tracker.registerTimestampForTracking(FAKE_METRIC, timestampValue::incrementAndGet); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(1L); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(1L); assertThat(getGauge(FAKE_METRIC).getValue()).isEqualTo(2L); } }
Source:
public void printWesHelpFooter() { out("Global Optional Parameters:"); out(" --wes-url <WES URI> WES URI where the WES command should run, e.g. 'http://localhost:8080/ga4gh/wes/v1'"); out(" --wes-auth <auth> Authorization credentials for the WES endpoint, e.g. 'Bearer 12345'"); out(""); out("NOTE: WES SUPPORT IS IN BETA AT THIS TIME. RESULTS MAY BE UNPREDICTABLE."); }

Target:
public void printWesHelpFooter() { out("Global Optional Parameters:"); out(" --wes-url <WES URL> URL where the WES request should be sent, e.g. 'http://localhost:8080/ga4gh/wes/v1'"); out(" --wes-auth <auth> Authorization credentials for the WES endpoint, e.g. 'Bearer 12345'"); out(""); out("NOTE: WES SUPPORT IS IN BETA AT THIS TIME. RESULTS MAY BE UNPREDICTABLE."); }
Source:
private String buildQuery(SpecificationController initialSpecification, List<LogicalNodeController> queryNodes) { QBuilder qBuilder = new QBuilder(); Optional<Condition> condition = initialSpecification.appendTo(qBuilder); String lastYearQuery = ""; if (onlyShowLastYearCheckBox.isVisible() && onlyShowLastYearCheckBox.isSelected()) { lastYearQuery = generateOnlyLastYearQuery(); } if (!condition.isPresent()) { return lastYearQuery; } for (LogicalNodeController queryNode : queryNodes) { Optional<Condition> currentCondition = queryNode.appendTo(condition.get()); if (!currentCondition.isPresent()) { break; } condition = currentCondition; } if (lastYearQuery.isEmpty()) { return (String) condition.get().query(new RSQLVisitor()); } return String.format("%s;%s", condition.get().query(new RSQLVisitor()), lastYearQuery); }

Target:
private String buildQuery(SpecificationController initialSpecification, List<LogicalNodeController> queryNodes) { QBuilder qBuilder = new QBuilder<>(); boolean isLastYearChecked = onlyShowLastYearCheckBox.isVisible() && onlyShowLastYearCheckBox.isSelected(); Optional<Condition> condition = initialSpecification.appendTo(qBuilder); if (!condition.isPresent()) { return isLastYearChecked ? (String) qBuilder.instant("endTime").after(OffsetDateTime.now().minusYears(1).toInstant(), false).query(new RSQLVisitor()) : ""; } for (LogicalNodeController queryNode : queryNodes) { Optional<Condition> currentCondition = queryNode.appendTo(condition.get()); if (!currentCondition.isPresent()) { break; } condition = currentCondition; } Condition toQuery = isLastYearChecked ? condition.get().and().instant("endTime").after(OffsetDateTime.now().minusYears(1).toInstant(), false) : condition.get(); return (String) toQuery.query(new RSQLVisitor()); }
Source:
private static String reportMessage(List<InterfaceTreeAndStringPairReport> interfacesToBeReported) { String functionalInterfaces = interfacesToBeReported.stream().map(x -> x.reportString).collect(Collectors.joining(", ")); String manyInterfaces = (interfacesToBeReported.size() > 1 ? "s" : "") + " '"; return String.format("Refactor this code to use the more specialised Functional Interface%s%s'", manyInterfaces, functionalInterfaces); }

Target:
private static String reportMessage(List<InterfaceTreeAndStringPairReport> interfacesToBeReported) { String functionalInterfaces = interfacesToBeReported.stream().map(x -> x.reportString) .collect(Collectors.joining("', '", (interfacesToBeReported.size() > 1 ? "s '" : " '"), "'")); return String.format("Refactor this code to use the more specialised Functional Interface%s", functionalInterfaces); }
Source:
private PlanNodeStatsEstimate filterForFalseExpression() { PlanNodeStatsEstimate.Builder falseStatsBuilder = PlanNodeStatsEstimate.builder(); input.getSymbolsWithKnownStatistics().forEach( symbol -> falseStatsBuilder.addSymbolStatistics(symbol, buildFrom(input.getSymbolStatistics(symbol)) .setLowValue(NaN) .setHighValue(NaN) .setDistinctValuesCount(0.0) .setNullsFraction(NaN).build())); return falseStatsBuilder.setOutputRowCount(0.0).build(); }

Target:
private PlanNodeStatsEstimate filterForFalseExpression() { PlanNodeStatsEstimate.Builder falseStatsBuilder = PlanNodeStatsEstimate.builder(); input.getSymbolsWithKnownStatistics().forEach(symbol -> falseStatsBuilder.addSymbolStatistics(symbol, ZERO_STATS)); return falseStatsBuilder .setOutputRowCount(0.0) .build(); }
Source:
public Element build(final CallbackProperties properties) throws SAMLAssertionBuilderException { LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20()"); Element signedAssertion = null; try { final X509Certificate certificate = certificateManager.getDefaultCertificate(); final PublicKey publicKey = certificateManager.getDefaultPublicKey(); final PrivateKey privateKey = certificateManager.getDefaultPrivateKey(); Assertion assertion; assertion = OpenSAML2ComponentBuilder.getInstance().createAssertion(); final String aID = createAssertionId(); LOG.debug("Assertion ID: {}", aID); assertion.setID(aID); final DateTime issueInstant = new DateTime(); assertion.setIssueInstant(issueInstant); assertion.setIssuer(createIssuer(properties, certificate)); assertion.setSubject(createSubject(properties, certificate, publicKey)); assertion.setConditions(createConditions(properties)); assertion.getStatements().addAll( createAttributeStatements(properties, createEvidenceSubject(properties, certificate, publicKey))); signedAssertion = sign(assertion, certificate, privateKey, publicKey); } catch (final SAMLComponentBuilderException | CertificateManagerException ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20() -- End"); return signedAssertion; }

Target:
public Element build(final CallbackProperties properties) throws SAMLAssertionBuilderException { LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20()"); Element signedAssertion = null; try { final X509Certificate certificate = certificateManager.getDefaultCertificate(); final PublicKey publicKey = certificateManager.getDefaultPublicKey(); final PrivateKey privateKey = certificateManager.getDefaultPrivateKey(); Assertion assertion = OpenSAML2ComponentBuilder.getInstance().createAssertion(); final String aID = createAssertionId(); LOG.debug("Assertion ID: {}", aID); assertion.setID(aID); final DateTime issueInstant = new DateTime(); assertion.setIssueInstant(issueInstant); assertion.setIssuer(createIssuer(properties, certificate)); assertion.setSubject(createSubject(properties, certificate, publicKey)); assertion.setConditions(createConditions(properties)); assertion.getStatements().addAll( createAttributeStatements(properties, createEvidenceSubject(properties, certificate, publicKey))); signedAssertion = sign(assertion, certificate, privateKey, publicKey); } catch (final SAMLComponentBuilderException | CertificateManagerException ex) { LOG.error("Unable to create HOK Assertion: {}", ex.getLocalizedMessage()); throw new SAMLAssertionBuilderException(ex.getLocalizedMessage(), ex); } LOG.debug("SamlCallbackHandler.createHOKSAMLAssertion20() -- End"); return signedAssertion; }
Source:
public static String toActivityString(int activity) { switch (activity) { case DetectedActivity.STILL: return "STILL"; case DetectedActivity.WALKING: return "WALKING"; case DetectedActivity.RUNNING: return "RUNNING"; case DetectedActivity.IN_VEHICLE: return "IN_VEHICLE"; case DetectedActivity.ON_FOOT: return "ON_FOOT"; default: return "UNKNOWN"; } }

Target:
public static String toActivityString(int activity) { switch (activity) { case DetectedActivity.STILL: return "STILL"; case DetectedActivity.WALKING: return "WALKING"; case DetectedActivity.RUNNING: return "RUNNING"; case DetectedActivity.IN_VEHICLE: return "IN_VEHICLE"; case DetectedActivity.ON_FOOT: return "ON_FOOT"; case DetectedActivity.ON_BICYCLE: return "ON_BICYCLE"; default: return "UNKNOWN = " + activity; } }
Source:
public void createPartControl(Composite parent) { super.createPartControl(parent); viewer = super.getViewer(); createFilterAction(); initToolBar(); }

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); createFilterAction(); initToolBar(); }
Source:
public void missingUrl() { String message = "Patch Set 1:\r\nBuild Started <LINK_0>*se.org/mylyn/job/gerrit-mylyn-reviews/"; BuildResult result = _parser.getBuildResult(message); Assert.assertNull(result); }

Target:
public void missingUrl() { String message = "Patch Set 1:\r\nBuild Started"; BuildResult result = parser.getBuildResult(message); Assert.assertNull(result); }
Source:
public void pushReset() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); HttpFields.Mutable requestHeaders = HttpFields.build() .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); CompletableFuture<Stream> streamCF = session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public Stream.Listener onPush(Stream pushedStream, PushPromiseFrame frame) { pushedStream.reset(new ResetFrame(pushedStream.getId(), ErrorCode.CANCEL_STREAM_ERROR.code), Callback.NOOP); return null; } }); }

Target:
public void pushReset() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); HttpFields requestHeaders = HttpFields.build() .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); CompletableFuture<Stream> streamCF = session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public Stream.Listener onPush(Stream pushedStream, PushPromiseFrame frame) { pushedStream.reset(new ResetFrame(pushedStream.getId(), ErrorCode.CANCEL_STREAM_ERROR.code), Callback.NOOP); return null; } }); }
Source:
public void testExecuteNonNullRunnable() throws Exception { FutureTask<Void> task = new FutureTask<Void>(new Runnable() { @Override public void run() { } }, null); ImmediateExecutor.INSTANCE.execute(task); assertTrue(task.isDone()); assertFalse(task.isCancelled()); assertTrue(task.get() == null); }

Target:
public void testExecuteNonNullRunnable() throws Exception { FutureTask<Void> task = new FutureTask<Void>(new Runnable() { @Override public void run() { } }, null); ImmediateExecutor.INSTANCE.execute(task); assertTrue(task.isDone()); assertFalse(task.isCancelled()); assertNull(task.get()); }
Source:
public void beginMetaData(MetaData metadata) { Map<String, String> parameters = new HashMap<>(); for (Map.Entry<String, Object> metadaPair : metadata.getMetaData().entrySet()) { parameters.put(metadaPair.getKey(), metadaPair.getValue().toString()); } parameters.put("class", "xwiki-metadata-block"); this.getXHTMLWikiPrinter().printXMLStartElement(METADATA_BLOCK_ELEMENT, parameters); }

Target:
public void beginMetaData(MetaData metadata) { Map<String, String> attributes = new LinkedHashMap<>(); for (Map.Entry<String, Object> metadataPair : metadata.getMetaData().entrySet()) { attributes.put(XHTMLXWikiGeneratorListener.METADATA_ATTRIBUTE_PREFIX + metadataPair.getKey(), metadataPair.getValue().toString()); } attributes.put("class", XHTMLXWikiGeneratorListener.METADATA_CONTAINER_CLASS); this.getXHTMLWikiPrinter().printXMLStartElement(getMetadataContainerElement(), attributes); }
Source:
public PatternLatencyTableView() { this.addPartPropertyListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); loadNewLatencyView(); } } } }); }

Target:
public PatternLatencyTableView() { this.addPartPropertyListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); loadLatencyView(); } } } }); }
Source:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); if (CoreUtils.isNullOrEmpty(connectionString)) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "credentials(String, String, TokenCredential), or setting the environment variable '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); } connectionString(connectionString); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP Web Sockets.")); } final CbsAuthorizationType authorizationType = credentials instanceof EventHubSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, SslDomain.VerifyMode.VERIFY_PEER_NAME); }

Target:
private ConnectionOptions getConnectionOptions() { configuration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; if (credentials == null) { final String connectionString = configuration.get(AZURE_EVENT_HUBS_CONNECTION_STRING); if (CoreUtils.isNullOrEmpty(connectionString)) { throw logger.logExceptionAsError(new IllegalArgumentException("Credentials have not been set. " + "They can be set using: connectionString(String), connectionString(String, String), " + "credentials(String, String, TokenCredential), or setting the environment variable '" + AZURE_EVENT_HUBS_CONNECTION_STRING + "' with a connection string")); } connectionString(connectionString); } if (proxyOptions == null) { proxyOptions = getDefaultProxyConfiguration(configuration); } if (proxyOptions != null && proxyOptions.isProxyAddressConfigured() && transport != AmqpTransportType.AMQP_WEB_SOCKETS) { throw logger.logExceptionAsError(new IllegalArgumentException( "Cannot use a proxy when TransportType is not AMQP Web Sockets.")); } final CbsAuthorizationType authorizationType = credentials instanceof EventHubSharedKeyCredential ? CbsAuthorizationType.SHARED_ACCESS_SIGNATURE : CbsAuthorizationType.JSON_WEB_TOKEN; final ClientOptions options = clientOptions != null ? clientOptions : new ClientOptions(); final SslDomain.VerifyMode verificationMode = verifyMode != null ? verifyMode : SslDomain.VerifyMode.VERIFY_PEER_NAME; return new ConnectionOptions(fullyQualifiedNamespace, credentials, authorizationType, transport, retryOptions, proxyOptions, scheduler, options, verificationMode); }
Source:
private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); ZKClientConfig conf = zooKeeper.getClientConfig(); if (conf.isSaslClientEnabled()) { try { String principalUserName = conf.getProperty(ZKClientConfig.ZK_SASL_CLIENT_USERNAME, ZKClientConfig.ZK_SASL_CLIENT_USERNAME_DEFAULT); String serverPrincipal = principalUserName + "/" + addr.getHostString(); String loginContext = conf.getProperty(ZKClientConfig.LOGIN_CONTEXT_NAME_KEY, ZKClientConfig.LOGIN_CONTEXT_NAME_KEY_DEFAULT); if (null != zooKeeperSaslClient && zooKeeperSaslClient.getSaslState() != SaslState.FAILED) { zooKeeperSaslClient.reCreateSaslClient(serverPrincipal, loginContext); } else { if (null != zooKeeperSaslClient) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(serverPrincipal, conf); } } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }

Target:
private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); if (clientConfig.isSaslClientEnabled()) { try { if (zooKeeperSaslClient != null) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(getServerPrincipal(addr), clientConfig); } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }
Source:
public IntervalListCodec(final SAMSequenceDictionary dict) { this(); dictionary = dict; }

Target:
public IntervalListCodec(final SAMSequenceDictionary dict) { super(Interval.class); dictionary = dict; }
Source:
public void execution() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { final SphereRequest<List<ShippingMethod>> sphereRequest = new VrapRequestDecorator<>(ShippingMethodsByLocationGet.of(CountryCode.DE).withExpansionPaths(m -> m.zones()), "response"); final List<ShippingMethod> shippingMethodsByLocation = client().executeBlocking(sphereRequest); assertThat(shippingMethodsByLocation).isNotEmpty(); for (final ShippingMethod shippingMethodByLocation : shippingMethodsByLocation) { final List<ShippingRate> shippingRates = shippingMethodByLocation.getZoneRates().stream() .flatMap(zoneRate -> zoneRate.getShippingRates().stream()) .collect(Collectors.toList()); assertThat(shippingRates).areAtLeastOne(new Condition<>(ShippingRate::isMatching, "Shipping rate is matching")); } }); }

Target:
public void execution() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { final SphereRequest<List<ShippingMethod>> sphereRequest = new VrapRequestDecorator<>(ShippingMethodsByLocationGet.of(CountryCode.DE).withExpansionPaths(m -> m.zones()), "response"); final List<ShippingMethod> shippingMethodsByLocation = client().executeBlocking(sphereRequest); assertThat(shippingMethodsByLocation).isNotEmpty(); for (final ShippingMethod shippingMethodByLocation : shippingMethodsByLocation) { final List<ShippingRate> shippingRates = shippingMethodByLocation.getZoneRates().stream() .flatMap(zoneRate -> zoneRate.getShippingRates().stream()) .collect(Collectors.toList()); assertThat(shippingRates).areAtLeastOne(new Condition<>(ShippingRate::isMatching, "Shipping rate is matching")); assertThat(shippingMethodByLocation.getZones()).isNotEmpty(); assertThat(shippingMethodByLocation.getZones().get(0).getObj()).isNotNull(); } }); }
Source:
private Gauge<Number> makeZkQueueGauge(final String path){ return () -> { try { return curatorFramework.getChildren().forPath(path).size(); } catch (Exception e) { return 0; } }; }

Target:
private Gauge<Number> makeZkQueueGauge(final String path){ return () -> { try { return curatorFramework.getChildren().forPath(path).size(); } catch (Exception e) { throw new RuntimeException(e); } }; }
Source:
public void testGetProducerInfoPartialClient() { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("2"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("2"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span parentSpan = new Span(); parentSpan.setId("1"); parentSpan.setParentId("1"); try { spanCache.store(null, Arrays.asList(serverSpan, clientSpan, parentSpan), SpanUniqueIdGenerator::toUnique); } catch (CacheException e) { fail("Failed to store span"); } ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }

Target:
public void testGetProducerInfoPartialClient() throws CacheException { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("2"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("2"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span parentSpan = new Span(); parentSpan.setId("1"); parentSpan.setParentId("1"); spanCache.store(null, Arrays.asList(serverSpan, clientSpan, parentSpan), SpanUniqueIdGenerator::toUnique); ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }
Source:
public void create(String stream) throws IOException { HttpPut putRequest = new HttpPut(restClient.getBaseUrl() + String.format("streams/%s", stream)); CloseableHttpResponse httpResponse = restClient.execute(putRequest); try { LOG.debug("Create Stream Response Code : {}", httpResponse.getStatusLine().getStatusCode()); RestClient.responseCodeAnalysis(httpResponse); } finally { httpResponse.close(); } }

Target:
public void create(String stream) throws IOException { HttpPut putRequest = new HttpPut(restClient.getBaseURL().resolve(String.format("/%s/streams/%s", restClient.getVersion(), stream))); CloseableHttpResponse httpResponse = restClient.execute(putRequest); try { LOG.debug("Create Stream Response Code : {}", httpResponse.getStatusLine().getStatusCode()); RestClient.responseCodeAnalysis(httpResponse); } finally { httpResponse.close(); } }
Source:
public int compareTo(Result<T> tResult) { if (timestamp == null && tResult.timestamp == null) { return 0; } else if (timestamp == null) { return 1; } else if (tResult == null) { return -1; } else { return timestamp.compareTo(tResult.timestamp); } }

Target:
public int compareTo(Result<T> tResult) { return Comparator.nullsLast(DateTime::compareTo).compare(this.timestamp, tResult.timestamp); }
Source:
private void getTasksRequest(){ Log.i("watasdfasdf", String.valueOf(mArgs.getInt(OPTION))); HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); TaskListRequest taskListRequest = new TaskListRequest(getActivity(), params, new Response.Listener<ArrayList<Task>>() { @Override public void onResponse(ArrayList<Task> tasks) { if (mArgs.getInt(OPTION) == USER) { tasks = getUserTasks(tasks); if (tasks.size() > 0) { showList(); setUserTasks(tasks); mUserTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mUserTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } else { if (tasks.size() > 0) { showList(); setAllTasks(tasks); mAllTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mAllTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } if (mSwipeLayout != null) mSwipeLayout.setRefreshing(false); } }, mSwipeLayout); mNetworkManager.getRequestQueue().add(taskListRequest); }

Target:
private void getTasksRequest(){ mSwipeLayout.setRefreshing(true); HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); TaskListRequest taskListRequest = new TaskListRequest(getActivity(), params, new Response.Listener<ArrayList<Task>>() { @Override public void onResponse(ArrayList<Task> tasks) { if (mArgs.getInt(OPTION) == USER) { tasks = getUserTasks(tasks); if (tasks.size() > 0) { showList(); setUserTasks(tasks); mUserTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mUserTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } else { if (tasks.size() > 0) { showList(); setAllTasks(tasks); mAllTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mAllTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } if (mSwipeLayout != null) mSwipeLayout.setRefreshing(false); } }, mSwipeLayout); mNetworkManager.getRequestQueue().add(taskListRequest); }
Source:
private void syncObjectUnsafeInner(long timestamp) { if (optimisticallyOwnedByThreadUnsafe()) { if (optimisticStream.pos() == Address.NEVER_READ) { final WriteSetSMRStream currentOptimisticStream = optimisticStream; if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); } catch (NoRollbackException nre) { log.warn("SyncObjectUnsafe[{}] to failed {}", this, timestamp, nre); if (getCompactionMark() > timestamp) { throw new TrimmedException(); } resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); optimisticStream = currentOptimisticStream; } syncStreamUnsafe(optimisticStream, Address.OPTIMISTIC); } else { if (this.optimisticStream != null) { optimisticRollbackUnsafe(); this.optimisticStream = null; } if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); if (getVersionUnsafe() == timestamp) { return; } } catch (NoRollbackException nre) { log.warn("Rollback[{}] to failed {}", this, timestamp, nre); if (Address.isAddress(timestamp) && getCompactionMark() > timestamp) { throw new TrimmedException(); } resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); } }

Target:
private void syncObjectUnsafeInner(long timestamp) { if (optimisticallyOwnedByThreadUnsafe()) { if (optimisticStream.pos() == Address.NEVER_READ) { final WriteSetSMRStream currentOptimisticStream = optimisticStream; if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); } catch (NoRollbackException nre) { log.warn("SyncObjectUnsafe[{}] to failed {}", this, timestamp, nre); resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); optimisticStream = currentOptimisticStream; } syncStreamUnsafe(optimisticStream, Address.OPTIMISTIC); } else { if (this.optimisticStream != null) { optimisticRollbackUnsafe(); this.optimisticStream = null; } if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); if (getVersionUnsafe() == timestamp) { return; } } catch (NoRollbackException nre) { log.warn("Rollback[{}] to failed {}", this, timestamp, nre); resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); } }
Source:
public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Max abs example started."); IgniteCache<Integer, Person> persons = createCache(ignite); IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); IgniteBiFunction<Integer, Person, Vector> preprocessor = new MaxAbsScalerTrainer<Integer, Person>() .fit(ignite, persons, featureExtractor); try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) { double[] mean = dataset.mean(); System.out.println("Mean \n\t" + Arrays.toString(mean)); double[] std = dataset.std(); System.out.println("Standard deviation \n\t" + Arrays.toString(std)); double[][] cov = dataset.cov(); System.out.println("Covariance matrix "); for (double[] row : cov) System.out.println("\t" + Arrays.toString(row)); double[][] corr = dataset.corr(); System.out.println("Correlation matrix "); for (double[] row : corr) System.out.println("\t" + Arrays.toString(row)); } System.out.println(">>> Max abs example completed."); } }

Target:
public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Max abs example started."); IgniteCache<Integer, Person> persons = createCache(ignite); IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); IgniteBiFunction<Integer, Person, Vector> preprocessor = new MaxAbsScalerTrainer<Integer, Person>() .fit(ignite, persons, featureExtractor); try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) { new DatasetHelper(dataset).describe(); } System.out.println(">>> Max abs example completed."); } }
Source:
private void initViewModel() { mFloatingActionButton = findViewById(R.id.fab_button); mFabTooltip = findViewById(R.id.fab_tooltip); mViewModel = ViewModelProviders.of(this, mViewModelFactory).get(WPMainActivityViewModel.class); if (BuildConfig.INFORMATION_ARCHITECTURE_AVAILABLE) { mViewModel.getShowMainActionFab().observe(this, showUiState -> { if (showUiState.isFabVisible()) { mFloatingActionButton.show(); } else { mFloatingActionButton.hide(); } if (showUiState.isFabTooltipVisible()) { mFabTooltip.show(); } else { mFabTooltip.hide(); } }); mViewModel.getCreateAction().observe(this, createAction -> { switch (createAction) { case CREATE_NEW_POST: handleNewPostAction(PagePostCreationSourcesDetail.POST_FROM_MY_SITE); break; case CREATE_NEW_PAGE: handleNewPageAction(PagePostCreationSourcesDetail.PAGE_FROM_MY_SITE); break; } }); mFloatingActionButton.setOnClickListener(v -> { mViewModel.setIsBottomSheetShowing(true); }); mViewModel.isBottomSheetShowing().observe(this, event -> { event.applyIfNotHandled(isShowing -> { FragmentManager fm = getSupportFragmentManager(); if (fm != null) { MainBottomSheetFragment bottomSheet = (MainBottomSheetFragment) fm.findFragmentByTag(MAIN_BOTTOM_SHEET_TAG); if (isShowing && bottomSheet == null) { bottomSheet = new MainBottomSheetFragment(); bottomSheet.show(getSupportFragmentManager(), MAIN_BOTTOM_SHEET_TAG); } else if (!isShowing && bottomSheet != null) { bottomSheet.dismiss(); } } return null; }); }); } mViewModel.start(mBottomNav.getCurrentSelectedPage() == PageType.MY_SITE); }

Target:
private void initViewModel() { mFloatingActionButton = findViewById(R.id.fab_button); mFabTooltip = findViewById(R.id.fab_tooltip); mViewModel = ViewModelProviders.of(this, mViewModelFactory).get(WPMainActivityViewModel.class); if (BuildConfig.INFORMATION_ARCHITECTURE_AVAILABLE) { mViewModel.getFabUiState().observe(this, fabUiState -> { if (fabUiState.isFabTooltipVisible()) { mFabTooltip.show(); } else { mFabTooltip.hide(); } if (fabUiState.isFabVisible()) { mFloatingActionButton.show(); } else { mFloatingActionButton.hide(); } }); mViewModel.getCreateAction().observe(this, createAction -> { switch (createAction) { case CREATE_NEW_POST: handleNewPostAction(PagePostCreationSourcesDetail.POST_FROM_MY_SITE); break; case CREATE_NEW_PAGE: handleNewPageAction(PagePostCreationSourcesDetail.PAGE_FROM_MY_SITE); break; } }); mFloatingActionButton.setOnClickListener(v -> { mViewModel.setIsBottomSheetShowing(true); }); mFabTooltip.setOnClickListener(v -> { mViewModel.onTooltipTapped(); }); mViewModel.isBottomSheetShowing().observe(this, event -> { event.applyIfNotHandled(isShowing -> { FragmentManager fm = getSupportFragmentManager(); if (fm != null) { MainBottomSheetFragment bottomSheet = (MainBottomSheetFragment) fm.findFragmentByTag(MAIN_BOTTOM_SHEET_TAG); if (isShowing && bottomSheet == null) { bottomSheet = new MainBottomSheetFragment(); bottomSheet.show(getSupportFragmentManager(), MAIN_BOTTOM_SHEET_TAG); } else if (!isShowing && bottomSheet != null) { bottomSheet.dismiss(); } } return null; }); }); } mViewModel.start(mBottomNav.getCurrentSelectedPage() == PageType.MY_SITE); }
Source:
private Node valueMap( Node n ) { if (n.isVariable()) { Var v = Var.alloc(n); Node n2 = values.get( v ); return n2==null?n:n2; } return n; }

Target:
private Node valueMap( Node n ) { if (n.isVariable()) { Var v = Var.alloc(n); return values.getOrDefault(v, n); } return n; }
Source:
public Object getAdapter(Class adapter) { if (adapter == IResource.class || adapter == IContainer.class) { return getContainer(); } else if (adapter == IPath.class) { return path; } return null; }

Target:
public Object getAdapter(Class adapter) { if (adapter == IResource.class || adapter == IContainer.class) return getContainer(); else if (adapter == IPath.class) return path; return null; }
Source:
public Optional<Long> getFeeAmount() { if (fee != null) { return Optional.of(fee.getAmountCollected()); } else { return Optional.empty(); } }

Target:
public Optional<Long> getFeeAmount() { return Optional.ofNullable(fee).map(FeeEntity::getAmountCollected); }
Source:
public void notifyHeartbeat(final String streamId, final String claimedJobId) { final AtomicBoolean isNew = new AtomicBoolean(false); final JobStreamsRecord jobStreamsRecord = this.jobStreamRecordsMap.computeIfAbsent( claimedJobId, jobId -> { isNew.set(true); return new JobStreamsRecord(jobId); } ); log.debug( "Received heartbeat for job using stream {}", isNew.get() ? "new" : "existing", claimedJobId, streamId ); jobStreamsRecord.updateActiveStream(streamId, timeSupplier.get()); if (isNew.get()) { log.debug("Notifying new agent connected executing job: {}", claimedJobId); this.agentRoutingService.handleClientConnected(claimedJobId); } }

Target:
public void notifyHeartbeat(final String streamId, final String claimedJobId) { final AtomicBoolean atomicIsNew = new AtomicBoolean(false); final JobStreamsRecord jobStreamsRecord = this.jobStreamRecordsMap.computeIfAbsent( claimedJobId, jobId -> { atomicIsNew.set(true); return new JobStreamsRecord(jobId); } ); final boolean isNew = atomicIsNew.get(); log.debug( "Received heartbeat for job using stream {}", isNew ? "new" : "existing", claimedJobId, streamId ); jobStreamsRecord.updateActiveStream(streamId, timeSupplier.get()); if (isNew) { log.debug("Notifying new agent connected executing job: {}", claimedJobId); this.agentRoutingService.handleClientConnected(claimedJobId); } }
Source:
default String getDynamicConfigPath() { return "/models/"; }

Target:
default String getDynamicConfigPath() { return File.separator + "models" + File.separator; }
Source:
public ResponseEntity setModelVersion(String version) { boolean validRequest = !StringUtils.isEmpty(version); if (validRequest) { try { if (version.equals(configurationService.getModelRepositoryVersion())) { return new ResponseEntity(HttpStatus.NO_CONTENT); } if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { LOGGER.info(LOG_REJECTING_MODEL_VERSION); return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { LOGGER.info(LOG_FAILED_TO_GET_LIST_OF_VERSIONS); LOGGER.info(LOG_VERSION_CONFIGURATION_NOT_UPDATED); LOGGER.error(e); return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }

Target:
public ResponseEntity setModelVersion(String version) { boolean validRequest = !StringUtils.isEmpty(version); if (validRequest) { try { if (version.equals(configurationService.getModelRepositoryVersion())) { return new ResponseEntity(HttpStatus.NO_CONTENT); } if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { LOGGER.info(LOG_REJECTING_MODEL_VERSION); return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { LOGGER.error(LOG_FAILED_TO_GET_LIST_OF_VERSIONS, e); LOGGER.info(LOG_VERSION_CONFIGURATION_NOT_UPDATED); return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }
Source:
public void executeScriptFile() throws IOException { String hiveSql = "use default"; File file = new File(tempFolder.getRoot(), "script.hiveSql"); Files.write(hiveSql, file, UTF_8); HiveShell shell = createHiveCliShell(); shell.start(); shell.execute(file); verify(container).executeStatement(hiveSql); }

Target:
public void executeScriptFile() throws IOException { String hiveSql = "use default"; File file = new File(tempFolder.getRoot(), "script.sql"); Files.write(hiveSql, file, UTF_8); HiveShell shell = createHiveCliShell(); shell.start(); shell.execute(file); verify(container).executeStatement(hiveSql); }
Source:
private static String buildColumns(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return EMPTY_STRING; } return columns.stream().map(HiveColumnHandle::getName).collect(Collectors.joining(",")); }

Target:
private static String buildColumns(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return ""; } return columns.stream() .map(HiveColumnHandle::getName) .collect(Collectors.joining(",")); }
Source:
private void showPrepublishingNudgeBottomSheet() { mViewPager.setCurrentItem(PAGE_CONTENT); ActivityUtils.hideKeyboard(this); Fragment fragment = getSupportFragmentManager().findFragmentByTag( PrepublishingBottomSheetFragment.TAG); if (fragment == null) { PrepublishingBottomSheetFragment prepublishingFragment = PrepublishingBottomSheetFragment.newInstance(getSite(), mIsPage); long delayMs = 100; new Handler().postDelayed( () -> prepublishingFragment.show(getSupportFragmentManager(), PrepublishingBottomSheetFragment.TAG), delayMs); } }

Target:
private void showPrepublishingNudgeBottomSheet() { mViewPager.setCurrentItem(PAGE_CONTENT); ActivityUtils.hideKeyboard(this); long delayMs = 100; mShowPrepublishingBottomSheetHandler.postDelayed(mShowPrepublishingBottomSheetRunnable, delayMs); }
Source:
public List<String> getFieldValues() throws IOException { if (values == null) { List<Object> objs = HighlightUtils.loadFieldValues(context.field, context.mapper, context.context, context.hitContext); values = objs.stream().map(Object::toString).collect(toList()); } return values; }

Target:
public List<String> getFieldValues() throws IOException { if (values == null) { List<Object> objs = HighlightUtils.loadFieldValues(context.field, context.mapper, context.context, context.hitContext); values = objs.stream().map(Object::toString).collect(toCollection(() -> new ArrayList<>(objs.size()))); } return values; }
Source:
public WordsStorage(Context context) { mContext = context; if (!checkBaseDBExist()) { mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); try { InputStream input = mContext.getAssets().open("base.sqlite3"); OutputStream output = new FileOutputStream( mContext.getDatabasePath("base.sqlite3")); IOUtils.copy(input, output); } catch (IOException e) { e.printStackTrace(); } } }

Target:
public WordsStorage(Context context) { mContext = context; if (!checkBaseDBExist()) { mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); InputStream input = null; OutputStream output = null; try { input = mContext.getAssets().open("base.sqlite3"); output = new FileOutputStream(mContext.getDatabasePath("base.sqlite3")); IOUtils.copy(input, output); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(input); IOUtils.closeQuietly(output); } } }
Source:
public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } DateTime createdLocal; try { int foundCreatedLocal = r.findColumn("nameOfColumn"); createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.valueOf(r.getString("response_type").toUpperCase()), Question.FREQUENCY.valueOf(r.getString("frequency").toUpperCase()), Question.ASK_TIME.valueOf(r.getString("ask_time").toUpperCase()), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices ); return question; }

Target:
public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } DateTime createdLocal; try { int foundCreatedLocal = r.findColumn("created_local_utc_ts"); createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.valueOf(r.getString("response_type").toUpperCase()), Question.FREQUENCY.valueOf(r.getString("frequency").toUpperCase()), Question.ASK_TIME.valueOf(r.getString("ask_time").toUpperCase()), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices ); return question; }
Source:
protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } long start = 0; long end = 0; do { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); } while (!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } long start = 0; long end = 0; boolean finished = false; do { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } finished = ss.waitUntilBuilt(LIVE_UPDATE_DELAY); TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); } while (!finished); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }
Source:
public String toString() { return String.format("%s: %s", key, value); }

Target:
public String toString() { return String.format("%s: %s (%s)", key, value, type); }