auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static List<Entity> fillTransport(AtBScenario scenario, Entity transport, UnitGeneratorParameters params, int skill, Campaign campaign) { List<Entity> transportedUnits = new ArrayList<>(); if(scenario.getTransportLinkages().containsKey(transport.getExternalIdAsString())) { return transportedUnits; } for(Transporter bay : transport.getTransports()) { if(bay instanceof TroopSpace) { double bayCapacity = ((TroopSpace) bay).getUnused(); UnitGeneratorParameters newParams = params.clone(); newParams.clearMovementModes(); newParams.setWeightClass(AtBDynamicScenarioFactory.UNIT_WEIGHT_UNSPECIFIED); Entity transportedUnit = null; int baRoll = Compute.d6(2); if(baRoll >= infantryToBAUpgradeTNs[params.getQuality()]) { transportedUnit = generateTransportedBAUnit(newParams, bayCapacity, skill, campaign); } if(transportedUnit == null) { transportedUnit = generateTransportedInfantryUnit(newParams, bayCapacity, skill, campaign); } transportedUnit.setDeployRound(transport.getDeployRound()); scenario.addTransportRelationship(transport.getExternalIdAsString(), transportedUnit.getExternalIdAsString()); transportedUnits.add(transportedUnit); } } return transportedUnits; }

Target:
private static List<Entity> fillTransport(AtBScenario scenario, Entity transport, UnitGeneratorParameters params, int skill, Campaign campaign) { List<Entity> transportedUnits = new ArrayList<>(); if(scenario.getTransportLinkages().containsKey(transport.getExternalIdAsString())) { return transportedUnits; } for(Transporter bay : transport.getTransports()) { if(bay instanceof TroopSpace) { double bayCapacity = ((TroopSpace) bay).getUnused(); UnitGeneratorParameters newParams = params.clone(); newParams.clearMovementModes(); newParams.setWeightClass(AtBDynamicScenarioFactory.UNIT_WEIGHT_UNSPECIFIED); Entity transportedUnit = null; int baRoll = Compute.d6(2); if(baRoll >= infantryToBAUpgradeTNs[params.getQuality()]) { transportedUnit = generateTransportedBAUnit(newParams, bayCapacity, skill, campaign); } if(transportedUnit == null) { transportedUnit = generateTransportedInfantryUnit(newParams, bayCapacity, skill, campaign); } if(transportedUnit == null) { continue; } transportedUnit.setDeployRound(transport.getDeployRound()); scenario.addTransportRelationship(transport.getExternalIdAsString(), transportedUnit.getExternalIdAsString()); transportedUnits.add(transportedUnit); } } return transportedUnits; }
Source:
private ColumnStatus getColumnStatus(String colName, Connection connection) throws SQLException { if (hasColumn(connection, colName)) { String sql = String.format("SELECT %s FROM %s FOR UPDATE", colName, prefixedTimestampTableName()); QueryRunner run = new QueryRunner(); return run.query(connection, sql, rs -> { if (rs.next()) { return ColumnStatus.columnStatusWithValue(rs.getLong(colName)); } return ColumnStatus.columnStatusWithoutValue(); }); } else { return ColumnStatus.voidColumnStatus(); } }

Target:
private Optional<ColumnStatus> getColumnStatus(String colName, Connection connection) throws SQLException { if (!PhysicalBoundStoreDatabaseUtils.hasColumn(connection, prefixedTimestampTableName(), colName)) { return Optional.empty(); } String sql = String.format("SELECT %s FROM %s FOR UPDATE", colName, prefixedTimestampTableName()); QueryRunner run = new QueryRunner(); return run.query(connection, sql, rs -> { if (rs.next()) { return ColumnStatus.columnStatusWithValue(rs.getLong(colName)); } return ColumnStatus.columnStatusWithoutValue(); }); }
Source:
@Test public void unusedArgumentsIndexed() { try { CodeBlock.builder().add("$1L $2L", "a", "b", "c"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused arguments are marked as zero: [1, 1, 0]"); } try { CodeBlock.builder().add("$1L $2L $1L", "a", "b", "c"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused arguments are marked as zero: [2, 1, 0]"); } try { CodeBlock.builder().add("$3L $1L $3L $1L $3L", "a", "b", "c"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused arguments are marked as zero: [2, 0, 3]"); } }

Target:
@Test public void unusedArgumentsIndexed() { try { CodeBlock.builder().add("$1L $2L", "a", "b", "c"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused argument: $3"); } try { CodeBlock.builder().add("$1L $1L $1L", "a", "b", "c"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused arguments: $2, $3"); } try { CodeBlock.builder().add("$3L $1L $3L $1L $3L", "a", "b", "c", "d"); fail(); } catch (IllegalArgumentException expected) { assertThat(expected).hasMessage("unused arguments: $2, $4"); } }
Source:
public List<Workflow> userWorkflows(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); final User fetchedUser = this.userDAO.findById(userId); List<Workflow> workflows = getWorkflows(fetchedUser); EntryVersionHelper.stripContent(workflows, this.userDAO); return workflows; }

Target:
public List<Workflow> userWorkflows(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "User ID", required = true) @PathParam("userId") Long userId) { checkUser(user, userId); final User fetchedUser = this.userDAO.findById(userId); if (fetchedUser == null) { throw new CustomWebApplicationException("The given user does not exist.", HttpStatus.SC_NOT_FOUND); } List<Workflow> workflows = getWorkflows(fetchedUser); EntryVersionHelper.stripContent(workflows, this.userDAO); return workflows; }
Source:
public BuildStepWithTimeout newInstance(StaplerRequest req, JSONObject formData) throws hudson.model.Descriptor.FormException { BuildStep buildstep = BuildTimeOutUtility.bindJSONWithDescriptor(req, formData, "buildStep", BuildStep.class); BuildTimeOutStrategy strategy = BuildTimeOutUtility.bindJSONWithDescriptor(req, formData, "strategy", BuildTimeOutStrategy.class); if (!(strategy instanceof AbsoluteTimeOutStrategy || strategy instanceof DeadlineTimeOutStrategy)) { throw new IllegalArgumentException("Unsupported strategy"); } List<BuildTimeOutOperation> operationList = newInstancesFromHeteroList(req, formData, "operationList", getOperations()); return new BuildStepWithTimeout(buildstep, strategy, operationList); }

Target:
public BuildStepWithTimeout newInstance(StaplerRequest req, JSONObject formData) throws hudson.model.Descriptor.FormException { BuildStep buildstep = BuildTimeOutUtility.bindJSONWithDescriptor(req, formData, "buildStep", BuildStep.class); BuildTimeOutStrategy strategy = BuildTimeOutUtility.bindJSONWithDescriptor(req, formData, "strategy", BuildTimeOutStrategy.class); List<BuildTimeOutOperation> operationList = newInstancesFromHeteroList(req, formData, "operationList", getOperations()); return new BuildStepWithTimeout(buildstep, strategy, operationList); }
Source:
public boolean isInRange(int idx) { return find(idx)>-1; }

Target:
public boolean isInRange(int idx) { return 0<=idx && idx<size; }
Source:
private HttpRequestFactory httpRequestFactory(Subscription subscription) { int requestTimeout = subscription.getSerialSubscriptionPolicy().getRequestTimeout(); HttpClient client = subscription.isHttp2Enabled() ? http2Client.orElseGet(() -> { logger.info("Http2 delivery is not enabled on this server. Falling back to http1."); return httpClient; }) : httpClient; return new HttpRequestFactory(http2Client.get(), requestTimeout, metadataAppender, authorizationProviderFactory.create(subscription)); }

Target:
private HttpRequestFactory httpRequestFactory(Subscription subscription) { int requestTimeout = subscription.getSerialSubscriptionPolicy().getRequestTimeout(); return new HttpRequestFactory(getHttpClient(subscription), requestTimeout, metadataAppender, authorizationProviderFactory.create(subscription)); }
Source:
private void createList(List<Genome> genomes) { list = new JList(genomes .stream() .map(i -> i.getIdentifier()) .sorted() .toArray()); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(-1); }

Target:
private void createList(List<Genome> genomes) { list = new JList<>(genomes .stream() .map(Genome::getIdentifier) .sorted() .toArray(String[]::new)); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(-1); }
Source:
private boolean sendSlackMessage(RepositoryBuild build, SlackAttachment attachment) { String email = build.getCommitInfo().get().getCurrent().getAuthor().getEmail(); if (!slackSession.isPresent()) { LOG.debug("No slack session present, not sending message to user {}", attachment.toString(), email); return true; } Optional<SlackUser> user = Optional.fromNullable(slackSession.get().findUserByEmail(email)); if (!user.isPresent()) { LOG.error("Could not find user for message about repo build {}", email, build.getId().get()); return false; } SlackMessageHandle<SlackMessageReply> result = slackSession.get().sendMessageToUser(user.get(), "", attachment); if (!result.getReply().isOk()) { LOG.warn("Failed to send slack message to user: message: error: {}", email, attachment.toString(), result.getReply().getErrorMessage()); return false; } return true; }

Target:
private boolean sendSlackMessage(RepositoryBuild build, SlackAttachment attachment) { String email = build.getCommitInfo().get().getCurrent().getAuthor().getEmail(); if (!slackSession.isPresent()) { LOG.debug("No slack session present, not sending message to user {}", attachment.toString(), email); return true; } Optional<SlackUser> user = Optional.fromNullable(slackSession.get().findUserByEmail(email)); if (!user.isPresent()) { LOG.error("Could not find user for message about repo build {}", email, build.getId().get()); return false; } SlackMessageHandle<SlackMessageReply> result = slackSession.get().sendMessageToUser(user.get(), "", attachment); if (result == null) { LOG.warn("Failed to send slack message to user: message: slack response was null", email, attachment.toString()); return false; } else if (!result.getReply().isOk()) { LOG.warn("Failed to send slack message to user: message: error: {}", email, attachment.toString(), result.getReply().getErrorMessage()); return false; } return true; }
Source:
private CqlTranslator(NamespaceInfo namespaceInfo, VersionedIdentifier sourceInfo, ANTLRInputStream is, ModelManager modelManager, LibraryManager libraryManager, UcumService ucumService, CqlTranslatorOptions options) { this.sourceInfo = sourceInfo; this.namespaceInfo = namespaceInfo; this.modelManager = modelManager; this.libraryManager = libraryManager; this.ucumService = ucumService; this.errorLevel = options.getErrorLevel(); if (this.sourceInfo == null) { sourceInfo = new VersionedIdentifier().withId("Anonymous").withSystem("text/cql"); } if (this.namespaceInfo != null) { libraryManager.getNamespaceManager().ensureNamespaceRegistered(this.namespaceInfo); } if (libraryManager.getNamespaceManager().hasNamespaces() && libraryManager.getLibrarySourceLoader() instanceof NamespaceAware) { ((NamespaceAware)libraryManager.getLibrarySourceLoader()).setNamespaceManager(libraryManager.getNamespaceManager()); } if (libraryManager.getUcumService() == null) { libraryManager.setUcumService(this.ucumService); } translateToELM(is, options); }

Target:
private CqlTranslator(NamespaceInfo namespaceInfo, VersionedIdentifier sourceInfo, ANTLRInputStream is, ModelManager modelManager, LibraryManager libraryManager, UcumService ucumService, CqlTranslatorOptions options) { this.sourceInfo = sourceInfo; this.namespaceInfo = namespaceInfo; this.modelManager = modelManager; this.libraryManager = libraryManager; this.ucumService = ucumService; this.errorLevel = options.getErrorLevel(); if (this.sourceInfo == null) { this.sourceInfo = new VersionedIdentifier().withId("Anonymous").withSystem("text/cql"); } if (this.namespaceInfo != null) { libraryManager.getNamespaceManager().ensureNamespaceRegistered(this.namespaceInfo); } if (libraryManager.getNamespaceManager().hasNamespaces() && libraryManager.getLibrarySourceLoader() instanceof NamespaceAware) { ((NamespaceAware)libraryManager.getLibrarySourceLoader()).setNamespaceManager(libraryManager.getNamespaceManager()); } if (libraryManager.getUcumService() == null) { libraryManager.setUcumService(this.ucumService); } translateToELM(is, options); }
Source:
private String codePointToString(int codePoint) { StringBuffer sb = new StringBuffer(); sb.appendCodePoint(codePoint); return sb.toString(); }

Target:
private String codePointToString(int codePoint) { if (codePoint <= 0xFFFF) { return new String(new char[]{(char) codePoint}); } else { ByteStringBuilder b = new ByteStringBuilder(); b.appendUtf8Raw(codePoint); return new String(b.toArray(), StandardCharsets.UTF_8); } }
Source:
public void whenGetThenOK() throws Exception { getCursors().andExpect(status().is(HttpStatus.OK.value())); }

Target:
public void whenGetThenOK() throws Exception { when(cursorsService.getSubscriptionCursors(SUBSCRIPTION_ID)).thenReturn(DUMMY_CURSORS); getCursors() .andExpect(status().is(HttpStatus.OK.value())) .andExpect(content().string("[{\"partition\":\"0\",\"offset\":\"10\"},{\"partition\":\"1\",\"offset\":\"10\"}]")); }
Source:
public static void viewPostPreviewForResult(Activity activity, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; Intent intent = new Intent(activity, PostPreviewActivity.class); intent.putExtra(PostPreviewActivity.ARG_LOCAL_POST_ID, post.getId()); intent.putExtra(WordPress.SITE, site); intent.putExtra(PostPreviewActivity.ARG_IS_PAGE, isPage); activity.startActivityForResult(intent, RequestCodes.PREVIEW_POST); }

Target:
public static void viewPostPreviewForResult(Activity activity, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; Intent intent = new Intent(activity, PostPreviewActivity.class); intent.putExtra(PostPreviewActivity.EXTRA_POST, post); intent.putExtra(WordPress.SITE, site); activity.startActivityForResult(intent, RequestCodes.PREVIEW_POST); }
Source:
public List<BasicDocumentRevision> deleteDocument(final String id) throws ConflictException, DocumentException { Preconditions.checkNotNull(id, "id can not be null"); try { return queue.submitTransaction(new SQLQueueCallable<List<BasicDocumentRevision>>(){ @Override public List<BasicDocumentRevision> call(SQLDatabase db) throws Exception { ArrayList<BasicDocumentRevision> deleted = new ArrayList<BasicDocumentRevision>(); Cursor cursor = null; try { final String sql = "SELECT revs.revid FROM docs,revs " + "WHERE revs.doc_id = docs.doc_id " + "AND docs.docid = ? " + "AND deleted = 0 AND revs.sequence NOT IN " + "(SELECT DISTINCT parent FROM revs WHERE parent NOT NULL) "; cursor = db.rawQuery(sql, new String[]{id}); while (cursor.moveToNext()) { String revId = cursor.getString(0); deleted.add(deleteDocumentInQueue(db, id, revId)); } return deleted; } catch (SQLException sqe) { throw new DocumentException("SQLException in deleteDocument, not deleting revisions", sqe); } finally { DatabaseUtils.closeCursorQuietly(cursor); } } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE,"Failed to delete document",e); } catch (ExecutionException e) { throw new DocumentException("Failed to delete document",e); } return null; }

Target:
public List<BasicDocumentRevision> deleteDocument(final String id) throws ConflictException, DocumentException { Preconditions.checkNotNull(id, "id can not be null"); try { return queue.submitTransaction(new SQLQueueCallable<List<BasicDocumentRevision>>(){ @Override public List<BasicDocumentRevision> call(SQLDatabase db) throws Exception { ArrayList<BasicDocumentRevision> deleted = new ArrayList<BasicDocumentRevision>(); Cursor cursor = null; try { final String sql = "SELECT revs.revid FROM docs,revs " + "WHERE revs.doc_id = docs.doc_id " + "AND docs.docid = ? " + "AND deleted = 0 AND revs.sequence NOT IN " + "(SELECT DISTINCT parent FROM revs WHERE parent NOT NULL) "; cursor = db.rawQuery(sql, new String[]{id}); while (cursor.moveToNext()) { String revId = cursor.getString(0); deleted.add(deleteDocumentInQueue(db, id, revId)); } return deleted; } catch (SQLException sqe) { throw new DatastoreException("SQLException in deleteDocument, not deleting revisions", sqe); } finally { DatabaseUtils.closeCursorQuietly(cursor); } } }).get(); } catch (InterruptedException e) { logger.log(Level.SEVERE,"Failed to delete document",e); } catch (ExecutionException e) { throw new DocumentException("Failed to delete document",e); } return null; }
Source:
public void setCleanup(List<Runnable> cleanup) { this.cleanup = cleanup; }

Target:
public void setCleanup(List<Runnable> cleanup) { if (!this.cleanup.isEmpty()) { cleanup.addAll(this.cleanup); } this.cleanup = cleanup; }
Source:
private DeploymentInfoResult(String command, String serverGroup, String output) { this.command = command; this.serverGroup = serverGroup; this.originalOutput = output; if (output != null && !output.isEmpty()) { log.info("Read output:\n" + output); this.rows = Arrays.asList(output.split("\n")); } else { log.info("Read output: " + OUTPUT_EMPTY_MARK); this.rows = new ArrayList<>(); this.rows.add(OUTPUT_EMPTY_MARK); } }

Target:
private DeploymentInfoResult(String command, String serverGroup, String output) { this.command = command; this.serverGroup = serverGroup; originalOutput = output; if (originalOutput != null && !originalOutput.isEmpty()) { log.trace("Read output:\n" + output); rows = Arrays.asList(originalOutput.split(LINE_SEPARATOR)); } else { log.trace("Read output: <EMPTY>"); rows = new ArrayList<>(); } }
Source:
public NewApplicationViewImpl(org.eclipse.che.ide.Resources coreResources, OpenshiftResources resources, CellTableResources cellTableResources, OpenshiftLocalizationConstant locale, CoreLocalizationConstant constants) { this.resources = resources; this.locale = locale; ensureDebugId("deployCheProject"); setTitle(locale.deployProjectWindowTitle()); getWidget().getElement().getStyle().setPadding(0, Style.Unit.PX); environmentVariablesProvider = new ListDataProvider<Pair<String, String>>(); environmentVariables = createCellTable(cellTableResources, environmentVariablesProvider); environmentLabelsProvider = new ListDataProvider<Pair<String, String>>(); environmentLabels = createCellTable(cellTableResources, environmentLabelsProvider); setWidget(uiBinder.createAndBindUi(this)); projectsList = createProjectList(coreResources); osProjectListPanel.add(projectsList); deployBtn = createPrimaryButton(locale.deployProjectWindowDeploy(), "deployCodenvyProject-deploy-button", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onDeployClicked(); } }); addButtonToFooter(deployBtn); cancelBtn = createButton(constants.cancel(), "deployCodenvyProject-cancel-button", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCancelClicked(); } }); addButtonToFooter(cancelBtn); createNewProject.setValue(true); projectName.setEnabled(true); displayName.setEnabled(true); description.setEnabled(true); }

Target:
public NewApplicationViewImpl(org.eclipse.che.ide.Resources coreResources, OpenshiftResources resources, CellTableResources cellTableResources, OpenshiftLocalizationConstant locale, CoreLocalizationConstant constants) { this.resources = resources; this.locale = locale; ensureDebugId("deployCheProject"); setTitle(locale.deployProjectWindowTitle()); getWidget().getElement().getStyle().setPadding(0, Style.Unit.PX); environmentVariablesProvider = new ListDataProvider<Pair<String, String>>(); environmentVariables = createCellTable(cellTableResources, environmentVariablesProvider); environmentLabelsProvider = new ListDataProvider<Pair<String, String>>(); environmentLabels = createCellTable(cellTableResources, environmentLabelsProvider); setWidget(uiBinder.createAndBindUi(this)); projectsList = createProjectList(coreResources); osProjectListPanel.add(projectsList); deployBtn = createPrimaryButton(locale.deployProjectWindowDeploy(), "deployCheProject-deploy-button", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onDeployClicked(); } }); addButtonToFooter(deployBtn); cancelBtn = createButton(constants.cancel(), "deployCheProject-cancel-button", new ClickHandler() { @Override public void onClick(ClickEvent event) { delegate.onCancelClicked(); } }); addButtonToFooter(cancelBtn); createNewProject.setValue(true); projectName.setEnabled(true); displayName.setEnabled(true); description.setEnabled(true); }
Source:
public void close() throws IOException { long totalTimeMillis = currentTimeMillis() - startTime; DataStatistics state = getState( DataStatistics.class ); String additionalInformation = Objects.toString( state, "Data diagnostics is not available." ); executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", additionalInformation, bytes( peakMemoryUsage ) ) ); log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + additionalInformation ); closeAll( nodeRelationshipCache, nodeLabelsCache, idMapper, inputCache ); }

Target:
public void close() throws IOException { long totalTimeMillis = currentTimeMillis() - startTime; DataStatistics state = getState( DataStatistics.class ); String additionalInformation = Objects.toString( state, "Data statistics is not available." ); executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", additionalInformation, bytes( peakMemoryUsage ) ) ); log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + additionalInformation ); closeAll( nodeRelationshipCache, nodeLabelsCache, idMapper, inputCache ); }
Source:
protected void executeVdsBrokerCommand() { httpTask = getBroker().setupNetworks(generateNetworks(), generateBonds(), generateOptions(), true); }

Target:
protected void executeVdsBrokerCommand() { httpTask = getBroker().setupNetworks(generateNetworks(), generateBonds(), generateOptions(), getParameters().isManagementNetworkChanged()); }
Source:
public BasicDatastore(String dir, String name) throws SQLException, IOException { Preconditions.checkNotNull(dir); Preconditions.checkNotNull(name); this.datastoreDir = dir; this.datastoreName = name; this.extensionsDir = FilenameUtils.concat(this.datastoreDir, "extensions"); final String dbFilename = FilenameUtils.concat(this.datastoreDir, DB_FILE_NAME); queue = new SQLDatabaseQueue(dbFilename); queue.updateSchema(DatastoreConstants.getSchemaVersion3(), 3); queue.updateSchema(DatastoreConstants.getSchemaVersion4(), 4); queue.updateSchema(DatastoreConstants.getSchemaVersion5(), 5); queue.updateSchema(DatastoreConstants.getSchemaVersion6(), 6); dbOpen = true; this.eventBus = new EventBus(); this.attachmentManager = new AttachmentManager(this); }

Target:
public BasicDatastore(String dir, String name) throws SQLException, IOException, DatastoreException { Preconditions.checkNotNull(dir); Preconditions.checkNotNull(name); this.datastoreDir = dir; this.datastoreName = name; this.extensionsDir = FilenameUtils.concat(this.datastoreDir, "extensions"); final String dbFilename = FilenameUtils.concat(this.datastoreDir, DB_FILE_NAME); queue = new SQLDatabaseQueue(dbFilename); int dbVersion = queue.getVersion(); if(dbVersion >= 100){ throw new DatastoreException(String.format("Database version is higher than the version supported " + "by this library, current version %d , highest supported version %d",dbVersion, 99)); } queue.updateSchema(DatastoreConstants.getSchemaVersion3(), 3); queue.updateSchema(DatastoreConstants.getSchemaVersion4(), 4); queue.updateSchema(DatastoreConstants.getSchemaVersion5(), 5); queue.updateSchema(DatastoreConstants.getSchemaVersion6(), 6); dbOpen = true; this.eventBus = new EventBus(); this.attachmentManager = new AttachmentManager(this); }
Source:
private GBPTree.Monitor treeMonitor( ) { return new GBPTree.Monitor.Adaptor() { @Override public void cleanupFinished( long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis ) { monitor.recoveryCompleted( indexId, descriptor, partName(), map( "Number of pages visited", numberOfPagesVisited, "Number of cleaned crashed pointers", numberOfCleanedCrashPointers, "Time spent", duration( durationMillis ) ) ); } }; }

Target:
private GBPTree.Monitor treeMonitor( ) { return new GBPTree.Monitor.Adaptor() { @Override public void cleanupFinished( long numberOfPagesVisited, long numberOfCleanedCrashPointers, long durationMillis ) { monitor.recoveryCompleted( descriptor, storeFile.getAbsolutePath(), map( "Number of pages visited", numberOfPagesVisited, "Number of cleaned crashed pointers", numberOfCleanedCrashPointers, "Time spent", duration( durationMillis ) ) ); } }; }
Source:
protected void configure() { Collection<Plugin> plugins = pluginLoader.getPlugins(); for (Plugin p : plugins) { Class<PluginCommandModule> c = (Class<PluginCommandModule>) p.moduleClass; try { PluginCommandModule module = c.newInstance(); module.initSshModule(p.name); CommandName cmd = Commands.named(p.name); command(cmd).toProvider(new DispatchCommandProvider(cmd)); install(module); } catch (InstantiationException e) { log.warn("Initialization of plugin module '" + p.name + "' failed"); } catch (IllegalAccessException e) { log.warn("Initialization of plugin module '" + p.name + "' failed"); } } }

Target:
protected void configure() { Collection<Plugin> plugins = pluginLoader.getPlugins(); for (Plugin p : plugins) { if (PluginCommandModule.class.isAssignableFrom(p.moduleClass)) { @SuppressWarnings("unchecked") Class<PluginCommandModule> c = (Class<PluginCommandModule>) p.moduleClass; try { PluginCommandModule module = c.newInstance(); module.initSshModule(p.name); install(module); } catch (InstantiationException e) { log.warn("Initialization of plugin module '" + p.name + "' failed"); } catch (IllegalAccessException e) { log.warn("Initialization of plugin module '" + p.name + "' failed"); } } } }
Source:
public void setUserProperties(final JSONObject userProperties) { if (userProperties == null || userProperties.length() == 0) { return; } runOnLogThread(new Runnable() { @Override public void run() { JSONObject copy = cloneJSONObject(userProperties); if (copy == null) { return; } Identify identify = new Identify(); Iterator<?> keys = copy.keys(); while (keys.hasNext()) { String key = (String) keys.next(); try { identify.set(key, copy.get(key)); } catch (JSONException e) { Log.e(TAG, e.toString()); } } identify(identify); } }); }

Target:
public void setUserProperties(final JSONObject userProperties) { if (userProperties == null || userProperties.length() == 0) { return; } runOnLogThread(new Runnable() { @Override public void run() { JSONObject copy; try { copy = new JSONObject(userProperties.toString()); } catch (JSONException e) { Log.e(TAG, e.toString()); return; } Identify identify = new Identify(); Iterator<?> keys = copy.keys(); while (keys.hasNext()) { String key = (String) keys.next(); try { identify.set(key, copy.get(key)); } catch (JSONException e) { Log.e(TAG, e.toString()); } } identify(identify); } }); }
Source:
static void truncateTable(String strTable) throws SQLException { LOG.debug("Truncating '" + strTable + "' ..."); try { System.out.println("truncate " + strTable); conn.createStatement().execute("truncate " + strTable); conn.commit(); } catch (SQLException se) { LOG.debug(se.getMessage()); conn.rollback(); } }

Target:
static void truncateTable(String strTable) throws SQLException { LOG.debug("Truncating '" + strTable + "' ..."); try { conn.createStatement().execute("DELETE FROM " + strTable); conn.commit(); } catch (SQLException se) { LOG.debug(se.getMessage()); conn.rollback(); } }
Source:
public FixNotMavenizedArtifactInfo() { String pomTemplate = null; try { pomTemplate = new BufferedReader(new InputStreamReader(M2ServletContextListener.class.getResourceAsStream("template.pom"))) .lines().collect(Collectors.joining("\n")); final InputStream isNotMavenizedArtifacts = M2ServletContextListener.class.getResourceAsStream("/not-mavenized-artifacts.txt"); if (isNotMavenizedArtifacts != null) { notMavenizedArtifacts.load(isNotMavenizedArtifacts); } } catch (IOException e) { logger.error(e.getMessage(), e); } this.pomTemplate = pomTemplate; }

Target:
public FixNotMavenizedArtifactInfo() { final Properties notMavenizedArtifactsProps = new Properties(); try { final InputStream isNotMavenizedArtifacts = M2ServletContextListener.class.getResourceAsStream("/not-mavenized-artifacts.properties"); if (isNotMavenizedArtifacts != null) { notMavenizedArtifactsProps.load(isNotMavenizedArtifacts); } for (Map.Entry<Object, Object> entry : notMavenizedArtifactsProps.entrySet()) { notMavenizedArtifacts.put(entry.getKey().toString() + "-", entry.getValue().toString().split(":")); } } catch (IOException e) { logger.error(e.getMessage(), e); } }
Source:
public void removeDatasourceConfirm() { if ( messageBundle != null ) { XulLabel removeDatasourceConfirmationDialogLabel = (XulLabel) removeDatasourceConfirmationDialog.getElementById( "removeDatasourceConfirmationDialogLabel" ); LogicalModelSummary logicalModelSummary = getDialogResult(); removeDatasourceConfirmationDialogLabel.setValue( messageBundle.getString( REMOVE_DS_MSG_ID, logicalModelSummary.getModelName() ) ); } removeDatasourceConfirmationDialog.show(); }

Target:
public void removeDatasourceConfirm() { if ( messageBundle != null ) { XulLabel removeDatasourceConfirmationDialogLabel = (XulLabel) removeDatasourceConfirmationDialog.getElementById( "removeDatasourceConfirmationDialogLabel" ); LogicalModelSummary logicalModelSummary = getDialogResult(); if ( removeDatasourceConfirmationDialogLabel != null && logicalModelSummary != null ) { removeDatasourceConfirmationDialogLabel.setValue( messageBundle.getString( REMOVE_DS_MSG_ID, logicalModelSummary.getModelName() ) ); } } removeDatasourceConfirmationDialog.show(); }
Source:
public void testTenantContextLoadInLogin() throws LazyLoadingTestException { assertEquals(getTenantStatus(TENANT_DOMAIN_1).isTenantContextLoaded(), false, "Tenant context is loaded before any action related to that tenant"); assertEquals(getTenantStatus(TENANT_DOMAIN_2).isTenantContextLoaded(), false, "Tenant context is loaded before any action related to that tenant"); log.info("Testing Tenant context loading for :" + TENANT_DOMAIN_1); loginAsTenantAdmin(TENANT_DOMAIN_1_kEY); try { webAppAdminClient = new WebAppAdminClient(backendURL, sessionCookie); } catch (AxisFault axisFault) { String customErrorMessage = "AxisFault Exception when creating WebAppAdminClient object, Backend URL:" + backendURL + " Session Cookie: " + sessionCookie + "\n" + axisFault.getMessage(); log.error(customErrorMessage); throw new LazyLoadingTestException(customErrorMessage, axisFault); } assertEquals(getTenantStatus(TENANT_DOMAIN_1).isTenantContextLoaded(), true, "Tenant context is not loaded after tenant loginTenantUser"); assertEquals(getTenantStatus(TENANT_DOMAIN_2).isTenantContextLoaded(), false, "Tenant context is loaded without" + " loginTenantUser"); }

Target:
public void testTenantContextLoadInLogin() throws Exception { assertFalse(getTenantStatus(tenantDomain1).isTenantContextLoaded(), "Tenant context is loaded before any action related to that tenant"); assertFalse(getTenantStatus(tenantDomain2).isTenantContextLoaded(), "Tenant context is loaded before any action related to that tenant"); log.info("Testing Tenant context loading for :" + tenantDomain1); init(TENANT_DOMAIN_1_KEY, ADMIN); try { webAppAdminClient = new WebAppAdminClient(backendURL, sessionCookie); } catch (AxisFault axisFault) { String customErrorMessage = "AxisFault Exception when creating WebAppAdminClient object, Backend URL:" + backendURL + " Session Cookie: " + sessionCookie + "\n" + axisFault.getMessage(); log.error(customErrorMessage, axisFault); throw new LazyLoadingTestException(customErrorMessage, axisFault); } assertTrue(getTenantStatus(tenantDomain1).isTenantContextLoaded(), "Tenant context is not loaded after tenant loginTenantUser"); assertFalse(getTenantStatus(tenantDomain2).isTenantContextLoaded(), "Tenant context is loaded without" + " loginTenantUser"); }
Source:
void testSimple() { final Territory westRussia = gameData.getMap().getTerritory("West Russia"); final IBattle battle = mock(IBattle.class); final GamePlayer russians = GameDataTestUtil.russians(gameData); final IDelegateBridge bridge = newDelegateBridge(russians); final UnitType infantryType = GameDataTestUtil.infantry(gameData); final List<Unit> infantry = infantryType.create(1, russians); final Collection<TerritoryEffect> territoryEffects = TerritoryEffectHelper.getEffects(westRussia); whenGetRandom(bridge) .thenAnswer(withValues(1)) .thenAnswer(withValues(2)) .thenAnswer(withValues(0)) .thenAnswer(withValues(1)); final DiceRoll roll = DiceRoll.rollDice( infantry, true, russians, bridge, battle, "", territoryEffects, null, infantry); assertThat(roll.getHits(), is(1)); final DiceRoll roll2 = DiceRoll.rollDice( infantry, true, russians, bridge, battle, "", territoryEffects, null, infantry); assertThat(roll2.getHits(), is(0)); final DiceRoll roll3 = DiceRoll.rollDice( infantry, false, russians, bridge, battle, "", territoryEffects, null, infantry); assertThat(roll3.getHits(), is(1)); final DiceRoll roll4 = DiceRoll.rollDice( infantry, false, russians, bridge, battle, "", territoryEffects, null, infantry); assertThat(roll4.getHits(), is(0)); }

Target:
void testSimple() { final Territory westRussia = gameData.getMap().getTerritory("West Russia"); final IBattle battle = mock(IBattle.class); final GamePlayer russians = GameDataTestUtil.russians(gameData); final IDelegateBridge bridge = newDelegateBridge(russians); final UnitType infantryType = GameDataTestUtil.infantry(gameData); final List<Unit> infantry = infantryType.create(1, russians); final Collection<TerritoryEffect> territoryEffects = TerritoryEffectHelper.getEffects(westRussia); whenGetRandom(bridge) .thenAnswer(withValues(1)) .thenAnswer(withValues(2)) .thenAnswer(withValues(0)) .thenAnswer(withValues(1)); final DiceRoll roll = DiceRoll.rollDice(infantry, true, russians, bridge, battle, territoryEffects); assertThat(roll.getHits(), is(1)); final DiceRoll roll2 = DiceRoll.rollDice(infantry, true, russians, bridge, battle, territoryEffects); assertThat(roll2.getHits(), is(0)); final DiceRoll roll3 = DiceRoll.rollDice(infantry, false, russians, bridge, battle, territoryEffects); assertThat(roll3.getHits(), is(1)); final DiceRoll roll4 = DiceRoll.rollDice(infantry, false, russians, bridge, battle, territoryEffects); assertThat(roll4.getHits(), is(0)); }
Source:
public byte[] encrypt(final byte[] inputData) { try { final Cipher cipher = Cipher.getInstance(ALGORITHM, PROVIDER); cipher.init(Cipher.ENCRYPT_MODE, this.key, new IvParameterSpec(IVBYTES)); return cipher.doFinal(inputData); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchProviderException | InvalidAlgorithmParameterException e) { LOGGER.error("Unexpected exception during encryption", e); throw new EncrypterException("Unexpected exception during encryption!", e); } }

Target:
public byte[] encrypt(final byte[] inputData) { try { final Cipher cipher = Cipher.getInstance(ALGORITHM, PROVIDER); cipher.init(Cipher.ENCRYPT_MODE, this.key, new IvParameterSpec(IVBYTES)); return cipher.doFinal(inputData); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | IllegalBlockSizeException | BadPaddingException | NoSuchProviderException | InvalidAlgorithmParameterException e) { LOGGER.error(UNEXPECTED_EXCEPTION_DURING_ENCRYPTION, e); throw new EncrypterException("Unexpected exception during encryption!", e); } }
Source:
private void fillEnemies(SolGame game, RemoveController removeController, ShipConfig enemyConfig, Vector2 chunkCenter) { int enemyCount = getEntityCount(enemyConfig.density); if (enemyCount == 0) { return; } for (int i = 0; i < enemyCount; i++) { Optional<Vector2> enemyPosition = getFreeRndPos(game, chunkCenter); enemyPosition.ifPresent(position -> { FarShip ship = buildSpaceEnemy(game, position, removeController, enemyConfig); game.getObjectManager().addFarObjNow(ship); }); } }

Target:
private void fillEnemies(SolGame game, RemoveController removeController, ShipConfig enemyConfig, Vector2 chunkCenter) { int enemyCount = getEntityCount(enemyConfig.density); if (enemyCount == 0) { return; } for (int i = 0; i < enemyCount; i++) { Optional<Vector2> enemyPosition = getFreeRndPos(game, chunkCenter); enemyPosition.ifPresent(enemyPos -> { FarShip ship = buildSpaceEnemy(game, enemyPos, removeController, enemyConfig); game.getObjectManager().addFarObjNow(ship); }); } }
Source:
void record(List<Span> sampled, Callback<Void> callback) { if(blockOnStorage) { storage.spanConsumer().accept(sampled).blockingEnqueue(callback); } else { storage.spanConsumer().accept(sampled).enqueue(callback); } }

Target:
void record(List<Span> sampled, Callback<Void> callback) { if(semaphore != null) { try { semaphore.acquire(); storage.spanConsumer().accept(sampled).execute(); callback.onSuccess(null); } catch (RuntimeException | IOException | InterruptedException e) { callback.onError(e); } finally { semaphore.release(); } } else { storage.spanConsumer().accept(sampled).enqueue(callback); } }
Source:
private void finishAllThreads(Collection<Future<Void>> results) throws Throwable { for (final Future<Void> result : results) { try { result.get(); } catch (final ExecutionException e) { throw e.getCause(); } } }

Target:
private static void finishAllThreads(Collection<Future<Void>> results) throws InterruptedException, ExecutionException { for (final Future<Void> result : results) { result.get(); } }
Source:
public void testGetCommandLineNonNullModSeqWithFlagDraftTypeShared() throws IOException, IllegalArgumentException, IllegalAccessException, SearchException, ImapAsyncClientException { final Flags flags = new Flags(); flags.add(Flags.Flag.DRAFT); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(flags, EntryTypeReq.SHARED, 1L); final MessageNumberSet[] msgsets = null; final ImapRequest cmd = new SearchCommand(msgsets, extendedModifiedSinceTerm, null); Assert.assertEquals(cmd.getCommandLine(), "SEARCH MODSEQ \"/flags/\\\\Draft\" SHARED 1\r\n", "Expected result mismatched."); cmd.cleanup(); for (final Field field : fieldsToCheck) { Assert.assertNull(field.get(cmd), "Cleanup should set " + field.getName() + " as null"); } }

Target:
public void testGetCommandLineNonNullModSeqWithFlagDraftTypeShared() throws IOException, IllegalArgumentException, IllegalAccessException, SearchException, ImapAsyncClientException { final Flags flags = new Flags(); flags.add(Flags.Flag.DRAFT); final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(flags, EntryTypeRequest.SHARED, 1L); final MessageNumberSet[] msgsets = null; final ImapRequest cmd = new SearchCommand(msgsets, extendedModifiedSinceTerm, null); Assert.assertEquals(cmd.getCommandLine(), "SEARCH MODSEQ \"/flags/\\\\Draft\" SHARED 1\r\n", "getCommandLine() mismatched."); cmd.cleanup(); for (final Field field : fieldsToCheck) { Assert.assertNull(field.get(cmd), "Cleanup should set " + field.getName() + " as null"); } }
Source:
private String deleteBucket() throws SignatureException, SSLSetupException, CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (e.getStatusCode() == 409) { return "Error: Tried to delete a non-empty bucket without the force delete objects flag.\nUse --force to delete all objects in the bucket"; } throw new CommandException("Error: Request failed with the following error: " + e.getMessage(), e); } return "Success: Deleted bucket '" + bucketName + "'."; }

Target:
private String deleteBucket() throws SignatureException, SSLSetupException, CommandException, IOException { try { getClient().deleteBucket(new DeleteBucketRequest(bucketName)); } catch (final FailedRequestException e) { if (e.getStatusCode() == 409) { throw new CommandException("Error: Tried to delete a non-empty bucket without the force delete objects flag.\nUse --force to delete all objects in the bucket"); } throw new CommandException("Error: Request failed with the following error: " + e.getMessage(), e); } return "Success: Deleted bucket '" + bucketName + "'."; }
Source:
public EntityManager createEntityManager(SynchronizationType synchronizationType) { return null; }

Target:
public EntityManager createEntityManager(SynchronizationType synchronizationType) { throw new UnsupportedOperationException("createEntityManager"); }
Source:
public static void main(String[] args) { ArrayTransposeMasterWorker mw = new ArrayTransposeMasterWorker(); int rows = 10; int columns = 20; int[][] inputMatrix = new int[rows][columns]; Random rand = new Random(); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { inputMatrix[i][j] = rand.nextInt(10); } } ArrayInput input = new ArrayInput(inputMatrix); ArrayResult result = (ArrayResult) mw.getResult(input); if (result != null) { App.printMatrix(inputMatrix); System.out.println(""); App.printMatrix(result.data); } else { System.out.println("Please enter non-zero input"); } }

Target:
public static void main(String[] args) { ArrayTransposeMasterWorker mw = new ArrayTransposeMasterWorker(); int rows = 10; int columns = 20; int[][] inputMatrix = ArrayUtilityMethods.createRandomIntMatrix(rows,columns); ArrayInput input = new ArrayInput(inputMatrix); ArrayResult result = (ArrayResult) mw.getResult(input); if (result != null) { ArrayUtilityMethods.printMatrix(inputMatrix); System.out.println(""); ArrayUtilityMethods.printMatrix(result.data); } else { System.out.println("Please enter non-zero input"); } }
Source:
private SurveyAssignment marshallToDomain(SurveyAssignmentDto dto) { final SurveyAssignment sa = new SurveyAssignment(); BeanUtils.copyProperties(dto, sa); sa.setKey(KeyFactory.createKey("SurveyAssignment", dto.getKeyId())); sa.setDeviceIds(dto.getDevices()); sa.setSurveyIds(dto.getSurveys()); return sa; }

Target:
private SurveyAssignment marshallToDomain(SurveyAssignmentDto dto) { final SurveyAssignment sa = new SurveyAssignment(); BeanUtils.copyProperties(dto, sa); if (dto.getKeyId() != null) { sa.setKey(KeyFactory.createKey("SurveyAssignment", dto.getKeyId())); } sa.setDeviceIds(dto.getDevices()); sa.setSurveyIds(dto.getSurveys()); return sa; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionSubjects = new ArrayList<>(); permissionSubjects.add(new PermissionSubject( getDiskImage().getId(), VdcObjectType.Disk, ActionGroup.ATTACH_DISK)); return permissionSubjects; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionSubjects = new ArrayList<>(); permissionSubjects.add(new PermissionSubject(getDiskImage().getId(), VdcObjectType.Disk, ActionGroup.ATTACH_DISK)); permissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); return permissionSubjects; }
Source:
public String toString() { return "ThreadMeta{threadId=" + threadId + ", threadName=" + threadName + '}'; }

Target:
public String toString() { return "ThreadMeta{" + "threadId=" + threadId + ", threadName=" + threadName + '}'; }
Source:
public void add(String str, StatsSnapshot statsSnapshot) { this.subMap = this.subMap == null ? new HashMap<>() : this.subMap; this.subMap.put(str, statsSnapshot); }

Target:
public void add(String str, StatsSnapshot statsSnapshot) { subMap = subMap == null ? new HashMap<>() : subMap; subMap.put(str, statsSnapshot); }
Source:
public void run() { while(alive) { try { Thread.sleep(SLEEP_TIME); try { storageClientManager.getMetricsDAO().checkLiveness(RHQ_KEYSPACE); if(fails > 0) { fails = 0; } } catch(QueryTimeoutException e) { LOG.error("Storage node connection check timed out"); } catch(NoHostAvailableException e) { fails++; if(fails >= ALLOWED_FAILS) { LOG.error("Failed to contact the storage node for live check, recreating connection session"); storageClientManager.refreshSession(); Thread.sleep(EXTENDED_SLEEP); } } } catch (InterruptedException e) { } } }

Target:
public void run() { while(alive) { try { Thread.sleep(SLEEP_TIME); try { storageClientManager.getMetricsDAO().checkLiveness(RHQ_KEYSPACE); if(fails > 0) { fails = 0; } } catch(QueryTimeoutException e) { LOG.error("Storage node connection check timed out"); } catch(NoHostAvailableException e) { fails++; if(fails >= ALLOWED_FAILS) { LOG.error("Failed to contact the storage node for live check, recreating connection session"); storageClientManager.refreshSession(); Thread.sleep(EXTENDED_SLEEP); } } } catch (InterruptedException e) { } catch(Exception e) { LOG.error("AliveCheck thread run into an unexpected exception: " + e.getLocalizedMessage()); } } }
Source:
public void signTransaction(Transaction tx, Transaction.SigHash hashType, @Nullable KeyParameter aesKey) { lock.lock(); try { List<TransactionInput> inputs = tx.getInputs(); List<TransactionOutput> outputs = tx.getOutputs(); checkState(inputs.size() > 0); checkState(outputs.size() > 0); checkArgument(hashType == Transaction.SigHash.ALL, "Only SIGHASH_ALL is currently supported"); for (TransactionSigner signer : signers) { try { log.debug("Trying out to sign tx."); signer.signInputs(tx, aesKey); } catch (IllegalArgumentException e) { } catch (IllegalStateException e) { } } } finally { lock.unlock(); } }

Target:
public void signTransaction(Transaction tx, Transaction.SigHash hashType, @Nullable KeyParameter aesKey) { lock.lock(); try { List<TransactionInput> inputs = tx.getInputs(); List<TransactionOutput> outputs = tx.getOutputs(); checkState(inputs.size() > 0); checkState(outputs.size() > 0); checkArgument(hashType == Transaction.SigHash.ALL, "Only SIGHASH_ALL is currently supported"); KeyBag maybeDecryptingKeyBag = aesKey != null ? new DecryptingKeyBag(this, aesKey) : this; for (TransactionSigner signer : signers) { if (!signer.signInputs(tx, maybeDecryptingKeyBag)) log.info("{} returned false for the tx", signer.getClass().getName()); } } finally { lock.unlock(); } }
Source:
public void testListSLATimer() throws Exception { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "UserTaskWithSLAOnTask"); assertNotNull(processInstanceId); long scheduleTime = System.currentTimeMillis(); Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId); assertNotNull(activeNodes); assertEquals(1, activeNodes.size()); Collection<TimerInstance> timers = processAdminService.getTimerInstances(processInstanceId); assertNotNull(timers); assertEquals(1, timers.size()); TimerInstance timer = timers.iterator().next(); assertNotNull(timer.getActivationTime()); assertNotNull(timer.getDelay()); assertNotNull(timer.getNextFireTime()); assertNotNull(timer.getProcessInstanceId()); assertNotNull(timer.getSessionId()); assertNotNull(timer.getTimerId()); assertNotNull(timer.getId()); assertNotNull(timer.getTimerName()); }

Target:
public void testListSLATimer() throws Exception { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "UserTaskWithSLAOnTask"); assertNotNull(processInstanceId); Collection<NodeInstanceDesc> activeNodes = processAdminService.getActiveNodeInstances(processInstanceId); assertNotNull(activeNodes); assertEquals(1, activeNodes.size()); Collection<TimerInstance> timers = processAdminService.getTimerInstances(processInstanceId); assertNotNull(timers); assertEquals(1, timers.size()); TimerInstance timer = timers.iterator().next(); assertNotNull(timer.getActivationTime()); assertNotNull(timer.getDelay()); assertNotNull(timer.getNextFireTime()); assertNotNull(timer.getProcessInstanceId()); assertNotNull(timer.getSessionId()); assertNotNull(timer.getTimerId()); assertNotNull(timer.getId()); assertNotNull(timer.getTimerName()); }