~tapaal-contributor/tapaal/fix-1848946-annotation-undo-redo

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPNDiscreteVerification.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:
208
208
                
209
209
                public static boolean trySetup() {
210
210
 
211
 
                        String verifydtapn = null;
212
 
 
213
 
                        //If env is set, it overwrites the value
214
 
                        verifydtapn = System.getenv("verifydtapn");
215
 
                        if (verifydtapn != null && !verifydtapn.isEmpty()) {
216
 
                                if (new File(verifydtapn).exists()){
 
211
                        try {
 
212
                                String verifydtapn = null;
 
213
 
 
214
                                //If env is set, it overwrites the value
 
215
                                verifydtapn = System.getenv("verifydtapn");
 
216
                                if (verifydtapn != null && !verifydtapn.isEmpty()) {
 
217
                                        if (new File(verifydtapn).exists()){
 
218
                                                verifydtapnpath = verifydtapn;
 
219
                                                VerifyTAPNDiscreteVerification v = new VerifyTAPNDiscreteVerification(new FileFinder(), new MessengerImpl());
 
220
                                                if(v.isCorrectVersion()){
 
221
                                                        return true;
 
222
                                                }else{
 
223
                                                        verifydtapn = null;
 
224
                                                        verifydtapnpath = null;
 
225
                                                }
 
226
                                        }
 
227
                                }
 
228
 
 
229
                                //If pref is set
 
230
                                verifydtapn = Preferences.getInstance().getVerifydtapnLocation();
 
231
                                if (verifydtapn != null && !verifydtapn.isEmpty()) {
217
232
                                        verifydtapnpath = verifydtapn;
218
 
                                        VerifyTAPNDiscreteVerification v = new VerifyTAPNDiscreteVerification(new FileFinder(), new MessengerImpl());
219
 
                                        if(v.isCorrectVersion()){
220
 
                                                return true;
221
 
                                        }else{
222
 
                                                verifydtapn = null;
223
 
                                                verifydtapnpath = null;
224
 
                                        }
225
 
                                }
226
 
                        }
227
 
 
228
 
                        //If pref is set
229
 
                        verifydtapn = Preferences.getInstance().getVerifydtapnLocation();
230
 
                        if (verifydtapn != null && !verifydtapn.isEmpty()) {
231
 
                                verifydtapnpath = verifydtapn;
232
 
                                return true;
233
 
                        }
234
 
 
235
 
                        //Search the installdir for verifytapn
236
 
                        File installdir = TAPAAL.getInstallDir();
237
 
 
238
 
                        String[] paths = {"/bin/verifydtapn", "/bin/verifydtapn64", "/bin/verifydtapn.exe", "/bin/verifydtapn64.exe"};
239
 
                        for (String s : paths) {
240
 
                                File verifydtapnfile = new File(installdir + s);
241
 
 
242
 
                                if (verifydtapnfile.exists()){
243
 
 
244
 
                                        verifydtapnpath = verifydtapnfile.getAbsolutePath();
245
 
                                        VerifyTAPNDiscreteVerification v = new VerifyTAPNDiscreteVerification(new FileFinder(), new MessengerImpl());
246
 
                                        if(v.isCorrectVersion()){
247
 
                                                return true;
248
 
                                        }else{
249
 
                                                verifydtapn = null;
250
 
                                                verifydtapnpath = null;
251
 
                                        }
252
 
 
253
 
                                }
254
 
                        }
255
 
 
256
 
 
257
 
 
258
 
                        return false;
 
233
                                        return true;
 
234
                                }
 
235
 
 
236
                                //Search the installdir for verifytapn
 
237
                                File installdir = TAPAAL.getInstallDir();
 
238
 
 
239
                                String[] paths = {"/bin/verifydtapn", "/bin/verifydtapn64", "/bin/verifydtapn.exe", "/bin/verifydtapn64.exe"};
 
240
                                for (String s : paths) {
 
241
                                        File verifydtapnfile = new File(installdir + s);
 
242
 
 
243
                                        if (verifydtapnfile.exists()){
 
244
 
 
245
                                                verifydtapnpath = verifydtapnfile.getAbsolutePath();
 
246
                                                VerifyTAPNDiscreteVerification v = new VerifyTAPNDiscreteVerification(new FileFinder(), new MessengerImpl());
 
247
                                                if(v.isCorrectVersion()){
 
248
                                                        return true;
 
249
                                                }else{
 
250
                                                        verifydtapn = null;
 
251
                                                        verifydtapnpath = null;
 
252
                                                }
 
253
 
 
254
                                        }
 
255
                                }
 
256
 
 
257
 
 
258
                                return false;
 
259
                        } catch (Exception e) {
 
260
                                return false;
 
261
                        }
259
262
                }
260
263
 
261
264
                public VerificationResult<TimedArcPetriNetTrace> verify(VerificationOptions options, Tuple<TimedArcPetriNet, NameMapping> model, TAPNQuery query) throws Exception {