Skip to content
Snippets Groups Projects
Commit 97bb871d authored by “kpepper”'s avatar “kpepper”
Browse files

Fix for ticket 503254 - ACT was not validating input file arguments

parent 4e9118d6
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,7 @@ Version 17 ...@@ -32,7 +32,7 @@ Version 17
Fixed RT ticket #606061 - Using EBI-Dbfetch on ARTEMIS. Change to DbfetchEntrySource.java due to incorrect regular expression and EBI URL. Fixed RT ticket #606061 - Using EBI-Dbfetch on ARTEMIS. Change to DbfetchEntrySource.java due to incorrect regular expression and EBI URL.
Resized splash screen. Resized splash screen, as it was too small to the accommodate text info.
Added error handling for dnaplotter template file loading in standalone mode. Added error handling for dnaplotter template file loading in standalone mode.
...@@ -40,6 +40,8 @@ Version 17 ...@@ -40,6 +40,8 @@ Version 17
Fixed RT ticket #467433 - Genbank DBSOURCE field was not recognised by Artemis. DBLINK was already added. Fixed RT ticket #467433 - Genbank DBSOURCE field was not recognised by Artemis. DBLINK was already added.
Fixed RT ticket #503254 - Act doesn't detect if file does not exist.
KNOWN ISSUES: KNOWN ISSUES:
1) Java JDKs 1.8.0_131 and above have a Swing bug related to overlaying of modal dialogs for Mac OS X: https://bugs.openjdk.java.net/browse/JDK-8179335 1) Java JDKs 1.8.0_131 and above have a Swing bug related to overlaying of modal dialogs for Mac OS X: https://bugs.openjdk.java.net/browse/JDK-8179335
2) There is a current bug in htsjdk whereby calls to the queryMate functionality can throw an exception on reads with secondaries and/or supplementals. 2) There is a current bug in htsjdk whereby calls to the queryMate functionality can throw an exception on reads with secondaries and/or supplementals.
......
...@@ -24,7 +24,7 @@ usage () { ...@@ -24,7 +24,7 @@ usage () {
echo " -DuserplotX=FILE[,FILE2] For sequence 'X' open one or more userplots" echo " -DuserplotX=FILE[,FILE2] For sequence 'X' open one or more userplots"
echo " -DloguserplotX=FILE[,FILE2] For sequence 'X' open one or more userplots, take log(data)" echo " -DloguserplotX=FILE[,FILE2] For sequence 'X' open one or more userplots, take log(data)"
echo " -DbamX=FILE[,FILE2,...] For sequence 'X' open one or more BAM, CRAM, VCF, or BCF files" echo " -DbamX=FILE[,FILE2,...] For sequence 'X' open one or more BAM, CRAM, VCF, or BCF files"
echo " -Dchado="h:p/d?u" Get ACT to open this CHADO database" echo " -Dchado=\"h:p/d?u\" Get ACT to open this CHADO database"
echo " -Dread_only Open CHADO database read-only" echo " -Dread_only Open CHADO database read-only"
echo "EXAMPLES" echo "EXAMPLES"
echo " % act" echo " % act"
......
...@@ -31,7 +31,7 @@ usage () { ...@@ -31,7 +31,7 @@ usage () {
echo " -Dshow_cov_plot Open coverage plot in BamView" echo " -Dshow_cov_plot Open coverage plot in BamView"
echo " -Dshow_forward_lines=? Hide/show forward frame lines [true,false]" echo " -Dshow_forward_lines=? Hide/show forward frame lines [true,false]"
echo " -Dshow_reverse_lines=? Hide/show reverse frame lines [true,false]" echo " -Dshow_reverse_lines=? Hide/show reverse frame lines [true,false]"
echo " -Dchado="h:p/d?u" Get Artemis to open this CHADO database" echo " -Dchado=\"h:p/d?u\" Get Artemis to open this CHADO database"
echo " -Dread_only Open CHADO database read-only" echo " -Dread_only Open CHADO database read-only"
echo "EXAMPLES" echo "EXAMPLES"
echo " % art AJ006275.embl" echo " % art AJ006275.embl"
......
...@@ -39,7 +39,10 @@ import uk.ac.sanger.artemis.io.EntryInformation; ...@@ -39,7 +39,10 @@ import uk.ac.sanger.artemis.io.EntryInformation;
import uk.ac.sanger.artemis.io.SimpleEntryInformation; import uk.ac.sanger.artemis.io.SimpleEntryInformation;
import java.awt.event.*; import java.awt.event.*;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import javax.swing.JFrame; import javax.swing.JFrame;
/** /**
...@@ -346,24 +349,50 @@ public class ActMain extends Splash ...@@ -346,24 +349,50 @@ public class ActMain extends Splash
} }
/** /**
* Main entry point for ACT * Validate the program input arguments and exit
**/ * if they are not valid, displaying an error message(s).
public static void main(final String [] args) * @param args String array
*/
protected static void validateStartupArguments(final String[] args)
{ {
final ActMain main_window = new ActMain(); boolean valid = true;
main_window.setVisible(true);
final InputStreamProgressListener progress_listener =
main_window.getInputStreamProgressListener();
if(args.length >= 3) if(args.length >= 3)
ActMain.makeMultiComparator(main_window, progress_listener, {
args); // Make sure the files provided are actually valid as far as possible...
for (String file : args)
{
if (file.startsWith("ftp") || file.startsWith("http"))
{
// web resource
try
{
URL url = new URL(file);
}
catch (Exception e)
{
valid = false;
System.err.println("\nError - " + file + " is not a valid URL.");
}
}
else
{
// normal file
File argFile = new File(file);
if (!argFile.exists() || !argFile.isFile())
{
valid = false;
System.err.println("\nError - " + argFile + " is not a valid file.");
}
}
}
}
else else
{ {
if(args.length != 0) if(args.length != 0)
{ {
System.err.println("Error - this program needs either no " + System.err.println("\nError - this program needs either no" +
" arguments or an odd number\n" + " arguments or an odd number\n" +
"(3 or more):"); "(3 or more):");
System.err.println(" act sequence_1 comparison_data sequence_2"); System.err.println(" act sequence_1 comparison_data sequence_2");
...@@ -371,8 +400,34 @@ public class ActMain extends Splash ...@@ -371,8 +400,34 @@ public class ActMain extends Splash
System.err.println(" act seq_1 comparison_data_2_v_1 seq_2 comparison_data_3_v_2 seq_3"); System.err.println(" act seq_1 comparison_data_2_v_1 seq_2 comparison_data_3_v_2 seq_3");
System.err.println("or"); System.err.println("or");
System.err.println(" act"); System.err.println(" act");
valid = false;
}
}
if (!valid)
{
System.exit(1); System.exit(1);
} }
}
/**
* Main entry point for ACT
**/
public static void main(final String [] args)
{
validateStartupArguments(args);
final ActMain main_window = new ActMain();
main_window.setVisible(true);
final InputStreamProgressListener progress_listener =
main_window.getInputStreamProgressListener();
if(args.length >= 3)
{
ActMain.makeMultiComparator(main_window, progress_listener,
args);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment