auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testRecovery2() throws URISyntaxException { startContainer(null); URI longLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", LONG_TIMEOUT, ChronoUnit.MILLIS); URI shortLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", SHORT_TIMEOUT, ChronoUnit.MILLIS); try (Response ignore = ClientBuilder.newClient().target(lraListenerURL).path(LRA_LISTENER_KILL) .request() .get()) { fail(testName + ": the container should have halted"); } catch (RuntimeException e) { LRALogger.logger.infof("%s: the container halted", testName); } restartContainer(); int sc = recover(); if (sc != 0) { recover(); } LRAStatus longStatus = getStatus(longLRA); LRAStatus shortStatus = getStatus(shortLRA); Assert.assertEquals("LRA with long timeout should still be active", LRAStatus.Active.name(), longStatus.name()); Assert.assertTrue("LRA with short timeout should not be active", shortStatus == null || LRAStatus.Cancelled.equals(shortStatus)); try (Response response = ClientBuilder.newClient().target(lraListenerURL).path(LRA_LISTENER_UNTIMED_ACTION) .request() .header(LRA_HTTP_CONTEXT_HEADER, longLRA) .put(null)) { Assert.assertEquals("LRA participant action", 200, response.getStatus()); } lraClient.closeLRA(longLRA); String listenerStatus = getStatusFromListener(); assertEquals("LRA listener should have been told that the final state of the LRA was closed", LRAStatus.Closed.name(), listenerStatus); }

Target:
public void testRecovery2() throws URISyntaxException { startContainer(null); URI longLRA = lraClient.startLRA(null, "Long Timeout Recovery Test", LONG_TIMEOUT, ChronoUnit.MILLIS); URI shortLRA = lraClient.startLRA(null, "Short Timeout Recovery Test", SHORT_TIMEOUT, ChronoUnit.MILLIS); try (Response ignore = client.target(lraListenerURL).path(LRA_LISTENER_KILL) .request() .get()) { fail(testName + ": the container should have halted"); } catch (RuntimeException e) { LRALogger.logger.infof("%s: the container halted", testName); } restartContainer(); int sc = recover(); if (sc != 0) { recover(); } LRAStatus longStatus = getStatus(longLRA); LRAStatus shortStatus = getStatus(shortLRA); Assert.assertEquals("LRA with long timeout should still be active", LRAStatus.Active.name(), longStatus.name()); Assert.assertTrue("LRA with short timeout should not be active", shortStatus == null || LRAStatus.Cancelled.equals(shortStatus)); try (Response response = client.target(lraListenerURL).path(LRA_LISTENER_UNTIMED_ACTION) .request() .header(LRA_HTTP_CONTEXT_HEADER, longLRA) .put(null)) { Assert.assertEquals("LRA participant action", 200, response.getStatus()); } lraClient.closeLRA(longLRA); String listenerStatus = getStatusFromListener(); assertEquals("LRA listener should have been told that the final state of the LRA was closed", LRAStatus.Closed.name(), listenerStatus); }
Source:
public void completedServerStartup() { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { if (gatewayArtifactSynchronizerProperties.getGatewayStartup() .equals(APIConstants.GatewayArtifactSynchronizer.GATEWAY_STARTUP_SYNC)) { deployAPIsInSyncMode(); } else { deployAPIsInAsyncMode(); } } jmsTransportHandlerForTrafficManager .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_THROTTLE_DATA, new JMSMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_TOKEN_REVOCATION, new GatewayTokenRevocationMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_CACHE_INVALIDATION, new APIMgtGatewayCacheMessageListener()); jmsTransportHandlerForEventHub .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_NOTIFICATION, new GatewayJMSMessageListener()); }

Target:
public void completedServerStartup() { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { if (APIConstants.GatewayArtifactSynchronizer.GATEWAY_STARTUP_SYNC .equals(gatewayArtifactSynchronizerProperties.getGatewayStartup())) { deployAPIsInSyncMode(); } else { deployAPIsInAsyncMode(); } } jmsTransportHandlerForTrafficManager .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_THROTTLE_DATA, new JMSMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_TOKEN_REVOCATION, new GatewayTokenRevocationMessageListener()); jmsTransportHandlerForEventHub.subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_CACHE_INVALIDATION, new APIMgtGatewayCacheMessageListener()); jmsTransportHandlerForEventHub .subscribeForJmsEvents(APIConstants.TopicNames.TOPIC_NOTIFICATION, new GatewayJMSMessageListener()); }
Source:
public List<ItemStackSnapshot> getRemainingItems() { return remainingItems; }

Target:
public List<ItemStackSnapshot> getRemainingItems() { return this.remainingItems; }
Source:
private void testWithSchemaSearchPath() throws SQLException { deleteDb(getTestName()); final JdbcConnection conn = getJdbcConnection(); final Session session = (Session) conn.getSession(); session.setSchemaSearchPath(new String[]{ "PUBLIC" }); final Statement stat = conn.createStatement(); stat.execute("CREATE TABLE T1 ( ID INT IDENTITY )"); try { stat.executeQuery("SELECT 1 FROM t1"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { final String message = e.getMessage(); assertContains(message, "Table \"t1\" not found (candidates are: \"T1\")"); } conn.close(); deleteDb(getTestName()); }

Target:
private void testWithSchemaSearchPath() throws SQLException { deleteDb(getTestName()); Connection conn = getConnection(); Statement stat = conn.createStatement(); stat.execute("SET SCHEMA_SEARCH_PATH PUBLIC"); stat.execute("CREATE TABLE T1 ( ID INT IDENTITY )"); try { stat.executeQuery("SELECT 1 FROM t1"); fail("Table `t1` was accessible but should not have been."); } catch (SQLException e) { String message = e.getMessage(); assertContains(message, "Table \"t1\" not found (candidates are: \"T1\")"); } conn.close(); deleteDb(getTestName()); }
Source:
public void onSuccess() { if (!vmStatic.isHostedEngine()) { return; } vmStatic.getDiskList().stream() .map(DiskImage::getStoragePoolId) .distinct() .forEach((storagePoolId) -> Backend.getInstance().runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new ProcessOvfUpdateForStoragePoolParameters(storagePoolId))); }

Target:
public void onSuccess() { if (!vm.isHostedEngine()) { return; } Backend.getInstance().runInternalAction(VdcActionType.ProcessOvfUpdateForStoragePool, new ProcessOvfUpdateForStoragePoolParameters(vm.getStoragePoolId())); }
Source:
private List<Row> getKeyHeads() { List<Row> keyHeads = new ArrayList<Row>(rows.size()); for (Row row : rows) { final List<Cell> cells = row.getCellsCopy(); keyHeads.add(new Row(cells.get(0), cells.get(1), new Cell(cells.get(2).getTimestamp()))); } return keyHeads; }

Target:
private static List<Row> getKeyHeads() { List<Row> keyHeads = new ArrayList<Row>(rows.size()); for (Row row : rows) { final List<Cell> cells = row.getCellsCopy(); keyHeads.add(new Row(cells.get(0), cells.get(1), cells.get(2))); } return keyHeads; }
Source:
public static Object deepToOrgJson(JsonValue v) { if (v instanceof JsonObject) { JSONObject obj = new JSONObject(); ((JsonObject)v).forEach((key, value) -> obj.put(key, deepToOrgJson(value))); return obj; } else if (v instanceof JsonArray) { JSONArray array = new JSONArray(); ((JsonArray)v).forEach((index, value) -> array.put(deepToOrgJson(value))); return array; } else return v.unwrap(); }

Target:
protected static Object deepToOrgJson(JsonValue v) { if (v.unwrap() == null) { return JSONObject.NULL; } if (v instanceof JsonObject) { JSONObject obj = new JSONObject(); ((JsonObject)v).forEach((key, value) -> obj.put(key, deepToOrgJson(value))); return obj; } else if (v instanceof JsonArray) { JSONArray array = new JSONArray(); ((JsonArray)v).forEach((index, value) -> array.put(deepToOrgJson(value))); return array; } else return v.unwrap(); }
Source:
public void updateData(ByteBuffer data){ if (!data.isDirect()) throw new IllegalArgumentException("Currently only direct buffers are allowed"); this.audioData = data; updateNeeded = true; }

Target:
public void updateData(ByteBuffer data){ if (!data.isDirect()) { throw new IllegalArgumentException( "Currently only direct buffers are allowed"); } this.audioData = data; updateNeeded = true; }
Source:
protected void onAddRequestStart(Channel channel) { if (addsSemaphore != null) { if (!addsSemaphore.tryAcquire()) { final long throttlingStartTimeNanos = MathUtils.nowInNano(); channel.config().setAutoRead(false); addsBlocked.incrementAndGet(); addsSemaphore.acquireUninterruptibly(); channel.config().setAutoRead(true); addEntryBlockedStats.registerSuccessfulEvent(MathUtils.elapsedNanos(throttlingStartTimeNanos), TimeUnit.NANOSECONDS); addsBlocked.decrementAndGet(); } } final int curr = addsInProgress.incrementAndGet(); maxAddsInProgress.accumulateAndGet(curr, Integer::max); }

Target:
protected void onAddRequestStart(Channel channel) { if (addsSemaphore != null) { if (!addsSemaphore.tryAcquire()) { final long throttlingStartTimeNanos = MathUtils.nowInNano(); channel.config().setAutoRead(false); LOG.info("Too many add requests in progress, disabling autoread on channel {}", channel); addsBlocked.incrementAndGet(); addsSemaphore.acquireUninterruptibly(); channel.config().setAutoRead(true); final long delayNanos = MathUtils.elapsedNanos(throttlingStartTimeNanos); LOG.info("Re-enabled autoread on channel after AddRequest delay of nanos", channel, delayNanos); addEntryBlockedStats.registerSuccessfulEvent(delayNanos, TimeUnit.NANOSECONDS); addsBlocked.decrementAndGet(); } } final int curr = addsInProgress.incrementAndGet(); maxAddsInProgress.accumulateAndGet(curr, Integer::max); }
Source:
private Mono<Void> sendIterable(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transaction) { if (Objects.isNull(messages)) { return monoError(logger, new NullPointerException("'messages' cannot be null.")); } return createMessageBatch().flatMap(messageBatch -> { messages.forEach(message -> messageBatch.tryAddMessage(message)); return sendInternal(messageBatch, transaction); }).onErrorMap(throwable -> { if (throwable instanceof AmqpException) { return new ServiceBusException((AmqpException) throwable, ServiceBusErrorSource.SEND); } else { return throwable; } }); }

Target:
private Mono<Void> sendIterable(Iterable<ServiceBusMessage> messages, ServiceBusTransactionContext transaction) { if (Objects.isNull(messages)) { return monoError(logger, new NullPointerException("'messages' cannot be null.")); } return createMessageBatch().flatMap(messageBatch -> { messages.forEach(message -> messageBatch.tryAddMessage(message)); return sendInternal(messageBatch, transaction); }); }
Source:
protected RouteBuilder createRouteBuilder() throws Exception { final Namespaces ns = new Namespaces("sparql", "<LINK_0>"); final XPathBuilder xpath = new XPathBuilder( " xpath.namespaces(ns); final XPathBuilder uriResult = new XPathBuilder( "/sparql:binding/sparql:uri"); uriResult.namespaces(ns); final XPathBuilder literalResult = new XPathBuilder( "/sparql:binding/sparql:literal"); literalResult.namespaces(ns); return new RouteBuilder() { public void configure() throws IOException { final String fuseki_url = "localhost:" + System.getProperty("fuseki.dynamic.test.port", "3030"); from("direct:start") .process(new AuditSparqlProcessor()) .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); from("direct:query") .to("http4:" + fuseki_url + "/test/query") .split(xpath) .choice() .when().xpath("/sparql:binding/sparql:uri", String.class, ns) .transform().xpath("/sparql:binding/sparql:uri/text()", String.class, ns) .to("mock:sparql.query") .when().xpath("/sparql:binding/sparql:literal", String.class, ns) .transform().xpath("/sparql:binding/sparql:literal/text()", String.class, ns) .to("mock:sparql.query"); from("direct:clear") .transform().constant("update=DELETE WHERE { ?s ?o ?p }") .setHeader(Exchange.CONTENT_TYPE).constant("application/x-www-form-urlencoded") .setHeader(Exchange.HTTP_METHOD).constant("POST") .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); } }; }

Target:
protected RouteBuilder createRouteBuilder() throws Exception { final Namespaces ns = new Namespaces("sparql", "<LINK_0>"); final XPathBuilder xpath = new XPathBuilder( " xpath.namespaces(ns); final XPathBuilder uriResult = new XPathBuilder( "/sparql:binding/sparql:uri"); uriResult.namespaces(ns); final XPathBuilder literalResult = new XPathBuilder( "/sparql:binding/sparql:literal"); literalResult.namespaces(ns); return new RouteBuilder() { public void configure() throws IOException { final String fuseki_url = "localhost:" + Integer.toString(FUSEKI_PORT); from("direct:start") .process(new AuditSparqlProcessor()) .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); from("direct:query") .to("http4:" + fuseki_url + "/test/query") .split(xpath) .choice() .when().xpath("/sparql:binding/sparql:uri", String.class, ns) .transform().xpath("/sparql:binding/sparql:uri/text()", String.class, ns) .to("mock:sparql.query") .when().xpath("/sparql:binding/sparql:literal", String.class, ns) .transform().xpath("/sparql:binding/sparql:literal/text()", String.class, ns) .to("mock:sparql.query"); from("direct:clear") .transform().constant("update=DELETE WHERE { ?s ?o ?p }") .setHeader(Exchange.CONTENT_TYPE).constant("application/x-www-form-urlencoded") .setHeader(Exchange.HTTP_METHOD).constant("POST") .to("http4:" + fuseki_url + "/test/update") .to("mock:sparql.update"); } }; }
Source:
public void queueListeningTestCase() { try { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME_2); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME_2); Assert.assertTrue(queueTestMessageProcessor.getCount() > 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME_2); jmsQueueTransportListener.stop(); } catch (Exception e) { Assert.fail("Error while listening to queue"); } }

Target:
public void queueListeningTestCase() throws ServerConnectorException, InterruptedException, JMSException { jmsQueueTransportListener.start(queueListeningParameters); logger.info("JMS Transport Listener is starting to listen to the queue " + JMSTestConstants.QUEUE_NAME_2); jmsServer.publishMessagesToQueue(JMSTestConstants.QUEUE_NAME_2); Assert.assertTrue(queueTestMessageProcessor.getCount() > 10, "Expected message count is not received when " + "listening to queue " + JMSTestConstants.QUEUE_NAME_2); jmsQueueTransportListener.stop(); }
Source:
public void registerDatasources(){ Object obj = get(DATASOURCES_KEY); if (obj != null && obj instanceof GenericConfiguration) { ConcurrentHashMap<String, GenericConfiguration> datasources = ((GenericConfiguration) obj).getSubConfigs(); for(Entry<String, GenericConfiguration> e : datasources.entrySet()){ String dsKey = e.getKey(); GenericConfiguration dsConfig = e.getValue(); Properties dsProps = ((GenericConfiguration) dsConfig).getRebuiltPropertyTree(); Properties dsProperties = new Properties(); for (Entry<Object, Object> entry : dsProps.entrySet()) { String key = (String) entry.getKey(); dsProperties.put(key.toLowerCase(), entry.getValue()); } if(dsProperties.get(HANDLE_KEY.toLowerCase()) != null){ String[] handleNames = ((String)dsProperties.get(HANDLE_KEY.toLowerCase())).toUpperCase().split(","); try { boolean mccr = ObjectTransformer.getBoolean(dsProperties.get("mccr"), false); log.debug("register one datasource "+dsKey); if (mccr) { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.mccr, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } else { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.contentrepository, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } } catch (NodeException exception) { log.error("Error while register datasource: "+dsKey, exception); } } } } }

Target:
public void registerDatasources() { log.debug("register datasources"); Object obj = get(DATASOURCES_KEY); if (obj != null && obj instanceof GenericConfiguration) { Map<String, GenericConfiguration> datasources = ((GenericConfiguration) obj) .getSubConfigs(); for (Entry<String, GenericConfiguration> e : datasources.entrySet()) { String dsKey = e.getKey(); GenericConfiguration dsConfig = e.getValue(); Properties dsProps = dsConfig.getRebuiltPropertyTree(); Properties dsProperties = new Properties(); for (Entry<Object, Object> entry : dsProps.entrySet()) { String key = (String) entry.getKey(); dsProperties.put(key.toLowerCase(), entry.getValue()); } if (dsProperties.get(HANDLE_KEY.toLowerCase()) != null) { String[] handleNames = ((String) dsProperties .get(HANDLE_KEY.toLowerCase())).split(","); for (int i = 0; i < handleNames.length; i++) { handleNames[i] = convertKey(handleNames[i].trim()); } try { boolean mccr = ObjectTransformer.getBoolean( dsProperties.get("mccr"), false); log.debug("register one datasource " + dsKey); if (mccr) { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.mccr, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } else { PortalConnectorFactory.registerDatasource(dsKey, DatasourceType.contentrepository, CRUtil.propertiesToMap(dsProperties), Arrays.asList(handleNames)); } } catch (NodeException exception) { log.error("Error while register datasource: " + dsKey, exception); } } } } }
Source:
public ByteBuffer encode(ByteBuffer bb) { int size = 0; for (DataHolder dataHolder : data) { size += dataHolder.size(true); } bb.putInt(size); for (DataHolder dataHolder : data) { dataHolder.encode(bb, true); } return bb; }

Target:
public ByteBuffer encode(ByteBuffer bb) { int size = 0; for (DataHolder dataHolder : data) { size += dataHolder.size(true); } WriteBuffer writeBuffer = new WriteBuffer(bb); writeBuffer.putVlqInt(size); for (DataHolder dataHolder : data) { dataHolder.encode(writeBuffer, true); } return bb; }
Source:
public void updateState() { if (AccountUtil.isLoggedIn()) { accountNameView.setText(AccountUtil.getUserName()); accountNameView.setVisibility(VISIBLE); loginLogoutButton.setText(getContext().getString(R.string.preference_title_logout)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorError)); accountAvatar.setVisibility(View.VISIBLE); accountWikiGlobe.setVisibility(View.GONE); notificationsContainer.setVisibility(View.VISIBLE); if (ReleaseUtil.isPreBetaRelease() && Prefs.getTotalUserDescriptionsEdited() >= ACTION_DESCRIPTION_EDIT_UNLOCK_THRESHOLD) { editTasksContainer.setVisibility(VISIBLE); maybeShowIndicatorDots(); } } else { accountNameView.setVisibility(GONE); loginLogoutButton.setText(getContext().getString(R.string.main_drawer_login)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorAccent)); accountAvatar.setVisibility(View.GONE); accountWikiGlobe.setVisibility(View.VISIBLE); notificationsContainer.setVisibility(View.GONE); editTasksContainer.setVisibility(GONE); } }

Target:
public void updateState() { if (AccountUtil.isLoggedIn()) { accountNameView.setText(AccountUtil.getUserName()); accountNameView.setVisibility(VISIBLE); loginLogoutButton.setText(getContext().getString(R.string.preference_title_logout)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorError)); accountAvatar.setVisibility(View.VISIBLE); accountWikiGlobe.setVisibility(View.GONE); notificationsContainer.setVisibility(View.VISIBLE); if (ReleaseUtil.isPreBetaRelease() && Prefs.getTotalUserDescriptionsEdited() >= ACTION_DESCRIPTION_EDIT_UNLOCK_THRESHOLD) { editTasksContainer.setVisibility(VISIBLE); } maybeShowIndicatorDots(); } else { accountNameView.setVisibility(GONE); loginLogoutButton.setText(getContext().getString(R.string.main_drawer_login)); loginLogoutButton.setTextColor(ResourceUtil.getThemedColor(getContext(), R.attr.colorAccent)); accountAvatar.setVisibility(View.GONE); accountWikiGlobe.setVisibility(View.VISIBLE); notificationsContainer.setVisibility(View.GONE); editTasksContainer.setVisibility(GONE); } }
Source:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { PathMatcher jarMatcher = FileSystems.getDefault() .getPathMatcher("glob:*.jar"); @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(jarMatcher.matches(n1), jarMatcher.matches(n2)) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }

Target:
private TreeSet<Entry<String, Path>> jarsFirstSortedPluginsSet( Map<String, Path> activePlugins) { TreeSet<Entry<String, Path>> sortedPlugins = Sets.newTreeSet(new Comparator<Entry<String, Path>>() { @Override public int compare(Entry<String, Path> e1, Entry<String, Path> e2) { Path n1 = e1.getValue().getFileName(); Path n2 = e2.getValue().getFileName(); return ComparisonChain.start() .compareTrueFirst(n1.toString().endsWith(".jar"), n2.toString().endsWith(".jar")) .compare(n1, n2) .result(); } }); addAllEntries(activePlugins, sortedPlugins); return sortedPlugins; }
Source:
@Override public void parseArguments(CommandArgIterator argIter) { String s = argIter.nextArg("New cluster state not found."); try { state = ClusterState.valueOf(s.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Can't parse new cluster state. State: " + s, e); } force = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { force = true; argIter.nextArg(""); } } }

Target:
@Override public void parseArguments(CommandArgIterator argIter) { String s = argIter.nextArg("New cluster state not found."); try { state = ClusterState.valueOf(s.toUpperCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Can't parse new cluster state. State: " + s, e); } forceDeactivation = false; if (argIter.hasNextArg()) { String arg = argIter.peekNextArg(); if (FORCE_COMMAND.equalsIgnoreCase(arg)) { forceDeactivation = true; argIter.nextArg(""); } } }
Source:
public String getActiveStateTxnName(){ return "PAST_TRANSACTION"; }

Target:
public String getActiveStateTxnName(){ return "PAST_TRANSACTION@"+txn.getTxnId(); }
Source:
public GrillDriver select(Collection<GrillDriver> drivers, final Map<GrillDriver, String> driverQueries, final Configuration conf) { return Collections.min(drivers, new Comparator<GrillDriver>() { @Override public int compare(GrillDriver d1, GrillDriver d2) { DriverQueryPlan c1 = null; DriverQueryPlan c2 = null; conf.setBoolean(GrillConfConstants.PREPARE_ON_EXPLAIN, false); if(driverQueries.get(d1) == null) { return 1; } if(driverQueries.get(d2) == null) { return -1; } try { c1 = d1.explain(driverQueries.get(d1), conf); } catch (GrillException e) { LOG.warn("Explain on Driver:" + d1.getClass().getSimpleName() + " failed", e); } try { c2 = d2.explain(driverQueries.get(d2), conf); } catch (GrillException e) { LOG.warn("Explain on Driver" + d2.getClass().getSimpleName() + " failed", e); } if (c1 == null && c2 == null) { return 0; } else if (c1 == null && c2 != null) { return 1; } else if (c1 != null && c2 == null) { return -1; } return c1.getCost().compareTo(c2.getCost()); } }); }

Target:
public GrillDriver select(Collection<GrillDriver> drivers, final Map<GrillDriver, String> driverQueries, final Configuration conf) { return Collections.min(drivers, new Comparator<GrillDriver>() { @Override public int compare(GrillDriver d1, GrillDriver d2) { DriverQueryPlan c1 = null; DriverQueryPlan c2 = null; conf.setBoolean(GrillConfConstants.PREPARE_ON_EXPLAIN, false); if(driverQueries.get(d1) == null) { return 1; } if(driverQueries.get(d2) == null) { return -1; } try { c1 = d1.explain(driverQueries.get(d1), conf); } catch (GrillException e) { LOG.warn("Explain query:" + driverQueries.get(d1) + " on Driver:" + d1.getClass().getSimpleName() + " failed", e); } try { c2 = d2.explain(driverQueries.get(d2), conf); } catch (GrillException e) { LOG.warn("Explain query:" + driverQueries.get(d2) + " on Driver:" + d2.getClass().getSimpleName() + " failed", e); } if (c1 == null && c2 == null) { return 0; } else if (c1 == null && c2 != null) { return 1; } else if (c1 != null && c2 == null) { return -1; } return c1.getCost().compareTo(c2.getCost()); } }); }
Source:
public void verifyLatestDateInDatePicker() { String currentDate = datePickerInput.getAttribute("value"); String latestDate = DateTimeFormat.forPattern("MMMM d, yyyy").withLocale(Locale.ENGLISH) .print(DateTime.now().minus(Period.days(2)).withZone(DateTimeZone.UTC)); Assertion.assertEquals(latestDate, currentDate, "Current date and the latest possible date are not the same"); }

Target:
public void verifyLatestDateInDatePicker() { String currentDate = datePickerInput.getAttribute("value"); String latestDate = DateTimeFormat.forPattern("MMMM d, yyyy").withLocale(Locale.ENGLISH) .print(DateTime.now().minus(Period.days(2)).withZone(DateTimeZone.UTC)); Assertion.assertEquals(currentDate, latestDate, "Current date and the latest possible date are not the same"); }
Source:
public boolean doMonitor(ServiceEmitter emitter) { for (FireDepartment fireDepartment : fireDepartments) { FireDepartmentMetrics metrics = fireDepartment.getMetrics().snapshot(); FireDepartmentMetrics previous = previousValues.get(fireDepartment); if (previous == null) { previous = new FireDepartmentMetrics(); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder() .setUser2(fireDepartment.getDataSchema().getDataSource()); long thrownAway = metrics.thrownAway() - previous.thrownAway(); if (thrownAway > 0) { log.warn("[%,d] events thrown away because they are outside the window period!"); } emitter.emit(builder.build("events/thrownAway", thrownAway)); final long unparseable = metrics.unparseable() - previous.unparseable(); if (unparseable > 0) { log.error("[%,d] Unparseable events! Turn on debug logging to see exception stack trace.", unparseable); } emitter.emit(builder.build("events/unparseable", unparseable)); emitter.emit(builder.build("events/processed", metrics.processed() - previous.processed())); emitter.emit(builder.build("rows/output", metrics.rowOutput() - previous.rowOutput())); emitter.emit(builder.build("persists/num", metrics.numPersists() - previous.numPersists())); emitter.emit(builder.build("persists/time", metrics.persistTimeMillis() - previous.persistTimeMillis())); emitter.emit( builder.build( "persists/backPressure", metrics.persistBackPressureMillis() - previous.persistBackPressureMillis() ) ); previousValues.put(fireDepartment, metrics); } return true; }

Target:
public boolean doMonitor(ServiceEmitter emitter) { for (FireDepartment fireDepartment : fireDepartments) { FireDepartmentMetrics metrics = fireDepartment.getMetrics().snapshot(); FireDepartmentMetrics previous = previousValues.get(fireDepartment); if (previous == null) { previous = new FireDepartmentMetrics(); } final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder() .setUser2(fireDepartment.getDataSchema().getDataSource()); final long thrownAway = metrics.thrownAway() - previous.thrownAway(); if (thrownAway > 0) { log.warn("[%,d] events thrown away because they are outside the window period!", thrownAway); } emitter.emit(builder.build("events/thrownAway", thrownAway)); final long unparseable = metrics.unparseable() - previous.unparseable(); if (unparseable > 0) { log.error("[%,d] Unparseable events! Turn on debug logging to see exception stack trace.", unparseable); } emitter.emit(builder.build("events/unparseable", unparseable)); emitter.emit(builder.build("events/processed", metrics.processed() - previous.processed())); emitter.emit(builder.build("rows/output", metrics.rowOutput() - previous.rowOutput())); emitter.emit(builder.build("persists/num", metrics.numPersists() - previous.numPersists())); emitter.emit(builder.build("persists/time", metrics.persistTimeMillis() - previous.persistTimeMillis())); emitter.emit( builder.build( "persists/backPressure", metrics.persistBackPressureMillis() - previous.persistBackPressureMillis() ) ); previousValues.put(fireDepartment, metrics); } return true; }
Source:
protected IStatus validateItem(Object item) { if (fdisabledModels != null && fdisabledModels.contains(item)) { return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); }

Target:
protected IStatus validateItem(Object item) { if (fdisabledModels.contains(item)) { return new Status(IStatus.CANCEL, IPDEUIConstants.PLUGIN_ID, 0, "", null); } return new Status(IStatus.OK, IPDEUIConstants.PLUGIN_ID, 0, "", null); }
Source:
private StilPlotter setUpTests(ExtSed sed) throws Exception { preferences = new VisualizerComponentPreferences(ws); preferences.update(sed); preferences.getDataModel().setSelectedSed(sed); StilPlotter plot = new StilPlotter(preferences); plot.resetPlot(false, false); return plot; }

Target:
private StilPlotter setUpTests(ExtSed sed) throws Exception { preferences = new VisualizerComponentPreferences(ws); preferences.getDataStore().update(sed); preferences.getDataModel().setSelectedSed(sed); StilPlotter plot = new StilPlotter(preferences); return plot; }
Source:
protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<String>(); if (PROBABILITY < 0 || PROBABILITY > 1) { errors.add("PROBABILITY must be a value between 0 and 1, found: " + PROBABILITY); } IOUtil.assertFileIsReadable(INPUT); IOUtil.assertFileIsWritable(OUTPUT); if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }

Target:
protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<String>(); if (FRACTION < 0 || FRACTION > 1) { errors.add("FRACTION must be a value between 0 and 1, found: " + FRACTION); } if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }
Source:
protected boolean isTransientException(Throwable e) { if(e instanceof SQLException) { final String sqlState = ((SQLException) e).getSQLState(); return sqlState.startsWith("08") || sqlState.startsWith("53"); } return false; }

Target:
protected boolean isTransientException(Throwable e) { if(e instanceof SQLException) { final String sqlState = ((SQLException) e).getSQLState(); return sqlState != null && (sqlState.startsWith("08") || sqlState.startsWith("53")); } return false; }
Source:
private void processAddRequest(final BookieProtocol.ParsedAddRequest r, final Channel c) { WriteEntryProcessor write = WriteEntryProcessor.create(r, c, this); if (null == writeThreadPool) { write.run(); } else if (r.isHighPriority()) { highPriorityThreadPool.submit(write); } else { try { writeThreadPool.submitOrdered(r.getLedgerId(), write); } catch (RejectedExecutionException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to process request to add entry at {}:{}. Too many pending requests", r.ledgerId, r.entryId); } write.sendResponse(BookieProtocol.ETOOMANYREQUESTS, ResponseBuilder.buildErrorResponse(BookieProtocol.ETOOMANYREQUESTS, r), addRequestStats); } } }

Target:
private void processAddRequest(final BookieProtocol.ParsedAddRequest r, final Channel c) { WriteEntryProcessor write = WriteEntryProcessor.create(r, c, this); final OrderedSafeExecutor threadPool; if (r.isHighPriority()) { threadPool = highPriorityThreadPool; } else { threadPool = writeThreadPool; } if (null == threadPool) { write.run(); } else { try { threadPool.submitOrdered(r.getLedgerId(), write); } catch (RejectedExecutionException e) { if (LOG.isDebugEnabled()) { LOG.debug("Failed to process request to add entry at {}:{}. Too many pending requests", r.ledgerId, r.entryId); } write.sendResponse(BookieProtocol.ETOOMANYREQUESTS, ResponseBuilder.buildErrorResponse(BookieProtocol.ETOOMANYREQUESTS, r), addRequestStats); } } }
Source:
public BundleGroupExtractor(Map<String, BundleInfo> bundles, String version) { this.bundles = bundles; this.version = version; for (BundleInfo bundle : bundles.values()) { registerBundle(bundle); } generateGroups(version); }

Target:
public BundleGroupExtractor(Map<String, BundleInfo> bundles, String version) { this.bundles = bundles; this.version = version; bundles.values().forEach(this::registerBundle); generateGroups(version); }
Source:
protected void outputQuotedString(String s) throws IOException { if (s == null || s.length() == 0) { return; } final String xa0 = Character.toString((char)0xa0); for (Iterator<String> iter = new StringCodepointsIterable(s).iterator(); iter.hasNext();) { String codepoint = iter.next(); switch (codepoint) { case "<": _out.write("&lt;"); break; case ">": _out.write("&gt;"); break; case "&": _out.write("&amp;"); break; case "\"": _out.write("&quot;"); break; case "\n": _out.write("&#xa;"); break; case "\r": _out.write("&#xd;"); break; case "\t": _out.write("&#x9;"); break; case "\u00A0": _out.write("&#xa0;"); break; default: if (codepoint.length() == 1) { char c = codepoint.charAt(0); if (replaceWithQuestionMark(c)) { _out.write('?'); } else { _out.write(c); } } else { _out.write(codepoint); } break; } } }

Target:
protected void outputQuotedString(String s) throws IOException { if (s == null || s.length() == 0) { return; } for (String codepoint : new StringCodepointsIterable(s)) { switch (codepoint) { case "<": _out.write("&lt;"); break; case ">": _out.write("&gt;"); break; case "&": _out.write("&amp;"); break; case "\"": _out.write("&quot;"); break; case "\n": _out.write("&#xa;"); break; case "\r": _out.write("&#xd;"); break; case "\t": _out.write("&#x9;"); break; case "\u00A0": _out.write("&#xa0;"); break; default: if (codepoint.length() == 1) { char c = codepoint.charAt(0); if (replaceWithQuestionMark(c)) { _out.write('?'); } else { _out.write(c); } } else { _out.write(codepoint); } break; } } }
Source:
for (Change.Status s : Change.Status.values()) { VALUES.put(s.name().toLowerCase(), s); }

Target:
for (Change.Status s : Change.Status.values()) { VALUES.put(canonicalize(s), s); }
Source:
private Properties getRunningPlatformProperties() { Properties props = new Properties(); for (String PROPS : EquinoxBundlesState.PROPS) { String value = context.getProperty(PROPS); if (value != null) { props.setProperty(PROPS, value); } } return props; }

Target:
private Properties getRunningPlatformProperties() { Properties props = new Properties(); for (String property : EquinoxBundlesState.PROPS) { String value = context.getProperty(property); if (value != null) { props.setProperty(property, value); } } return props; }
Source:
public void onCascadeEvent(BeforeAccountRemovedEvent event) throws Exception { for (WorkspaceImpl workspace : iterate( (maxItems, skipCount) -> workspaceManager.getByNamespace( event.getAccount().getName(), false, maxItems, skipCount))) { if (WorkspaceStatus.RUNNING.equals(workspace.getStatus())) { String owner = workspace.getRuntime().getOwner(); if (owner.equals(EnvironmentContext.getCurrent().getSubject().getUserId())) { workspaceManager.stopWorkspace(workspace.getId(), Collections.emptyMap()); } else { EnvironmentContext current = EnvironmentContext.getCurrent(); try { EnvironmentContext.reset(); workspaceManager.stopWorkspace(workspace.getId(), Collections.emptyMap()); } finally { EnvironmentContext.setCurrent(current); } } } workspaceManager.removeWorkspace(workspace.getId()); } }

Target:
public void onCascadeEvent(BeforeAccountRemovedEvent event) throws Exception { boolean nonStoppedExists = false; for (WorkspaceImpl workspace : iterate( (maxItems, skipCount) -> workspaceManager.getByNamespace( event.getAccount().getName(), false, maxItems, skipCount))) { if (STOPPED.equals(workspace.getStatus())) { workspaceManager.removeWorkspace(workspace.getId()); continue; } nonStoppedExists = true; if (STOPPING.equals(workspace.getStatus())) { continue; } tryStopAndRemoveWithSA(workspace); } if (!nonStoppedExists) { return; } for (WorkspaceImpl workspace : iterate( (maxItems, skipCount) -> workspaceManager.getByNamespace( event.getAccount().getName(), false, maxItems, skipCount))) { if (!STOPPED.equals(workspace.getStatus())) { throw new ConflictException("User has workspace that is not stopped yet. Try again"); } } }
Source:
private void launchUpdateActivity() { Intent i = new Intent(getApplicationContext(), UpdateActivity.class); i.putExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, true); startActivityForResult(i, CommCareHomeActivity.UPGRADE_APP); }

Target:
private void launchUpdateActivity() { Intent i = new Intent(getApplicationContext(), UpdateActivity.class); i.putExtra(AppManagerActivity.KEY_LAUNCH_FROM_MANAGER, true); startActivityForResult(i, UPGRADE_APP); }
Source:
public void stop() { if ( shouldClose.compareAndSet( false, true ) ) { machine.terminate(); if ( !hasPendingJobs() ) { processNextBatch( 0 ); } } }

Target:
public void stop() { if ( shouldClose.compareAndSet( false, true ) ) { machine.terminate(); enqueueInternal( ignore -> { } ); } }
Source:
private void logAction(String action) { String shortURI = URI; shortURI = shortURI.replaceAll("^.*\\/", ""); shortURI = shortURI.replaceAll("\\.[^.]+$", ""); String message = action + " " + shortURI; Integer progress = controller.getProgress(); Integer duration = controller.getDuration(); if (progress != null && duration != null) { message += " " + formatTime(progress) + "/" + formatTime(duration); } Logger.log("audio", message); }

Target:
private void logAction(String action) { String message = action + " " + shortURI; Integer progress = controller.getProgress(); Integer duration = controller.getDuration(); if (progress != null && duration != null) { message += " " + formatTime(progress) + "/" + formatTime(duration); } Logger.log("audio", message); }
Source:
private RealmAwareZkClient buildRealmAwareZkClient( RealmAwareZkClient.RealmAwareZkClientConfig clientConfig, String zkAddress, ZkClientType zkClientType) { RealmAwareZkClient zkClient; try { zkClient = new FederatedZkClient( new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), clientConfig); } catch (IllegalStateException | IllegalArgumentException | IOException | InvalidRoutingDataException e) { if (zkAddress.isEmpty()) { throw new IllegalStateException( "Not able to connect on multi-realm mode, caused by: " + e.getMessage()); } LOG.info("Not able to connect on multi-realm mode, caused by: {}. " + "Connecting on single-realm mode to ZK: {}.", e.getMessage(), zkAddress); switch (zkClientType) { case DEDICATED: zkClient = DedicatedZkClientFactory.getInstance().buildZkClient( new HelixZkClient.ZkConnectionConfig(zkAddress), clientConfig.createHelixZkClientConfig()); break; case SHARED: default: zkClient = SharedZkClientFactory.getInstance().buildZkClient( new HelixZkClient.ZkConnectionConfig(zkAddress), clientConfig.createHelixZkClientConfig()); break; } } return zkClient; }

Target:
private RealmAwareZkClient buildRealmAwareZkClient( RealmAwareZkClient.RealmAwareZkClientConfig clientConfig, String zkAddress, ZkClientType zkClientType) { if (Boolean.getBoolean(SystemPropertyKeys.MULTI_ZK_ENABLED)) { try { return new FederatedZkClient( new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), clientConfig); } catch (IllegalStateException | IOException | InvalidRoutingDataException e) { throw new HelixException("Not able to connect on multi-realm mode.", e); } } RealmAwareZkClient zkClient; switch (zkClientType) { case DEDICATED: zkClient = DedicatedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), clientConfig.createHelixZkClientConfig()); break; case SHARED: default: zkClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress), clientConfig.createHelixZkClientConfig()); zkClient .waitUntilConnected(HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS); break; } return zkClient; }
Source:
private double getWeightedLocality(int region, int entity) { return cluster.getOrComputeWeightedLocality(region, entity, type, onlyOnSsd); }

Target:
private double getWeightedLocality(int region, int entity) { return cluster.getOrComputeWeightedLocality(region, entity, type, includeStorageType); }
Source:
public static SerializerAdapter initializeSerializerAdapter() { JacksonAdapter adapter = (JacksonAdapter) JacksonAdapter.createDefaultSerializerAdapter(); ObjectMapper mapper = adapter.serializer(); SerializationUtil.configureMapper(mapper); return adapter; }

Target:
public static SerializerAdapter initializeSerializerAdapter() { JacksonAdapter adapter = new JacksonAdapter(); ObjectMapper mapper = adapter.serializer(); SerializationUtil.configureMapper(mapper); return adapter; }
Source:
public void RTE_012_Photo(){ String articleName = PageContent.articleNamePrefix+base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName); SourceEditModePageObject source = article.openCurrectArticleSourceMode(); PhotoAddComponentObject photoAddPhoto = source.clickAddPhoto(); PhotoOptionsComponentObject photoOptions = photoAddPhoto.addPhotoFromWiki("Image001.jpg"); photoOptions.setCaption(PageContent.caption); photoOptions.clickAddPhoto(); String photoName = photoAddPhoto.getPhotoName(); source.checkSourceContent(String.format(PageContent.wikiTextPhoto.replace("%photoName%", photoName), PageContent.caption)); source.submitArticle(); }

Target:
public void RTE_012_Photo(){ String articleName = PageContent.articleNamePrefix+base.getTimeStamp(); ArticlePageObject article = base.openArticleByName(wikiURL, articleName); SourceEditModePageObject source = article.openCurrectArticleSourceMode(); PhotoAddComponentObject photoAddPhoto = source.clickAddPhoto(); PhotoOptionsComponentObject photoOptions = photoAddPhoto.addPhotoFromWiki(PageContent.ARTICLESOURCEMODEFILE); photoOptions.setCaption(PageContent.caption); photoOptions.clickAddPhoto(); String photoName = photoAddPhoto.getPhotoName(); source.checkSourceContent(String.format(PageContent.wikiTextPhoto.replace("%photoName%", photoName), PageContent.caption)); source.submitArticle(); }
Source:
public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); try { logic.moveCourseToRecycleBin(idOfCourseToDelete); if (isRedirectedToHomePage()) { return new JsonResult("The course " + idOfCourseToDelete + " has been deleted. You can restore it from the 'Courses' tab."); } else { return new JsonResult("The course " + idOfCourseToDelete + " has been deleted. You can restore it from the deleted courses table below."); } } catch (InvalidParametersException ipe) { return new JsonResult(ipe.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException ednee) { return new JsonResult(ednee.getMessage(), HttpStatus.SC_MULTI_STATUS); } }

Target:
public ActionResult execute() { String idOfCourseToDelete = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); try { logic.moveCourseToRecycleBin(idOfCourseToDelete); return new JsonResult("The course " + idOfCourseToDelete + " has been deleted. You can restore it from the Recycle Bin manually."); } catch (InvalidParametersException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_BAD_REQUEST); } catch (EntityDoesNotExistException e) { return new JsonResult(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } }
Source:
public int countChildren(String path) { if (!checkIfPathBelongsToZkRealm(path)) { throw new IllegalArgumentException( "The given path does not map to the ZK realm for this DedicatedZkClient! Path: " + path + " ZK realm sharding key: " + _zkRealmShardingKey); } return countChildren(path); }

Target:
public int countChildren(String path) { checkIfPathContainsShardingKey(path); return _innerSharedZkClient.countChildren(path); }
Source:
public DeprecatedAgentProtocolMonitor() { super(AgentProtocol.class.getName() + "-deprecated"); }

Target:
public DeprecatedAgentProtocolMonitor() { super(); }
Source:
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) { if (!parentWrapper.isExpanded()) { parentWrapper.setExpanded(true); List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList(); if (wrappedChildList != null) { int childCount = wrappedChildList.size(); for (int i = 0; i < childCount; i++) { mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i)); } notifyItemRangeInserted(flatParentPosition + 1, childCount); } if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) { mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition)); } } }

Target:
private void updateExpandedParent(@NonNull ExpandableWrapper<P, C> parentWrapper, int flatParentPosition, boolean expansionTriggeredByListItemClick) { if (parentWrapper.isExpanded()) { return; } parentWrapper.setExpanded(true); List<ExpandableWrapper<P, C>> wrappedChildList = parentWrapper.getWrappedChildList(); if (wrappedChildList != null) { int childCount = wrappedChildList.size(); for (int i = 0; i < childCount; i++) { mFlatItemList.add(flatParentPosition + i + 1, wrappedChildList.get(i)); } notifyItemRangeInserted(flatParentPosition + 1, childCount); } if (expansionTriggeredByListItemClick && mExpandCollapseListener != null) { mExpandCollapseListener.onParentExpanded(getNearestParentPosition(flatParentPosition)); } }
Source:
public void test_presentValue_onStart() { SimpleRatesProvider prov = provider(START_DATE); CurrencyAmount computed = PRICER.presentValue(TERM_DEPOSIT, prov); double expected = ((1d + RATE * TERM_DEPOSIT.expand().getYearFraction()) * dfEnd - dfStart) * NOTIONAL; assertEquals(computed.getCurrency(), EUR); assertEquals(computed.getAmount(), expected, TOLERANCE * NOTIONAL); }

Target:
public void test_presentValue_onStart() { SimpleRatesProvider prov = provider(START_DATE, 1.0d, DF_END); CurrencyAmount computed = PRICER.presentValue(TERM_DEPOSIT, prov); double expected = ((1d + RATE * TERM_DEPOSIT.expand().getYearFraction()) * DF_END - 1.0d) * NOTIONAL; assertEquals(computed.getCurrency(), EUR); assertEquals(computed.getAmount(), expected, TOLERANCE * NOTIONAL); }
Source:
public void run() { logger.debug("Trying to create KieServerClient for {}", config); if (config.getClient() == null) { try { config.setClient(createKieServicesClient(config)); executorService.shutdown(); } catch (NoEndpointFoundException e) { logger.warn("Unable to connect to KieServer: {}. The client will try to reconnect in the background", config); } catch (Exception e) { if (e.getCause() != null && NoEndpointFoundException.class.isInstance(e.getCause())) { logger.warn("Unable to connect to KieServer: {}. The client will try to reconnect in the background", config); } else { logger.warn("Unable to create KieServer client: {}", config, e); } } } }

Target:
public void run() { logger.debug("Trying to create KieServerClient for {}", kieConfig); if (kieConfig.getClient() == null) { try { kieConfig.setClient(createKieServicesClient(kieConfig)); } catch (NoEndpointFoundException e) { logger.warn("Unable to connect to KieServer: {}. The client will try to reconnect in the background", kieConfig); } catch (Exception e) { if (e.getCause() != null && NoEndpointFoundException.class.isInstance(e.getCause())) { logger.warn("Unable to connect to KieServer: {}. The client will try to reconnect in the background", kieConfig); } else { logger.warn("Unable to create KieServer client: {}", kieConfig, e); } } finally { if (kieConfig.getClient() == null) { logger.debug("KieServerClient for could not be created. Retrying...", kieConfig); retryConnection(kieConfig); } else { logger.debug("KieServerClient for created.", kieConfig); } } } }
Source:
public void testBuildProcessStartedEventWithInitiatorAndUserAuthBypassEnabled() { processMetadata.put("initiator", "john"); ServicesAwareAuditEventBuilder builder = new ServicesAwareAuditEventBuilder(); builder.setIdentityProvider(identityProvider); enableSetInitiator(builder); ProcessStartedEvent pse = new ProcessStartedEventImpl(processInstance, kieRuntime); ProcessInstanceLog log = (ProcessInstanceLog) builder.buildEvent(pse); assertEquals("john", log.getIdentity()); }

Target:
public void testBuildProcessStartedEventWithInitiatorAndUserAuthBypassEnabled() { processMetadata.put("initiator", "john"); enableSetInitiator(builder); ProcessStartedEvent pse = new ProcessStartedEventImpl(processInstance, kieRuntime); ProcessInstanceLog log = (ProcessInstanceLog) builder.buildEvent(pse); assertEquals("john", log.getIdentity()); }