• Post Reply Bookmark Topic Watch Topic
  • New Topic

arrays and generics  RSS feed

 
Brian Storenson
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to debug this web app. It's an interview problem that I'm using to learn about the Spring framework and web development. I get the following error message:
/Users/brian/Desktop/yalp/src/main/java/com/rnsolutions/model/FilesystemEntryDAO.java: /Users/brian/Desktop/yalp/src/main/java/com/rnsolutions/model/FilesystemEntryDAO.java uses unchecked or unsafe operations.

I think it has to do with using arrays, generics, and maybe collections. Am I headed in the correct direction? I'm reading about using arrays in generics right now.

 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not an error message, it's just a warning. It's usually caused by not using generics somewhere where they really ought to be used. Sometimes, though, that can't be avoided - e.g. when you're using an external library that doesn't use generics.

Does it give a particular line number? I can't see anywhere immediately obvious that would cause it. You do have what looks like an unnecessary cast on line 22, though, that might be related. Isn't CSVReader.readAll() declared to return a List<String[]> already?
 
Brian Storenson
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked my boss, and he thinks it might be the return statement. It might need to include YalpEntry.

I also figured out I am doing the problem all wrong. I have to correct the FIXME's which I thought was the warnings on the output screen. The FIXME's are in the source code. lol.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider whether you want to return an empty set or throw an Exception if you cannot parse the file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!