You searched for exceptions. We found 168 results in 0.043 seconds.

Arrays.sort does not work in java

I am having a custom class called Company, and it has fields being latitude and longitude. I want to sort them based on distance from current location but it does not seem to...
Jon Skeet
people
quotationmark

Now we can see the string values for the latitude and longitude, I suspect I know the problem. Double.parseDouble will throw an exception for a string like this: 41,352979. My guess is that somewhere you're catching Exception and... more

people

BufferedReader Initialization hangs?

I'm trying to read content from the web(more specifically wikipedia) and whenever it's a wiki page that doesn't exist(ie. http://en.wikipedia.org/wiki/Asdfasdfasdfasdf) my...
Jon Skeet
people
quotationmark

I strongly suspect that it's not hanging - it's just throwing an exception without you noticing. I'd expect it to throw a FileNotFoundException, which is what happens when I tried it. It's happening before readLine() because... more

people

Java BufferedWriter very slow 300 MB of data

I'm reading a text file consisting of fixed length records line by line and append some values and then write to another file. As usual, I used BufferedWriter, and found that it...
Jon Skeet
people
quotationmark

You've got at least two problems here: You're reopening the output file on each iteration. That's pretty much bound to be slow. Open it once at the same time you open the reader. You're not closing either the reader or the writer on... more

people

getCause() function of Throwable class (in Java) is not working as expected

I am getting null while calling the getCause function of Throwable. package com.salman.demo; public class MyClass { public static void main(String[] args) { // TODO...
Jon Skeet
people
quotationmark

The ValidationException you've thrown will be th in your calling code... there's no cause for that ValidationException. The point of getCause() is for one exception to be able to refer to another one as an underlying cause - but there's... more

people

Error parsing data org.json.JSONException , already try other post

I know there are several posts with the same error, but I've proven solutions and still have the same error Log.txt: 03-18 18:32:33.082: D/gralloc_goldfish(974): Emulator...
Jon Skeet
people
quotationmark

You're parsing an empty string, because you never assign a different value to json. You make a request, and set is to refer to the input stream from the response - but you then don't use is. You might want: JObj = new JSONObject(new... more

people

How to return value from the method in C#

It might be a small question, but i am not understanding why it is throwing error. Error: Use of unassigned local variable status. public static bool...
Jon Skeet
people
quotationmark

There are two problems here: 1) You've declared a local variable a static. That's invalid. 2) If an exception is thrown early in your method, you're catching it and then trying to return status without ever assigning a value to it. I... more

people

Why TcpClient.Connect is not throwing exception in async method even if it is running synchroneously

Why this code is not throwing System.Net.Sockets.SocketException even if no await is specified? (no server is listening at specified port ) Why Thread.Sleep(4000); is not...
Jon Skeet
people
quotationmark

An async method never throws an exception directly. Instead, if an exception is raised within the body of the method, the task returned by the async method becomes faulted. The sleep isn't executed because the exception does prevent the... more

people

The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'IMS.Models.Dealer'

I know there are a lot of similar questions here, but none of them could solve my problem. When I access the URL: http://localhost:42626/dealer/edit/2 Error occurs: The...
Jon Skeet
people
quotationmark

Currently if the dealer ID can't be found, you're calling RedirectToAction, but ignoring the result and then trying to return your view with the dealer ID. I suspect you want: [HttpGet] public ActionResult Edit(int dealerId = 0) { ... more

people

Java Tcp socket sending extra data?

I have a class that will send data in java, the server requires a certain string to actually work. I am sending the correct string, this is the connection and sending process: ...
Jon Skeet
people
quotationmark

My problem is that I don't want that to be sent, I am making sure that the string I am sending it has no extra white space at the end to create this. No, you're not. Look at your code: sendingStream.println("00 0012552 003365... more

people

Is constructor returning object never used wasteful?

I'm working with a code base that instantiates objects without assigning to a variable, like so: new MyNonStaticClass(); Inside the constructor are calls to static...
Jon Skeet
people
quotationmark

Is there a performance benefit to changing these to static classes? Yes - you won't be constructing a load of pointless objects which the GC then has to collect. Is that significant in your application? Hard to tell. More... more

people