From: SourceForge.net <no...@so...> - 2004-02-13 12:36:52
|
Bugs item #895973, was opened at 2004-02-12 20:06 Message generated for change (Comment added) made by egonw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120024&aid=895973&group_id=20024 Category: cdk-io module Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Egon Willighagen (egonw) Summary: java.lang.OutOfMemoryError with IteratingMDLReader Initial Comment: Hello, I get an java.lang.OutOfMemoryError if I access the IteratingMDLReader.next() function. Example program: FileReader fileReader = new FileReader( args[1] ); IteratingMDLReader reader = new IteratingMDLReader( fileReader ); while( reader.hasNext() ) reader.next(); The first call of reader.next() leads to the OutOfMemoryError. I really appreaciate any help. Uli ---------------------------------------------------------------------- >Comment By: Egon Willighagen (egonw) Date: 2004-02-13 13:34 Message: Logged In: YES user_id=25678 I've applied to suggested fixes (Thanx Sulev!). About the throws Exception. It's specified by the Iterator interface, and indeed should have been implemented as such. ---------------------------------------------------------------------- Comment By: Sulev Sild (sulev) Date: 2004-02-13 13:21 Message: Logged In: YES user_id=887540 One more thing. According to the Iterator interface specification, this method should throw NoSuchElementException if there is no next element. With the current implementation an empty molecule is returned which is against the spec. ---------------------------------------------------------------------- Comment By: Sulev Sild (sulev) Date: 2004-02-13 13:18 Message: Logged In: YES user_id=887540 The next() method has problem that no next line is read in the while cycle. Thus the first line is appended to the buffer over and over, eventually overflowing. Add "currentLine = input.readLine();" after "buffer.append(currentLine);". There is another problem in this method as well. "input.readLine();" will strip newline and parsing of the molecule will fail. Therefore "buffer.append(currentLine);" should be replaced with "buffer.append(currentLine + "\n");" After these changes, it should work OK. ---------------------------------------------------------------------- Comment By: Christoph Steinbeck (steinbeck) Date: 2004-02-12 21:57 Message: Logged In: YES user_id=54358 It would be great to learn something about the boundary conditions of the occurence of this bug. How many where present in the file? Can we get a copy of this file? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=120024&aid=895973&group_id=20024 |