From: <rv...@us...> - 2011-06-10 14:52:00
|
Revision: 907 http://treebase.svn.sourceforge.net/treebase/?rev=907&view=rev Author: rvos Date: 2011-06-10 14:51:54 +0000 (Fri, 10 Jun 2011) Log Message: ----------- Now using a study ID that actually has character sets, and added some defensive programming to prevent null pointer exceptions in cases where no increment has been defined for the column range (in which case we default to an increment of 1, i.e. a contiguous range). Modified Paths: -------------- trunk/treebase-core/src/test/java/org/cipres/treebase/domain/nexus/NexmlMatrixConverterTest.java Modified: trunk/treebase-core/src/test/java/org/cipres/treebase/domain/nexus/NexmlMatrixConverterTest.java =================================================================== --- trunk/treebase-core/src/test/java/org/cipres/treebase/domain/nexus/NexmlMatrixConverterTest.java 2011-06-10 14:46:37 UTC (rev 906) +++ trunk/treebase-core/src/test/java/org/cipres/treebase/domain/nexus/NexmlMatrixConverterTest.java 2011-06-10 14:51:54 UTC (rev 907) @@ -34,7 +34,7 @@ logger.info("Running Test: " + testName); } - long studyId = 1787; + long studyId = 794; // this study seems to have character sets // this is the full study as it is stored by the database Study tbStudy = (Study)loadObject(Study.class, studyId); @@ -91,12 +91,19 @@ int start = tbColumnRange.getStartColIndex(); int stop = tbColumnRange.getEndColIndex(); - // this is how we increment from beginning to end. This number is probably either 1, for a - // contiguous range, or 3 for codon positions - int inc = tbColumnRange.getRepeatInterval(); + // this is how we increment from beginning to end. This number is probably either null, for a + // contiguous range, or perhaps 3 for codon positions + int inc = 1; + // need to do this to prevent nullpointerexceptions + if ( null != tbColumnRange.getRepeatInterval() ) { + inc = tbColumnRange.getRepeatInterval(); + } + // this is how we create the equivalent nexml character set - Subset nexSubset = nexMatrix.createSubset(tbCharSet.getLabel()); + // you will need to update CharSet to get the new implementation of getLabel(), which + // returns the same value as getTitle() + Subset nexSubset = nexMatrix.createSubset(tbCharSet.getLabel()); // we have to assign character objects to the subset. Here we get the full list List<org.nexml.model.Character> nexCharacters = nexMatrix.getCharacters(); @@ -110,6 +117,7 @@ } } Assert.assertTrue("Searched for equivalent to NeXML matrix "+nexId, foundEquivalentMatrix); + System.out.println(nexDoc.getXmlString()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |