Skip to content

Commit

Permalink
o Updated to guard against 'NullPointerException's.
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
ChristianSchulte committed May 7, 2016
1 parent ba1c194 commit 2644af5
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/main/java/org/codehaus/plexus/util/AbstractScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@


import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
* Scan a directory tree for files, with specified inclusions and exclusions.
Expand Down Expand Up @@ -262,11 +264,15 @@ public void setIncludes( String[] includes )
}
else
{
this.includes = new String[includes.length];
for ( int i = 0; i < includes.length; i++ )
final List<String> list = new ArrayList<String>( includes.length );
for ( String include : includes )
{
this.includes[i] = normalizePattern( includes[i] );
if ( include != null )
{
list.add( normalizePattern( include ) );
}
}
this.includes = list.toArray( new String[ list.size() ] );
}
}

Expand All @@ -290,11 +296,15 @@ public void setExcludes( String[] excludes )
}
else
{
this.excludes = new String[excludes.length];
for ( int i = 0; i < excludes.length; i++ )
final List<String> list = new ArrayList<String>( excludes.length );
for ( String exclude : excludes )
{
this.excludes[i] = normalizePattern( excludes[i] );
if ( exclude != null )
{
list.add( normalizePattern( exclude ) );
}
}
this.excludes = list.toArray( new String[ list.size() ] );
}
}

Expand Down

0 comments on commit 2644af5

Please sign in to comment.