From: <rv...@us...> - 2009-07-02 21:06:35
|
Revision: 163 http://treebase.svn.sourceforge.net/treebase/?rev=163&view=rev Author: rvos Date: 2009-07-02 21:06:34 +0000 (Thu, 02 Jul 2009) Log Message: ----------- Changed convertToMatrices to prevent NPEs. Modified Paths: -------------- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/search/TreeSearchResults.java Modified: trunk/treebase-core/src/main/java/org/cipres/treebase/domain/search/TreeSearchResults.java =================================================================== --- trunk/treebase-core/src/main/java/org/cipres/treebase/domain/search/TreeSearchResults.java 2009-07-02 21:02:07 UTC (rev 162) +++ trunk/treebase-core/src/main/java/org/cipres/treebase/domain/search/TreeSearchResults.java 2009-07-02 21:06:34 UTC (rev 163) @@ -77,34 +77,37 @@ // need to resurrect the study, otherwise we get a LazyInitializationException Study resurrectedStudy = getStudyService().resurrect(study); - Collection<AnalysisStep> analysisStepCollection = resurrectedStudy.getAnalysisSteps(); - // for the study we need to iterate over all analysis steps - for ( AnalysisStep analysisStep : analysisStepCollection ) { - Collection<AnalyzedData> analyzedDataCollection = analysisStep.getDataSetReadOnly(); - boolean treeIsOutput = false; - - // now we have to check any trees in the analyzedData... - for ( AnalyzedData analyzedData : analyzedDataCollection ) { - PhyloTree analyzedTree = analyzedData.getTreeData(); - String inputOutput = analyzedData.getInputOutput(); - - // if the datum is a tree, and it's an output, and it's our focal tree... - if ( inputOutput.equals("output") && analyzedTree != null && analyzedTree.getId() == phyloTree.getId() ) { - treeIsOutput = true; - } - } - // ...then... - if ( treeIsOutput ) { + if ( resurrectedStudy != null ) { + Collection<AnalysisStep> analysisStepCollection = resurrectedStudy.getAnalysisSteps(); + + // for the study we need to iterate over all analysis steps + for ( AnalysisStep analysisStep : analysisStepCollection ) { + Collection<AnalyzedData> analyzedDataCollection = analysisStep.getDataSetReadOnly(); + boolean treeIsOutput = false; + + // now we have to check any trees in the analyzedData... for ( AnalyzedData analyzedData : analyzedDataCollection ) { - Matrix analyzedMatrix = analyzedData.getMatrixData(); - String inputOutput = analyzedData.getInputOutput(); + PhyloTree analyzedTree = analyzedData.getTreeData(); + String inputOutput = analyzedData.getInputOutput(); - // collect all input matrices - if ( inputOutput.equals("input") && analyzedMatrix != null ) { - pResults.add(analyzedMatrix); - } + // if the datum is a tree, and it's an output, and it's our focal tree... + if ( inputOutput.equals("output") && analyzedTree != null && analyzedTree.getId() == phyloTree.getId() ) { + treeIsOutput = true; + } } + // ...then... + if ( treeIsOutput ) { + for ( AnalyzedData analyzedData : analyzedDataCollection ) { + Matrix analyzedMatrix = analyzedData.getMatrixData(); + String inputOutput = analyzedData.getInputOutput(); + + // collect all input matrices + if ( inputOutput.equals("input") && analyzedMatrix != null ) { + pResults.add(analyzedMatrix); + } + } + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |