exception

unknown host exception

梦想的初衷 提交于 2019-12-31 04:40:46
问题 try { { long startTime = System.currentTimeMillis(); String source="s"; String source1="s"; URL google = new URL("http://google.com/"); HttpURLConnection yc =(HttpURLConnection)google.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { source=source.concat(inputLine); } in.close(); yc.disconnect(); } long endTime1 = System.currentTimeMillis(); System.out.println("Total elapsed

Android Volley ECONNRESET

社会主义新天地 提交于 2019-12-31 04:30:12
问题 I try to use Volley library and upload image to server. This library should do this process in standalone mode, but have got following error message: java.net.SocketException: sendto failed: ECONNRESET (Connection reset by peer) Is it maybe a server side misconfiguration? I try to upload a jpeg image with this code: private void uploadImage(){ final ProgressDialog loading = ProgressDialog.show(this,"Uploading...","Please wait...",false,false); StringRequest stringRequest = new StringRequest

gwt java.lang.ExceptionInInitializerError

╄→гoц情女王★ 提交于 2019-12-31 04:30:10
问题 I'm working on a GWT app, and keep getting the error shown below. I followed the GWT tutorial regarding naming conventions for servlet classes, and followed the Service / Async / ServiceImpl structure. I also tried adding the -XX:-UseSplitVerifier VM argument to fix a previous problem. any ideas on what's going on? SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call java.lang.ExceptionInInitializerError at sun.reflect.NativeConstructorAccessorImpl

Android Hello World Exception

北慕城南 提交于 2019-12-31 03:54:09
问题 I am trying to get this hello world android application working. I go through this installation process and read about how easy this thing is to get up and running with a "Hello World" application. I run the simple hello world application (following every step exactly as it says) and POOF... nothing. I get an error java.lang.IllegalArgumentException: Bad version: standalone at com.android.sdkstats.sdkStatsService.normalizeVersion(sdkStatsService.java:467) Any idea how to fix this? I have

Getting OutofMemoryException at runtime with the message “Insufficient memory to continue the execution of the program”

这一生的挚爱 提交于 2019-12-31 03:27:07
问题 I am getting OutofMemoryException at runtime with the message "Insufficient memory to continue the execution of the program.". I am loading the images at the start of program. Each image is 50+ MB. If the images size goes to 277 MB plus, then I get this exception. I am loading the images at once because I have to display their thumbnails at start. I was thinking of caching and paging solution. I there any possibility to use more memory of the system or somehow other solution. Thanks 回答1: You

Illegal argument exception: n must be positive

时间秒杀一切 提交于 2019-12-31 03:26:10
问题 main class: public class ECONAPP2 { static Scanner input= new Scanner(System.in); static int score = 0; static ArrayList<Integer> usedArray = new ArrayList<Integer>(); public static void main(String[] args){ app(); arrayContents(); } public static void arrayContents() { usedArray.add(2); usedArray.add(1); } app() method: public static void app() { Random generator = new Random (); int randomNumber = generator.nextInt(usedArray.size()); System.out.println(randomNumber); if (randomNumber == 2)

How to get result of Null Reference Analysis into a log file

若如初见. 提交于 2019-12-31 03:09:08
问题 I have following classes. class Tim { public Tim() { } public Tom GetTom() { return new Tom(); } } class Tom { public Tom() { } public Jim GetJim() { return new Jim(); } } class Jim { public Jim() { } public Jom GetJom() { return null; } } class Jom { public Jom() { } public string GetMagicString() { return "Hello World"; } } Its used as follows. class Program { static void Main(string[] args) { new Tim().GetTom().GetJim().GetJom().GetMagicString(); } } When I run it, a Null Reference

Compare method throw exception: Comparison method violates its general contract [duplicate]

烂漫一生 提交于 2019-12-31 02:39:27
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: why does my compare method throw exception — Comparison method violates its general contract! I've this code: class TimeComparatorTipo0 implements Comparator { @Override public int compare(Object a, Object b) { String Time1 = ((DataImportedTipo0) a).ora; Long VolTot1 = Long.parseLong(((DataImportedTipo0) a).volume_totale); String Time2 = ((DataImportedTipo0) b).ora; Long VolTot2 = Long.parseLong((

How do stack traces get generated?

我与影子孤独终老i 提交于 2019-12-31 02:18:04
问题 No single method in a program "knows" where it is on the stack. All it knows is its own little job, and it does that and returns. So when an Exception is thrown and a stack trace is printed, where does this come from? Is there implicitly a separate Thread running alongside of every application in the JVM that's monitoring the state of the program? Or does the JVM itself hold this information and the Exceptions somehow pull that data from it when they are thrown? If either of these is the case

What causes Winforms to silently discard unhandled exceptions (with no try/Catches)?

本秂侑毒 提交于 2019-12-30 23:05:56
问题 I'm in the middle of adding new functionality to my winforms controls, and part of that requires that a variable that was once always used to now be optional (if it's null, get the data from a second source). I made some changes and ran my form, only to find out nothing was happening, even functionality that previously worked. Confused I stepped through the code and found out that my Winforms user control was throwing a NullReferenceException when it encountered my variable, but in the UI no