< prev index next >

src/java.base/windows/native/libnet/Inet4AddressImpl.c

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -357,12 +357,11 @@
                                    ReplySize,  // DWORD ReplySize,
                                    (timeout < 1000) ? 1000 : timeout); // DWORD Timeout
     }
 
     if (dwRetVal == 0) { // if the call failed
-        TCHAR *buf = NULL;
-        DWORD n;
+        TCHAR *buf;
         DWORD err = WSAGetLastError();
         switch (err) {
             case ERROR_NO_NETWORK:
             case ERROR_NETWORK_UNREACHABLE:
             case ERROR_HOST_UNREACHABLE:

@@ -378,21 +377,13 @@
             case WSAENETDOWN:       /* Network is down */
             case WSAEPFNOSUPPORT:   /* Protocol Family unsupported */
             case IP_REQ_TIMED_OUT:
                 break;
             default:
-                n = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
-                        FORMAT_MESSAGE_FROM_SYSTEM,
-                        NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                        (LPTSTR)&buf, 0, NULL);
-                if (n > 3) {
-                    // Drop final '.', CR, LF
-                    if (buf[n - 1] == TEXT('\n')) n--;
-                    if (buf[n - 1] == TEXT('\r')) n--;
-                    if (buf[n - 1] == TEXT('.')) n--;
-                    buf[n] = TEXT('\0');
-                }
+                FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+                              NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+                              (LPTSTR)&buf, 0, NULL);
                 NET_ThrowNew(env, err, buf);
                 LocalFree(buf);
                 break;
         }
     } else {
< prev index next >