auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private String resolveUrlSource(String base, Object... format) { if (format.length != 0) { base = String.format(base, format); } try { return new URI(base).normalize().toURL().toString(); } catch (Exception e) { log.error("Variable selenide.reportsUrl is incorrect: " + base, e); return null; } }

Target:
private String resolveUrlSource(String base, Object... format) { if (format.length != 0) { base = String.format(base, format); } try { return new URI(base).normalize().toURL().toString(); } catch (Exception e) { log.error("Variable selenide.reportsUrl is incorrect: {}", base, e); return null; } }
Source:
public void initConfig(Config config) { config.addKey("filenet.contentEngineUrl", null); config.addKey("filenet.username", null); config.addKey("filenet.password", null); config.addKey("filenet.objectStore", null); config.addKey("filenet.objectFactory", null); config.addKey("filenet.displayUrl", null); config.addKey("filenet.isPublic", "false"); config.addKey("filenet.pushAcls", "true"); config.addKey("filenet.additionalWhereClause", ""); config.addKey("filenet.deleteAdditionalWhereClause", ""); config.addKey("filenet.excludedMetadata", ""); config.addKey("filenet.includedMetadata", ""); config.addKey("adaptor.namespace", Principal.DEFAULT_NAMESPACE); }

Target:
public void initConfig(Config config) { config.addKey("filenet.contentEngineUrl", null); config.addKey("filenet.username", null); config.addKey("filenet.password", null); config.addKey("filenet.objectStore", null); config.addKey("filenet.objectFactory", FileNetObjectFactory.class.getName()); config.addKey("filenet.displayUrl", null); config.addKey("filenet.additionalWhereClause", ""); config.addKey("filenet.deleteAdditionalWhereClause", ""); config.addKey("filenet.excludedMetadata", ""); config.addKey("filenet.includedMetadata", ""); config.addKey("adaptor.namespace", DEFAULT_NAMESPACE); }
Source:
public static SegmentLineage fromZNRecord(ZNRecord record) { String tableNameWithType = record.getId(); Map<String, LineageEntry> lineageEntries = new HashMap<>(); Map<String, List<String>> listFields = record.getListFields(); for (Map.Entry<String, List<String>> listField : listFields.entrySet()) { String lineageId = listField.getKey(); List<String> value = listField.getValue(); Preconditions.checkState(value.size() == 4); String segmentsFromStr = value.get(0); List<String> segmentsFrom = (segmentsFromStr == null || segmentsFromStr.length() == 0) ? new ArrayList<>() : Arrays.asList(value.get(0).split(COMMA_SEPARATOR)); List<String> segmentsTo = Arrays.asList(value.get(1).split(COMMA_SEPARATOR)); LineageEntryState state = LineageEntryState.valueOf(value.get(2)); long timestamp = Long.parseLong(value.get(3)); lineageEntries.put(lineageId, new LineageEntry(segmentsFrom, segmentsTo, state, timestamp)); } return new SegmentLineage(tableNameWithType, lineageEntries); }

Target:
public static SegmentLineage fromZNRecord(ZNRecord record) { String tableNameWithType = record.getId(); Map<String, LineageEntry> lineageEntries = new HashMap<>(); Map<String, List<String>> listFields = record.getListFields(); for (Map.Entry<String, List<String>> listField : listFields.entrySet()) { String lineageId = listField.getKey(); List<String> value = listField.getValue(); Preconditions.checkState(value.size() == 4); List<String> segmentsFrom = Arrays.asList(StringUtils.split(value.get(0), COMMA_SEPARATOR)); List<String> segmentsTo = Arrays.asList(StringUtils.split(value.get(1), COMMA_SEPARATOR)); LineageEntryState state = LineageEntryState.valueOf(value.get(2)); long timestamp = Long.parseLong(value.get(3)); lineageEntries.put(lineageId, new LineageEntry(segmentsFrom, segmentsTo, state, timestamp)); } return new SegmentLineage(tableNameWithType, lineageEntries); }
Source:
public void setConfigurationManager(String name, Map<String, String> properties) { SessionPropertyConfigurationManagerFactory factory = sessionPropertyConfigurationManagerFactories.get(name); checkState(factory != null, format("Session property configuration manager '%s' is not registered", name)); SessionPropertyConfigurationManager manager = factory.create(properties, configurationManagerContext); checkState(sessionPropertyConfigurationManager.compareAndSet(null, manager), "sessionPropertyConfigurationManager is already set"); }

Target:
public void setConfigurationManager(String name, Map<String, String> properties) { SessionPropertyConfigurationManagerFactory factory = sessionPropertyConfigurationManagerFactories.get(name); checkState(factory != null, "Session property configuration manager '%s' is not registered", name); SessionPropertyConfigurationManager manager = factory.create(properties, configurationManagerContext); checkState(sessionPropertyConfigurationManager.compareAndSet(null, manager), "sessionPropertyConfigurationManager is already set"); }
Source:
protected Set<X509Certificate> loadUpstreamCACertificates(String path) { Set<X509Certificate> result = new HashSet<>(); File dir = new File(path); if (!dir.exists()) { return result; } for (File file : dir.listFiles()) { try ( InputStream inStream = new FileInputStream(file.getAbsolutePath()); ) { X509Certificate cert = (X509Certificate) this.certFactory .generateCertificate(inStream); inStream.close(); result.add(cert); } catch (Exception e) { throw new RuntimeException(e); } } return result; }

Target:
protected Set<X509Certificate> loadUpstreamCACertificates(String path) { Set<X509Certificate> result = new HashSet<>(); File dir = new File(path); if (!dir.exists()) { return result; } File[] files = dir.listFiles(); if (files == null) { throw new RuntimeException("Could not read files in " + path); } for (File file : files) { try ( InputStream inStream = new FileInputStream(file.getAbsolutePath()); ) { X509Certificate cert = (X509Certificate) this.certFactory.generateCertificate(inStream); result.add(cert); } catch (Exception e) { throw new RuntimeException(e); } } return result; }
Source:
public void testFinishLocalSetupFullyInitialized() throws Exception { final Checker checker = new Checker(); ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); checker.setModuleClassLoader(contextClassLoader); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), contextClassLoader); checker.setModuleFactory(factory); checker.setBasedir("testBaseDir"); checker.setLocaleLanguage("it"); checker.setLocaleCountry("IT"); checker.finishLocalSetup(); Field sLocale = LocalizedMessage.class.getDeclaredField("sLocale"); sLocale.setAccessible(true); Locale locale = (Locale) sLocale.get(null); Context context = (Context) Whitebox.getInternalState(checker, "childContext"); assertEquals("UTF-8", context.get("charset")); assertEquals(contextClassLoader, context.get("classLoader")); assertEquals("error", context.get("severity")); assertEquals("testBaseDir", context.get("basedir")); assertEquals(Locale.ITALY, locale); }

Target:
public void testFinishLocalSetupFullyInitialized() throws Exception { final Checker checker = new Checker(); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); checker.setModuleClassLoader(contextClassLoader); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), contextClassLoader); checker.setModuleFactory(factory); checker.setBasedir("testBaseDir"); checker.setLocaleLanguage("it"); checker.setLocaleCountry("IT"); checker.finishLocalSetup(); final Context context = (Context) Whitebox.getInternalState(checker, "childContext"); assertEquals(System.getProperty("file.encoding", "UTF-8"), context.get("charset")); assertEquals(contextClassLoader, context.get("classLoader")); assertEquals("error", context.get("severity")); assertEquals("testBaseDir", context.get("basedir")); final Field sLocale = LocalizedMessage.class.getDeclaredField("sLocale"); sLocale.setAccessible(true); final Locale locale = (Locale) sLocale.get(null); assertEquals(Locale.ITALY, locale); }
Source:
private static String getFuntionSymbol(FlamegraphEvent event, ISymbolProvider symbolProvider) { String funcSymbol = ""; if (event.getSymbol() instanceof Long || event.getSymbol() instanceof Integer) { Long longAddress = (long) event.getSymbol(); funcSymbol = symbolProvider.getSymbolText(longAddress); if (funcSymbol == null) { return "0x" + Long.toHexString(longAddress); } } else { return event.getSymbol().toString(); } return funcSymbol; }

Target:
private static String getFuntionSymbol(FlamegraphEvent event, ISymbolProvider symbolProvider) { String funcSymbol = ""; if (event.getSymbol() instanceof Long || event.getSymbol() instanceof Integer) { long longAddress = ((Long) event.getSymbol()).longValue(); funcSymbol = symbolProvider.getSymbolText(longAddress); if (funcSymbol == null) { return "0x" + Long.toHexString(longAddress); } } else { return event.getSymbol().toString(); } return funcSymbol; }
Source:
public int indexOf(Object element) { if (filteredPlan.isEmpty()) return -1; if (filteredPlan.get(lastFoundElementPosition).equals(element)) return lastFoundElementPosition; int upIndex = getSeqIndex(lastFoundElementPosition + 1); if (filteredPlan.get(upIndex).equals(element)) { lastFoundElementPosition = upIndex; return lastFoundElementPosition; } int downIndex = getSeqIndex(lastFoundElementPosition - 1); if (filteredPlan.get(downIndex).equals(element)) { lastFoundElementPosition = downIndex; return lastFoundElementPosition; } int index = getSeqIndex(upIndex + 1); while (index != downIndex) { if (filteredPlan.get(index).equals(element)) { lastFoundElementPosition = index; return lastFoundElementPosition; } index = getSeqIndex(index + 1); } lastFoundElementPosition = 0; return -1; }

Target:
public int indexOf(Object element) { if (filteredPlan.isEmpty()) return -1; if (filteredPlan.get(lastFoundElementPosition).equals(element)) return lastFoundElementPosition; int upIndex = mapToCircularIndex(lastFoundElementPosition + 1); if (filteredPlan.get(upIndex).equals(element)) { lastFoundElementPosition = upIndex; return lastFoundElementPosition; } int downIndex = mapToCircularIndex(lastFoundElementPosition - 1); if (filteredPlan.get(downIndex).equals(element)) { lastFoundElementPosition = downIndex; return lastFoundElementPosition; } int index = mapToCircularIndex(upIndex + 1); while (index != downIndex) { if (filteredPlan.get(index).equals(element)) { lastFoundElementPosition = index; return lastFoundElementPosition; } index = mapToCircularIndex(index + 1); } lastFoundElementPosition = 0; return -1; }
Source:
public void changeText_sameActivity() { onView(isRoot()).perform(waitId(R.id.terminal_view, TimeUnit.SECONDS.toMillis(15))); onView(withId(R.id.terminal_view)).perform(typeText(mStringToBetyped), closeSoftKeyboard()); Log.d(TermuxTest.class.getSimpleName(), "Hello"); Log.d(TermuxTest.class.getSimpleName(), getText(withId(R.id.terminal_view))); }

Target:
public void changeText_sameActivity() { onView(isRoot()).perform(waitId(R.id.terminal_view, TimeUnit.SECONDS.toMillis(300))); onView(withId(R.id.terminal_view)).perform(typeText(mStringToBetyped), closeSoftKeyboard()); Log.d(TermuxTest.class.getSimpleName(), "Hello"); Log.d(TermuxTest.class.getSimpleName(), getText(withId(R.id.terminal_view))); }
Source:
public static List<String> addProperty(String key, String value) { if (key == null) throw new NullPointerException(); if (key.length() == 0) throw new IllegalArgumentException(); List<String> old = _props.get(key); if (old == null) old = new LinkedList<String>(); old.add(value); return _props.put(key, old); }

Target:
public static List<String> addProperty(String key, String value) { if (key == null) throw new NullPointerException(); if (key.length() == 0) throw new IllegalArgumentException(); synchronized (_props) { List<String> old = _props.get(key); if (old == null) old = new LinkedList<String>(); old.add(value); return _props.put(key, old); } }
Source:
public static boolean isRemoteCacheOptions(RemoteOptions options) { return options.remoteCache != null && !options.remoteCache.isEmpty() && !options.remoteCache.startsWith("http"); }

Target:
public static boolean isRemoteCacheOptions(RemoteOptions options) { if (options.remoteCache == null || options.remoteCache.isEmpty()) { return false; } String scheme; try { scheme = new URI(options.remoteCache).getScheme(); } catch (URISyntaxException e) { return false; } return scheme == null || scheme.toLowerCase().startsWith("grpc"); }
Source:
private PrincipalCollection renewSecurityAssertions( SecurityTokenHolder tokenHolder, HttpServletRequest request) throws SecurityServiceException { AuthenticationToken token; Collection<SecurityAssertion> assertions = tokenHolder.getPrincipals().byType(SecurityAssertion.class); if (assertions.isEmpty()) { return null; } else if (assertions.size() == 1) { SecurityAssertion assertion = assertions.iterator().next(); if (assertion instanceof SecurityAssertionDefault) { token = new GuestAuthenticationToken(assertion.getPrincipal().getName()); } else if (assertion instanceof SecurityAssertionSaml) { token = new SAMLAuthenticationToken(null, tokenHolder.getPrincipals(), request.getRemoteAddr()); } else { return null; } } else { if (!tokenHolder.getPrincipals().byType(SecurityAssertionSaml.class).isEmpty()) { token = new SAMLAuthenticationToken(null, tokenHolder.getPrincipals(), request.getRemoteAddr()); } else { return null; } } return securityManager.getSubject(token).getPrincipals(); }

Target:
private PrincipalCollection renewSecurityAssertions( SecurityTokenHolder tokenHolder, HttpServletRequest request) throws SecurityServiceException { AuthenticationToken token; Collection<SecurityAssertion> assertions = tokenHolder.getPrincipals().byType(SecurityAssertion.class); if (assertions.isEmpty()) { return null; } else if (assertions.size() == 1) { SecurityAssertion assertion = assertions.iterator().next(); if (assertion.getWeight() == SecurityAssertion.NO_AUTH_WEIGHT) { token = new GuestAuthenticationToken(assertion.getPrincipal().getName()); } else if (assertion instanceof SecurityAssertionSaml) { token = new SAMLAuthenticationToken(null, tokenHolder.getPrincipals(), request.getRemoteAddr()); } else { return null; } } else { if (!tokenHolder.getPrincipals().byType(SecurityAssertionSaml.class).isEmpty()) { token = new SAMLAuthenticationToken(null, tokenHolder.getPrincipals(), request.getRemoteAddr()); } else { return null; } } return securityManager.getSubject(token).getPrincipals(); }
Source:
private View validateLoginData(String email, String password) { emailView.setError(null); passwordView.setError(null); View focusView = null; if (TextUtils.isEmpty(password)) { showErrorSnackbar(getString(R.string.error_invalid_password)); focusView = passwordView; } if (TextUtils.isEmpty(email)) { showErrorSnackbar(getString(R.string.error_email_required)); focusView = emailView; } else if (!LoginPackage.isEmailValid(email)) { showErrorSnackbar(getString(R.string.error_invalid_email)); focusView = emailView; } return focusView; }

Target:
private View validateLoginData(String email, String password) { emailView.setError(null); passwordView.setError(null); View focusView = null; if (TextUtils.isEmpty(password)) { showErrorSnackbar(getString(R.string.error_invalid_password)); focusView = passwordView; } if (TextUtils.isEmpty(email)) { showErrorSnackbar(getString(R.string.error_email_required)); focusView = emailView; } else if (!LoginPackage.isValidEmail(email)) { showErrorSnackbar(getString(R.string.error_invalid_email)); focusView = emailView; } return focusView; }
Source:
public Association createAssociation(AssociationKey key) { DBCollection associations = getCollection( key ); DBObject assoc = MongoHelpers.associationKeyToObject( key ); assoc.put( ROWS_FIELDNAME, new ArrayList<Map<String, Object>>() ); associations.insert( assoc ); return new Association( new MongoDBAssociationSnapshot( assoc ) ); }

Target:
public Association createAssociation(AssociationKey key) { DBCollection associations = getAssociationCollection( key ); DBObject assoc = MongoHelpers.associationKeyToObject( key ); assoc.put( ROWS_FIELDNAME, Collections.EMPTY_LIST ); associations.insert( assoc ); return new Association( new MongoDBAssociationSnapshot( assoc ) ); }
Source:
public void shouldConvertWsDeviceToSsld() { final Device device = this.createDevice(); final Ssld ssld = this.mapper.map(device, Ssld.class); assertThat(ssld.getDeviceIdentification()).isEqualTo(DEVICE_IDENTIFICATION); assertThat(ssld.getAlias()).isEqualTo(ALIAS); assertThat(ssld.getContainer()).isNotNull(); assertThat(ssld.getContainer().getCity()).isEqualTo(CITY); assertThat(ssld.getContainer().getPostalCode()).isEqualTo(POSTAL_CODE); assertThat(ssld.getGpsCoordinates().getLatitude()).isEqualTo(GPS_LATITUDE); assertThat(ssld.getGpsCoordinates().getLongitude()).isEqualTo(GPS_LONGITUDE); assertThat(ssld.isPublicKeyPresent()).isEqualTo(PUBLIC_KEY_PRESENT); }

Target:
public void shouldConvertWsDeviceToSsld() { final Device device = this.createDevice(); final Ssld ssld = this.mapper.map(device, Ssld.class); assertThat(ssld.getDeviceIdentification()).isEqualTo(DEVICE_IDENTIFICATION); assertThat(ssld.getAlias()).isEqualTo(ALIAS); assertThat(ssld.getContainerAddress()).isNotNull(); assertThat(ssld.getContainerAddress().getCity()).isEqualTo(CITY); assertThat(ssld.getContainerAddress().getPostalCode()).isEqualTo(POSTAL_CODE); assertThat(ssld.getGpsCoordinates().getLatitude()).isEqualTo(GPS_LATITUDE); assertThat(ssld.getGpsCoordinates().getLongitude()).isEqualTo(GPS_LONGITUDE); assertThat(ssld.isPublicKeyPresent()).isEqualTo(PUBLIC_KEY_PRESENT); }
Source:
public void partClosed(IWorkbenchPart part) { IDragAndDropService dndService = part.getSite() .getService(IDragAndDropService.class); IAdaptable adapter = part; Control control = adapter.getAdapter(Control.class); if (control != null && dndService != null) { dndService.removeMergedDropTarget(control); } }

Target:
public void partClosed(IWorkbenchPart part) { IDragAndDropService dndService = part.getSite() .getService(IDragAndDropService.class); Control control = part.getAdapter(Control.class); if (control != null && dndService != null) { dndService.removeMergedDropTarget(control); } }
Source:
private boolean isRequiresFundingManagerApproval() { final ContractsGrantsInvoiceDocumentService contractsGrantsInvoiceDocumentService = SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class); boolean result; result = !getInvoiceSuspensionCategories().isEmpty() || !getInvoiceGeneralDetail().getAward().getAutoApproveIndicator() || (contractsGrantsInvoiceDocumentService.isDocumentBatchCreated(this) && !contractsGrantsInvoiceDocumentService.doesInvoicePassValidation(this)); return result; }

Target:
private boolean isRequiresFundingManagerApproval() { final ContractsGrantsInvoiceDocumentService contractsGrantsInvoiceDocumentService = SpringContext.getBean(ContractsGrantsInvoiceDocumentService.class); boolean result; result = !CollectionUtils.isEmpty(getInvoiceSuspensionCategories()) || !getInvoiceGeneralDetail().getAward().getAutoApproveIndicator() || (contractsGrantsInvoiceDocumentService.isDocumentBatchCreated(this) && !contractsGrantsInvoiceDocumentService.doesInvoicePassValidation(this)); return result; }
Source:
synchronized public void validateTransition(List<WidgetResult> results, IValueProvider valueProvider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef) { for (AtsXWidgetValidatorProvider provider : providers) { for (IAtsXWidgetValidator validator : provider.getValidators()) { try { WidgetResult status = validator.validateTransition(valueProvider, widgetDef, fromStateDef, toStateDef); if (!status.isValid()) { results.add(status); } } catch (Exception ex) { results.add(new WidgetResult(WidgetStatus.Exception, widgetDef, ex, String.format( "Exception retriving validation for widget [%s] Exception [%s]", validator.getClass().getSimpleName(), ex.getLocalizedMessage()), ex)); return; } } } }

Target:
public void validateTransition(List<WidgetResult> results, IValueProvider valueProvider, IAtsWidgetDefinition widgetDef, IAtsStateDefinition fromStateDef, IAtsStateDefinition toStateDef) { for (AtsXWidgetValidatorProvider provider : providers) { for (IAtsXWidgetValidator validator : provider.getValidators()) { try { WidgetResult status = validator.validateTransition(valueProvider, widgetDef, fromStateDef, toStateDef); if (!status.isValid()) { results.add(status); } } catch (Exception ex) { results.add(new WidgetResult(WidgetStatus.Exception, widgetDef, ex, String.format( "Exception retriving validation for widget [%s] Exception [%s]", validator.getClass().getSimpleName(), ex.getLocalizedMessage()), ex)); return; } } } }
Source:
public Map<String, Metric> getMetrics() { Map<String, Metric> metrics = new HashMap<>(); String prefix = this.getClass().getName() + "."; metrics.put(prefix + "eventsWrittenPerSec", _eventWriteRate); metrics.put(prefix + "eventBytesWrittenPerSec", _eventByteWriteRate); metrics.put(prefix + "eventTransportErrorCount", _eventTransportErrorCount); return Collections.unmodifiableMap(metrics); }

Target:
public Map<String, Metric> getMetrics() { Map<String, Metric> metrics = new HashMap<>(); metrics.put(buildMetricName("eventsWrittenPerSec"), _eventWriteRate); metrics.put(buildMetricName("eventBytesWrittenPerSec"), _eventByteWriteRate); metrics.put(buildMetricName("eventTransportErrorCount"), _eventTransportErrorRate); return Collections.unmodifiableMap(metrics); }
Source:
private static void checkAndSetReplicationFactor( Cassandra.Client client, KsDef ks, boolean freshInstance, CassandraKeyValueServiceConfig config) throws TException { if (freshInstance) { Set<String> dcs = sanityCheckDatacenters(client, config); ks.setStrategy_options(Maps2.createConstantValueMap(dcs, String.valueOf(config.replicationFactor()))); return; } final Set<String> dcs; if (CassandraConstants.SIMPLE_STRATEGY.equals(ks.getStrategy_class())) { int currentRf = Integer.parseInt(ks.getStrategy_options().get( CassandraConstants.REPLICATION_FACTOR_OPTION)); String errorMessage = "This cassandra cluster is running using the simple partitioning strategy." + " This partitioner is not rack aware and is not intended for use on prod." + " This will have to be fixed by manually configuring to the network partitioner" + " and running the appropriate repairs." + " Contact the AtlasDB team to perform these steps."; if (currentRf != 1) { logErrorOrThrow(errorMessage, config.safetyDisabled() || config.ignoreBadNodeTopologyChecks()); } dcs = sanityCheckDatacenters(client, config); if (dcs.size() > 1) { logErrorOrThrow(errorMessage, config.safetyDisabled() || config.ignoreBadDatacenterConfigurationChecks()); } if (!(config.safetyDisabled() || config.ignoreBadDatacenterConfigurationChecks())) { ks.setStrategy_class(CassandraConstants.NETWORK_STRATEGY); ks.setStrategy_options(ImmutableMap.of(dcs.iterator().next(), "1")); } } else { dcs = sanityCheckDatacenters(client, config); } sanityCheckReplicationFactor(ks, config, dcs); }

Target:
private static void checkAndSetReplicationFactor( Cassandra.Client client, KsDef ks, boolean freshInstance, CassandraKeyValueServiceConfig config) throws TException { if (freshInstance) { Set<String> dcs = sanityCheckDatacenters(client, config); ks.setStrategy_options(Maps2.createConstantValueMap(dcs, String.valueOf(config.replicationFactor()))); return; } final Set<String> dcs; if (CassandraConstants.SIMPLE_STRATEGY.equals(ks.getStrategy_class())) { int currentRf = Integer.parseInt(ks.getStrategy_options().get( CassandraConstants.REPLICATION_FACTOR_OPTION)); String errorMessage = "This cassandra cluster is running using the simple partitioning strategy." + " This partitioner is not rack aware and is not intended for use on prod." + " This will have to be fixed by manually configuring to the network partitioner" + " and running the appropriate repairs; talking to support first is recommended. " + "If you're running in some sort of environment where nodes have no known correlated " + "failure patterns, you can set the 'ignoreNodeTopologyChecks' KVS config option."; if (currentRf != 1) { logErrorOrThrow(errorMessage, config.ignoreNodeTopologyChecks()); } dcs = sanityCheckDatacenters(client, config); if (dcs.size() > 1) { logErrorOrThrow(errorMessage, config.ignoreNodeTopologyChecks()); } if (!config.ignoreNodeTopologyChecks()) { ks.setStrategy_class(CassandraConstants.NETWORK_STRATEGY); ks.setStrategy_options(ImmutableMap.of(dcs.iterator().next(), "1")); } } else { dcs = sanityCheckDatacenters(client, config); } sanityCheckReplicationFactor(ks, config, dcs); }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); org.wikipedia.LongPressHandler.ListViewContextMenuListener contextMenuListener = new LongPressHandler(this); new org.wikipedia.LongPressHandler(getActivity(), searchResultsList, HistoryEntry.SOURCE_SEARCH, contextMenuListener); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); LongPressHandler.ListViewContextMenuListener contextMenuListener = new SearchResultsFragmentLongPressHandler(this); new LongPressHandler(getActivity(), searchResultsList, HistoryEntry.SOURCE_SEARCH, contextMenuListener); }
Source:
public List<Span> getChildren(String tenantId, String id) { List<Span> spans = new ArrayList<>(); try { final String index = client.getIndex(tenantId); RefreshRequestBuilder refreshRequestBuilder = client.getClient() .admin() .indices() .prepareRefresh(index); client.getClient() .admin() .indices() .refresh(refreshRequestBuilder.request()) .actionGet(); QueryBuilder query = QueryBuilders.termQuery("parentId", id); SearchRequestBuilder request = client.getClient() .prepareSearch(index) .setTypes(SPAN_TYPE) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(query); SearchResponse response = request.execute() .actionGet(); for (SearchHit searchHitFields : response.getHits()) { try { spans.add(deserialize(searchHitFields.getSourceAsString(), Span.class)); } catch (IOException ex) { msgLog.errorFailedToParse(ex); } } } catch (IndexMissingException ex) { msgLog.tracef("No index found, so unable to retrieve spans"); } msgLog.tracef("Get children with parentId[%s] is: %s", id, spans); return spans; }

Target:
public List<Span> getChildren(String tenantId, String id) { List<Span> spans = new ArrayList<>(); final String index = client.getIndex(tenantId); try { RefreshRequestBuilder refreshRequestBuilder = client.getClient() .admin() .indices() .prepareRefresh(index); client.getClient() .admin() .indices() .refresh(refreshRequestBuilder.request()) .actionGet(); QueryBuilder query = QueryBuilders.termQuery("parentId", id); SearchRequestBuilder request = client.getClient() .prepareSearch(index) .setTypes(SPAN_TYPE) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(query); SearchResponse response = request.execute() .actionGet(); for (SearchHit searchHitFields : response.getHits()) { try { spans.add(deserialize(searchHitFields.getSourceAsString(), Span.class)); } catch (IOException ex) { log.errorFailedToParse(ex); throw new IllegalStateException("Failed to deserialize span", ex); } } } catch (IndexMissingException ex) { log.errorf("No index[%s] found, so unable to retrieve spans", index); } log.tracef("Get children with parentId[%s] is: %s", id, spans); return spans; }
Source:
private String cliGetResult(String line) { log.info(line); cli.sendLine(line); String output = null; try { output = (String) cli.readAllAsOpResult().getResult(); } catch (IOException e) { Assert.fail("Fail to get result of CLI command: " + line); } return output; }

Target:
private String cliGetResult(String line) { log.info(line); cli.sendLine(line); String output = null; try { output = (String) cli.readAllAsOpResult().getResult(); } catch (IOException e) { Assert.fail("Fail to get result of CLI command: " + line + "\n" + e.getMessage() + "\n" + e.getStackTrace()); } return output; }
Source:
public void tryBuildDbAuthenticator(final Map<String, Authenticator> authenticators, final Map<String, PasswordEncoder> encoders) { for (int i = 0; i <= MAX_NUM_AUTHENTICATORS; i++) { if (containsProperty(COUCH_URL, i) || containsProperty(COUCH_DATABASENAME, i)) { final Builder httpClientBuilder = new StdHttpClient.Builder(); if (containsProperty(COUCH_USERNAME, i)) { httpClientBuilder.username(getProperty(COUCH_USERNAME, i)); } if (containsProperty(COUCH_PASSWORD, i)) { httpClientBuilder.password(getProperty(COUCH_PASSWORD, i)); } if (containsProperty(COUCH_URL, i)) { httpClientBuilder.password(getProperty(COUCH_URL, i)); } else { throw new TechnicalException("missing "+COUCH_URL+" property in CouchDB configuration"); } final HttpClient httpClient = httpClientBuilder.build(); final CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient); if (!containsProperty(COUCH_DATABASENAME, i)) { throw new TechnicalException("missing "+COUCH_DATABASENAME+" property in CouchDB configuration"); } final String databaseName = getProperty(COUCH_DATABASENAME, i); if (!dbInstance.checkIfDbExists(databaseName)) { throw new TechnicalException("Database "+databaseName+" does not exist, please create it with the appropriate design doc, see <LINK_0>"); } final CouchDbConnector db = dbInstance.createConnector(COUCH_DATABASENAME, false); final CouchProfileService authenticator = new CouchProfileService(db); if (containsProperty(COUCH_PASSWORD_ENCODER, i)) { authenticator.setPasswordEncoder(encoders.get(getProperty(COUCH_PASSWORD_ENCODER, i))); } authenticators.put(concat("couch", i), authenticator); } } }

Target:
public void tryBuildDbAuthenticator(final Map<String, Authenticator> authenticators, final Map<String, PasswordEncoder> encoders) { for (int i = 0; i <= MAX_NUM_AUTHENTICATORS; i++) { if (containsProperty(COUCH_URL, i) && containsProperty(COUCH_DATABASENAME, i)) { final Builder httpClientBuilder = new StdHttpClient.Builder(); if (containsProperty(COUCH_USERNAME, i)) { httpClientBuilder.username(getProperty(COUCH_USERNAME, i)); } if (containsProperty(COUCH_PASSWORD, i)) { httpClientBuilder.password(getProperty(COUCH_PASSWORD, i)); } try { httpClientBuilder.url(getProperty(COUCH_URL, i)); } catch (MalformedURLException e) { throw new TechnicalException(e); } final String databaseName = getProperty(COUCH_DATABASENAME, i); final HttpClient httpClient = httpClientBuilder.build(); final CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient); if (!dbInstance.checkIfDbExists(databaseName)) { throw new TechnicalException("Database "+databaseName+" does not exist, please create it with the appropriate design doc, see <LINK_0>"); } final CouchDbConnector db = dbInstance.createConnector(COUCH_DATABASENAME, false); final CouchProfileService authenticator = new CouchProfileService(db); if (containsProperty(COUCH_PASSWORD_ENCODER, i)) { authenticator.setPasswordEncoder(encoders.get(getProperty(COUCH_PASSWORD_ENCODER, i))); } authenticators.put(concat("couch", i), authenticator); } } }
Source:
public static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao) throws Exception { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put("experimental.resource-groups-enabled", "true"); Map<String, String> properties = builder.build(); DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().setCatalog("tpch").setSchema("tiny").build(), 2, ImmutableMap.of(), properties, new SqlParserOptions()); try { Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin(); queryRunner.installPlugin(h2ResourceGroupManagerPlugin); queryRunner.getCoordinator().getResourceGroupManager().get() .setConfigurationManager(CONFIGURATION_MANAGER_TYPE, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl)); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); setup(queryRunner, dao); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } }

Target:
public static DistributedQueryRunner createQueryRunner(String dbConfigUrl, H2ResourceGroupsDao dao) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner( testSessionBuilder().setCatalog("tpch").setSchema("tiny").build(), 2, ImmutableMap.of("experimental.resource-groups-enabled", "true"), ImmutableMap.of(), new SqlParserOptions()); try { Plugin h2ResourceGroupManagerPlugin = new H2ResourceGroupManagerPlugin(); queryRunner.installPlugin(h2ResourceGroupManagerPlugin); queryRunner.getCoordinator().getResourceGroupManager().get() .setConfigurationManager(CONFIGURATION_MANAGER_TYPE, ImmutableMap.of("resource-groups.config-db-url", dbConfigUrl)); queryRunner.installPlugin(new TpchPlugin()); queryRunner.createCatalog("tpch", "tpch"); setup(queryRunner, dao); return queryRunner; } catch (Exception e) { queryRunner.close(); throw e; } }
Source:
private static void startNCs(ClusterType type, int sleepms) throws IOException, InterruptedException { LOG.info("Starting NC's"); String startNCCmd = System.getProperty("app.home", ".") + File.separator + "bin" + File.separator + "startAllNCs.sh " + type; Files.setPosixFilePermissions(FileSystems.getDefault().getPath(startNCCmd), PosixFilePermissions.fromString("rwxr-x---")); Process p = Runtime.getRuntime().exec(startNCCmd); p.waitFor(); Thread.sleep(sleepms); System.out.println("\nstdout: " + IOUtils.toString(p.getInputStream()) + "\nstderr: " + IOUtils.toString(p.getErrorStream())); if (p.exitValue() != 0) throw new RuntimeException("Failed to start the" + type + " NC's! Script returned exit code: " + p.exitValue() + "\nstdout: " + IOUtils.toString(p.getInputStream()) + "\nstderr: " + IOUtils.toString(p.getErrorStream())); }

Target:
private static void startNCs(ClusterType type, int sleepms) throws IOException, InterruptedException { LOG.info("Starting NC's"); String startNCCmd = System.getProperty("app.home", ".") + File.separator + "bin" + File.separator + "startAllNCs.sh " + type; Process p = Runtime.getRuntime().exec(startNCCmd); p.waitFor(); Thread.sleep(sleepms); System.out.println("\nstdout: " + IOUtils.toString(p.getInputStream()) + "\nstderr: " + IOUtils.toString(p.getErrorStream())); if (p.exitValue() != 0) throw new RuntimeException("Failed to start the" + type + " NC's! Script returned exit code: " + p.exitValue() + "\nstdout: " + IOUtils.toString(p.getInputStream()) + "\nstderr: " + IOUtils.toString(p.getErrorStream())); }
Source:
public Observable<TranslationRowData> getOnClickDownloadSubject() { return onClickDownloadSubject; }

Target:
public Observable<TranslationRowData> getOnClickDownloadSubject() { return onClickDownloadSubject.hide(); }
Source:
public void handleRebalance(final String cacheName, final CacheTopology cacheTopology, final int viewId, final Address sender) throws InterruptedException { if (!running) { log.debugf("Ignoring rebalance request %s for cache %s, the local cache manager is not running", cacheTopology.getTopologyId(), cacheName); return; } final LocalCacheStatus cacheStatus = runningCaches.get(cacheName); if (cacheStatus == null) { log.tracef("Ignoring rebalance %s for cache %s that doesn't exist locally", cacheTopology.getTopologyId(), cacheName); return; } cacheStatus.getTopologyUpdatesCompletionService().submit(new Runnable() { @Override public void run() { try { doHandleRebalance(viewId, cacheStatus, cacheTopology, cacheName, sender); } catch (Throwable t) { log.errorf(t, "Error handling rebalance request %s", cacheTopology); } } }, null); }

Target:
public void handleRebalance(final String cacheName, final CacheTopology cacheTopology, final int viewId, final Address sender) throws InterruptedException { if (!running) { log.debugf("Ignoring rebalance request %s for cache %s, the local cache manager is not running", cacheTopology.getTopologyId(), cacheName); return; } final LocalCacheStatus cacheStatus = runningCaches.get(cacheName); if (cacheStatus == null) { log.tracef("Ignoring rebalance %s for cache %s that doesn't exist locally", cacheTopology.getTopologyId(), cacheName); return; } cacheStatus.getTopologyUpdatesCompletionService().submit(new Runnable() { @Override public void run() { try { doHandleRebalance(viewId, cacheStatus, cacheTopology, cacheName, sender); } catch (Throwable t) { log.rebalanceStartError(cacheName, t); } } }, null); }
Source:
public Composite getControl() { return fTimeAlignedComposite; }

Target:
public Control getControl() { return fTimeAlignedComposite; }
Source:
private static void populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store, long count, INewSegment segmentCreator) { for (int i = 0; i < count; i++) { long start = i + fuzz[i % size]; store.add(segmentCreator.createSegment(start, start + 10, i)); } }

Target:
private static void populate(int size, int[] fuzz, ISegmentStore<@NonNull ISegment> store, long count, INewSegment segmentCreator) { for (int i = 0; i < count; i++) { long start = (long) i + fuzz[i % size]; store.add(segmentCreator.createSegment(start, start + 10, i)); } }
Source:
public String getBootstrapConnector(String baseConnectorType) { if (!_isInitialized) { String errorMessage = "DatastreamServer is not initialized."; LOG.error(errorMessage); throw new DatastreamRuntimeException(errorMessage); } String ret = _bootstrapConnectors.get(baseConnectorType); if (ret == null) { String errorMessage = "No bootstrap connector specified for connector: " + baseConnectorType; LOG.error(errorMessage); throw new DatastreamRuntimeException(errorMessage); } return ret; }

Target:
public String getBootstrapConnector(String baseConnectorType) { if (!_isInitialized) { String errorMessage = "DatastreamServer is not initialized."; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } String ret = _bootstrapConnectors.get(baseConnectorType); if (ret == null) { String errorMessage = "No bootstrap connector specified for connector: " + baseConnectorType; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } return ret; }
Source:
public void factoryCreatesExecutorsWithoutListeners() { WorkflowStateProcessor executor = factory.createProcessor(12, () -> FALSE); assertNotNull(executor); }

Target:
public void factoryCreatesExecutorsWithoutListeners() { WorkflowStateProcessor executor = factory.createProcessor(12, FALSE::booleanValue); assertNotNull(executor); }
Source:
public String putProject(final ProjectStorageMetadata metadata, final File localFile) { this.hdfsAuth.authorize(); final Path projectsPath = new Path(this.projectRootUri.getPath(), String.valueOf(metadata.getProjectId())); try { if (this.hdfs.mkdirs(projectsPath)) { log.info("Created project dir: " + projectsPath); } final Path targetPath = new Path(projectsPath, StorageUtils.getTargetProjectFilename(metadata.getProjectId(), metadata.getHash())); final Path tmpPath = new Path(projectsPath, TMP_PROJECT_UPLOAD_FILENAME); log.info(String.format("Creating project artifact: meta: %s path: %s", metadata, targetPath)); this.hdfs.copyFromLocalFile(true, true, new Path(localFile.getAbsolutePath()), tmpPath); this.hdfs.rename(tmpPath, targetPath, Options.Rename.OVERWRITE); return getRelativeProjectPath(targetPath); } catch (final IOException e) { log.error("error in putProject(): Metadata: " + metadata); throw new StorageException(e); } }

Target:
public String putProject(final ProjectStorageMetadata metadata, final File localFile) { this.hdfsAuth.authorize(); final Path projectsPath = new Path(this.projectRootUri.getPath(), String.valueOf(metadata.getProjectId())); try { if (this.hdfs.mkdirs(projectsPath)) { log.info("Created project dir: " + projectsPath); } final Path targetPath = new Path(projectsPath, StorageUtils.getTargetProjectFilename(metadata.getProjectId(), metadata.getHash())); final Path tmpPath = new Path(projectsPath, TMP_PROJECT_UPLOAD_FILENAME); log.info(String.format("Creating project artifact: meta: %s path: %s", metadata, targetPath)); this.hdfs.copyFromLocalFile(false, true, new Path(localFile.getAbsolutePath()), tmpPath); this.hdfs.rename(tmpPath, targetPath, Options.Rename.OVERWRITE); return getRelativeProjectPath(targetPath); } catch (final IOException e) { log.error("error in putProject(): Metadata: " + metadata); throw new StorageException(e); } }
Source:
public List<Port> ports() { List<Port> list = Lists.newArrayList(); list.addAll(ports.stream().filter(port -> port.isVisible()).collect(Collectors.toList())); return list; }

Target:
public List<Port> ports() { return ports.stream().filter(Port::isVisible).collect(Collectors.toCollection(ArrayList::new)); }
Source:
public void actionPerformed(AnActionEvent e) { PantsMakeBeforeRun.terminatePantsProcess(e.getProject()); PantsConsoleManager.getOrMakeNewConsole(e.getProject()).print("\nPants process terminated.", ConsoleViewContentType.ERROR_OUTPUT); }

Target:
public void actionPerformed(AnActionEvent e) { PantsMakeBeforeRun.terminatePantsProcess(e.getProject()); PantsConsoleManager.getOrMakeNewConsole(e.getProject()).print(PantsBundle.message("pants.command.terminated"), ConsoleViewContentType.ERROR_OUTPUT); }
Source:
private void authenticateUser(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean enableBasicAuth = false; String strVal = request.getSession().getServletContext().getInitParameter("enable-basic-auth"); if (StringUtils.isNotEmpty(strVal)) { enableBasicAuth = Boolean.parseBoolean(strVal); } boolean needsBasicAuthHandling = enableBasicAuth && !containsUserCredentialsInParams(request.getParameterMap()); try { Credentials userCredentials = getUserCredentials(enableBasicAuth, request); if (userCredentials == null) { throw new AuthenticationException("Credentials Required"); } try { AuthenticationUtils.handleCredentials( session, userCredentials.getUsername(), userCredentials.getPassword(), userCredentials.getProfile()); request.getRequestDispatcher(SSOUtils.LOGIN_PHASE3_URI).forward(request, response); } catch (SQLException ex) { log.error("Internal Database Error", ex); throw new AuthenticationException("Internal Database Error", ex); } } catch (AuthenticationException ex) { if (needsBasicAuthHandling) { response.sendRedirect(request.getContextPath() + SSOUtils.LOGIN_EXTERNAL_URI + request.getQueryString()); } else { request.getRequestDispatcher("/WEB-INF/login.jsp?msg=" + ex.getMessage()).forward(request, response); } } }

Target:
private void authenticateUser(HttpSession session, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Credentials userCredentials = getUserCredentialsFromRequest(request); if (userCredentials == null) { userCredentials = getUserCredentialsFromSession(request); } if (userCredentials == null) { throw new AuthenticationException("Credentials Required"); } try { AuthenticationUtils.handleCredentials( session, userCredentials.getUsername(), userCredentials.getPassword(), userCredentials.getProfile()); request.getRequestDispatcher(SSOUtils.LOGIN_PHASE3_URI).forward(request, response); } catch (SQLException ex) { log.error("Internal Database Error", ex); throw new AuthenticationException("Internal Database Error", ex); } } catch (AuthenticationException ex) { request.getRequestDispatcher("/WEB-INF/login.jsp?msg=" + ex.getMessage()).forward(request, response); } finally { request.getSession().removeAttribute(SSOUtils.USER_CREDENTIALS); } }
Source:
private Citation extractCitationFromRunData(RunData data) { try { SessionState session = ((JetspeedRunData)data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); if(session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS) != null) { List refs = (List) session .getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); String citationCollectionId = (String) sessionManager.getCurrentToolSession().getAttribute(STATE_CITATION_COLLECTION_ID); CitationCollection collection = getCitationService().getCollection(citationCollectionId); Citation citation = null; if (!refs.isEmpty()) { for (Iterator it = refs.iterator(); it.hasNext(); ) { Reference selection = (Reference) it.next(); String resourceId = selection.getId(); ContentResource resource = contentService.getResource(resourceId); ResourceProperties props = resource.getProperties(); String displayName = props.getProperty(ResourceProperties.PROP_DISPLAY_NAME); citation = citationService.addCitation("unknown"); citation.setDisplayName(displayName); citation.setCitationProperty("resourceId", resourceId); String urlId = citation.addCustomUrl(resource.getUrl(), resource.getUrl()); citation.setPreferredUrl(urlId); } session.removeAttribute(FilePickerHelper.FILE_PICKER_CANCEL); session.removeAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); return citation; } } } catch (PermissionException e) { logger.warn("Unable to extract citation" + e.getMessage()); } catch (IdUnusedException e) { logger.warn("Unable to extract citation" + e.getMessage()); } catch (TypeException e) { logger.warn("Unable to extract citation" + e.getMessage()); } return null; }

Target:
private Citation extractCitationFromRunData(RunData data) { try { SessionState session = ((JetspeedRunData)data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); if(session.getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS) != null) { List refs = (List) session .getAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); Citation citation = null; if (!refs.isEmpty()) { Reference selection = (Reference) refs.get(0); String resourceId = selection.getId(); ContentResource resource = contentService.getResource(resourceId); ResourceProperties props = resource.getProperties(); String displayName = props.getProperty(ResourceProperties.PROP_DISPLAY_NAME); citation = citationService.addCitation("unknown"); citation.setDisplayName(displayName); citation.setCitationProperty("resourceId", resourceId); String urlId = citation.addCustomUrl(resource.getUrl(), resource.getUrl()); citation.setPreferredUrl(urlId); session.removeAttribute(FilePickerHelper.FILE_PICKER_CANCEL); session.removeAttribute(FilePickerHelper.FILE_PICKER_ATTACHMENTS); return citation; } } } catch (PermissionException e) { logger.warn("Unable to extract citation" + e.getMessage()); } catch (IdUnusedException e) { logger.warn("Unable to extract citation" + e.getMessage()); } catch (TypeException e) { logger.warn("Unable to extract citation" + e.getMessage()); } return null; }
Source:
private IndexValue(long size, Offset offset, byte flags, long expiresAtMs, long originalMessageOffset, long operationTimeInMs, short serviceId, short containerId) { this.size = size; this.offset = offset; this.flags = flags; if (TimeUnit.MILLISECONDS.toSeconds(expiresAtMs) > Integer.MAX_VALUE) { this.expiresAtMs = Utils.Infinite_Time; } else if (expiresAtMs != Utils.Infinite_Time && expiresAtMs < 0) { this.expiresAtMs = 0; } else { this.expiresAtMs = Utils.getTimeInMsToTheNearestSec(expiresAtMs); } this.originalMessageOffset = originalMessageOffset; this.operationTimeInMs = Utils.getTimeInMsToTheNearestSec(operationTimeInMs); this.serviceId = serviceId; this.containerId = containerId; version = PersistentIndex.CURRENT_VERSION; }

Target:
private IndexValue(long size, Offset offset, byte flags, long expiresAtMs, long originalMessageOffset, long operationTimeInMs, short serviceId, short containerId) { this.size = size; this.offset = offset; this.flags = flags; if (TimeUnit.MILLISECONDS.toSeconds(expiresAtMs) > Integer.MAX_VALUE) { this.expiresAtMs = Utils.Infinite_Time; } else { this.expiresAtMs = Utils.getTimeInMsToTheNearestSec(expiresAtMs); } this.originalMessageOffset = originalMessageOffset; this.operationTimeInMs = Utils.getTimeInMsToTheNearestSec(operationTimeInMs); this.serviceId = serviceId; this.containerId = containerId; version = PersistentIndex.CURRENT_VERSION; }
Source:
public Transaction startLong() { txMetricsCollector.gauge("start.long", 1); Stopwatch timer = new Stopwatch().start(); long currentTime = System.currentTimeMillis(); Transaction tx = startTx(-currentTime); txMetricsCollector.gauge("start.long.latency", (int) timer.elapsedMillis()); return tx; }

Target:
public Transaction startLong() { txMetricsCollector.gauge("start.long", 1); Stopwatch timer = new Stopwatch().start(); Transaction tx = startTx(-1); txMetricsCollector.gauge("start.long.latency", (int) timer.elapsedMillis()); return tx; }