You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2016/06/06 13:50:19 UTC

[4/5] git commit: [flex-falcon] [refs/heads/develop] - - Worked on resolving some of the critical sonarqube issues

- Worked on resolving some of the critical sonarqube issues


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/4e05b759
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/4e05b759
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/4e05b759

Branch: refs/heads/develop
Commit: 4e05b75902c8db3efe59bf02615efe0378c03a0e
Parents: ddb6c8f
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Mon Jun 6 15:35:33 2016 +0200
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Mon Jun 6 15:35:33 2016 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/flex/abc/ABCParser.java     |  6 ++----
 compiler/src/main/java/org/apache/flex/abc/Pool.java     |  6 ++++--
 .../apache/flex/abc/instructionlist/InstructionList.java |  4 +++-
 .../main/java/org/apache/flex/abc/semantics/Name.java    |  4 ++--
 .../java/org/apache/flex/abc/semantics/Namespace.java    | 11 +++++++----
 .../org/apache/flex/compiler/asdoc/ASDocComment.java     |  9 +++++----
 .../src/main/java/flex/tools/debugger/cli/DebugCLI.java  |  2 +-
 .../java/flex/tools/debugger/cli/ExpressionContext.java  |  6 +++---
 8 files changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/abc/ABCParser.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/ABCParser.java b/compiler/src/main/java/org/apache/flex/abc/ABCParser.java
index fbacda6..f056676 100644
--- a/compiler/src/main/java/org/apache/flex/abc/ABCParser.java
+++ b/compiler/src/main/java/org/apache/flex/abc/ABCParser.java
@@ -361,12 +361,10 @@ public class ABCParser
         if (nameBase == null || nameParam == null)
             return true;
         
-        if (nameBase != null && nameBase.isTypeName() && 
-                usesForwardReference(nameBase))
+        if (nameBase.isTypeName() && usesForwardReference(nameBase))
             return true;
         
-        if (nameParam != null && nameParam.isTypeName() &&
-                usesForwardReference(nameParam))
+        if (nameParam.isTypeName() && usesForwardReference(nameParam))
             return true;
         
         return false;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/abc/Pool.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/Pool.java b/compiler/src/main/java/org/apache/flex/abc/Pool.java
index de9321b..59f48ea 100644
--- a/compiler/src/main/java/org/apache/flex/abc/Pool.java
+++ b/compiler/src/main/java/org/apache/flex/abc/Pool.java
@@ -125,8 +125,10 @@ public final class Pool<T>
         
         Integer result = refs.get(e);
         
-        if (result == null)
-            throw new IllegalArgumentException("Unknown pool item \"" + e.toString() + "\"");
+        if (result == null) {
+            String msg = (e != null) ? e.toString() : "-none-";
+            throw new IllegalArgumentException("Unknown pool item \"" + msg + "\"");
+        }
         
         return result;
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/abc/instructionlist/InstructionList.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/instructionlist/InstructionList.java b/compiler/src/main/java/org/apache/flex/abc/instructionlist/InstructionList.java
index d8e99c6..ce8da16 100644
--- a/compiler/src/main/java/org/apache/flex/abc/instructionlist/InstructionList.java
+++ b/compiler/src/main/java/org/apache/flex/abc/instructionlist/InstructionList.java
@@ -1143,7 +1143,9 @@ public class InstructionList implements Cloneable
             assert false : cantHappen;
         }
 
-        newb.copyInstructionList(this);
+        if(newb != null) {
+            newb.copyInstructionList(this);
+        }
         return newb;
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/abc/semantics/Name.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/semantics/Name.java b/compiler/src/main/java/org/apache/flex/abc/semantics/Name.java
index 1d98045..c54e6b2 100644
--- a/compiler/src/main/java/org/apache/flex/abc/semantics/Name.java
+++ b/compiler/src/main/java/org/apache/flex/abc/semantics/Name.java
@@ -319,7 +319,7 @@ public class Name
         //  when called from equals().
         boolean result = true; /* this.kind == other.kind; */
 
-        if (result && kind != CONSTANT_TypeName)
+        if (kind != CONSTANT_TypeName)
         {
             //  Check qualifiers, then base.
             if (this.qualifiers == other.qualifiers)
@@ -351,7 +351,7 @@ public class Name
                 }
             }
         }
-        else if (result)
+        else
         {
             // When comparing C1.<T1> to C2.<T2>,
             // first compare C1 to C2; if they're equal, compare T1 to T2.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/abc/semantics/Namespace.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/abc/semantics/Namespace.java b/compiler/src/main/java/org/apache/flex/abc/semantics/Namespace.java
index d34f347..53c1b87 100644
--- a/compiler/src/main/java/org/apache/flex/abc/semantics/Namespace.java
+++ b/compiler/src/main/java/org/apache/flex/abc/semantics/Namespace.java
@@ -116,10 +116,13 @@ public class Namespace
 
         if (obj instanceof Namespace && this.kind != ABCConstants.CONSTANT_PrivateNs || mergePrivateNamespaces)
         {
-            Namespace that = (Namespace)obj;
-            return that.kind == this.kind &&
-                   that.apiVersion == this.apiVersion &&
-                   that.name.equals(this.name);
+            Namespace that = (Namespace) obj;
+            if(that != null) {
+                return that.kind == this.kind &&
+                        that.apiVersion == this.apiVersion &&
+                        that.name.equals(this.name);
+            }
+            return false;
         }
 
         //  Other object is not a Namespace.

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/compiler/src/main/java/org/apache/flex/compiler/asdoc/ASDocComment.java
----------------------------------------------------------------------
diff --git a/compiler/src/main/java/org/apache/flex/compiler/asdoc/ASDocComment.java b/compiler/src/main/java/org/apache/flex/compiler/asdoc/ASDocComment.java
index aa3826d..f28eda2 100644
--- a/compiler/src/main/java/org/apache/flex/compiler/asdoc/ASDocComment.java
+++ b/compiler/src/main/java/org/apache/flex/compiler/asdoc/ASDocComment.java
@@ -89,15 +89,16 @@ public class ASDocComment implements IASDocComment
                         if (pendingTag != null)
                         {
                             addTag(pendingTag);
-                            pendingTag = null;
                         }
                         pendingTag = new ASDocTag(tok.getText().substring(1));
                     }
                     else if (tok.getType() == ASTokenTypes.TOKEN_ASDOC_TEXT)
                     {
-                        pendingTag.setDescription(tok.getText());
-                        addTag(pendingTag);
-                        pendingTag = null;
+                        if(pendingTag != null) {
+                            pendingTag.setDescription(tok.getText());
+                            addTag(pendingTag);
+                            pendingTag = null;
+                        }
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java b/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java
index 43ee983..a65f650 100644
--- a/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java
+++ b/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java
@@ -632,7 +632,7 @@ public class DebugCLI implements Runnable, SourceLocator {
 			{
 				build = buildString;
 			}
-		} catch (Throwable t) {
+		} catch (Exception t) {
 			// ignore
 		}
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/4e05b759/debugger/src/main/java/flex/tools/debugger/cli/ExpressionContext.java
----------------------------------------------------------------------
diff --git a/debugger/src/main/java/flex/tools/debugger/cli/ExpressionContext.java b/debugger/src/main/java/flex/tools/debugger/cli/ExpressionContext.java
index 2bed5ee..9090399 100644
--- a/debugger/src/main/java/flex/tools/debugger/cli/ExpressionContext.java
+++ b/debugger/src/main/java/flex/tools/debugger/cli/ExpressionContext.java
@@ -141,7 +141,7 @@ public class ExpressionContext implements Context
 				}
 
 				if (var == null)
-					throw new NoSuchVariableException((var == null) ? m_current : var.getName());
+					throw new NoSuchVariableException(m_current);
 
 				// set the value, for the case of a variable that does not exist it will not have a type
 				// so we try to glean one from v.
@@ -183,7 +183,7 @@ public class ExpressionContext implements Context
 				throw new NoSuchVariableException(o);
 
 			// take on the path to the variable; so 'what' command prints something nice
-			if ((result != null) && result instanceof VariableFacade)
+			if (result instanceof VariableFacade)
 			{
 				((VariableFacade)result).setPath(getName());
 			}
@@ -357,7 +357,7 @@ public class ExpressionContext implements Context
 				v = locateForNamed(id, name, true);
 				if (v != null)
 					v = new VariableFacade(v, id, m_isolateId);
-				else if (v == null && m_createIfMissing && name.charAt(0) != '$')
+				else if (m_createIfMissing && name.charAt(0) != '$')
 					v = new VariableFacade(id, name, m_isolateId);
 			}
 		}