Skip to content

Commit

Permalink
IFSFileEnumeration typesafety
Browse files Browse the repository at this point in the history
Signed-off-by: NicolaIsotta <nicola.isotta@gmail.com>
  • Loading branch information
NicolaIsotta authored and ThePrez committed May 26, 2023
1 parent d07b521 commit 2f99cca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/main/java/com/ibm/as400/access/IFSFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.io.UnsupportedEncodingException; //@A6A
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import java.util.StringTokenizer; //@D4A

Expand Down Expand Up @@ -933,7 +932,7 @@ characters are wildcards (*) and question marks (?).
@exception ServerStartupException If the host server cannot be started.
@exception UnknownHostException If the system cannot be located.
**/
public Enumeration enumerateFiles(IFSFileFilter filter, String pattern)
public Enumeration<IFSFile> enumerateFiles(IFSFileFilter filter, String pattern)
throws IOException
{
// Validate arguments. Note that we tolerate a null-valued 'filter'.
Expand Down Expand Up @@ -974,7 +973,7 @@ characters are wildcards (*) and question marks (?).
@exception ServerStartupException If the host server cannot be started.
@exception UnknownHostException If the system cannot be located.
**/
public Enumeration enumerateFiles(String pattern)
public Enumeration<IFSFile> enumerateFiles(String pattern)
throws IOException
{
// Validate arguments. Note that we tolerate a null-valued 'filter'.
Expand Down Expand Up @@ -1015,7 +1014,7 @@ public Enumeration enumerateFiles(String pattern)
@exception ServerStartupException If the host server cannot be started.
@exception UnknownHostException If the system cannot be located.
**/
public Enumeration enumerateFiles(IFSFileFilter filter)
public Enumeration<IFSFile> enumerateFiles(IFSFileFilter filter)
throws IOException
{
try {
Expand Down Expand Up @@ -1049,7 +1048,7 @@ public Enumeration enumerateFiles(IFSFileFilter filter)
@exception ServerStartupException If the host server cannot be started.
@exception UnknownHostException If the system cannot be located.
**/
public Enumeration enumerateFiles()
public Enumeration<IFSFile> enumerateFiles()
throws IOException
{
try {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/ibm/as400/access/IFSFileEnumeration.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


class IFSFileEnumeration
implements Enumeration
implements Enumeration<IFSFile>
{
// The block size is hardcoded based on the value chosen by OpNav.
// For now, it is not configurable.
Expand Down Expand Up @@ -80,7 +80,7 @@ class IFSFileEnumeration
getNextBlock();
}


@Override
public boolean hasMoreElements()
{
return ((contents_ != null && index_ < contents_.length) ||
Expand Down Expand Up @@ -205,7 +205,8 @@ private static boolean isContainWildcard(String pattern){
return false;
}

public Object nextElement()
@Override
public IFSFile nextElement()
{
if (index_ < contents_.length)
return contents_[index_++];
Expand Down

0 comments on commit 2f99cca

Please sign in to comment.