auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void start() { final KeyStore rootca = getParams().getRootca(); if (rootca == null) { try { createNewRootCa(); } catch (Exception e) { logger.error("Failed to create new root CA certificate:", e); } return; } try { setRootCa(rootca); } catch (final Exception e) { logger.error("Couldn't initialize Root CA", e); } X509Certificate caCert = getCaCertificate(); if (isCertExpired(caCert)) { warnCertExpired(caCert); } }

Target:
public void start() { final KeyStore rootca = getParams().getRootca(); if (rootca == null) { try { createNewRootCa(); } catch (Exception e) { logger.error("Failed to create new root CA certificate:", e); } return; } try { setRootCa(rootca); } catch (final Exception e) { logger.error("Couldn't initialize Root CA", e); } if (isCertExpired(getRootCaCertificate())) { warnRooCaCertExpired(); } }
Source:
public Role(@Nonnull String name, @CheckForNull String pattern, @CheckForNull Set <String> permissionIds, @CheckForNull String description) { this(name, Pattern.compile(pattern != null ? pattern : GLOBAL_ROLE_PATTERN), PermissionHelper.fromStrings(permissionIds, true), description); }

Target:
public Role(@Nonnull String name, @CheckForNull String pattern, @CheckForNull Set <String> permissionIds, @CheckForNull String description) { this(name, Pattern.compile(pattern != null ? pattern : GLOBAL_ROLE_PATTERN), PermissionHelper.fromStrings(permissionIds, DangerousPermissionHandlingMode.getCurrent() != DangerousPermissionHandlingMode.ENABLED), description); }
Source:
public boolean isEnabled() { IStructuredSelection selection = getSelection(); if (selection.size() != 1) return false; IResource resource = (IResource) getAdapter(selection.getFirstElement(), IResource.class); if (resource == null || resource instanceof IFolder) return false; Repository repository = getRepository(); if (repository == null) return false; return isStaged(repository, resource); }

Target:
public boolean isEnabled() { IStructuredSelection selection = getSelection(); if (selection.size() != 1) return false; IResource resource = (IResource) getAdapter(selection.getFirstElement(), IResource.class); if (resource == null || !(resource instanceof IFile)) return false; Repository repository = getRepository(); if (repository == null) return false; return isStaged(repository, resource); }
Source:
public QueryRunner<Result<TimeseriesResultValue>> preMergeQueryDecoration(final QueryRunner<Result<TimeseriesResultValue>> runner) { return intervalChunkingQueryRunnerDecorator.decorate( (queryPlus, responseContext) -> { TimeseriesQuery timeseriesQuery = (TimeseriesQuery) queryPlus.getQuery(); if (timeseriesQuery.getDimensionsFilter() != null) { timeseriesQuery = timeseriesQuery.withDimFilter(timeseriesQuery.getDimensionsFilter().optimize()); queryPlus = queryPlus.withQuery(timeseriesQuery); } if (timeseriesQuery.getLimit() < Integer.MAX_VALUE) { timeseriesQuery = timeseriesQuery.withLimit(timeseriesQuery.getLimit()); queryPlus = queryPlus.withQuery(timeseriesQuery); } return runner.run(queryPlus, responseContext); }, this); }

Target:
public QueryRunner<Result<TimeseriesResultValue>> preMergeQueryDecoration(final QueryRunner<Result<TimeseriesResultValue>> runner) { return intervalChunkingQueryRunnerDecorator.decorate( (queryPlus, responseContext) -> { TimeseriesQuery timeseriesQuery = (TimeseriesQuery) queryPlus.getQuery(); if (timeseriesQuery.getDimensionsFilter() != null) { timeseriesQuery = timeseriesQuery.withDimFilter(timeseriesQuery.getDimensionsFilter().optimize()); queryPlus = queryPlus.withQuery(timeseriesQuery); } return runner.run(queryPlus, responseContext); }, this); }
Source:
public static int run(final AppBase app, final String[] testClasses, final String... args) { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); DateTimeZone.setDefault(DateTimeZone.UTC); final CmdLineParser p = new CmdLineParser(app); try { p.parseArgument(args); LOGGER.info("Start"); final int retval = app.runTests(testClasses); LOGGER.info("End. Retval = {}", retval); return retval; } catch (final CmdLineException e) { LOGGER.error(e.getMessage()); LOGGER.error("java -jar <...>.jar [opts] ..."); p.printUsage(System.err); return -1; } }

Target:
public static int run(final AppBase app, final String[] testClasses, final String... args) { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); DateTimeZone.setDefault(DateTimeZone.UTC); final CmdLineParser p = new CmdLineParser(app); try { p.parseArgument(args); LOGGER.info("Start"); final int retval = app.runTests(testClasses); LOGGER.info("End. Retval = {}", retval); return retval; } catch (final CmdLineException e) { LOGGER.error("Incorrect usage", e); LOGGER.error("java -jar <...>.jar [opts] ..."); p.printUsage(System.err); return -1; } }
Source:
private void updateInsertedRowsColumn(int insertedRows, RowMap startBootstrapRow, BinlogPosition position, Connection connection) throws SQLException, NoSuchElementException { long now = System.currentTimeMillis(); if ( now - lastInsertedRowsUpdateTimeMillis > INSERTED_ROWS_UPDATE_PERIOD_MILLIS ) { long rowId = ( long ) startBootstrapRow.getData("id"); String sql = "update `bootstrap` set inserted_rows = ?, binlog_file = ?, binlog_position = ? where id = ?"; connection.setCatalog(this.context.getConfig().databaseName); PreparedStatement preparedStatement = connection.prepareStatement(sql); preparedStatement.setInt(1, insertedRows); preparedStatement.setString(2, position.getFile()); preparedStatement.setLong(3, position.getOffset()); preparedStatement.setLong(4, rowId); if ( preparedStatement.executeUpdate() == 0 ) { throw new NoSuchElementException(); } lastInsertedRowsUpdateTimeMillis = now; } }

Target:
private void updateInsertedRowsColumn(int insertedRows, RowMap startBootstrapRow, BinlogPosition position, Connection connection) throws SQLException, NoSuchElementException { long now = System.currentTimeMillis(); if ( now - lastInsertedRowsUpdateTimeMillis > INSERTED_ROWS_UPDATE_PERIOD_MILLIS ) { long rowId = ( long ) startBootstrapRow.getData("id"); String sql = "update `bootstrap` set inserted_rows = ?, binlog_file = ?, binlog_position = ? where id = ?"; PreparedStatement preparedStatement = connection.prepareStatement(sql); preparedStatement.setInt(1, insertedRows); preparedStatement.setString(2, position.getFile()); preparedStatement.setLong(3, position.getOffset()); preparedStatement.setLong(4, rowId); if ( preparedStatement.executeUpdate() == 0 ) { throw new NoSuchElementException(); } lastInsertedRowsUpdateTimeMillis = now; } }
Source:
protected HealthCheckRegistry getHealthCheckRegistry() { HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); LightblueFactory factory = RestConfiguration.getFactory(); CRUDController[] crudControllers = null; try { crudControllers = factory.getFactory().getCRUDControllers(); } catch (Exception e) { } if (crudControllers != null) { for (CRUDController crudController : crudControllers) { healthCheckRegistry.register(crudController.getClass().getName(), new ControllerHealthCheck(crudController)); } } healthCheckRegistry.register("ldap-auth-healthcheck", new RolesProviderHealthCheck(CertLdapLoginModule.getRolesProvider())); return healthCheckRegistry; }

Target:
protected HealthCheckRegistry getHealthCheckRegistry() { HealthCheckRegistry healthCheckRegistry = new HealthCheckRegistry(); LightblueFactory factory = RestConfiguration.getFactory(); CRUDController[] crudControllers = null; try { crudControllers = factory.getFactory().getCRUDControllers(); } catch (Exception e) { LOGGER.error("Could not fetch CRUD Controllers from Lightblue Factory. Reason: " + e.getMessage()); } if (crudControllers != null) { for (CRUDController crudController : crudControllers) { healthCheckRegistry.register(crudController.getClass().getSimpleName(), new ControllerHealthCheck(crudController)); } } healthCheckRegistry.register("ldap-auth-healthcheck", new RolesProviderHealthCheck(CertLdapLoginModule.getRolesProvider())); return healthCheckRegistry; }
Source:
public void bulkUpsert(List<Entry> entries) { try (RestClient restClient = RestClient.builder(new HttpHost(ElasticManager.hostname, ElasticManager.port, "http")).build()) { String newlineDJSON = getNDJSON(entries); HttpEntity bulkEntity = new NStringEntity(newlineDJSON, ContentType.APPLICATION_JSON); org.elasticsearch.client.Response post = restClient.performRequest("POST", "/entry/_bulk", Collections.emptyMap(), bulkEntity); if (post.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e) { throw new CustomWebApplicationException(e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR); } }

Target:
public void bulkUpsert(List<Entry> entries) { try (RestClient restClient = RestClient.builder(new HttpHost(ElasticManager.hostname, ElasticManager.port, "http")).build()) { String newlineDJSON = getNDJSON(entries); HttpEntity bulkEntity = new NStringEntity(newlineDJSON, ContentType.APPLICATION_JSON); org.elasticsearch.client.Response post = restClient.performRequest("POST", "/entry/_bulk", Collections.emptyMap(), bulkEntity); if (post.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new CustomWebApplicationException("Could not submit index to elastic search", HttpStatus.SC_INTERNAL_SERVER_ERROR); } } catch (IOException e) { LOGGER.error("Could not submit index to elastic search. " + e.getMessage()); } }
Source:
public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new CeWsModule().configure(container); assertThat(container.size()).isEqualTo(12 + 2 ); }

Target:
public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new CeWsModule().configure(container); assertThat(container.size()).isEqualTo(12 + COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER); }
Source:
private void takeSnapshotSync( Map<OperatorID, OperatorSnapshotFutures> operatorSnapshotsInProgress, CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics, CheckpointOptions checkpointOptions, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isCanceled) throws Exception { long checkpointId = checkpointMetaData.getCheckpointId(); long started = System.nanoTime(); ChannelStateWriteResult channelStateWriteResult = checkpointOptions.getCheckpointType() == CHECKPOINT ? channelStateWriter.getWriteResult(checkpointId) : ChannelStateWriteResult.EMPTY; CheckpointStreamFactory storage = checkpointStorage.resolveCheckpointStorageLocation(checkpointId, checkpointOptions.getTargetLocation()); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorSnapshotsInProgress.put( operatorWrapper.getStreamOperator().getOperatorID(), buildOperatorSnapshotFutures( checkpointMetaData, checkpointOptions, operatorChain, operatorWrapper.getStreamOperator(), isCanceled, channelStateWriteResult, storage)); } checkpointStorage.clearCacheFor(checkpointId); LOG.debug( "{} - finished synchronous part of checkpoint {}. Alignment duration: ms, snapshot duration ms", taskName, checkpointId, checkpointMetrics.getAlignmentDurationNanos() / 1_000_000, checkpointMetrics.getSyncDurationMillis()); checkpointMetrics.setSyncDurationMillis((System.nanoTime() - started) / 1_000_000); }

Target:
private void takeSnapshotSync( Map<OperatorID, OperatorSnapshotFutures> operatorSnapshotsInProgress, CheckpointMetaData checkpointMetaData, CheckpointMetrics checkpointMetrics, CheckpointOptions checkpointOptions, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isCanceled) throws Exception { long checkpointId = checkpointMetaData.getCheckpointId(); long started = System.nanoTime(); ChannelStateWriteResult channelStateWriteResult = checkpointOptions.getCheckpointType() == CHECKPOINT ? channelStateWriter.getWriteResult(checkpointId) : ChannelStateWriteResult.EMPTY; CheckpointStreamFactory storage = checkpointStorage.resolveCheckpointStorageLocation(checkpointId, checkpointOptions.getTargetLocation()); try { for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorSnapshotsInProgress.put( operatorWrapper.getStreamOperator().getOperatorID(), buildOperatorSnapshotFutures( checkpointMetaData, checkpointOptions, operatorChain, operatorWrapper.getStreamOperator(), isCanceled, channelStateWriteResult, storage)); } } finally { checkpointStorage.clearCacheFor(checkpointId); } LOG.debug( "{} - finished synchronous part of checkpoint {}. Alignment duration: ms, snapshot duration ms", taskName, checkpointId, checkpointMetrics.getAlignmentDurationNanos() / 1_000_000, checkpointMetrics.getSyncDurationMillis()); checkpointMetrics.setSyncDurationMillis((System.nanoTime() - started) / 1_000_000); }
Source:
public void shouldGetThePrivateKeyFromUsersPreference() throws Exception { sshKeyStore = spy(new UserProfileSshKeyStore(API_ENDPOINT)); final String privateKey = "private key"; final String publicKey = "public key"; doReturn(ImmutableMap.of("ssh.key.private." + privateKey, "ssh.key.public." + publicKey)).when(sshKeyStore).getSshKeys(); doNothing().when(sshKeyStore).updateSshKeys(any()); Set<String> result = sshKeyStore.getAll(); assertTrue(result.size() == 1 && result.contains(privateKey)); }

Target:
public void shouldGetThePrivateKeyFromUsersPreference() throws Exception { sshKeyStore = spy(new UserProfileSshKeyStore(API_ENDPOINT)); final String privateKey = "private key"; final String publicKey = "public key"; doReturn(ImmutableMap.of("ssh.key.private." + privateKey, "ssh.key.public." + publicKey)).when(sshKeyStore).getSshKeys(); doNothing().when(sshKeyStore).updateSshKeys(any()); Set<String> result = sshKeyStore.getAll(); assertTrue(result.contains(privateKey)); assertTrue(result.size() == 1); }
Source:
public static QueryNode translateQuery(Map<String, Object> query, Map<String, Object> indexes, Boolean[] indexesCoverQuery) { TranslatorState state = new TranslatorState(); QueryNode node = translateQuery(query, indexes, state); if (state.textIndexMissing) { String msg = "No text index defined, cannot execute query containing a text search."; logger.log(Level.SEVERE, msg); return null; } else if (state.textIndexRequired && state.atLeastOneIndexMissing) { String msg = String.format("Query %s contains a text search but is missing \"json\"" + " index(es). All indexes must exist in order to execute a" + " query containing a text search. Create all necessary" + " indexes for the query and re-execute.", query.toString()); logger.log(Level.SEVERE, msg); return null; } else if (!state.textIndexRequired && (!state.atLeastOneIndexUsed || state.atLeastOneORIndexMissing)) { SqlQueryNode sqlNode = new SqlQueryNode(); Set<String> neededFields = new HashSet<String>(Collections.singletonList("_id")); String allDocsIndex = chooseIndexForFields(neededFields, indexes); if (allDocsIndex != null && !allDocsIndex.isEmpty()) { String tableName = IndexManager.tableNameForIndex(allDocsIndex); String sql = String.format("SELECT _id FROM \"%s\"", tableName); sqlNode.sql = SqlParts.partsForSql(sql, new String[]{}); } AndQueryNode root = new AndQueryNode(); root.children.add(sqlNode); indexesCoverQuery[0] = false; return root; } else { indexesCoverQuery[0] = !state.atLeastOneIndexMissing; return node; } }

Target:
public static QueryNode translateQuery(Map<String, Object> query, Map<String, Object> indexes, Boolean[] indexesCoverQuery) { TranslatorState state = new TranslatorState(); QueryNode node = translateQuery(query, indexes, state); if (state.textIndexMissing) { String msg = "No text index defined, cannot execute query containing a text search."; logger.log(Level.SEVERE, msg); return null; } else if (state.textIndexRequired && state.atLeastOneIndexMissing) { String msg = String.format("Query %s contains a text search but is missing \"json\"" + " index(es). All indexes must exist in order to execute a" + " query containing a text search. Create all necessary" + " indexes for the query and re-execute.", query.toString()); logger.log(Level.SEVERE, msg); return null; } else if (!state.textIndexRequired && (!state.atLeastOneIndexUsed || state.atLeastOneORIndexMissing)) { SqlQueryNode sqlNode = new SqlQueryNode(); Set<String> neededFields = new HashSet<String>(Collections.singletonList("_id")); String allDocsIndex = chooseIndexForFields(neededFields, indexes); if (allDocsIndex != null && !allDocsIndex.isEmpty()) { String tableName = IndexManager.tableNameForIndex(allDocsIndex); String sql = String.format(Locale.ENGLISH, "SELECT _id FROM \"%s\"", tableName); sqlNode.sql = SqlParts.partsForSql(sql, new String[]{}); } AndQueryNode root = new AndQueryNode(); root.children.add(sqlNode); indexesCoverQuery[0] = false; return root; } else { indexesCoverQuery[0] = !state.atLeastOneIndexMissing; return node; } }
Source:
private void initializeCurrentListeners() { UnitedServerListener[] all = null; synchronized(this) { all = getListeners(); isInitialized = true; } for( int i = 0; i < all.length; i++ ) { initializeListener(all[i]); } }

Target:
private void initializeCurrentListeners() { Iterator<UnitedServerListener> it = null; synchronized(this) { it = list.iterator(); setInitialized(true); } while( it.hasNext() ) { initializeListener(it.next()); } }
Source:
protected void contentChanged(ITmfTreeViewerEntry rootEntry) { if (fSelectedThread != null) { for (ITmfTreeViewerEntry entry : rootEntry.getChildren()) { if (entry instanceof CpuUsageEntry) { if (fSelectedThread.equals(((CpuUsageEntry) entry).getTid())) { List<ITmfTreeViewerEntry> list = Collections.singletonList(entry); if (list != null) { super.setSelection(list); } return; } } } } }

Target:
protected void contentChanged(ITmfTreeViewerEntry rootEntry) { String selectedThread = fSelectedThread; if (selectedThread != null) { for (ITmfTreeViewerEntry entry : rootEntry.getChildren()) { if (entry instanceof CpuUsageEntry) { if (selectedThread.equals(((CpuUsageEntry) entry).getTid())) { List<ITmfTreeViewerEntry> list = Collections.singletonList(entry); if (list != null) { super.setSelection(list); } return; } } } } }
Source:
protected boolean checkUserAndGroupsAuthorization(Guid userId, HashSet<Guid> groupIds, final ActionGroup actionGroup, final Guid object, final VdcObjectType type, final boolean ignoreEveryone) { if (log.isDebugEnabled()) { log.debugFormat("Checking whether user {0} has permission on {1} groups with {2} action group on {3} object with {4}", userId, StringUtils.join(groupIds, ","), actionGroup, object, type.name()); } final Guid permId = getPermissionDAO().getEntityPermissionsForUserAndGroups(userId, StringUtils.join(groupIds, ","), actionGroup, object, type, ignoreEveryone); if (permId != null) { if (log.isDebugEnabled()) { log.debugFormat("Found permission {0} for user when running {1}, on {2} with id {3}", permId, getActionType(), type.getVdcObjectTranslation(), object); } return true; } if (log.isDebugEnabled()) { log.debugFormat("No permission found for user when running action {0}, on object {1} for action group {2} with id {3}.", getActionType(), type.getVdcObjectTranslation(), actionGroup, object); } return false; }

Target:
protected boolean checkUserAndGroupsAuthorization(Guid userId, HashSet<Guid> groupIds, final ActionGroup actionGroup, final Guid object, final VdcObjectType type, final boolean ignoreEveryone) { if (log.isDebugEnabled()) { log.debugFormat("Checking whether user {0} or groups {1} have action group {3} on object type {4}", userId, StringUtils.join(groupIds, ","), actionGroup, object, type.name()); } final Guid permId = getPermissionDAO().getEntityPermissionsForUserAndGroups(userId, StringUtils.join(groupIds, ","), actionGroup, object, type, ignoreEveryone); if (permId != null) { if (log.isDebugEnabled()) { log.debugFormat("Found permission {0} for user when running {1}, on {2} with id {3}", permId, getActionType(), type.getVdcObjectTranslation(), object); } return true; } if (log.isDebugEnabled()) { log.debugFormat("No permission found for user when running action {0}, on object {1} for action group {2} with id {3}.", getActionType(), type.getVdcObjectTranslation(), actionGroup, object); } return false; }
Source:
public void connect(String controller, String username, char[] password, String clientBindAddress) { checkAlreadyConnected(); try { ctx = CommandContextFactory.getInstance().newCommandContext(new CommandContextConfiguration(controller, username, password, clientBindAddress, false, -1)); ctx.connectController(); } catch (CliInitializationException e) { throw new IllegalStateException("Unable to initialize command context.", e); } catch (CommandLineException e) { throw new IllegalStateException("Unable to connect to controller.", e); } }

Target:
public void connect(String controller, String username, char[] password, String clientBindAddress) { checkAlreadyConnected(); try { ctx = CommandContextFactory.getInstance().newCommandContext(new CommandContextConfiguration.Builder() .setController(controller) .setUsername(username) .setPassword(password) .setClientBindAddress(clientBindAddress) .build()); ctx.connectController(); } catch (CliInitializationException e) { throw new IllegalStateException("Unable to initialize command context.", e); } catch (CommandLineException e) { throw new IllegalStateException("Unable to connect to controller.", e); } }
Source:
private void processSignals() { this.healtcheckRefreshTime = clock.millis(); signals.drain(this::process); }

Target:
private void processSignals() { refreshHealthcheck(); signals.drain(this::process); refreshHealthcheck(); }
Source:
public void testDisableL1() { GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder(); ConfigurationBuilder cb = new ConfigurationBuilder(); DefaultCacheManager manager = new DefaultCacheManager(gcb.build(), cb.build()); cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC).l1().disable().disableOnRehash(); manager.defineConfiguration("testConfigCache", cb.build()); manager.getCache("testConfigCache"); }

Target:
public void testDisableL1() { EmbeddedCacheManager manager = TestCacheManagerFactory .createClusteredCacheManager(new ConfigurationBuilder(), new TransportFlags()); try { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(CacheMode.DIST_SYNC).l1().disable().disableOnRehash(); manager.defineConfiguration("testConfigCache", cb.build()); manager.getCache("testConfigCache"); } finally { TestingUtil.killCacheManagers(manager); } }
Source:
public String getProtoFileName() { return "/library.proto"; }

Target:
public String getProtoFileName() { return "library.proto"; }
Source:
public static LocalDateTime parseLocalDateTimeForSessionsForm(String date, String hour, String min) { if (date == null || hour == null || min == null) { return null; } LocalDate localDate = parseLocalDate(date, "EEE, dd MMM, yyyy"); if (localDate == null) { return null; } try { return localDate.atTime(Integer.parseInt(hour), Integer.parseInt(min)); } catch (DateTimeException | NumberFormatException e) { return null; } }

Target:
public static LocalDateTime parseLocalDateTimeForSessionsForm(String date, String hour, String min) { LocalDate localDate = parseLocalDateForSessionsForm(date); if (localDate == null) { return null; } if (hour == null || min == null) { return null; } try { return localDate.atTime(Integer.parseInt(hour), Integer.parseInt(min)); } catch (DateTimeException | NumberFormatException e) { return null; } }
Source:
public static Bitmap inflateDisplayImage(Context context, String jrUri, int boundingWidth, int boundingHeight) { if (jrUri == null || jrUri.equals("")) { return null; } try { String imageFilename = ReferenceManager._().DeriveReference(jrUri).getLocalURI(); final File imageFile = new File(imageFilename); if (!imageFile.exists()) { return null; } Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); if (boundingHeight == -1) { boundingHeight = display.getHeight(); } if (boundingWidth == -1) { boundingWidth = display.getWidth(); } if (DeveloperPreferences.isSmartInflationEnabled()) { return getBitmapScaledForNativeDensity( context.getResources().getDisplayMetrics(), imageFile.getAbsolutePath(), boundingHeight, boundingWidth, DeveloperPreferences.getTargetInflationDensity()); } else { return getBitmapScaledToContainer(imageFile.getAbsolutePath(), boundingHeight, boundingWidth); } } catch (InvalidReferenceException e) { Log.e("ImageInflater", "image invalid reference exception for " + e.getReferenceString()); e.printStackTrace(); } return null; }

Target:
public static Bitmap inflateDisplayImage(Context context, String jrUri, int boundingWidth, int boundingHeight) { if (jrUri == null || jrUri.equals("")) { return null; } try { Reference ref = ReferenceManager._().DeriveReference(jrUri); try { if (!ref.doesBinaryExist()) { return null; } if (!(ref instanceof JavaFileReference)) { return BitmapFactory.decodeStream(ref.getStream()); } } catch (IOException e) { Logger.log(AndroidLogger.TYPE_ERROR_ASSERTION, "IO Exception loading reference: " + jrUri); return null; } String imageFilename = ref.getLocalURI(); final File imageFile = new File(imageFilename); if (!imageFile.exists()) { return null; } Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); if (boundingHeight == -1) { boundingHeight = display.getHeight(); } if (boundingWidth == -1) { boundingWidth = display.getWidth(); } if (DeveloperPreferences.isSmartInflationEnabled()) { return getBitmapScaledForNativeDensity( context.getResources().getDisplayMetrics(), imageFile.getAbsolutePath(), boundingHeight, boundingWidth, DeveloperPreferences.getTargetInflationDensity()); } else { return getBitmapScaledToContainer(imageFile.getAbsolutePath(), boundingHeight, boundingWidth); } } catch (InvalidReferenceException e) { Log.e("ImageInflater", "image invalid reference exception for " + e.getReferenceString()); e.printStackTrace(); } return null; }
Source:
public void createFeaturesTest() throws IOException { String[] tokens = new String[] {"he", "went", "with", "you"}; AdaptiveFeatureGenerator generator = new BrownBigramFeatureGenerator(brownCluster); List<String> features = new ArrayList<>(); generator.createFeatures(features, tokens, 3, null); Assert.assertEquals(2, features.size()); Assert.assertTrue(features.contains("pbrowncluster,browncluster=0101,0010")); Assert.assertTrue(features.contains("pbrowncluster,browncluster=01010,00101")); }

Target:
public void createFeaturesTest() throws IOException { String[] tokens = new String[] {"he", "went", "with", "you"}; List<String> features = new ArrayList<>(); generator.createFeatures(features, tokens, 3, null); Assert.assertEquals(2, features.size()); Assert.assertTrue(features.contains("pbrowncluster,browncluster=0101,0010")); Assert.assertTrue(features.contains("pbrowncluster,browncluster=01010,00101")); }
Source:
private List<StorageServerConnections> getConnections() { List<StorageServerConnections> connectionsList = new ArrayList<>(); for (int i = 0; i <= NUMBER_OF_EXISTING_CONNECTIONS; i++) { StorageServerConnections conn = new StorageServerConnections(); conn.setId(Guid.newGuid().toString()); connectionsList.add(conn); } return connectionsList; }

Target:
private List<StorageServerConnections> getConnections() { List<StorageServerConnections> connectionsList = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_EXISTING_CONNECTIONS; i++) { StorageServerConnections conn = new StorageServerConnections(); conn.setId(Guid.newGuid().toString()); connectionsList.add(conn); } return connectionsList; }
Source:
public static VersionInfo getVersionInfo(VersionResponseMsg msg) { final Gson parser = new GsonBuilder().create(); return parser.fromJson(msg.getJsonPayloadMsg(), VersionInfo.class); }

Target:
public static VersionInfo getVersionInfo(VersionResponseMsg msg) { final Gson parser = new GsonBuilder().create(); try { return parser.fromJson(msg.getJsonPayloadMsg(), VersionInfo.class); } catch (Exception ex) { throw new SerializerException("Unexpected error while deserializing VersionInfo JSON", ex); } }
Source:
public static KeyPair getKeyPair() { if (keyPairs.isEmpty()) { synchronized (keyPairs) { keyPairs.notify(); } } try { return keyPairs.take(); } catch (InterruptedException e) { logger.error("Thead was interrupted", e); return null; } }

Target:
public static KeyPair getKeyPair() throws NoSuchAlgorithmException { return keyPairProducer.getKeyPair(); }
Source:
void remove(MessageGroup group) { Object correlationKey = group.getGroupId(); if (this.groupIds.contains(correlationKey)) { this.messageStore.removeMessageGroup(correlationKey); this.groupIds.remove(correlationKey); } }

Target:
protected void remove(MessageGroup group) { Object correlationKey = group.getGroupId(); this.messageStore.removeMessageGroup(correlationKey); this.groupIds.remove(group.getGroupId()); }
Source:
public AccessControlPolicy[] getPolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } if (!hasPrivileges(absPath, new Privilege[] {privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL)})) { throw new AccessDeniedException(); } AccessControlList acl = findAccessList(absPath, false); return acl == null ? new AccessControlPolicy[0] : new AccessControlPolicy[] {acl}; }

Target:
public AccessControlPolicy[] getPolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } if (!hasPrivileges(absPath, new Privilege[] {privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL)})) { throw new AccessDeniedException(); } AccessControlList acl = findAccessList(absPath, false); return acl == null ? EMPTY_POLICIES : new AccessControlPolicy[] {acl}; }
Source:
public static <TClass, TAnnotation extends Annotation> void scanJar(String path, Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { log.tracef("Looking for @%s %s, loading classes from %s", annotationClass.getSimpleName(), superClass.getSimpleName(), path); try (ZipInputStream inputStream = new ZipInputStream(new FileInputStream(path))) { for(;;) { ZipEntry entry = inputStream.getNextEntry(); if (entry == null) break; if (!entry.getName().endsWith(".class")) continue; String className = entry.getName().replace('/', '.').substring(0, entry.getName().length() - 6); scanClass(className, superClass, annotationClass, requirePackage, consumer); } } catch (FileNotFoundException e) { log.error("Cannot load executed JAR file '" + path + "'to find stages."); } catch (IOException e) { log.error("Cannot open/read JAR '" + path + "'"); } }

Target:
public static <TClass, TAnnotation extends Annotation> void scanJar(String path, Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { log.tracef("Looking for @%s %s, loading classes from %s", annotationClass.getSimpleName(), superClass.getSimpleName(), path); try (ZipInputStream inputStream = new ZipInputStream(new FileInputStream(path))) { for(;;) { ZipEntry entry = inputStream.getNextEntry(); if (entry == null) break; if (!entry.getName().endsWith(CLASS_SUFFIX)) continue; String className = entry.getName().replace('/', '.').substring(0, entry.getName().length() - CLASS_SUFFIX.length()); scanClass(className, superClass, annotationClass, requirePackage, consumer); } } catch (FileNotFoundException e) { log.error("Cannot load executed JAR file '" + path + "'to find stages."); } catch (IOException e) { log.error("Cannot open/read JAR '" + path + "'"); } }
Source:
public void testEquality() { for (boolean ascending : getTestedOrder()) { testEquals(true); testEquals(false); } }

Target:
public void testEquality() { for (Order order : getTestedOrder()) { boolean ascending = isAscending(order); testEquals(ascending); } }
Source:
private List<String> toConjuncts(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> tupleDomain) { ImmutableList.Builder<String> builder = ImmutableList.builder(); for (HiveColumnHandle column : columns) { Type type = column.getHiveType().getType(typeManager); if (tupleDomain.getDomains().isPresent() && isAcceptedType(type)) { Domain domain = tupleDomain.getDomains().get().get(column); if (domain != null) { builder.add(toPredicate(domain, type, column.getHiveColumnIndex())); } } } return builder.build(); }

Target:
private List<String> toConjuncts(List<HiveColumnHandle> columns, TupleDomain<HiveColumnHandle> tupleDomain) { Builder<String> builder = builder(); for (HiveColumnHandle column : columns) { Type type = column.getHiveType().getType(typeManager); if (tupleDomain.getDomains().isPresent() && isSupported(type)) { Domain domain = tupleDomain.getDomains().get().get(column); if (domain != null) { builder.add(toPredicate(domain, type, column.getHiveColumnIndex())); } } } return builder.build(); }
Source:
public void batch_mutate(Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { try (CloseableTrace trace = startLocalTrace("client.batch_mutate(number of rows {}, consistency {})", mutation_map.size(), toString(consistency_level))) { registerDuration(() -> { delegate.batch_mutate(mutation_map, consistency_level); return null; }, BATCH_MUTATE_TIMER); } }

Target:
public void batch_mutate(Map<ByteBuffer, Map<String, List<Mutation>>> mutation_map, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { int numberOfMutations = mutation_map.size(); try (CloseableTrace trace = startLocalTrace("client.batch_mutate(number of mutations {}, consistency {})", numberOfMutations, consistency_level)) { registerDuration(() -> { delegate.batch_mutate(mutation_map, consistency_level); return null; }, BATCH_MUTATE_TIMER, logger -> logger.warn("client.batch_mutate({}, {})", SafeArg.of("number of mutations", numberOfMutations), SafeArg.of("consistency", consistency_level.toString()))); } }
Source:
public static PersonIdent parsePersonIdent(final byte[] raw, final int nameB) { final Charset cs = parseEncoding(raw); final int emailB = nextLF(raw, nameB, '<'); final int emailE = nextLF(raw, emailB, '>'); if (emailB >= raw.length || raw[emailB] == '\n' || (emailE >= raw.length - 1 && raw[emailE - 1] != '>')) return null; int nameEnd = emailB - 2; while (nameEnd >= 0 && raw[nameEnd] == ' ') nameEnd--; final String name = decode(cs, raw, nameB, nameEnd + 1); final String email = decode(cs, raw, emailB, emailE - 1).trim(); final int tzBegin = lastIndexOfTrim(raw, ' ', raw.length - 1) + 1; if (tzBegin <= emailE) return new PersonIdent(name, email, 0, 0); final int whenBegin = Math.max(emailE, lastIndexOfTrim(raw, ' ', tzBegin - 1) + 1); if (whenBegin >= tzBegin - 1) return new PersonIdent(name, email, 0, 0); final long when = parseLongBase10(raw, whenBegin, null); final int tz = parseTimeZoneOffset(raw, tzBegin); return new PersonIdent(name, email, when * 1000L, tz); }

Target:
public static PersonIdent parsePersonIdent(final byte[] raw, final int nameB) { final Charset cs = parseEncoding(raw); final int emailB = nextLF(raw, nameB, '<'); final int emailE = nextLF(raw, emailB, '>'); if (emailB >= raw.length || raw[emailB] == '\n' || (emailE >= raw.length - 1 && raw[emailE - 1] != '>')) return null; final int nameEnd = emailB - 2 >= 0 && raw[emailB - 2] == ' ' ? emailB - 2 : emailB - 1; final String name = decode(cs, raw, nameB, nameEnd); final String email = decode(cs, raw, emailB, emailE - 1); final int tzBegin = lastIndexOfTrim(raw, ' ', nextLF(raw, emailE - 1) - 1) + 1; if (tzBegin <= emailE) return new PersonIdent(name, email, 0, 0); final int whenBegin = Math.max(emailE, lastIndexOfTrim(raw, ' ', tzBegin - 1) + 1); if (whenBegin >= tzBegin - 1) return new PersonIdent(name, email, 0, 0); final long when = parseLongBase10(raw, whenBegin, null); final int tz = parseTimeZoneOffset(raw, tzBegin); return new PersonIdent(name, email, when * 1000L, tz); }
Source:
public void setIdGenerationStrategy(final IdGenerationStrategy idGenerationStrategy) { this.idGenerationStrategy = idGenerationStrategy; }

Target:
final void setIdGenerationStrategy(final IdGenerationStrategy idGenerationStrategy) { this.idGenerationStrategy = idGenerationStrategy; }
Source:
private Map<String, Object> getConfigMap(String config) { if (config == null) { return null; } String configStr = config; if (configStr.startsWith("{")) { configStr = configStr.substring(1, configStr.length()); } if (configStr.endsWith("}")) { configStr = configStr.substring(0, configStr.length() - 1); } Map<String, Object> map = new HashMap<>(); for (String part : configStr.split("\\s*,\\s*")) { String[] subparts = part.split("=", 2); if (subparts.length == 2 && subparts[0] != null && subparts[1] != null) { map.put(subparts[0].trim(), subparts[1].trim()); } } return map; }

Target:
private Map<String, Object> getConfigMap(String config) { if (config == null) { return null; } String configStr = config; if (configStr.startsWith("{") && configStr.endsWith("}")) { configStr = configStr.substring(1, configStr.length() - 1); } Map<String, Object> map = new HashMap<>(); for (String part : configStr.split("\\s*,\\s*")) { String[] subparts = part.split("=", 2); if (subparts.length == 2 && subparts[0] != null && subparts[1] != null) { map.put(subparts[0].trim(), subparts[1].trim()); } } return map; }
Source:
private void releaseExportBytes(long releaseOffset) throws IOException { if (!m_committedBuffers.isEmpty() && (m_committedBuffers.peek() != null) && (releaseOffset < m_committedBuffers.peek().uso())) { return; } long lastUso = m_firstUnpolledUso; while (!m_committedBuffers.isEmpty() && m_committedBuffers.peek() != null && releaseOffset >= m_committedBuffers.peek().uso()) { StreamBlock sb = m_committedBuffers.peek(); if (releaseOffset >= sb.uso() + sb.totalUso()) { m_committedBuffers.pop(); try { lastUso = sb.uso() + sb.totalUso(); } finally { sb.discard(); } } else if (releaseOffset >= sb.uso()) { sb.releaseUso(releaseOffset); lastUso = releaseOffset; break; } } m_lastReleaseOffset = releaseOffset; m_firstUnpolledUso = Math.max(m_firstUnpolledUso, lastUso); }

Target:
private void releaseExportBytes(long releaseOffset) throws IOException { if (m_committedBuffers.isEmpty()) return; if (releaseOffset < m_committedBuffers.peek().uso()) { return; } long lastUso = m_firstUnpolledUso; while (!m_committedBuffers.isEmpty() && releaseOffset >= m_committedBuffers.peek().uso()) { StreamBlock sb = m_committedBuffers.peek(); if (releaseOffset >= sb.uso() + sb.totalUso()) { m_committedBuffers.pop(); try { lastUso = sb.uso() + sb.totalUso(); } finally { sb.discard(); } } else if (releaseOffset >= sb.uso()) { sb.releaseUso(releaseOffset); lastUso = releaseOffset; break; } } m_lastReleaseOffset = releaseOffset; m_firstUnpolledUso = Math.max(m_firstUnpolledUso, lastUso); }
Source:
public void deleteCollectionSubmittersGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); Group submittersGroup = collectionService.createSubmitters(context, collection); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isForbidden()); }

Target:
public void deleteCollectionSubmittersGroupForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); Group submittersGroup = collectionService.createSubmitters(context, collection); context.restoreAuthSystemState(); String token = getAuthToken(eperson.getEmail(), password); getClient(token).perform(delete("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isForbidden()); token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/submittersGroup")) .andExpect(status().isOk()) .andExpect( jsonPath("$", GroupMatcher.matchGroupEntry(submittersGroup.getID(), submittersGroup.getName()))); }
Source:
public List<Object> configurations() { return Arrays.asList((Object[])whitelist.split("\\s*,\\s*")); }

Target:
public List<Object> configurations() { return Arrays.asList(whitelist.split(",")).stream().map(String::trim).collect(Collectors.toList()); }
Source:
public void autoCreatePanels_createCustomPanelsFromMenu_panelsCreatedWithAppropriatePanelNameAndFilter() throws NoSuchFieldException, IllegalAccessException { Field panelMenuCreatorField = MenuControl.class.getDeclaredField("panelMenuCreator"); panelMenuCreatorField.setAccessible(true); PanelMenuCreator value = (PanelMenuCreator) panelMenuCreatorField.get(ui.getMenuControl()); for (Map.Entry<String, String> entry : value.generateCustomizedPanelDetails(ui.prefs.getLastLoginUsername()).entrySet()) { customizedPanelMenuItemTest(entry.getKey(), entry.getValue()); } }

Target:
public void autoCreatePanels_createCustomPanelsFromMenu_panelsCreatedWithAppropriatePanelNameAndFilter() throws NoSuchFieldException, IllegalAccessException { PanelMenuCreator value = (PanelMenuCreator) getPanelMenuCreatorField().get(ui.getMenuControl()); for (Entry<String, String> entry : value.generatePanelDetails(ui.prefs.getLastLoginUsername()).entrySet()) { customizedPanelMenuItemTest(entry.getKey(), entry.getValue()); } }
Source:
public Resource<T> getChild(final String name) { throw new RuntimeException("not implemented"); }

Target:
public Resource<?> getChild(final String name) { throw new RuntimeException("not implemented"); }
Source:
private void handleError(Map<String, Object> params, Task task, TaskHandlerException e) { LOGGER.debug(String.format("Omitted the task with name: %s and ID: %s because: ", task.getName(), task.getId()), e); activityService.addError(task, e); task.incrementFailuresInRow(); int failureNumber = task.getFailuresInRow(); int possibleErrorsNumber = getPossibleErrorsNumber(); if (failureNumber >= possibleErrorsNumber) { task.setEnabled(false); activityService.addWarning(task); publishTaskDisabledMessage(task.getName()); } taskService.save(task); Map<String, Object> errorParam = new HashMap<>(); errorParam.put(TASK_FAIL_MESSAGE, e.getMessage()); errorParam.put(TASK_FAIL_STACK_TRACE, ExceptionUtils.getStackTrace(e)); errorParam.put(TASK_FAIL_FAILURE_DATE, DateTime.now()); errorParam.put(TASK_FAIL_FAILURE_NUMBER, failureNumber); errorParam.put(TASK_FAIL_TRIGGER_DISABLED, task.isEnabled()); errorParam.put(TASK_FAIL_TASK_ID, task.getId()); errorParam.put(TASK_FAIL_TASK_NAME, task.getName()); params.put(HANDLER_ERROR_PARAM, errorParam); eventRelay.sendEventMessage(new MotechEvent( createHandlerFailureSubject(task.getName(), e.getFailureCause()), params )); }

Target:
private void handleError(Map<String, Object> params, Task task, TaskHandlerException e) { LOGGER.warn("Omitted task: with ID: because: {}", task.getName(), task.getId(), e); activityService.addError(task, e); task.incrementFailuresInRow(); LOGGER.warn("The number of failures for task: is: {}", task.getName(), task.getFailuresInRow()); int failureNumber = task.getFailuresInRow(); int possibleErrorsNumber = getPossibleErrorsNumber(); if (failureNumber >= possibleErrorsNumber) { task.setEnabled(false); activityService.addWarning(task); publishTaskDisabledMessage(task.getName()); } taskService.save(task); Map<String, Object> errorParam = new HashMap<>(); errorParam.put(TASK_FAIL_MESSAGE, e.getMessage()); errorParam.put(TASK_FAIL_STACK_TRACE, ExceptionUtils.getStackTrace(e)); errorParam.put(TASK_FAIL_FAILURE_DATE, DateTime.now()); errorParam.put(TASK_FAIL_FAILURE_NUMBER, failureNumber); errorParam.put(TASK_FAIL_TRIGGER_DISABLED, task.isEnabled()); errorParam.put(TASK_FAIL_TASK_ID, task.getId()); errorParam.put(TASK_FAIL_TASK_NAME, task.getName()); params.put(HANDLER_ERROR_PARAM, errorParam); eventRelay.sendEventMessage(new MotechEvent( createHandlerFailureSubject(task.getName(), e.getFailureCause()), params )); }
Source:
public List<Map<String, Object>> executeFix() throws DotDataException, DotRuntimeException { List<Map<String, Object>> returnValue = new ArrayList<Map<String, Object>>(); Logger.info(FixTask00085FixEmptyParentPathOnIdentifier.class, "Beginning FixTask00085FixEmptyParentPathOnIdentifier"); if (!FixAssetsProcessStatus.getRunning()) { FixAssetsProcessStatus.startProgress(); FixAssetsProcessStatus .setDescription("Task 85: Updating Empty Parent Path in Identifiers"); FixAssetsProcessStatus.setTotal(total); try { HibernateUtil.startTransaction(); DotConnect dc = new DotConnect(); dc.setSQL( "update identifier set parent_path = '/' where parent_path is null or parent_path = ''"); try { dc.loadResult(); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); } FixAssetsProcessStatus.setErrorsFixed(total); FixAudit Audit = new FixAudit(); Audit.setTableName("identifier"); Audit.setDatetime(new Date()); Audit.setRecordsAltered(total); Audit.setAction("Task 85: Fixed EmptyParentPathInIdentifiers"); HibernateUtil.save(Audit); HibernateUtil.commitTransaction(); MaintenanceUtil.flushCache(); returnValue.add(FixAssetsProcessStatus.getFixAssetsMap()); FixAssetsProcessStatus.stopProgress(); Logger.debug(FixTask00085FixEmptyParentPathOnIdentifier.class, "Ending FixEmptyParentPathInIdentifiers"); } catch (Exception e) { Logger.error(this, e.getMessage(), e); HibernateUtil.rollbackTransaction(); FixAssetsProcessStatus.stopProgress(); FixAssetsProcessStatus.setActual(-1); } } return returnValue; }

Target:
public List<Map<String, Object>> executeFix() throws DotDataException { final List<Map<String, Object>> returnValue = new ArrayList<>(); Logger.info(FixTask00085FixEmptyParentPathOnIdentifier.class, "Beginning FixTask00085FixEmptyParentPathOnIdentifier"); if (!FixAssetsProcessStatus.getRunning()) { FixAssetsProcessStatus.startProgress(); FixAssetsProcessStatus .setDescription("Task 85: Updating Empty Parent Path in Identifiers"); FixAssetsProcessStatus.setTotal(total); try { HibernateUtil.startTransaction(); final DotConnect dc = new DotConnect(); dc.setSQL( "update identifier set parent_path = '/' where parent_path is null or parent_path = ''"); try { dc.loadResult(); } catch (DotDataException e) { Logger.error(this, e.getMessage(), e); } FixAssetsProcessStatus.setErrorsFixed(total); final FixAudit audit = new FixAudit(); audit.setTableName("identifier"); audit.setDatetime(new Date()); audit.setRecordsAltered(total); audit.setAction("Task 85: Fixed EmptyParentPathInIdentifiers"); HibernateUtil.save(audit); HibernateUtil.commitTransaction(); MaintenanceUtil.flushCache(); returnValue.add(FixAssetsProcessStatus.getFixAssetsMap()); FixAssetsProcessStatus.stopProgress(); Logger.debug(FixTask00085FixEmptyParentPathOnIdentifier.class, "Ending FixEmptyParentPathInIdentifiers"); } catch (Exception e) { Logger.error(this, e.getMessage(), e); HibernateUtil.rollbackTransaction(); FixAssetsProcessStatus.stopProgress(); FixAssetsProcessStatus.setActual(-1); } } return returnValue; }
Source:
public static void logAndEndMetrics() { if (enabled) { NodeStats stats = nodeStats.get(); if (stats != null && stats.isStarted()) { long elapsedTime = (System.nanoTime() - stats.getStartTime()); if (stats.getEvalCount() > 0 && (elapsedTime / 1000) > threshold) { logger.trace("{}, evalCount:{}, elapsed:{}", stats.getNode(), stats.getEvalCount(), elapsedTime / 1000); } } nodeStats.remove(); } }

Target:
public static void logAndEndMetrics() { if (enabled) { NodeStats stats = nodeStats.get(); if (stats != null && stats.isStarted()) { long elapsedTimeInMicro = (System.nanoTime() - stats.getStartTime()) / 1000; if (stats.getEvalCount() > 0 && elapsedTimeInMicro > threshold) { logger.trace("{}, evalCount:{}, elapsedMicro:{}", stats.getNode(), stats.getEvalCount(), elapsedTimeInMicro); } } else { logger.warn("nodeStats has to be initialized. Call startMetrics() beforehand : stats = {}", stats); } nodeStats.remove(); } }