• Post Reply Bookmark Topic Watch Topic
  • New Topic

Making the Clone method final  RSS feed

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you really need to make your class cloneable, then there are some protective measures you can take to prevent attackers from redefining your clone method. If you're defining your own clone method, just make it final like this :


public final void clone() throws java.lang.CloneNotSupportedException

{
super.clone();
}

This may be a stupid question .But i could not think beyond right now as
My doubt is that How can a attacker chnage our defined Object?? in a web based application or a product?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!