~tapaal-contributor/tapaal/label-shifting-when-zooming-1849782

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/verification/VerifyTAPN/VerifyPN.java

merged in  lp:~yrke/tapaal/fix-1821164-exceptionInEngineCheck fixing wrong binary engine NPE

Show diffs side-by-side

added added

removed removed

Lines of Context:
216
216
                
217
217
                public static boolean trySetup() {
218
218
 
219
 
                        String verifypn = null;
220
 
 
221
 
                        //If env is set, it overwrites the value
222
 
                        verifypn = System.getenv("verifypn");
223
 
                        if (verifypn != null && !verifypn.isEmpty()) {
224
 
                                if (new File(verifypn).exists()){
 
219
                        try {
 
220
                                String verifypn = null;
 
221
 
 
222
                                //If env is set, it overwrites the value
 
223
                                verifypn = System.getenv("verifypn");
 
224
                                if (verifypn != null && !verifypn.isEmpty()) {
 
225
                                        if (new File(verifypn).exists()){
 
226
                                                verifypnpath = verifypn;
 
227
                                                VerifyPN v = new VerifyPN(new FileFinder(), new MessengerImpl());
 
228
                                                if(v.isCorrectVersion()){
 
229
                                                        return true;
 
230
                                                }else{
 
231
                                                        verifypn = null;
 
232
                                                        verifypnpath = null;
 
233
                                                }
 
234
                                        }
 
235
                                }
 
236
 
 
237
                                //If pref is set
 
238
                                verifypn = Preferences.getInstance().getVerifypnLocation();
 
239
                                if (verifypn != null && !verifypn.isEmpty()) {
225
240
                                        verifypnpath = verifypn;
226
 
                                        VerifyPN v = new VerifyPN(new FileFinder(), new MessengerImpl());
227
 
                                        if(v.isCorrectVersion()){
228
 
                                                return true;
229
 
                                        }else{
230
 
                                                verifypn = null;
231
 
                                                verifypnpath = null;
232
 
                                        }
233
 
                                }
234
 
                        }
235
 
 
236
 
                        //If pref is set
237
 
                        verifypn = Preferences.getInstance().getVerifypnLocation();
238
 
                        if (verifypn != null && !verifypn.isEmpty()) {
239
 
                                verifypnpath = verifypn;
240
 
                                return true;
241
 
                        }
242
 
 
243
 
                        //Search the installdir for verifytapn
244
 
                        File installdir = TAPAAL.getInstallDir();
245
 
 
246
 
                        String[] paths = {"/bin/verifypn", "/bin/verifypn64", "/bin/verifypn.exe", "/bin/verifypn64.exe"};
247
 
                        for (String s : paths) {
248
 
                                File verifypnfile = new File(installdir + s);
249
 
 
250
 
                                if (verifypnfile.exists()){
251
 
 
252
 
                                        verifypnpath = verifypnfile.getAbsolutePath();
253
 
                                        VerifyPN v = new VerifyPN(new FileFinder(), new MessengerImpl());
254
 
                                        if(v.isCorrectVersion()){
255
 
                                                return true;
256
 
                                        }else{
257
 
                                                verifypn = null;
258
 
                                                verifypnpath = null;
259
 
                                        }
260
 
 
261
 
                                }
262
 
                        }
263
 
 
264
 
 
265
 
 
266
 
                        return false;
 
241
                                        return true;
 
242
                                }
 
243
 
 
244
                                //Search the installdir for verifytapn
 
245
                                File installdir = TAPAAL.getInstallDir();
 
246
 
 
247
                                String[] paths = {"/bin/verifypn", "/bin/verifypn64", "/bin/verifypn.exe", "/bin/verifypn64.exe"};
 
248
                                for (String s : paths) {
 
249
                                        File verifypnfile = new File(installdir + s);
 
250
 
 
251
                                        if (verifypnfile.exists()){
 
252
 
 
253
                                                verifypnpath = verifypnfile.getAbsolutePath();
 
254
                                                VerifyPN v = new VerifyPN(new FileFinder(), new MessengerImpl());
 
255
                                                if(v.isCorrectVersion()){
 
256
                                                        return true;
 
257
                                                }else{
 
258
                                                        verifypn = null;
 
259
                                                        verifypnpath = null;
 
260
                                                }
 
261
 
 
262
                                        }
 
263
                                }
 
264
 
 
265
 
 
266
                                return false;
 
267
                        } catch (Exception e) {
 
268
                                return false;
 
269
                        }
267
270
                }
268
271
 
269
272
                public VerificationResult<TimedArcPetriNetTrace> verify(VerificationOptions options, Tuple<TimedArcPetriNet, NameMapping> model, TAPNQuery query) throws Exception {