Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database integrity check

 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
When we try to open a text file using the Data class we get a OutOfMemoryException. Due to this i've decided to implement a small integrity check on the data class. As the file size less the header length divided by the number of records should give us the record length, i've added the following code just before we create the array of field info.

Usualy when reading a text file, we get a huge number of fields, a huge header length and record count when compared with the file size. By making this comparison, when reading a text file we get values that are less than 1.
Comments please.
Thanks,
Miguel
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you trying to open a text file with the Data class?
Mark
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark.
I'm not trying to open a text file, it's just a integrity check for future users of the data class so that they will not try to do it.
Thanks,
Miguel
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Is that one of the requirements? And Doesn't the Data class constructor throw an IOException if something like this happens?
Have fun.
Mark
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
No, it's not a requirement. No it doesn't throw a IOException because when we try to read a text file we can get a number of fields with values bigger that 10000000! Can you imagine a array of FieldInfo like this?
With this check, I'm just making the Data class more robust and more bullet prof!
I don't belive that I will lost points due to this. Do you think I will?
Thanks,
Miguel
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't belive that I will lost points due to this. Do you think I will?
I can't answer that question.
But I know I didn't lose points by not changing it.
Mark
 
Miguel Roque
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark.
Thanks for your help. I will keep the Data class with this small integrity check. I've read here some old post's of people that has done it.
I'm about to finish the coding. I'me reviewing the design and reading the notes made on paper so that I can start to write my designs file.
Best regards,
Miguel
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic