File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/main/java/org/openmicroscopy/shoola/env/data/model Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -260,11 +260,15 @@ public File getFileToImport()
260
260
//prepare command
261
261
ImagePlus img = (ImagePlus ) file ;
262
262
generated = true ;
263
+ StringWriter sw = new StringWriter ();
264
+ PrintWriter pw = new PrintWriter (sw );
263
265
try {
264
266
String baseName = CommonsLangUtils .deleteWhitespace (img .getTitle ());
267
+ baseName = baseName .replaceAll ("\\ ." , "_" );
268
+ baseName = baseName .replaceAll (":" , "_" );
265
269
String n = baseName +".ome.tif" ;
266
- f = File .createTempFile (baseName , ".ome.tif" );
267
- File p = f .getParentFile ();
270
+ File ff = File .createTempFile (baseName , ".ome.tif" );
271
+ File p = ff .getParentFile ();
268
272
File [] list = p .listFiles ();
269
273
if (list != null ) {
270
274
File toDelete = null ;
@@ -280,8 +284,18 @@ public File getFileToImport()
280
284
}
281
285
f = new File (p , n );
282
286
f .deleteOnExit ();
287
+ ff .deleteOnExit ();
283
288
} catch (Exception e ) {
289
+ e .printStackTrace (pw );
290
+ IJ .log (sw .toString ());
284
291
return null ;
292
+ } finally {
293
+ try {
294
+ sw .close ();
295
+ } catch (IOException e ) {
296
+ IJ .log ("I/O Exception:" + e .getMessage ());
297
+ }
298
+ pw .close ();
285
299
}
286
300
StringBuffer buffer = new StringBuffer ();
287
301
buffer .append ("outfile=" +f .getAbsolutePath ());
You can’t perform that action at this time.
0 commit comments