You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2022/05/25 10:28:30 UTC

[myfaces-tobago] branch tobago-5.x updated: chore: set version for checkstyle tool

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-5.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/tobago-5.x by this push:
     new edccf71aa6 chore: set version for checkstyle tool
edccf71aa6 is described below

commit edccf71aa64110619c9539a39b299890048ae019
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Wed May 25 12:25:08 2022 +0200

    chore: set version for checkstyle tool
---
 pom.xml                                                             | 5 +++++
 .../src/main/java/org/apache/myfaces/tobago/context/Markup.java     | 4 ++--
 .../org/apache/myfaces/tobago/internal/behavior/EventBehavior.java  | 6 +++---
 .../myfaces/tobago/internal/component/AbstractUICommandBase.java    | 2 +-
 .../myfaces/tobago/internal/renderkit/renderer/ImageRenderer.java   | 4 ++--
 .../tobago/internal/renderkit/renderer/SelectManyRendererBase.java  | 2 +-
 .../org/apache/myfaces/tobago/internal/util/HtmlWriterHelper.java   | 2 +-
 .../java/org/apache/myfaces/tobago/internal/util/NumberUtils.java   | 2 +-
 .../java/org/apache/myfaces/tobago/internal/util/SortingUtils.java  | 4 ++--
 .../main/java/org/apache/myfaces/tobago/util/ComponentUtils.java    | 2 +-
 .../java/org/apache/myfaces/tobago/model/SelectableUnitTest.java    | 6 +++---
 11 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/pom.xml b/pom.xml
index 43741dc88d..df316de3bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -381,6 +381,11 @@
             <artifactId>checkstyle-rules</artifactId>
             <version>${checkstyle-rules.version}</version>
           </dependency>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>9.3</version>
+          </dependency>
         </dependencies>
       </plugin>
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
index 15f17bf630..659eebe09e 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/Markup.java
@@ -213,7 +213,7 @@ public final class Markup implements Serializable, Iterable<String> {
     boolean forbiddenCharFound = false;
     for (int i = 0; i < string.length(); i++) {
       final char c = string.charAt(i);
-      if (('0' <= c && c <= '9') || ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) {
+      if ('0' <= c && c <= '9' || 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z') {
         stringBuilder.append(c);
       } else {
         forbiddenCharFound = true;
@@ -222,7 +222,7 @@ public final class Markup implements Serializable, Iterable<String> {
     if (forbiddenCharFound) {
       final String newString = stringBuilder.toString();
       LOG.warn("Only numeric and alphabetic characters are allowed for markups: '{}' converted to '{}'.", string,
-          newString);
+        newString);
       return newString;
     } else {
       return string;
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/behavior/EventBehavior.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/behavior/EventBehavior.java
index 98079b615b..67dde7c70e 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/behavior/EventBehavior.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/behavior/EventBehavior.java
@@ -135,7 +135,7 @@ public class EventBehavior extends ClientBehaviorBase {
     }
 
     final Map<String, Object> bindings = (Map<String, Object>) getStateHelper().
-        get(EventBehavior.PropertyKeys.bindings);
+      get(EventBehavior.PropertyKeys.bindings);
     if (bindings != null) {
       return (ValueExpression) bindings.get(name);
     } else {
@@ -187,7 +187,7 @@ public class EventBehavior extends ClientBehaviorBase {
   }
 
   public boolean isImmediateSet() {
-    return (getStateHelper().get(ATTR_IMMEDIATE) != null) || (getValueExpression(ATTR_IMMEDIATE) != null);
+    return getStateHelper().get(ATTR_IMMEDIATE) != null || getValueExpression(ATTR_IMMEDIATE) != null;
   }
 
   public String getFor() {
@@ -287,7 +287,7 @@ public class EventBehavior extends ClientBehaviorBase {
       return getCollectionFromSpaceSplitString((String) value);
     } else {
       throw new IllegalArgumentException("Type " + value.getClass()
-          + " not supported for attribute " + attributeName);
+        + " not supported for attribute " + attributeName);
     }
   }
 
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java
index 9acc787c9f..deb9bfa04d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUICommandBase.java
@@ -117,7 +117,7 @@ public abstract class AbstractUICommandBase extends UICommand
       }
     }
     return disabled != null && disabled
-        || (tobagoConfig.getSecurityAnnotation() == SecurityAnnotation.disable && !isAllowed());
+        || tobagoConfig.getSecurityAnnotation() == SecurityAnnotation.disable && !isAllowed();
   }
 
   private boolean isAllowed() {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ImageRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ImageRenderer.java
index 07269339f0..41eef43dc6 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ImageRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/ImageRenderer.java
@@ -43,8 +43,8 @@ public class ImageRenderer<T extends AbstractUIImage> extends RendererBase<T> {
     final String value = component.getUrl();
     final boolean isIcon = Icons.matches(value);
     final boolean disabled = component.isDisabled()
-        || (component.getParent() instanceof AbstractUICommandBase
-        && ((AbstractUICommandBase) component.getParent()).isDisabled());
+        || component.getParent() instanceof AbstractUICommandBase
+        && ((AbstractUICommandBase) component.getParent()).isDisabled();
     final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, component);
     final Markup markup = component.getMarkup();
     if (isIcon) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRendererBase.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRendererBase.java
index 937f54e36b..c165c72332 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRendererBase.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/SelectManyRendererBase.java
@@ -603,7 +603,7 @@ public abstract class SelectManyRendererBase<T extends AbstractUISelectManyBase>
             return hasNext();
           } else {
 
-            if ((facesContext.isProjectStage(ProjectStage.Production) && LOG.isDebugEnabled())
+            if (facesContext.isProjectStage(ProjectStage.Production) && LOG.isDebugEnabled()
                 || LOG.isWarnEnabled()) {
               final ValueExpression expression = currentUISelectItems.getValueExpression("value");
               final Object[] objects = {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterHelper.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterHelper.java
index fd81d39908..89d73a32cb 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterHelper.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterHelper.java
@@ -99,7 +99,7 @@ public final class HtmlWriterHelper extends WriterHelper {
 
         // Tilde or less...
         if (ch < CHARS_TO_ESCAPE.length) {
-          if (isAttribute && ch == '&' && (i + 1 < end) && text[i + 1] == '{') {
+          if (isAttribute && ch == '&' && i + 1 < end && text[i + 1] == '{') {
             // HTML 4.0, section B.7.1: ampersands followed by
             // an open brace don't get escaped
             buffer.addToBuffer('&');
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/NumberUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/NumberUtils.java
index 4294528ac1..c62441f1ae 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/NumberUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/NumberUtils.java
@@ -21,7 +21,7 @@ package org.apache.myfaces.tobago.internal.util;
 
 public class NumberUtils {
   public static boolean isDigits(final String str) {
-    if ((str == null) || (str.length() == 0)) {
+    if (str == null || str.length() == 0) {
       return false;
     }
     for (int i = 0; i < str.length(); i++) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/SortingUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/SortingUtils.java
index 6ca4fefd3f..d453bc07c3 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/SortingUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/SortingUtils.java
@@ -198,8 +198,8 @@ public class SortingUtils {
       if (child instanceof UISelectMany
           || child instanceof UISelectOne
           || child instanceof UISelectBoolean
-          || (child instanceof AbstractUICommand && child.getChildren().isEmpty())
-          || (child instanceof UIInput && RendererTypes.HIDDEN.equals(child.getRendererType()))) {
+          || child instanceof AbstractUICommand && child.getChildren().isEmpty()
+          || child instanceof UIInput && RendererTypes.HIDDEN.equals(child.getRendererType())) {
         continue;
         // look for a better component if any
       }
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
index 8771768150..a401c8727c 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
@@ -895,7 +895,7 @@ public final class ComponentUtils {
   private static void addLayoutChildren(final UIComponent component, final List<UIComponent> result) {
     for (final UIComponent child : component.getChildren()) {
       if (child instanceof Visual && !((Visual) child).isPlain()
-          || (UIComponent.isCompositeComponent(child) && !child.isRendered())) {
+          || UIComponent.isCompositeComponent(child) && !child.isRendered()) {
         result.add(child);
       } else {
         // Child seems to be transparent for layout, like UIForm with "plain" set.
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
index 88e30a0fc5..dfdd31edb7 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/model/SelectableUnitTest.java
@@ -53,9 +53,9 @@ public class SelectableUnitTest extends EnumUnitTest {
 
     StringBuilder stringBuilder = new StringBuilder();
     for (char c : fileContent.toCharArray()) {
-      if (('0' <= c && c <= '9')
-        || ('A' <= c && c <= 'Z')
-        || ('a' <= c && c <= 'z')) {
+      if ('0' <= c && c <= '9'
+        || 'A' <= c && c <= 'Z'
+        || 'a' <= c && c <= 'z') {
         stringBuilder.append(c);
       } else {
         if (stringBuilder.length() > 0) {