Issue #3181 Add check for valid array index.

Change-Id: I8e0a37bdd094b341da2ce42922a16d840d1ab468
(cherry picked from commit b4e8d1cdfdb0ef718e97fd7ca615b086b30aa6c0 [formerly adf6d95c01] [formerly 466bfed41e [formerly fb4ac9acc7] [formerly a1f25b8748] [formerly 466bfed41e [formerly fb4ac9acc7] [formerly a1f25b8748] [formerly adf6d95c01 [formerly a1f25b8748 [formerly ca01934f9e9d355dd4159fd472e2aa9bc0918898]]]]])

Former-commit-id: ee1116f5bb [formerly 332dd7a557] [formerly 359b835955] [formerly ee1116f5bb [formerly 332dd7a557] [formerly 359b835955] [formerly 54bdfef65a [formerly 359b835955 [formerly 743bfc070e5e0c82ed445afec08e294220c31018]]]]
Former-commit-id: 54bdfef65a
Former-commit-id: 73e6b98c1c [formerly 0e1d2d002e] [formerly 27375a6f6824e3869146519f29b7880191509161 [formerly 102615aea1]]
Former-commit-id: 1780fac6ccea87727d0b81e7dd218d5f93b8e138 [formerly ac3eaf3c7d]
Former-commit-id: 9f0f3e4a0c
This commit is contained in:
Roger Ferrel 2014-05-22 09:57:41 -05:00 committed by Steve Harris
parent 7f212df413
commit 101481752f

View file

@ -97,6 +97,7 @@ import com.raytheon.uf.common.util.FileUtil;
* Mar 21, 2014 2835 rjpeter Optimized getDisplayData to only scan directories to the depth required to
* populate the display label.
* Apr 29, 2014 3036 rferrel Check for missing archive root directories.
* May 22, 2014 3181 rferrel Add check for valid array index.
* </pre>
*
* @author rferrel
@ -658,6 +659,14 @@ public class ArchiveConfigManager {
tmpDirs.clear();
int subExprIndex = 0;
/*
* Will never match when pattern's directories shorter then
* directories being scanned.
*/
if ((tokens.length - rootFileDepth) > subExpr.length) {
continue DIR_PATTERN_LOOP;
}
for (int i = rootFileDepth; i < tokens.length; i++) {
Pattern subPattern = Pattern.compile("^"
+ subExpr[subExprIndex++] + "$");