|
29 | 29 | import org.openide.nodes.Node; |
30 | 30 | import java.awt.EventQueue; |
31 | 31 | import java.io.File; |
| 32 | +import java.io.IOException; |
| 33 | +import java.nio.file.LinkOption; |
32 | 34 | import java.nio.file.Path; |
33 | 35 | import java.nio.file.Paths; |
34 | 36 | import java.util.ArrayList; |
@@ -207,28 +209,34 @@ private List<CaseMetadata> getCases() throws CoordinationService.CoordinationSer |
207 | 209 | List<String> nodeList = CoordinationService.getInstance().getNodeList(CoordinationService.CategoryNode.CASES); |
208 | 210 |
|
209 | 211 | for (String node : nodeList) { |
210 | | - Path casePath = Paths.get(node); |
211 | | - File caseFolder = casePath.toFile(); |
212 | | - if (caseFolder.exists()) { |
213 | | - /* |
214 | | - * Search for '*.aut' files. |
215 | | - */ |
216 | | - File[] fileArray = caseFolder.listFiles(); |
217 | | - if (fileArray == null) { |
218 | | - continue; |
219 | | - } |
220 | | - String autFilePath = null; |
221 | | - for (File file : fileArray) { |
222 | | - String name = file.getName().toLowerCase(); |
223 | | - if (autFilePath == null && name.endsWith(".aut")) { |
224 | | - try { |
225 | | - caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath()))); |
226 | | - } catch (CaseMetadata.CaseMetadataException ex) { |
227 | | - LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex); |
| 212 | + Path casePath; |
| 213 | + try { |
| 214 | + casePath = Paths.get(node).toRealPath(LinkOption.NOFOLLOW_LINKS); |
| 215 | + |
| 216 | + File caseFolder = casePath.toFile(); |
| 217 | + if (caseFolder.exists()) { |
| 218 | + /* |
| 219 | + * Search for '*.aut' files. |
| 220 | + */ |
| 221 | + File[] fileArray = caseFolder.listFiles(); |
| 222 | + if (fileArray == null) { |
| 223 | + continue; |
| 224 | + } |
| 225 | + String autFilePath = null; |
| 226 | + for (File file : fileArray) { |
| 227 | + String name = file.getName().toLowerCase(); |
| 228 | + if (autFilePath == null && name.endsWith(".aut")) { |
| 229 | + try { |
| 230 | + caseList.add(new CaseMetadata(Paths.get(file.getAbsolutePath()))); |
| 231 | + } catch (CaseMetadata.CaseMetadataException ex) { |
| 232 | + LOGGER.log(Level.SEVERE, String.format("Error reading case metadata file '%s'.", autFilePath), ex); |
| 233 | + } |
| 234 | + break; |
228 | 235 | } |
229 | | - break; |
230 | 236 | } |
231 | 237 | } |
| 238 | + } catch (IOException ignore) { |
| 239 | + //if a path could not be resolved to a real path do add it to the caseList |
232 | 240 | } |
233 | 241 | } |
234 | 242 | return caseList; |
|
0 commit comments