2017-01-27 11 views
5

का उपयोग करते समय मैं टेलीग्राम बॉट बनाने की कोशिश कर रहा हूं और मेरा कोड पहले से ही काम करता है, लेकिन अचानक मैं अपना प्रोग्राम शुरू नहीं कर सकता, क्योंकि यह निम्न त्रुटि से क्रैश हो जाता है। मैंने कोई कोड नहीं बदला या कुछ भी नहीं किया।java.lang.NegativeArraySizeException URLConnection

शायद यह ऑपरेटिंग सिस्टम की एक बग है?

Exception in thread "main" javax.net.ssl.SSLException: java.security.ProviderException: java.lang.NegativeArraySizeException 
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) 
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949) 
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1906) 
    at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1889) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1410) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) 
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559) 
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) 
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) 
    at test.main(test.java:10) 
Caused by: java.security.ProviderException: java.lang.NegativeArraySizeException 
    at sun.security.ec.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:147) 
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:703) 
    at sun.security.ssl.ECDHCrypt.<init>(ECDHCrypt.java:77) 
    at sun.security.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:721) 
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:281) 
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979) 
    at sun.security.ssl.Handshaker.process_record(Handshaker.java:914) 
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062) 
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) 
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) 
    ... 5 more 
Caused by: java.lang.NegativeArraySizeException 
    at sun.security.ec.ECKeyPairGenerator.generateECKeyPair(Native Method) 
    at sun.security.ec.ECKeyPairGenerator.generateKeyPair(ECKeyPairGenerator.java:128) 
    ... 14 more 

कभी कभी एक विभाजन गलती में कोड परिणाम:

import java.net.URL; 
import java.net.URLConnection; 
import java.io.IOException; 
import java.net.MalformedURLException; 

class test { 
    public static void main(String[] args) throws IOException, MalformedURLException { 
     URL url = new URL("https://api.telegram.org/bot<ID>/getUpdates?offset=0"); 
     URLConnection c = url.openConnection(); 
     c.connect(); 
    } 
} 

मैं फेडोरा 25 और OpenJDK पर कोड चल रहा हूँ:

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# SIGSEGV (0xb) at pc=0x00007f2b1fb65711, pid=3982, tid=0x00007f2b2081f700 
# 
# JRE version: OpenJDK Runtime Environment (8.0_111-b16) (build 1.8.0_111-b16) 
# Java VM: OpenJDK 64-Bit Server VM (25.111-b16 mixed mode linux-amd64 compressed oops) 
# Problematic frame: 
# C [libc.so.6+0x14f711] __memmove_avx_unaligned_erms+0x211 
# 
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again 
# 
# An error report file with more information is saved as: 
# /tmp/hs_err_pid3982.log 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.java.com/bugreport/crash.jsp 
# 
Aborted (luotiin core-tiedosto) 

मिनिमल कोड त्रुटि पुन: पेश करने।

$ uname -a 
Linux localhost.localdomain 4.9.5-200.fc25.x86_64 #1 SMP Fri Jan 20 12:24:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 
$ java -version 
openjdk version "1.8.0_111" 
OpenJDK Runtime Environment (build 1.8.0_111-b16) 
OpenJDK 64-Bit Server VM (build 25.111-b16, mixed mode) 
+2

फेडोरा पर हाल ही में एनएसएस अपडेट के कारण होने वाला प्रतीत होता है, https://bugzilla.redhat.com/show_bug.cgi?id=1415137 देखें – vip

उत्तर

4

एनएसएस पुस्तकालयों के अपने संस्करण की जांच करें, एनएसएस 3.28 जावा के लिए सामान तोड़ने लगता है। यह gentoo पर भी होता है: https://bugs.gentoo.org/show_bug.cgi?id=605430

एनएसएस 3.27.x को डाउनग्रेड करने से यह मेरे और अन्य लोगों के लिए भी तय किया गया है।

संबंधित मुद्दे