git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CursoMode added
[jalview.git]
/
src
/
jalview
/
io
/
AppletFormatAdapter.java
diff --git
a/src/jalview/io/AppletFormatAdapter.java
b/src/jalview/io/AppletFormatAdapter.java
index
f8b809e
..
5f73898
100755
(executable)
--- a/
src/jalview/io/AppletFormatAdapter.java
+++ b/
src/jalview/io/AppletFormatAdapter.java
@@
-34,6
+34,11
@@
/** DOCUMENT ME!! */
\r
public static final Vector formats = new Vector();
\r
\r
/** DOCUMENT ME!! */
\r
public static final Vector formats = new Vector();
\r
\r
+ public static String INVALID_CHARACTERS = "Contains invalid characters";
\r
+
\r
+ public static String SUPPORTED_FORMATS = "Formats currently supported are\n" +
\r
+ "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM";
\r
+
\r
static
\r
{
\r
formats.addElement("BLC");
\r
static
\r
{
\r
formats.addElement("BLC");
\r
@@
-45,6
+50,12
@@
formats.addElement("PFAM");
\r
}
\r
\r
formats.addElement("PFAM");
\r
}
\r
\r
+
\r
+ public static String FILE = "File";
\r
+ public static String URL = "URL";
\r
+ public static String PASTE = "Paste";
\r
+ public static String CLASSLOADER = "ClassLoader";
\r
+
\r
AlignFile afile = null;
\r
\r
/**
\r
AlignFile afile = null;
\r
\r
/**
\r
@@
-57,6
+68,7
@@
* @return DOCUMENT ME!
\r
*/
\r
public SequenceI[] readFile(String inFile, String type, String format)
\r
* @return DOCUMENT ME!
\r
*/
\r
public SequenceI[] readFile(String inFile, String type, String format)
\r
+ throws java.io.IOException
\r
{
\r
try
\r
{
\r
{
\r
try
\r
{
\r
@@
-89,6
+101,7
@@
afile = new PfamFile(inFile, type);
\r
}
\r
\r
afile = new PfamFile(inFile, type);
\r
}
\r
\r
+
\r
return afile.getSeqsAsArray();
\r
}
\r
catch (Exception e)
\r
return afile.getSeqsAsArray();
\r
}
\r
catch (Exception e)
\r
@@
-96,6
+109,9
@@
System.err.println("Failed to read alignment using the '" + format +
\r
"' reader.\n"+e);
\r
\r
System.err.println("Failed to read alignment using the '" + format +
\r
"' reader.\n"+e);
\r
\r
+ if(e.getMessage()!=null && e.getMessage().startsWith(INVALID_CHARACTERS))
\r
+ throw new java.io.IOException(e.getMessage());
\r
+
\r
// Finally test if the user has pasted just the sequence, no id
\r
if(type.equalsIgnoreCase("Paste"))
\r
{
\r
// Finally test if the user has pasted just the sequence, no id
\r
if(type.equalsIgnoreCase("Paste"))
\r
{
\r
@@
-103,16
+119,19
@@
// Possible sequence is just residues with no label
\r
afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
\r
return afile.getSeqsAsArray();
\r
// Possible sequence is just residues with no label
\r
afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
\r
return afile.getSeqsAsArray();
\r
- }catch(Exception ex)
\r
+ }
\r
+ catch(Exception ex)
\r
{
\r
{
\r
- System.err.println("Failed to read alignment using the 'FASTA' reader.\n"+e);
\r
+ if(ex.toString().startsWith(INVALID_CHARACTERS))
\r
+ throw new java.io.IOException(e.getMessage());
\r
+
\r
ex.printStackTrace();
\r
}
\r
ex.printStackTrace();
\r
}
\r
-
\r
}
\r
}
\r
- }
\r
\r
\r
- return null;
\r
+ // If we get to this stage, the format was not supported
\r
+ throw new java.io.IOException(SUPPORTED_FORMATS);
\r
+ }
\r
}
\r
\r
\r
}
\r
\r
\r