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 2017/11/29 16:09:11 UTC

[myfaces-tobago] branch master updated: TOBAGO-1782: Clean up * aware NPE

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d039810  TOBAGO-1782: Clean up * aware NPE
d039810 is described below

commit d0398107d5a16aad4454584d3e31678b21c682cd
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Nov 29 17:09:08 2017 +0100

    TOBAGO-1782: Clean up
    * aware NPE
---
 .../java/org/apache/myfaces/tobago/context/Markup.java     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

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 3ea69a8..6302a9c 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
@@ -333,7 +333,10 @@ public final class Markup implements Serializable, Iterable<String> {
       Markup result = this;
       if (markup.values != null) {
         for (final String summand : markup.values) {
-          result = result.add(summand);
+          final Markup combined = result.add(summand);
+          if (combined != null) {
+            result = combined;
+          }
         }
       }
       return result;
@@ -373,7 +376,12 @@ public final class Markup implements Serializable, Iterable<String> {
       // this part is not optimized, but it will be used rarely, in the moment...
       Markup result = this;
       for (final String summand : markup.values) {
-        result = result.remove(summand);
+        final Markup removed = result.remove(summand);
+        if (removed == null) {
+          result = NULL;
+        } else {
+          result = removed;
+        }
       }
       return result;
     }
@@ -398,7 +406,7 @@ public final class Markup implements Serializable, Iterable<String> {
         final String[] strings = new String[values.length - 1];
         int found = 0;
         for (int i = 0; i < strings.length; i++) {
-          if (values[i].equals(summand)) {
+          if (summand.equals(values[i])) {
             found++;
           }
           strings[i] = values[i + found];

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].