Integration of Freemarker API to the Jalview help system to aid self-documentation...
[jalview.git] / src / jalview / io / PhylipFile.java
index ce65eea..faf6714 100644 (file)
@@ -49,7 +49,7 @@ public class PhylipFile extends AlignFile
   public static final String FILE_DESC = "PHYLIP";
 
   /**
-   * 
+   *
    * @see {@link AlignFile#AlignFile()}
    */
   public PhylipFile()
@@ -58,7 +58,7 @@ public class PhylipFile extends AlignFile
   }
 
   /**
-   * 
+   *
    * @param source
    * @throws IOException
    */
@@ -80,7 +80,7 @@ public class PhylipFile extends AlignFile
 
   /**
    * Parses the input source
-   * 
+   *
    * @see {@link AlignFile#parse()}
    */
   @Override
@@ -98,8 +98,8 @@ public class PhylipFile extends AlignFile
                 "First line must contain the number of specifies and number of characters");
       }
 
-      int numberSpecies = Integer.parseInt(lineElements[0]), numberCharacters = Integer
-              .parseInt(lineElements[1]);
+      int numberSpecies = Integer.parseInt(lineElements[0]);
+      int numberCharacters = Integer.parseInt(lineElements[1]);
 
       if (numberSpecies <= 0)
       {
@@ -163,9 +163,11 @@ public class PhylipFile extends AlignFile
         // first check sequence is the expected length
         if (sequences[i].length() != numberCharacters)
         {
-          throw new IOException(sequenceElements[i].getName()
+          String warnMessage = sequenceElements[i].getName()
                   + " sequence is incorrect length - should be "
-                  + numberCharacters + " but is " + sequences[i].length());
+                  + numberCharacters + " but is " + sequences[i].length();
+
+          throw new IOException(warnMessage);
         }
         sequenceElements[i].setSequence(sequences[i].toString());
         seqs.add(sequenceElements[i]);
@@ -190,7 +192,7 @@ public class PhylipFile extends AlignFile
   /**
    * Removes any whitespace from txt, used to strip and spaces added to
    * sequences to improve human readability
-   * 
+   *
    * @param txt
    * @return
    */
@@ -202,7 +204,7 @@ public class PhylipFile extends AlignFile
   /**
    * According to the specification, the name cannot have parentheses, square
    * brackets, colon, semicolon, comma
-   * 
+   *
    * @param name
    * @return
    * @throws IOException
@@ -210,7 +212,7 @@ public class PhylipFile extends AlignFile
   private String validateName(String name) throws IOException
   {
     char[] invalidCharacters = new char[]
-    { '(', ')', '[', ']', ':', ';', ',' };
+            { '(', ')', '[', ']', ':', ';', ',' };
     for (char c : invalidCharacters)
     {
       if (name.indexOf(c) > -1)
@@ -228,8 +230,8 @@ public class PhylipFile extends AlignFile
    * characters; a blank line is added between each matrix; no spacing is added
    * between the sequence characters.
    * </p>
-   * 
-   * 
+   *
+   *
    * @see {@link AlignFile#print()}
    */
   @Override
@@ -242,7 +244,7 @@ public class PhylipFile extends AlignFile
     sb.append(
             (seqs.size() > 0) ? Integer
                     .toString(seqs.get(0).getSequence().length) : "0")
-            .append(newline);
+                    .append(newline);
 
     // Due to how IO is handled, there doesn't appear to be a way to store
     // if the original file was sequential or interleaved; if there is, then
@@ -309,7 +311,7 @@ public class PhylipFile extends AlignFile
           sb.append(
                   s.getSequence(start, Math.min(start
                           + numInterleavedColumns, sequenceLength)))
-                  .append(newline);
+                          .append(newline);
         }
       }