The following code:
--- begin ---
try
{
java.net.InetAddress ia = java.net.InetAddress.getLocalHost();
}
catch (java.net.UnknownHostException e)
{
// Do something
}
--- end ---
gives me this:
--- begin ---
SIGSEGV 11* segmentation violation
stackbase=0xbffff1f0, stackpointer=0xbffff0f8
Full thread dump:
"Finalizer thread" (TID:0x4065a210, sys_thread_t:0x4139ef04, state:R) prio=1
"Async Garbage Collector" (TID:0x4065a258, sys_thread_t:0x4137df04, state:R)
prio=1
"Idle thread" (TID:0x4065a2a0, sys_thread_t:0x4135cf04, state:R) prio=0
"Clock" (TID:0x4065a088, sys_thread_t:0x4133bf04, state:CW) prio=12
"main" (TID:0x4065a0b0, sys_thread_t:0x818de00, state:R) prio=5 *current thr
ead*
java.lang.Runtime.loadLibrary(Runtime.java)
java.lang.System.loadLibrary(System.java)
java.net.InetAddress.<clinit>(InetAddress.java)
NBody.main(NBody.java:57)
Monitor Cache Dump:
java.lang.Runtime@1080418848/1080793064: owner "main" (0x818de00, 1 entry)
Registered Monitor Dump:
Thread queue lock: <unowned>
Name and type hash table lock: <unowned>
String intern lock: <unowned>
JNI pinning lock: <unowned>
JNI global reference lock: <unowned>
BinClass lock: <unowned>
Class loading lock: <unowned>
Java stack lock: <unowned>
Code rewrite lock: <unowned>
Heap lock: <unowned>
Has finalization queue lock: <unowned>
Finalize me queue lock: <unowned>
Dynamic loading lock: owner "main" (0x818de00, 1 entry)
Monitor IO lock: <unowned>
Child death monitor: <unowned>
Event monitor: <unowned>
I/O monitor: <unowned>
Alarm monitor: <unowned>
Waiting to be notified:
"Clock" (0x4133bf04)
Monitor registry: owner "main" (0x818de00, 1 entry)
Thread Alarm Q:
Abort
--- end ---
It's interesting that with my other PC, using a different distribution
(SUSE) but the same JDK (1.1.7v1a) all works.
I suppose there is a system misconfiguration and I'll fix this, but
shouldn't getLocalHost() handle a bit better the problem and send an
exception, instead of crashing?
PS: can you guess how does Java tries to get the hostname?
---
Andrea "Kontorotsui" Controzzi - MALE Student of Computer Science at
University of Pisa - Italy - E-mail: [EMAIL PROTECTED]
My home page: http://www.cli.di.unipi.it/~controzz/intro.html
Founder and Admiral of Hoshi no Senshi (italian Leiji Matsumoto's fan group).
Creator of It.Arti.Cartoni (italian anime newsgroup) and proud member of...
+-------------------------------------------------------------+
| . * . |
| . __ . . |
| oq | po _ _ |
| / #==>>>==# ,-' (_)\ |
| | ,-|~\\ ///_ ,() ,_____} |
| | |/|~]]] /// ,-~' .,~ / \| . |
| |\_|_|_\_\~~----~~' \ ( /| . |
| . /~ \___/ [m] \ \__// |
| _bo..__ // `-,.~~ |
| _-~ 0000000000000ooooo.__ ( . |
| \ 000000000000000000000000o . |
| . (_)0000000000000000000000 |
| . \~~~*,,,* ~000000000000000000 |
| ~0000000000000 . |
| ~~~---~~ |
| .* |
+-------------------------------------------------------------+
| An e-mail network of Space Cruiser Yamato and |
| StarBlazers Fans |
+-------------------------------------------------------------+