File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/io Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1376,19 +1376,20 @@ static String[] splitOnTokens(final String text) {
13761376 final ArrayList <String > list = new ArrayList <String >();
13771377 final StringBuilder buffer = new StringBuilder ();
13781378 for (int i = 0 ; i < array .length ; i ++) {
1379- if (array [i ] == '?' || array [i ] == '*' ) {
1379+ final char ch = array [i ];
1380+ if (ch == '?' || ch == '*' ) {
13801381 if (buffer .length () != 0 ) {
13811382 list .add (buffer .toString ());
13821383 buffer .setLength (0 );
13831384 }
1384- if (array [ i ] == '?' ) {
1385+ if (ch == '?' ) {
13851386 list .add ("?" );
1386- } else if (list .isEmpty () ||
1387+ } else if (list .isEmpty () || // ch == '*' here; check if previous char was '*'
13871388 i > 0 && list .get (list .size () - 1 ).equals ("*" ) == false ) {
13881389 list .add ("*" );
13891390 }
13901391 } else {
1391- buffer .append (array [ i ] );
1392+ buffer .append (ch );
13921393 }
13931394 }
13941395 if (buffer .length () != 0 ) {
You can’t perform that action at this time.
0 commit comments