X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2Fscoremodels%2FFeatureDistanceModel.java;h=8545e94f646e4d32bc7538cc95f2e92da3361718;hb=4f77328104498504339216829abf5ea87e2791ec;hp=38217e922aa0633089bffccaa105f03f85096ca5;hpb=2b8c0785318a3528e1876e8e2dd48b7d831eae69;p=jalview.git diff --git a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java index 38217e9..8545e94 100644 --- a/src/jalview/analysis/scoremodels/FeatureDistanceModel.java +++ b/src/jalview/analysis/scoremodels/FeatureDistanceModel.java @@ -55,17 +55,20 @@ public class FeatureDistanceModel extends DistanceScoreModel @Override public ScoreModelI getInstance(AlignmentViewPanel view) { - FeatureDistanceModel model; + FeatureDistanceModel instance; try { - model = this.getClass().newInstance(); - model.configureFromAlignmentView(view); - return model; + instance = this.getClass().getDeclaredConstructor().newInstance(); + instance.configureFromAlignmentView(view); + return instance; } catch (InstantiationException | IllegalAccessException e) { System.err.println("Error in " + getClass().getName() + ".getInstance(): " + e.getMessage()); return null; + } catch (ReflectiveOperationException roe) + { + return null; } } @@ -188,7 +191,7 @@ public class FeatureDistanceModel extends DistanceScoreModel protected Map> findFeatureTypesAtColumn( SeqCigar[] seqs, int columnPosition) { - Map> sfap = new HashMap>(); + Map> sfap = new HashMap<>(); for (SeqCigar seq : seqs) { int spos = seq.findPosition(columnPosition); @@ -197,7 +200,7 @@ public class FeatureDistanceModel extends DistanceScoreModel /* * position is not a gap */ - Set types = new HashSet(); + Set types = new HashSet<>(); List sfs = fr.findFeaturesAtResidue( seq.getRefSeq(), spos); for (SequenceFeature sf : sfs)