kafelez / jsendnsca

Automatically exported from code.google.com/p/jsendnsca
0 stars 0 forks source link

Unknown exception when compiilng withLocalHostname() #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi there,

In the provided QuickStart.java if I change 

.withHostname("localhost")

to use the local hostname:

.withLocalHostname()

I get the following error 

Ok.java:48: unreported exception java.net.UnknownHostException; must be caught 
or declared to be thrown
            .withLocalHostname()
                              ^
Thanks in advance.

Original issue reported on code.google.com by asimeo...@gmail.com on 15 Apr 2011 at 10:03

GoogleCodeExporter commented 8 years ago
The signature of the method is

withLocalHostname() throws UnknownHostException

Therefore you need to either throw this by adding throws UnknownHostException 
to the example i.e.

public void sendPassiveAlert() throws UnknownHostException

or catch it and handle

Original comment by rajneeshpatel on 16 Apr 2011 at 10:29