Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code quality fix - Collection.isEmpty() should be used to test for emptiness. #47

Merged
merged 1 commit into from
Feb 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixing squid:S1155-Collection.isEmpty() should be used to test for em…
…ptiness
  • Loading branch information
Faisal Hameed committed Feb 22, 2016
commit 574ae2d606429b4ebc760439dcfe11dd4309a321
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ public ConsoleAnnotator newInstance(Object context) {
return null;
}
List<FoundFailureCause> foundFailureCauses = action.getFoundFailureCauses();
if (foundFailureCauses.size() < 1) {
if (foundFailureCauses.isEmpty()) {
return null;
}
return new IndicationAnnotator(foundFailureCauses);
Original file line number Diff line number Diff line change
@@ -1014,7 +1014,7 @@ public void removeBuildfailurecause(AbstractBuild build) throws Exception {
*/
private void addFailureCausesToDBObject(DBObject object, List<FailureCauseStatistics> failureCauseStatisticsList)
throws UnknownHostException, AuthenticationException {
if (failureCauseStatisticsList != null && failureCauseStatisticsList.size() > 0) {
if (failureCauseStatisticsList != null && !failureCauseStatisticsList.isEmpty()) {
List<DBObject> failureCauseStatisticsObjects = new LinkedList<DBObject>();

for (FailureCauseStatistics failureCauseStatistics : failureCauseStatisticsList) {
@@ -1036,7 +1036,7 @@ private void addFailureCausesToDBObject(DBObject object, List<FailureCauseStatis
* @param indications the list of indications to add.
*/
private void addIndicationsToDBObject(DBObject object, List<FoundIndication> indications) {
if (indications != null && indications.size() > 0) {
if (indications != null && !indications.isEmpty()) {
List<DBObject> foundIndicationObjects = new LinkedList<DBObject>();
for (FoundIndication foundIndication : indications) {
DBObject foundIndicationObject = new BasicDBObject();
Original file line number Diff line number Diff line change
@@ -459,7 +459,7 @@ public List<String> getCategories() {
*/
@JsonIgnore
public String getCategoriesAsString() {
if (categories == null || categories.size() == 0) {
if (categories == null || categories.isEmpty()) {
return null;
}
StringBuilder builder = new StringBuilder();
Original file line number Diff line number Diff line change
@@ -259,7 +259,7 @@ public void doPerformScan(StaplerRequest request, StaplerResponse response)
throws ServletException, IOException, InterruptedException {
checkPermission();
List<AbstractBuild> sodbuilds = getBuilds();
if (sodbuilds.size() > 0) {
if (!sodbuilds.isEmpty()) {
for (AbstractBuild sodbuild : sodbuilds) {
FailureCauseBuildAction fcba = sodbuild.getAction(FailureCauseBuildAction.class);
if (fcba != null) {