Revision 43617

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.shp/src/main/java/org/gvsig/fmap/dal/store/shp/utils/SHP.java
221 221
	}
222 222

  
223 223
    private static File findEnd(String str,File[] files, String[] ends) {
224
    	for (int i=0;i<files.length;i++) {
225
			File dbfFile=files[i];
226
			if (dbfFile.getAbsolutePath().endsWith(ends[0])) {
227
				return dbfFile;
228
			}
229
		}
230
		for (int i=0;i<files.length;i++) {
231
			File dbfFile=files[i];
232
			if (dbfFile.getAbsolutePath().endsWith(ends[1])) {
233
				return dbfFile;
234
			}
235
		}
236
		for (int i=0;i<files.length;i++) {
237
			File dbfFile=files[i];
238
			if (dbfFile.getAbsolutePath().endsWith(ends[2])) {
239
				return dbfFile;
240
			}
241
		}
242
		for (int i=0;i<files.length;i++) {
243
			File dbfFile=files[i];
244
			if (dbfFile.getAbsolutePath().endsWith(ends[3])) {
245
				return dbfFile;
246
			}
247
		}
248
		for (int i=0;i<files.length;i++) {
249
			File dbfFile=files[i];
250
			if (dbfFile.getAbsolutePath().endsWith(ends[4])) {
251
				return dbfFile;
252
			}
253
		}
254
		for (int i=0;i<files.length;i++) {
255
			File dbfFile=files[i];
256
			if (dbfFile.getAbsolutePath().endsWith(ends[5])) {
257
				return dbfFile;
258
			}
259
		}
260
		for (int i=0;i<files.length;i++) {
261
			File dbfFile=files[i];
262
			if (dbfFile.getAbsolutePath().endsWith(ends[6])) {
263
				return dbfFile;
264
			}
265
		}
266
		for (int i=0;i<files.length;i++) {
267
			File dbfFile=files[i];
268
			if (dbfFile.getAbsolutePath().endsWith(ends[7])) {
269
				return dbfFile;
270
			}
271
		}
224
        if( files!=null ) {
225
            for (int i=0;i<files.length;i++) {
226
                File dbfFile=files[i];
227
                if (dbfFile.getAbsolutePath().endsWith(ends[0])) {
228
                    return dbfFile;
229
                }
230
            }
231
            for (int i=0;i<files.length;i++) {
232
                File dbfFile=files[i];
233
                if (dbfFile.getAbsolutePath().endsWith(ends[1])) {
234
                    return dbfFile;
235
                }
236
            }
237
            for (int i=0;i<files.length;i++) {
238
                File dbfFile=files[i];
239
                if (dbfFile.getAbsolutePath().endsWith(ends[2])) {
240
                    return dbfFile;
241
                }
242
            }
243
            for (int i=0;i<files.length;i++) {
244
                File dbfFile=files[i];
245
                if (dbfFile.getAbsolutePath().endsWith(ends[3])) {
246
                    return dbfFile;
247
                }
248
            }
249
            for (int i=0;i<files.length;i++) {
250
                File dbfFile=files[i];
251
                if (dbfFile.getAbsolutePath().endsWith(ends[4])) {
252
                    return dbfFile;
253
                }
254
            }
255
            for (int i=0;i<files.length;i++) {
256
                File dbfFile=files[i];
257
                if (dbfFile.getAbsolutePath().endsWith(ends[5])) {
258
                    return dbfFile;
259
                }
260
            }
261
            for (int i=0;i<files.length;i++) {
262
                File dbfFile=files[i];
263
                if (dbfFile.getAbsolutePath().endsWith(ends[6])) {
264
                    return dbfFile;
265
                }
266
            }
267
            for (int i=0;i<files.length;i++) {
268
                File dbfFile=files[i];
269
                if (dbfFile.getAbsolutePath().endsWith(ends[7])) {
270
                    return dbfFile;
271
                }
272
            }
273
        }
272 274
		return new File(removeExtension(str)+"."+ends[0]);
273 275
    }
274 276

  

Also available in: Unified diff