git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7d5689a
)
JAL-1982 defensive checks for null annotations array
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 22 Jun 2016 13:56:32 +0000
(14:56 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Wed, 22 Jun 2016 13:56:32 +0000
(14:56 +0100)
src/jalview/analysis/AlignmentUtils.java
patch
|
blob
|
history
src/jalview/io/AnnotationFile.java
patch
|
blob
|
history
src/jalview/io/JSONFile.java
patch
|
blob
|
history
src/jalview/schemes/RNAHelicesColour.java
patch
|
blob
|
history
src/jalview/schemes/RNAHelicesColourChooser.java
patch
|
blob
|
history
src/jalview/viewmodel/AlignmentViewport.java
patch
|
blob
|
history
src/jalview/workers/StrucConsensusThread.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/AlignmentUtils.java
b/src/jalview/analysis/AlignmentUtils.java
index
081f446
..
33a54e8
100644
(file)
--- a/
src/jalview/analysis/AlignmentUtils.java
+++ b/
src/jalview/analysis/AlignmentUtils.java
@@
-1332,15
+1332,19
@@
public class AlignmentUtils
Collection<String> types, List<SequenceI> forSequences,
boolean anyType, boolean doShow)
{
Collection<String> types, List<SequenceI> forSequences,
boolean anyType, boolean doShow)
{
- for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
+ AlignmentAnnotation[] anns = al.getAlignmentAnnotation();
+ if (anns != null)
{
{
- if (anyType || types.contains(aa.label))
+ for (AlignmentAnnotation aa : anns)
{
{
- if ((aa.sequenceRef != null)
- && (forSequences == null || forSequences
- .contains(aa.sequenceRef)))
+ if (anyType || types.contains(aa.label))
{
{
- aa.visible = doShow;
+ if ((aa.sequenceRef != null)
+ && (forSequences == null || forSequences
+ .contains(aa.sequenceRef)))
+ {
+ aa.visible = doShow;
+ }
}
}
}
}
}
}
diff --git
a/src/jalview/io/AnnotationFile.java
b/src/jalview/io/AnnotationFile.java
index
8b3aa98
..
d738882
100755
(executable)
--- a/
src/jalview/io/AnnotationFile.java
+++ b/
src/jalview/io/AnnotationFile.java
@@
-1760,6
+1760,10
@@
public class AnnotationFile
*/
public String printCSVAnnotations(AlignmentAnnotation[] annotations)
{
*/
public String printCSVAnnotations(AlignmentAnnotation[] annotations)
{
+ if (annotations == null)
+ {
+ return "";
+ }
StringBuffer sp = new StringBuffer();
for (int i = 0; i < annotations.length; i++)
{
StringBuffer sp = new StringBuffer();
for (int i = 0; i < annotations.length; i++)
{
diff --git
a/src/jalview/io/JSONFile.java
b/src/jalview/io/JSONFile.java
index
36980f8
..
3cda444
100644
(file)
--- a/
src/jalview/io/JSONFile.java
+++ b/
src/jalview/io/JSONFile.java
@@
-744,11
+744,14
@@
public class JSONFile extends AlignFile implements ComplexAlignFile
fr = avpanel.cloneFeatureRenderer();
// Add non auto calculated annotation to AlignFile
fr = avpanel.cloneFeatureRenderer();
// Add non auto calculated annotation to AlignFile
- for (AlignmentAnnotation annot : annots)
+ if (annots != null)
{
{
- if (annot != null && !annot.autoCalculated)
+ for (AlignmentAnnotation annot : annots)
{
{
- annotations.add(annot);
+ if (annot != null && !annot.autoCalculated)
+ {
+ annotations.add(annot);
+ }
}
}
globalColourScheme = ColourSchemeProperty.getColourName(viewport
}
}
globalColourScheme = ColourSchemeProperty.getColourName(viewport
diff --git
a/src/jalview/schemes/RNAHelicesColour.java
b/src/jalview/schemes/RNAHelicesColour.java
index
d17f510
..
9729a83
100644
(file)
--- a/
src/jalview/schemes/RNAHelicesColour.java
+++ b/
src/jalview/schemes/RNAHelicesColour.java
@@
-91,6
+91,10
@@
public class RNAHelicesColour extends ResidueColourScheme
// This loop will find the first rna structure annotation by which to colour
// the sequences.
AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
// This loop will find the first rna structure annotation by which to colour
// the sequences.
AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation();
+ if (annotations == null)
+ {
+ return;
+ }
for (int i = 0; i < annotations.length; i++)
{
for (int i = 0; i < annotations.length; i++)
{
diff --git
a/src/jalview/schemes/RNAHelicesColourChooser.java
b/src/jalview/schemes/RNAHelicesColourChooser.java
index
1a13bbe
..
b1b3c5a
100644
(file)
--- a/
src/jalview/schemes/RNAHelicesColourChooser.java
+++ b/
src/jalview/schemes/RNAHelicesColourChooser.java
@@
-22,6
+22,7
@@
package jalview.schemes;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
import java.awt.event.ActionEvent;
import jalview.datamodel.SequenceGroup;
import java.awt.event.ActionEvent;
@@
-77,16
+78,20
@@
public class RNAHelicesColourChooser
adjusting = true;
Vector list = new Vector();
int index = 1;
adjusting = true;
Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns != null)
{
{
- String label = av.getAlignment().getAlignmentAnnotation()[i].label;
- if (!list.contains(label))
+ for (int i = 0; i < anns.length; i++)
{
{
- list.addElement(label);
- }
- else
- {
- list.addElement(label + "_" + (index++));
+ String label = anns[i].label;
+ if (!list.contains(label))
+ {
+ list.addElement(label);
+ }
+ else
+ {
+ list.addElement(label + "_" + (index++));
+ }
}
}
}
}
diff --git
a/src/jalview/viewmodel/AlignmentViewport.java
b/src/jalview/viewmodel/AlignmentViewport.java
index
0f6d66b
..
91ee3c1
100644
(file)
--- a/
src/jalview/viewmodel/AlignmentViewport.java
+++ b/
src/jalview/viewmodel/AlignmentViewport.java
@@
-1420,11
+1420,15
@@
public abstract class AlignmentViewport implements AlignViewportI,
protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
boolean visible)
{
protected void setSequenceAnnotationsVisible(SequenceI sequenceI,
boolean visible)
{
- for (AlignmentAnnotation ann : alignment.getAlignmentAnnotation())
+ AlignmentAnnotation[] anns = alignment.getAlignmentAnnotation();
+ if (anns != null)
{
{
- if (ann.sequenceRef == sequenceI)
+ for (AlignmentAnnotation ann : anns)
{
{
- ann.visible = visible;
+ if (ann.sequenceRef == sequenceI)
+ {
+ ann.visible = visible;
+ }
}
}
}
}
}
}
diff --git
a/src/jalview/workers/StrucConsensusThread.java
b/src/jalview/workers/StrucConsensusThread.java
index
3483dac
..
4249112
100644
(file)
--- a/
src/jalview/workers/StrucConsensusThread.java
+++ b/
src/jalview/workers/StrucConsensusThread.java
@@
-94,12
+94,15
@@
public class StrucConsensusThread extends AlignCalcWorker
.getAlignmentAnnotation();
AlignmentAnnotation rnaStruc = null;
// select rna struct to use for calculation
.getAlignmentAnnotation();
AlignmentAnnotation rnaStruc = null;
// select rna struct to use for calculation
- for (int i = 0; i < aa.length; i++)
+ if (aa != null)
{
{
- if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc())
+ for (int i = 0; i < aa.length; i++)
{
{
- rnaStruc = aa[i];
- break;
+ if (aa[i].visible && aa[i].isRNA() && aa[i].isValidStruc())
+ {
+ rnaStruc = aa[i];
+ break;
+ }
}
}
// check to see if its valid
}
}
// check to see if its valid