auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initializeWhitelist( final MavenRepository mavenRepository ) { getLogger().debug( "Initializing white-list of newly added {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); try { unpublish( mavenRepository ); updateWhitelist( mavenRepository ); getLogger().info( "Initializing non existing white-list of newly added {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } catch ( Exception e ) { getLogger().warn( "Problem during white-list initialisation of newly added {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ), e ); try { unpublish( mavenRepository ); } catch ( IOException ioe ) { } } }

Target:
public void initializeWhitelist( final MavenRepository mavenRepository ) { getLogger().debug( "Initializing white-list of newly added {}", mavenRepository ); try { unpublish( mavenRepository ); updateWhitelist( mavenRepository ); getLogger().info( "Initializing non-existing white-list of newly added {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ) ); } catch ( Exception e ) { getLogger().warn( "Problem during white-list initialisation of newly added {}", RepositoryStringUtils.getHumanizedNameString( mavenRepository ), e ); try { unpublish( mavenRepository ); } catch ( IOException ioe ) { } } }
Source:
public boolean add(final String key, final int exp, final byte[] o) throws IOException { if (_log.isDebugEnabled()) _log.debug(String.format("Adding key to Redis (key=%s, exp=%d, %d bytes)", key, exp, o.length)); return (new JedisCommandRunner<Boolean>() { private boolean _setCompleted; @Override protected Boolean execute(BinaryJedis jedis) { byte[] kb = keyBytes(key); if (_setCompleted || jedis.setnx(kb, o) == 1) { _setCompleted = true; if (exp == 0) return true; else return jedis.expire(kb, convertExp(exp)) == 1; } else { return false; } } }).run(); }

Target:
public Future<Boolean> add(final String key, final int exp, final byte[] o) { if (_log.isDebugEnabled()) _log.debug(String.format("Adding key to Redis (key=%s, exp=%s, o=%s)", key, exp, o.getClass().getName())); return _executor.submit(new RedisCommandCallable<Boolean>() { private volatile boolean _setCompleted; @Override protected Boolean execute(BinaryJedis jedis) throws Exception { byte[] kb = keyBytes(key); if (_setCompleted || jedis.setnx(kb, o) == 1) { _setCompleted = true; if (exp == 0) return true; else return jedis.expire(kb, convertExp(exp)) == 1; } else { return false; } } }); }
Source:
public void onPropertyChange(EnvironmentChangeEvent event) { if (!customHttpClient) { boolean createNewClient = false; for (String key : event.getKeys()) { if (key.startsWith("zuul.host.")) { createNewClient = true; break; } } if (createNewClient) { try { SimpleHostRoutingFilter.this.httpClient.close(); } catch (IOException ex) { log.error("error closing client", ex); } SimpleHostRoutingFilter.this.connectionManager.shutdown(); SimpleHostRoutingFilter.this.connectionManager = newConnectionManager(); SimpleHostRoutingFilter.this.httpClient = newClient(); } } }

Target:
public void onPropertyChange(EnvironmentChangeEvent event) { if (!customHttpClient) { boolean createNewClient = false; for (String key : event.getKeys()) { if (key.startsWith("zuul.host.")) { createNewClient = true; break; } } if (createNewClient) { try { this.httpClient.close(); } catch (IOException ex) { log.error("error closing client", ex); } try { this.connectionManager.shutdown(); } catch (RuntimeException ex) { log.error("error shutting down connection manager", ex); } this.connectionManager = newConnectionManager(); this.httpClient = newClient(); } } }
Source:
public boolean isPostFollowed() { this.waitForPageLoad(); return this.getPost().findNewestPost().isFollowed(); }

Target:
public boolean isPostFollowed() { waitForPageLoad(); return getPost().findNewestPost().isFollowed(); }
Source:
private void currentBuildResultFailure(AbstractBuild<?, ?> build, BuildListener listener, Result previousBuildResult, String filename, EnvVars vars) throws InterruptedException, IOException { if (previousBuildResult == Result.FAILURE) { String comment = String.format("Build is still failing.\nFailed run: %s", getBuildDetailsString(vars)); String issueId = getIssue(filename); if (issueId != null) { try { Status status = getStatus(build, issueId); if (status.getName().equals("Closed") || status.getName().equals("Done")) { listener.getLogger().println("The previous build also failed but the issue is closed"); deleteFile(filename); Issue issue = createJiraIssue(build, filename); LOG.info(String.format("[%s] created.", issue.getKey())); }else { addComment(build, issueId, comment); LOG.info(String.format("[%s] The previous build also failed, comment added.", issueId)); } } catch (IOException e) { LOG.warning(String.format("[%s] - error processing JIRA change: %s", issueId, e.getMessage())); } } } if (previousBuildResult == Result.SUCCESS || previousBuildResult == Result.ABORTED) { try { Issue issue = createJiraIssue(build, filename); listener.getLogger().println("Build failed, created JIRA issue " + issue.getKey()); } catch (IOException e) { listener.error("Error creating JIRA issue : " + e.getMessage()); LOG.warning("Error creating JIRA issue\n" + e.getMessage()); } } }

Target:
private void currentBuildResultFailure(AbstractBuild<?, ?> build, BuildListener listener, Result previousBuildResult, String filename, EnvVars vars) throws InterruptedException, IOException { if (previousBuildResult == Result.FAILURE) { String comment = String.format("Build is still failing.\nFailed run: %s", getBuildDetailsString(vars)); String issueId = getIssue(filename); if (issueId != null) { try { Status status = getStatus(build, issueId); if ( status.getName().equalsIgnoreCase(finishedStatuses.Closed.toString()) || status.getName().equalsIgnoreCase(finishedStatuses.Done.toString()) ) { listener.getLogger().println("The previous build also failed but the issue is closed"); deleteFile(filename); Issue issue = createJiraIssue(build, filename); LOG.info(String.format("[%s] created.", issue.getKey())); }else { addComment(build, issueId, comment); LOG.info(String.format("[%s] The previous build also failed, comment added.", issueId)); } } catch (IOException e) { LOG.warning(String.format("[%s] - error processing JIRA change: %s", issueId, e.getMessage())); } } } if (previousBuildResult == Result.SUCCESS || previousBuildResult == Result.ABORTED) { try { Issue issue = createJiraIssue(build, filename); listener.getLogger().println("Build failed, created JIRA issue " + issue.getKey()); } catch (IOException e) { listener.error("Error creating JIRA issue : " + e.getMessage()); LOG.warning("Error creating JIRA issue\n" + e.getMessage()); } } }
Source:
public void realmResults_emittedChangesetOnUpdate() { RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); subscription = results.asChangesetObservable().subscribe(change -> { RealmResults<AllTypes> rxResults = change.getCollection(); assertTrue(rxResults.isFrozen()); if (rxResults.isEmpty()) { realm.executeTransaction(r -> r.createObject(AllTypes.class)); } else if (rxResults.size() == 1) { assertEquals(1, change.getChangeset().getInsertions().length); looperThread.testComplete(); } }); }

Target:
public void realmResults_emittedChangesetOnUpdate() { RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll(); subscription = results.asChangesetObservable().subscribe(change -> { RealmResults<AllTypes> rxResults = change.getCollection(); assertTrue(rxResults.isFrozen()); if (rxResults.isEmpty()) { realm.executeTransaction(r -> r.createObject(AllTypes.class)); } else if (rxResults.size() == 1) { assertEquals(1, change.getChangeset().getInsertions().length); disposeSuccessfulTest(realm); } }); }
Source:
private Optional<TreeItem<GroupNodeViewModel>> getTreeItemByValue(TreeItem<GroupNodeViewModel> root, GroupNodeViewModel value) { if (root.getValue().equals(value)) { return Optional.of(root); } Optional<TreeItem<GroupNodeViewModel>> node = Optional.empty(); for (int i = 0; i < root.getChildren().size() && node.isEmpty(); i++) { node = getTreeItemByValue(root.getChildren().get(i), value); } return node; }

Target:
private Optional<TreeItem<GroupNodeViewModel>> getTreeItemByValue(TreeItem<GroupNodeViewModel> root, GroupNodeViewModel value) { if (root.getValue().equals(value)) { return Optional.of(root); } Optional<TreeItem<GroupNodeViewModel>> node = Optional.empty(); for (TreeItem<GroupNodeViewModel> child : root.getChildren()) { node = getTreeItemByValue(child, value); if (node.isPresent()) { break; } } return node; }
Source:
private static StoreQueryRuntime constructStoreQueryRuntime(Table table, StoreQuery storeQuery, SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap, Map<String, Window> windowMap, String queryName, int metaPosition, Expression onCondition, MetaStreamEvent metaStreamEvent, List<VariableExpressionExecutor> variableExpressionExecutors, LockWrapper lockWrapper) { if (table instanceof QueryableProcessor && storeQuery.getType() == StoreQuery.StoreQueryType.FIND) { try { return constructOptimizedStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors); } catch (QueryableRecordTableException e) { log.warn("Failed to create optimized Store Query Runtime as no query configuration was found " + "for Store Query: " + storeQuery.toString()); return constructRegularStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, windowMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors, lockWrapper); } } else { return constructRegularStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, windowMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors, lockWrapper); } }

Target:
private static StoreQueryRuntime constructStoreQueryRuntime(Table table, StoreQuery storeQuery, SiddhiAppContext siddhiAppContext, Map<String, Table> tableMap, Map<String, Window> windowMap, String queryName, int metaPosition, Expression onCondition, MetaStreamEvent metaStreamEvent, List<VariableExpressionExecutor> variableExpressionExecutors, LockWrapper lockWrapper) { if (table instanceof QueryableProcessor && storeQuery.getType() == StoreQuery.StoreQueryType.FIND) { try { return constructOptimizedStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors); } catch (QueryableRecordTableException e) { if (log.isDebugEnabled()) { log.debug("Store Query optimization failed for table: " + table.getTableDefinition().getId() + ". Creating Store Query runtime in normal mode. " + "Reason for failure: " + e.getMessage()); } else { log.info("Creating Store Query Runtime in the normal mode, for table: " + table.getTableDefinition().getId()); } return constructRegularStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, windowMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors, lockWrapper); } } else { return constructRegularStoreQueryRuntime(table, storeQuery, siddhiAppContext, tableMap, windowMap, queryName, metaPosition, onCondition, metaStreamEvent, variableExpressionExecutors, lockWrapper); } }
Source:
public void refreshMapInfoWindow() { mitMapView.getMap().setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() { @Override public View getInfoWindow(Marker marker) { return null; } @Override public View getInfoContents(Marker marker) { if (marker.getTitle() != null) { View view = getActivity().getLayoutInflater().inflate(R.layout.mit_map_info_window, null); TextView stopNameTextView = (TextView) view.findViewById(R.id.stop_name_textview); TextView stopPredictionView = (TextView) view.findViewById(R.id.stop_prediction_textview); stopNameTextView.setText(marker.getTitle()); for (MITShuttleStopWrapper stop : route.getStops()) { if (marker.getSnippet().equals(stop.getId())) { stopNameTextView.setText(stop.getTitle()); if (route.isPredictable()) { if (stop.getPredictions().size() > 0) { if (stop.getPredictions().get(0).getSeconds() / 60 < 1) { stopPredictionView.setText(getString(R.string.arriving_now)); } else { stopPredictionView.setText(getString(R.string.arriving_in) + " " + stop.getPredictions().get(0).getSeconds() / 60 + " " + getString(R.string.minutes)); } } } else if (route.isScheduled()) { stopPredictionView.setText(getString(R.string.route_unknown)); } else { stopPredictionView.setText(getString(R.string.route_not_in_service)); } } } return view; } else { return null; } } }); }

Target:
public void refreshMapInfoWindow() { mitMapView.getMap().setInfoWindowAdapter(this); }
Source:
public InMemoryJarfile deepCopy () { InMemoryJarfile copy = new InMemoryJarfile(); for (Entry<String, byte[]> e: this.entrySet()) { copy.put(e.getKey(), e.getValue()); } copy.m_loader.initFrom(m_loader); return copy; }

Target:
public InMemoryJarfile deepCopy () { InMemoryJarfile copy = new InMemoryJarfile(); for (Entry<String, byte[]> e: this.entrySet()) { copy.put(e.getKey(), e.getValue().clone()); } copy.m_loader.initFrom(m_loader); return copy; }
Source:
public void testUnionPointWithEmptyLineString() { assertUnion("POINT (1 2)", "LINESTRING EMPTY", "GEOMETRYCOLLECTION (POINT (1 2))"); }

Target:
public void testUnionPointWithEmptyLineString() { assertUnion("POINT (1 2)", "LINESTRING EMPTY", "POINT (1 2)"); }
Source:
public void setEnabledAuthProvider(SocialProvider provider) { mDialog.setProviderEnabled(provider); }

Target:
public void setEnabledAuthProvider(SocialProvider provider) { mDialog.setEnabledProvider(provider); }
Source:
private R buildRecord(int offset, int length) { ByteBuffer data = ByteBuffers.getPartialView(currentBuffer, offset, length); final Matcher fileFooterMatcher = fileFooterPattern.matcher(data.asCharBuffer()); if(fileFooterMatcher.matches()){ stopParsing("End of file reached, file footer pattern matched"); return null; } ++recordsFromCurrentBuffer; Preconditions.checkNotNull(currentBufferFile); R record = null; try { record = buildRecord(currentBufferFile, convertData(data), toChannelOffset(offset)); } catch (DataConversionException e) { totalDataProcessingErrors.incrementAndGet(); logger.warn("Cannot process input data: " + e.getMessage() + ", falling back to raw data."); record = buildRecord(currentBufferFile, data, toChannelOffset(offset)); } finally { totalRecordsParsed.incrementAndGet(); } return record; }

Target:
private R buildRecord(int offset, int length) { ByteBuffer data = ByteBuffers.getPartialView(currentBuffer, offset, length); if(fileFooterPattern != null){ final Matcher fileFooterMatcher = fileFooterPattern.matcher(data.asCharBuffer()); if(fileFooterMatcher.matches()){ stopParsing("End of file reached, file footer pattern matched"); return null; } } ++recordsFromCurrentBuffer; Preconditions.checkNotNull(currentBufferFile); R record = null; try { record = buildRecord(currentBufferFile, convertData(data), toChannelOffset(offset)); } catch (DataConversionException e) { totalDataProcessingErrors.incrementAndGet(); logger.warn("Cannot process input data: " + e.getMessage() + ", falling back to raw data."); record = buildRecord(currentBufferFile, data, toChannelOffset(offset)); } finally { totalRecordsParsed.incrementAndGet(); } return record; }
Source:
public void excludeAll() { initializeExcludesIfNull(); for(Field field : new Mirror().on(getRootClass()).reflectAll().fields()) { excludes.putAll(field.getName(), getParentTypes(field.getName(), getRootClass())); } }

Target:
public void excludeAll() { for(Field field : new Mirror().on(getRootClass()).reflectAll().fields()) { getExcludes().putAll(field.getName(), getParentTypes(field.getName(), getRootClass())); } }
Source:
protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { this.id = dictionary.getJsonAliasFor(tableClass) + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "." + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH), relationshipName); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(dictionary.getJsonAliasFor(tableClass) + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }

Target:
protected Column(Class<?> tableClass, String fieldName, AggregationDictionary dictionary) { this.tableName = dictionary.getJsonAliasFor(tableClass); this.id = tableName + "." + fieldName; this.name = fieldName; this.columnTags = new HashSet<>(); if (dictionary.isRelation(tableClass, fieldName)) { Class<?> relationshipClass = dictionary.getParameterizedType(tableClass, fieldName); String relationshipName = dictionary.getJsonAliasFor(relationshipClass); this.dataType = new RelationshipType( this.id + "." + relationshipClass.getSimpleName().toLowerCase(Locale.ENGLISH), relationshipName); } else { Class<?> fieldClass = dictionary.getType(tableClass, fieldName); if (dictionary.getIdFieldName(tableClass).equals(fieldName)) { this.dataType = new DataType(tableName + "." + fieldName, ValueType.ID); } else if (Date.class.isAssignableFrom(fieldClass)) { this.dataType = new DataType(fieldClass.getSimpleName().toLowerCase(Locale.ENGLISH), ValueType.DATE); } else { DataType dataType = DataType.getScalarType(fieldClass); if (dataType == null) { throw new IllegalArgumentException("Unknown data type for " + this.id); } this.dataType = dataType; } } }
Source:
public List<QueryResult<StudyAclEntry>> getAcls(List<String> studyList, boolean silent, String sessionId) throws CatalogException { String userId = catalogManager.getUserManager().getUserId(sessionId); List<Long> studyIds = getIds(userId, studyList.get(0)); List<QueryResult<StudyAclEntry>> studyAclList = new ArrayList<>(studyIds.size()); for (Long studyId : studyIds) { try { QueryResult<StudyAclEntry> allStudyAcls = authorizationManager.getAllStudyAcls(userId, studyId); allStudyAcls.setId(String.valueOf(studyId)); studyAclList.add(allStudyAcls); } catch (CatalogException e) { if (silent) { studyAclList.add(new QueryResult<>(String.valueOf(studyId), 0, 0, 0, "", e.toString(), new ArrayList<>(0))); } else { throw e; } } } return studyAclList; }

Target:
public List<QueryResult<StudyAclEntry>> getAcls(List<String> studyList, boolean silent, String sessionId) throws CatalogException { String userId = catalogManager.getUserManager().getUserId(sessionId); List<Long> studyIds = getIds(userId, studyList.get(0)); List<QueryResult<StudyAclEntry>> studyAclList = new ArrayList<>(studyIds.size()); for (int i = 0; i < studyIds.size(); i++) { Long studyId = studyIds.get(i); try { QueryResult<StudyAclEntry> allStudyAcls = authorizationManager.getAllStudyAcls(userId, studyId); allStudyAcls.setId(String.valueOf(studyId)); studyAclList.add(allStudyAcls); } catch (CatalogException e) { if (silent) { studyAclList.add(new QueryResult<>(studyList.get(i), 0, 0, 0, "", e.toString(), new ArrayList<>(0))); } else { throw e; } } } return studyAclList; }
Source:
public String getTimeAgo(Date date) { if (date == null) { return "N/A"; } long time_ago = date.getTime() / 1000l; long cur_time = new Date().getTime() / 1000l; long time_elapsed = cur_time - time_ago; long seconds = time_elapsed; if (seconds <= 60) { return "Just now"; } else { int minutes = Math.round(time_elapsed / 60); if (minutes <= 60) { if (minutes == 1) { return "A minute ago"; } else { return minutes + " minutes ago"; } } else { int hours = Math.round(time_elapsed / 3600); if (hours <= 24) { if (hours == 1) { return "An hour ago"; } else { return hours + " hours ago"; } } else { int days = Math.round(time_elapsed / 86400); if (days <= 7) { if (days == 1) { return "Yesterday"; } else { return days + " days ago"; } } else { int weeks = Math.round(time_elapsed / 604800); if (weeks <= 4.3) { if (weeks == 1) { return "A week ago"; } else { return weeks + " weeks ago"; } } else { int months = Math.round(time_elapsed / 2600640); if (months <= 12) { if (months == 1) { return "A month ago"; } else { return months + " months ago"; } } else { int years = Math.round(time_elapsed / 31207680); if (years == 1) { return "A year ago"; } else { return years + " years ago"; } } } } } } } }

Target:
public String getTimeAgo(Date date) { if (date == null) { return "N/A"; } long time_ago = date.getTime() / 1000l; long cur_time = new Date().getTime() / 1000l; long time_elapsed = cur_time - time_ago; long seconds = time_elapsed; if (seconds <= 60) { return "Just now"; } else { int minutes = Math.round(time_elapsed / 60); if (minutes <= 60) { if (minutes == 1) { return "A minute ago"; } else { return minutes + " minutes ago"; } } else { int hours = Math.round(time_elapsed / 3600); if (hours <= 24) { if (hours == 1) { return "An hour ago"; } else { return hours + " hours ago"; } } else { int days = Math.round(time_elapsed / 86400); if (days <= 7) { if (days == 1) { return "Yesterday"; } else { return days + " days ago"; } } else { int weeks = Math.round(time_elapsed / 604800); if (weeks <= 4.3) { if (weeks == 1) { return "A week ago"; } else { return weeks + " weeks ago"; } } else { int months = Math.round(time_elapsed / 2600640); if (months <= 12) { if (months == 1) { return "A month ago"; } else { return months + " months ago"; } } else { int years = Math.round(time_elapsed / 31207680); if (years == 1) { return "1 year ago"; } else { return years + " years ago"; } } } } } } } }
Source:
private Map<String, List<TestEntity>> getTestsWithName(List<String> sessionIds, String testName){ List<Object[]> tasksEntities = getHibernateTemplate().findByNamedParam("select task, taskData.id from WorkloadTaskData task, TaskData taskData " + "where task.sessionId in (:sessionIds) and " + " task.scenario.name like :name and " + " taskData.sessionId in (:sessionIds) and "+ " taskData.taskId=task.taskId", new String[]{"sessionIds", "name"}, new Object[]{sessionIds, testName}); Map<String, List<TestEntity>> result = new HashMap<String, List<TestEntity>>(); for (Object[] taskEntity : tasksEntities){ WorkloadTaskData task = (WorkloadTaskData)taskEntity[0]; TestEntity entity = new TestEntity(); entity.setId((Long)taskEntity[1]); entity.setName(task.getScenario().getName()); entity.setDescription(task.getScenario().getDescription()); entity.setLoad(task.getClock()); entity.setTerminationStrategy(task.getTermination()); if (result.containsKey(task.getSessionId())){ result.get(task.getSessionId()).add(entity); }else{ List<TestEntity> list = new ArrayList<TestEntity>(); list.add(entity); result.put(task.getSessionId(), list); } } return result; }

Target:
private Map<String, List<TestEntity>> getTestsWithName(List<String> sessionIds, String testName){ if (sessionIds.isEmpty()){ return Collections.EMPTY_MAP; } List<Object[]> tasksEntities = getHibernateTemplate().findByNamedParam("select task, taskData.id from WorkloadTaskData task, TaskData taskData " + "where task.sessionId in (:sessionIds) and " + " task.scenario.name like :name and " + " taskData.sessionId in (:sessionIds) and "+ " taskData.taskId=task.taskId", new String[]{"sessionIds", "name"}, new Object[]{sessionIds, testName}); Map<String, List<TestEntity>> result = new HashMap<String, List<TestEntity>>(); for (Object[] taskEntity : tasksEntities){ WorkloadTaskData task = (WorkloadTaskData)taskEntity[0]; TestEntity entity = new TestEntity(); entity.setId((Long)taskEntity[1]); entity.setName(task.getScenario().getName()); entity.setDescription(task.getScenario().getDescription()); entity.setLoad(task.getClock()); entity.setTerminationStrategy(task.getTermination()); if (result.containsKey(task.getSessionId())){ result.get(task.getSessionId()).add(entity); }else{ List<TestEntity> list = new ArrayList<TestEntity>(); list.add(entity); result.put(task.getSessionId(), list); } } return result; }
Source:
private boolean isConnectionAvailable() throws InterruptedException { boolean knowIfServerUp = false; int numTimes = 5; while (!knowIfServerUp && numTimes > 0) { try { numTimes--; nwServer.testForConnection(); knowIfServerUp = true; } catch (Exception e) { OseeLog.log(HyperSqlDbServer.class, Level.SEVERE, "Unable to obtain a connection to network server, trying again after 3000 ms.", e); Thread.sleep(3000); } } return knowIfServerUp; }

Target:
private boolean isConnectionAvailable() throws InterruptedException { boolean knowIfServerUp = false; int numTimes = CHECK_ALIVE_NUMBER_OF_TIMES; while (!knowIfServerUp && numTimes > 0) { try { numTimes--; nwServer.testForConnection(); knowIfServerUp = true; } catch (Exception e) { OseeLog.log(HyperSqlDbServer.class, Level.SEVERE, "Unable to obtain a connection to network server, trying again after 3000 ms.", e); Thread.sleep(3000); } } return knowIfServerUp; }
Source:
public void visitWhileStatement(WhileStatementTree tree) { }

Target:
public void visitWhileStatement(WhileStatementTree tree) { scan(tree.statement()); }
Source:
public boolean checkCurrentUserHasQueueSubscriptionClosePermission() throws BrokerManagerAdminException { boolean hasPermission = false; String username = CarbonContext.getThreadLocalCarbonContext().getUsername(); try { if (Utils.isAdmin(username)) { hasPermission = true; } else if (CarbonContext.getThreadLocalCarbonContext().getUserRealm().getAuthorizationManager() .isUserAuthorized(username, PERMISSION_ADMIN_MANAGE_QUEUE_SUBSCRIPTION_CLOSE, UI_EXECUTE)) { hasPermission = true; } } catch (UserStoreException | QueueManagerException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new BrokerManagerAdminException(errorMessage, e); } return hasPermission; }

Target:
public boolean checkCurrentUserHasQueueSubscriptionClosePermission() throws BrokerManagerAdminException { boolean hasPermission = false; String username = getCurrentLoggedInUser(); try { if (Utils.isAdmin(username)) { hasPermission = true; } else if (CarbonContext.getThreadLocalCarbonContext().getUserRealm().getAuthorizationManager() .isUserAuthorized(username, PERMISSION_ADMIN_MANAGE_QUEUE_SUBSCRIPTION_CLOSE, UI_EXECUTE)) { hasPermission = true; } } catch (UserStoreException | QueueManagerException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new BrokerManagerAdminException(errorMessage, e); } return hasPermission; }
Source:
protected void checkProject(Project project) { assertNotNull(project.getId()); assertEquals(project.toString(), client.getProjectApi().getProject(project.getId()).toString()); assertTrue(project.getState() != null && project.getState() != Project.State.UNRECOGNIZED); }

Target:
protected void checkProject(Project project) { assertNotNull(project.getId()); assertEquals(project.toString(), client.getProjectApi().getProject(project.getId()).toString()); assertTrue(project.getState() != null); assertTrue(project.getState() != Project.State.UNRECOGNIZED); }
Source:
public void resetQueueState() throws IOException { queueFile = new File(r.jenkins.getRootDir(), "queue.xml"); XmlFile xmlFile = new XmlFile(Queue.XSTREAM, queueFile); xmlFile.write(new Queue.State()); r.jenkins.getQueue().load(); }

Target:
private void resetQueueState() throws IOException { File queueFile = r.jenkins.getQueue().getXMLQueueFile(); XmlFile xmlFile = new XmlFile(Queue.XSTREAM, queueFile); xmlFile.write(new Queue.State()); r.jenkins.getQueue().load(); }
Source:
public void textPlainContentType() throws Exception { refreshIndex(); String json = JsonUtils.mapToFormattedJsonString(hashMap("name", "Solitaire2")); WebResource.Builder builder = app().collection("games").getResource(true, getAdminToken()) .accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON); ClientResponse clientResponse = builder.post(ClientResponse.class, json); assertEquals(200, clientResponse.getStatus()); MultivaluedMap<String, String> headers = clientResponse.getHeaders(); List<String> contentType = headers.get("Content-Type"); assertEquals(1, contentType.size()); assertEquals(MediaType.APPLICATION_JSON, contentType.get(0)); }

Target:
public void textPlainContentType() throws Exception { String json = JsonUtils.mapToFormattedJsonString(hashMap("name", "Solitaire2")); WebResource.Builder builder = app().collection("games").getResource(true, getAdminToken()) .accept(MediaType.APPLICATION_JSON) .type(MediaType.TEXT_PLAIN_TYPE); ClientResponse clientResponse = builder.post(ClientResponse.class, json); assertEquals(200, clientResponse.getStatus()); MultivaluedMap<String, String> headers = clientResponse.getHeaders(); List<String> contentType = headers.get("Content-Type"); assertEquals(1, contentType.size()); assertEquals(MediaType.APPLICATION_JSON, contentType.get(0)); }
Source:
public final CharSequence getStr0(long offset, CharSequenceView view) { final int len = getInt(offset); if (offset + len * 2 + Integer.BYTES <= size) { if (len == TableUtils.NULL_LEN) { return null; } if (len == 0) { return ""; } return view.of(offset + VirtualMemory.STRING_LENGTH_BYTES, len); } throw CairoException.instance(0).put("String is outside of file boundary [offset=").put(offset).put(", len=").put(len).put(']'); }

Target:
public final CharSequence getStr0(long offset, CharSequenceView view) { final int len = getInt(offset); if (len > -1 && offset + len * Character.BYTES + Integer.BYTES <= size) { return view.of(offset + VirtualMemory.STRING_LENGTH_BYTES, len); } if (len == TableUtils.NULL_LEN) { return null; } throw CairoException.instance(0).put("String is outside of file boundary [offset=").put(offset).put(", len=").put(len).put(']'); }
Source:
public static void main(String[] args) throws Exception { if (args.length == 0) { System.err.println("Usage: c2dts [FILES...]"); System.exit(1); } List<SourceFile> sources = new ArrayList<>(); List<SourceFile> externs = new ArrayList<>(); List<SourceFile> fill = sources; boolean outFile = false; for (String arg : args) { if (arg.equals("--externs")) { fill = externs; continue; } if (arg.equals("-o")) { outFile = true; continue; } if (outFile) { System.setOut(new PrintStream(new FileOutputStream(new File(arg)), true, "utf-8")); } File f = new File(arg); if (!f.exists()) { System.err.println("Input file not found: " + f.getPath()); System.exit(1); } fill.add(SourceFile.fromFile(f)); } DeclarationGenerator generator = new DeclarationGenerator(true); System.out.println(generator.generateDeclarations(sources, externs)); }

Target:
public static void main(String[] args) { try { new DeclarationGenerator(new Options(args)).generateDeclarations(); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("Usage: cl2dts [options...] arguments..."); e.getParser().printUsage(System.err); System.err.println(); System.exit(1); } catch (Exception e) { e.printStackTrace(System.err); System.err.println("Uncaught exception in cl2dts, exiting."); System.exit(1); } System.exit(0); }
Source:
public Observable<Pair<RealmResults<E>, OrderedCollectionChangeSet>> asChangesetObservable() { if (realm instanceof Realm) { return realm.configuration.getRxFactory().changesetsFrom((Realm) realm, this); } else if (realm instanceof DynamicRealm) { DynamicRealm dynamicRealm = (DynamicRealm) realm; RealmResults<DynamicRealmObject> dynamicResults = (RealmResults<DynamicRealmObject>) this; @SuppressWarnings("UnnecessaryLocalVariable") Observable results = realm.configuration.getRxFactory().changesetsFrom(dynamicRealm, dynamicResults); return results; } else { throw new UnsupportedOperationException(realm.getClass() + " does not support RxJava2."); } }

Target:
public Observable<CollectionChange<RealmResults<E>>> asChangesetObservable() { if (realm instanceof Realm) { return realm.configuration.getRxFactory().changesetsFrom((Realm) realm, this); } else if (realm instanceof DynamicRealm) { DynamicRealm dynamicRealm = (DynamicRealm) realm; RealmResults<DynamicRealmObject> dynamicResults = (RealmResults<DynamicRealmObject>) this; return (Observable) realm.configuration.getRxFactory().changesetsFrom(dynamicRealm, dynamicResults); } else { throw new UnsupportedOperationException(realm.getClass() + " does not support RxJava2."); } }
Source:
public void checkWebJavaSpringProjectCommands() { consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, BUILD_GOAL, BUILD_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, RUN_GOAL, BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(By.xpath(" consoles.closeProcessTabWithAskDialog(BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING)); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, RUN_GOAL, RUN_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(By.xpath(" projectExplorer.invokeCommandWithContextMenu( RUN_GOAL, WEB_JAVA_SPRING, STOP_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING)); consoles.selectProcessInProcessConsoleTreeByName("Terminal"); terminal.typeIntoTerminal("ps ax"); terminal.typeIntoTerminal(ENTER.toString()); terminal.waitExpectedTextNotPresentTerminal("/bin/bash -c $TOMCAT_HOME/bin/catalina.sh"); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING, DEBUG_GOAL, DEBUG_COMMAND_ITEM.getItem(WEB_JAVA_SPRING), LISTENING_AT_ADDRESS_8000); }

Target:
public void checkWebJavaSpringProjectCommands() { String tomcatIsRunning = "/bin/bash -c $TOMCAT_HOME/bin/catalina.sh"; consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING_PROJECT, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING_PROJECT, BUILD_GOAL, BUILD_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT), BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING_PROJECT, RUN_GOAL, BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog( BUILD_AND_RUN_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT)); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING_PROJECT, RUN_GOAL, RUN_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT), SERVER_STARTUP_IN); consoles.checkWebElementVisibilityAtPreviewPage(textOnPreviewPage); projectExplorer.invokeCommandWithContextMenu( RUN_GOAL, WEB_JAVA_SPRING_PROJECT, STOP_TOMCAT_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT)); consoles.selectProcessInProcessConsoleTreeByName("Terminal"); terminal.typeIntoTerminal("ps ax"); terminal.typeIntoTerminal(ENTER.toString()); terminal.waitExpectedTextNotPresentTerminal(tomcatIsRunning); consoles.executeCommandFromProjectExplorer( WEB_JAVA_SPRING_PROJECT, DEBUG_GOAL, DEBUG_COMMAND_ITEM.getItem(WEB_JAVA_SPRING_PROJECT), LISTENING_AT_ADDRESS_8000); }
Source:
private boolean validate(){ Pattern userNamePattern = Pattern.compile("[a-z0-9]*"); Matcher userNameMatcher = userNamePattern.matcher(usernameText.getText().toString().trim()); if(!userNameMatcher.matches()) { usernameText.setError("This field can contain only lowercase alphabets and numbers."); usernameText.requestFocus(); return false; } if(!android.util.Patterns.EMAIL_ADDRESS.matcher(emailText.getText().toString().trim()).matches()) { emailText.setError("Please enter a valid email address"); emailText.requestFocus(); return false; } if (verificationMethod.equals(MOBILE)) { boolean isPhoneValid; if (isTwilioEnabled) { isPhoneValid = Validations.validateInternationalPhoneNumber(countryCodePicker); } else { isPhoneValid = Validations.validatePhoneNumber(phoneText.getText().toString().trim()); } if (!isPhoneValid) { phoneText.setError("Please enter a valid mobile number"); phoneText.requestFocus(); return false; } } if(passwordText.getText().toString().trim().length()<6){ passwordText.setError("Password should contain at least 6 digits"); passwordText.requestFocus(); return false; } if(!passwordText.getText().toString().equals(confirmPasswordText.getText().toString().trim())){ confirmPasswordText.setError("Passwords not matching"); confirmPasswordText.requestFocus(); return false; } return true; }

Target:
private boolean validate(){ Pattern userNamePattern = Pattern.compile("[a-z0-9]*"); Matcher userNameMatcher = userNamePattern.matcher(usernameText.getText().toString().trim()); if(!userNameMatcher.matches()) { usernameText.setError("This field can contain only lowercase alphabets and numbers."); usernameText.requestFocus(); return false; } if(!android.util.Patterns.EMAIL_ADDRESS.matcher(emailText.getText().toString().trim()).matches()) { emailText.setError("Please enter a valid email address"); emailText.requestFocus(); return false; } if (verificationMethod.equals(MOBILE)) { boolean isPhoneNumberValid; if (isTwilioEnabled) { isPhoneNumberValid = PhoneNumberValidator.validateInternationalPhoneNumber(countryCodePicker); } else { isPhoneNumberValid = PhoneNumberValidator.validatePhoneNumber(phoneText.getText().toString().trim()); } if (!isPhoneNumberValid) { phoneText.setError("Please enter a valid mobile number"); phoneText.requestFocus(); return false; } } if(passwordText.getText().toString().trim().length()<6){ passwordText.setError("Password should contain at least 6 digits"); passwordText.requestFocus(); return false; } if(!passwordText.getText().toString().equals(confirmPasswordText.getText().toString().trim())){ confirmPasswordText.setError("Passwords not matching"); confirmPasswordText.requestFocus(); return false; } return true; }
Source:
public boolean isPageview( String uriHost, String uriPath, String uriQuery, String httpStatus, String contentType, String userAgent, Map<String,String> xAnalyticsMap ) { uriHost = uriHost.toLowerCase(); if (xAnalyticsMap.containsKey("preview")) { return false; } return ( httpStatusesSet.contains(httpStatus) && ( (contentTypesSet.contains(contentType) && !Utilities.stringContains(uriPath, uriPathAPI)) || isAppPageview(uriPath, uriQuery, contentType, userAgent, xAnalyticsMap) ) && ( Utilities.patternIsFound(uriHostWikimediaDomainPattern, uriHost) || Utilities.patternIsFound(uriHostOtherProjectsPattern, uriHost) || Utilities.patternIsFound(uriHostProjectDomainPattern, uriHost) ) && ( Utilities.patternIsFound(uriPathPattern, uriPath) || Utilities.patternIsFound(uriQueryPattern, uriQuery) ) && !Utilities.patternIsFound(uriPathUnwantedSpecialPagesPattern, uriPath) && !Utilities.patternIsFound(uriQueryUnwantedSpecialPagesPattern, uriQuery) && !Utilities.patternIsFound(uriQueryUnwantedActions, uriQuery) ); }

Target:
public boolean isPageview( String uriHost, String uriPath, String uriQuery, String httpStatus, String contentType, String userAgent, Map<String,String> xAnalyticsMap ) { uriHost = uriHost.toLowerCase(); if (xAnalyticsMap.containsKey("preview")) return false; return ( httpStatusesSet.contains(httpStatus) && ( (contentTypesSet.contains(contentType) && !Utilities.stringContains(uriPath, uriPathAPI)) || isAppPageview(uriPath, uriQuery, contentType, userAgent, xAnalyticsMap) ) && ( Utilities.patternIsFound(uriHostWikimediaDomainPattern, uriHost) || Utilities.patternIsFound(uriHostOtherProjectsPattern, uriHost) || Utilities.patternIsFound(uriHostProjectDomainPattern, uriHost) ) && ( Utilities.patternIsFound(uriPathPattern, uriPath) || Utilities.patternIsFound(uriQueryPattern, uriQuery) ) && !Utilities.patternIsFound(uriPathUnwantedSpecialPagesPattern, uriPath) && !Utilities.patternIsFound(uriQueryUnwantedSpecialPagesPattern, uriQuery) && !Utilities.patternIsFound(uriQueryUnwantedActions, uriQuery) ); }
Source:
public String toASCII() throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { write(baos); return baos.toString("US-ASCII"); } }

Target:
public String toASCII() throws IOException { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { write(baos); return baos.toString(StandardCharsets.US_ASCII.name()); } }
Source:
public void calledWithTooManyCommandArguments_returnsError() { List<byte[]> commandsAsBytes = new ArrayList<>(); commandsAsBytes.add("EXPIREAT".getBytes()); commandsAsBytes.add("key".getBytes()); commandsAsBytes.add("1".getBytes()); commandsAsBytes.add("extra-argument".getBytes()); Command command = new Command(commandsAsBytes); Throwable thrown = catchThrowable(() -> command.execute(mockContext())); AssertionsForClassTypes.assertThat(thrown).hasMessageContaining("wrong number of arguments"); AssertionsForClassTypes.assertThat(thrown).isInstanceOf(RedisParametersMismatchException.class); }

Target:
public void calledWithTooManyCommandArguments_returnsError() { List<byte[]> commandsAsBytes = new ArrayList<>(); commandsAsBytes.add("EXPIREAT".getBytes()); commandsAsBytes.add("key".getBytes()); commandsAsBytes.add("1".getBytes()); commandsAsBytes.add("extra-argument".getBytes()); Command command = new Command(commandsAsBytes); assertThatThrownBy(() -> command.execute(mockContext())) .hasMessageContaining("wrong number of arguments") .isInstanceOf(RedisParametersMismatchException.class); }
Source:
public boolean upgradeCluster(long stackId, StatedImage currentImage, StatedImage targetImage) { Image targetIm = targetImage.getImage(); Image currentIm = currentImage.getImage(); String currentRuntimeBuildNumber = currentIm.getStackDetails().getStackBuildNumber(); boolean clusterManagerUpdateNeeded = !currentIm.getCmBuildNumber().equals(targetIm.getCmBuildNumber()); boolean clusterRuntimeUpgradeNeeded = !currentRuntimeBuildNumber.equals(targetIm.getStackDetails().getStackBuildNumber()); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_FINISHED, targetIm.getVersion()); } clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterRuntimeUpgradeNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_UPGRADE_NOT_NEEDED, currentRuntimeBuildNumber); } return clusterRuntimeUpgradeNeeded; }

Target:
public boolean upgradeCluster(long stackId, StatedImage currentImage, StatedImage targetImage) { Image targetIm = targetImage.getImage(); Image currentIm = currentImage.getImage(); String currentRuntimeBuildNumber = NullUtil.getIfNotNull(currentIm.getStackDetails(), StackDetails::getStackBuildNumber); boolean clusterManagerUpdateNeeded = isUpdateNeeded(currentIm.getCmBuildNumber(), targetIm.getCmBuildNumber()); boolean clusterRuntimeUpgradeNeeded = isUpdateNeeded(currentRuntimeBuildNumber, NullUtil.getIfNotNull(targetIm.getStackDetails(), StackDetails::getStackBuildNumber)); if (clusterManagerUpdateNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_MANAGER_UPGRADE_FINISHED, targetIm.getVersion()); } clusterService.updateClusterStatusByStackId(stackId, Status.UPDATE_IN_PROGRESS); if (clusterRuntimeUpgradeNeeded) { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_UPGRADE); } else { flowMessageService.fireEventAndLog(stackId, Status.UPDATE_IN_PROGRESS.name(), CLUSTER_UPGRADE_NOT_NEEDED, currentRuntimeBuildNumber); } return clusterRuntimeUpgradeNeeded; }
Source:
public static void createUser(final DB dbs, final SrlUser user, final String userId) throws DatabaseAccessException { final DBCollection users = dbs.getCollection(USER_COLLECTION); BasicDBObject query = null; LOG.info("userId: {}", userId); try { query = new BasicDBObject(SELF_ID, userId).append(COURSE_LIST, new ArrayList<String>()) .append(CREDENTIALS, PasswordHash.createHash(user.getEmail())).append(EMAIL, user.getEmail()) .append(ADMIN, PasswordHash.createHash(userId)); } catch (NoSuchAlgorithmException e) { LOG.info("Exception: {}", e); } catch (InvalidKeySpecException e) { LOG.info("Exception: {}", e); } if (query == null) { throw new DatabaseAccessException("An error occured creating password hash"); } users.insert(query); }

Target:
public static void createUser(final DB dbs, final SrlUser user, final String userId) throws DatabaseAccessException { final DBCollection users = dbs.getCollection(USER_COLLECTION); BasicDBObject query = null; LOG.debug("userId: {}", userId); try { query = new BasicDBObject(SELF_ID, userId).append(COURSE_LIST, new ArrayList<String>()) .append(CREDENTIALS, PasswordHash.createHash(user.getEmail())).append(EMAIL, user.getEmail()) .append(ADMIN, PasswordHash.createHash(userId)); } catch (NoSuchAlgorithmException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } catch (InvalidKeySpecException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } if (query == null) { throw new DatabaseAccessException("An error occured creating password hash"); } users.insert(query); }
Source:
public void handleClick(@NonNull final View view) { super.handleClick( view ); parentNativeAd.launchClickTarget( view.getContext() ); notifyAdClicked(); }

Target:
public void handleClick(@NonNull final View view) { super.handleClick( view ); notifyAdClicked(); parentNativeAd.launchClickTarget( view.getContext() ); }
Source:
public String toString() { return toStringHelper(this) .add("super", super.toString()) .add("valuesBufferCapacity", valuesBuffer == null ? 0 : valuesBuffer.length) .add("valuesBufferIndex", valuesBufferIndex) .toString(); }

Target:
public String toString() { return toStringHelper(this) .add("super", super.toString()) .add("estimatedValueBufferMaxCapacity", estimatedValueBufferMaxCapacity) .add("valuesBufferCapacity", valuesBuffer == null ? 0 : valuesBuffer.length) .add("valuesBufferIndex", valuesBufferIndex) .toString(); }
Source:
private void verifyBodyCloseBraceStyle(ParserRuleContext bodyCtx, String constructName) { ParseTree closeBrace = ParseTreeUtil.getLastChild(bodyCtx); Token closeBraceToken = ((TerminalNodeImpl)closeBrace).getSymbol(); Location closeBraceLocation = ListenerUtil.getTokenLocation(closeBraceToken); int closeBraceTokenIndex = closeBraceToken.getTokenIndex(); if (closeBraceTokenIndex >= 0) { List<Token> tokens = tokenStream.getHiddenTokensToLeft(closeBraceTokenIndex); if (tokens != null) { Token commentToken = getLastCommentToken(tokens); if (commentToken != null) { int commentEndLine = ListenerUtil.getEndLineOfToken(commentToken); if (commentEndLine == closeBraceLocation.line) { this.printer.warn(constructName + Messages.CLOSE_BRACKET_STYLE, closeBraceLocation); return; } } } } ParseTree closeBraceLeftSibling = ParseTreeUtil.getLeftSibling(closeBrace); Location closeBraceLeftSiblingLocation = ListenerUtil.getParseTreeStopLocation(closeBraceLeftSibling); if (closeBraceLocation.line == closeBraceLeftSiblingLocation.line) { if (!closeBraceLeftSibling.getText().equals("{")) { this.printer.warn(constructName + Messages.CLOSE_BRACKET_STYLE, closeBraceLocation); } else if (closeBraceLocation.column - closeBraceLeftSiblingLocation.column != 1) { this.printer.warn(Messages.EMPTY_BODY, closeBraceLeftSiblingLocation); } } }

Target:
private void verifyBodyCloseBraceStyle(ParserRuleContext bodyCtx, String constructName) { ParseTree closeBrace = ParseTreeUtil.getLastChild(bodyCtx); Token closeBraceToken = ((TerminalNodeImpl)closeBrace).getSymbol(); Location closeBraceLocation = ListenerUtil.getTokenLocation(closeBraceToken); List<Token> tokens = tokenStream.getHiddenTokensToLeft(closeBraceToken.getTokenIndex()); if (tokens != null) { Token commentToken = getLastCommentToken(tokens); if (commentToken != null) { int commentEndLine = ListenerUtil.getEndLineOfToken(commentToken); if (commentEndLine == closeBraceLocation.line) { this.printer.warn(constructName + Messages.CLOSE_BRACKET_STYLE, closeBraceLocation); return; } } } ParseTree closeBraceLeftSibling = ParseTreeUtil.getLeftSibling(closeBrace); Location closeBraceLeftSiblingLocation = ListenerUtil.getParseTreeStopLocation(closeBraceLeftSibling); if (closeBraceLocation.line == closeBraceLeftSiblingLocation.line) { if (!closeBraceLeftSibling.getText().equals("{")) { this.printer.warn(constructName + Messages.CLOSE_BRACKET_STYLE, closeBraceLocation); } else if (closeBraceLocation.column - closeBraceLeftSiblingLocation.column != 1) { this.printer.warn(Messages.EMPTY_BODY, closeBraceLeftSiblingLocation); } } }