BUG-5410: use Deque instead of a Stack 40/45140/3
authorRobert Varga <rovarga@cisco.com>
Mon, 5 Sep 2016 06:54:47 +0000 (08:54 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 21 Sep 2016 15:28:37 +0000 (15:28 +0000)
java.util.Stack is superseded by Deque and its implementations,
which are not synchronized. Use an ArrayDeque instead of a Stack.

Change-Id: I4e7fca6bb77c7122c56d3a85c5de3d264699765a
Signed-off-by: Robert Varga <rovarga@cisco.com>
third-party/xsd-regex/src/main/java/org/opendaylight/yangtools/xsd/regex/RegularExpression.java

index d87125077b8d426c5c556f0710d60553c1f2325c..ef6df06631c6633a4545652fc8d7bdfaeb1d68aa 100644 (file)
@@ -18,8 +18,9 @@
 package org.opendaylight.yangtools.xsd.regex;
 
 import java.text.CharacterIterator;
+import java.util.ArrayDeque;
+import java.util.Deque;
 import java.util.Locale;
-import java.util.Stack;
 
 /**
  * A regular expression matching engine using Non-deterministic Finite Automaton (NFA).
@@ -1049,7 +1050,7 @@ public class RegularExpression implements java.io.Serializable {
      */
     private int match(Context con, Op op, int offset, int dx, int opts) {
         final ExpressionTarget target = con.target;
-        final Stack<Op> opStack = new Stack<>();
+        final Deque<Op> opStack = new ArrayDeque<>();
         final IntStack dataStack = new IntStack();
         final boolean isSetIgnoreCase = isSet(opts, IGNORE_CASE);
         int retValue = -1;