Forums Register Login
Returning array from bean
Hello All,

I want to return array from getter methods of my bean, but findbugs show error as "may expose internal representation". what is the resolution for it? how should i return array from my bean class?
Either you can ignore the warning or you can create an identical local array, copy all values over then return the new array.
You only want to do it if you really want to restrict user from manipulating your array (internal state) indirectly (i.e. not via your object method, but to get the array, and manipulate its values hence your internal array changes accordingly).
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Rocket Oven Kickstarter - from the trailboss

This thread has been viewed 1958 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 17, 2018 03:58:12.