Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Please help  RSS feed

 
Chintan Shah
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i try to do the following:

private static final HostnameVerifier DO_NOT_VERIFY = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; }};

It give me error illegal start of expression.
I am doing this inside Main.
Why does this happen?

Thanks to all in advance
Chintan
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Illegal start usually means there was something missing right before the location it gives you. You may have several syntax problems but it's hard to say exactly what they are without more surrounding code.

So I'll guess. You hinted this is "inside main()" which would have some issues. You probably want that private variable outside main() and just inside the class body. It needs a closing semi-colon, too. The "public boolean verify" is a full blown method definition which should also be outside main().

See if those guesses ring true. If you still have trouble, post a little bigger chunk of code. Try the CODE button below the editor to help preserve your indentation and line breaks.
 
Chintan Shah
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks James that worked.
Chintan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!