# HG changeset patch # User Ingo Weinzierl # Date 1338125970 0 # Node ID c9815016a3bb122f33e15e844caac2dbfea2acab # Parent 19c119601111fe342460258cf2935a20fe696df8 Merged revisions 4536 via svnmerge from file:///home/clients/bsh/bsh-generischer-viewer/Material/SVN/flys-artifacts/trunk ........ r4536 | ingo | 2012-05-27 15:35:15 +0200 (So, 27 Mai 2012) | 1 line Added more checks in CrossSectionFactory.isNewst() to prevent IndexOutOfBoundsExceptions. ........ flys-artifacts/tags/2.7@4538 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 19c119601111 -r c9815016a3bb flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Sun May 27 10:50:11 2012 +0000 +++ b/flys-artifacts/ChangeLog Sun May 27 13:39:30 2012 +0000 @@ -1,3 +1,10 @@ +2012-05-27 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/model/CrossSectionFactory.java: + CrossSectionFactory.isNewest() will return true if the CrossSection is + the only CrossSection found in the database. No IndexOutOfBounds is + thrown. + 2012-05-27 Ingo Weinzierl * Tagged module as '2.7'. diff -r 19c119601111 -r c9815016a3bb flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFactory.java Sun May 27 10:50:11 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionFactory.java Sun May 27 13:39:30 2012 +0000 @@ -64,8 +64,15 @@ + " order by timeInterval.stopTime desc, timeInterval.startTime desc"); query.setParameter("riverid", section.getRiver().getId()); - CrossSection cs = (CrossSection) query.list().get(0); - return section.getId().equals(cs.getId()); + List result = query.list(); + + if (result == null || result.isEmpty()) { + return true; + } + else { + CrossSection cs = (CrossSection) result.get(0); + return section.getId().equals(cs.getId()); + } }