Revision 44686 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.lib/src/main/java/org/gvsig/fmap/dal/feature/spi/simpleprovider/AbstractSimpleSequentialReaderFactory.java
AbstractSimpleSequentialReaderFactory.java | ||
---|---|---|
61 | 61 |
return extensions; |
62 | 62 |
} |
63 | 63 |
|
64 |
public final boolean isValidExtension(File f) { |
|
65 |
if( f == null ) { |
|
66 |
return false; |
|
67 |
} |
|
68 |
String[] theExtensions = this.getExtensions(); |
|
69 |
if( theExtensions==null ) { |
|
70 |
// Si no hay especificadas extensiones decimos que vale. |
|
71 |
return true; |
|
72 |
} |
|
73 |
String extension = FilenameUtils.getExtension(f.getName()).trim(); |
|
74 |
if( extension.isEmpty() ) { |
|
75 |
// Si el fichero no tiene extension decimos que vale. |
|
76 |
return true; |
|
77 |
} |
|
78 |
for (String currentExtension : theExtensions) { |
|
79 |
if (currentExtension != null ) { |
|
80 |
currentExtension = currentExtension.trim(); |
|
81 |
if( !currentExtension.isEmpty() && extension.equalsIgnoreCase(currentExtension) ) { |
|
82 |
return true; |
|
83 |
} |
|
84 |
} |
|
85 |
} |
|
86 |
return false; |
|
87 |
} |
|
88 |
|
|
64 | 89 |
@Override |
65 |
public boolean accept(File pathname) {
|
|
66 |
return FilenameUtils.isExtension(pathname.getName(), this.getExtensions());
|
|
90 |
public boolean accept(File f) {
|
|
91 |
return isValidExtension(f);
|
|
67 | 92 |
} |
68 | 93 |
|
69 | 94 |
@Override |
Also available in: Unified diff