Exception message is null?
I have a try-catch statement in my code. In my catch block, I am calling e.getMessage() to print the message of the exception. However, e.getMessage keeps returning a null value. Interestingly, when I call e.printStackTrace, I have no problem printing the stack trace.
Below is my code:
try
{
console = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
}catch(Exception e)
{
Log.d("Error", "Error Message: " + e.getMessage()); //e.getMessage is returning a null value
e.printStackTrace(); //this works. is displaying a SocketTimeOutException
}
What could be the cause of my problem? How do I solve it?
Copyright License: Author:「Arci」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer. Link to:https://stackoverflow.com/questions/8613408/exception-message-is-null
About “Exception message is null?” questions
I found that exception message can't be null in C#, and after trying this
var ex = new Exception(null);
Console.WriteLine(ex.Message);
I get the following message:
Exception of type 'System.
|
I have a try-catch statement in my code. In my catch block, I am calling e.getMessage() to print the message of the exception. However, e.getMessage keeps returning a null value. Interestingly, whe...
|
Even though I have entered a custom message, that is not being printed when I print the message. Code below:
public void run() throws Exception {
try {
String poNumber=null;
if(
|
When I use MailClient in C# to send an email, it throws argument null exception which indicates my message is null.
But I confirm my message is a html table instead of null.
Does anyone have simi...
|
I have ASP.Net WebAPI based application. Below is my DTO.
public class CustomerTO
{
[Required(ErrorMessage="Name required")]
[StringLength(50, MinimumLength = 3, ErrorMessage = "Name inv...
|
I've written simple test for using JGroups.
There are two simple applications like this
import org.jgroups.*;
import org.jgroups.conf.ConfiguratorFactory;
import org.jgroups.conf.ProtocolConfigur...
|
I build android app voice recognition command to control devices over embedded bluetooth, i use example code BluetoothChat to send voice recognition result. but i got an error like this.
enter FATAL
|
I want to get unread message from a particular number by the following code .
public void getUnreadMessage() {
Cursor smsInboxCursor1 = getContentResolver().query(
Uri.par...
|
I just recently got put on a project at my company which uses ELMAH in an C# MVC project that uses .NET 4.6.2. I've never used ELMAH before so this question may be dumb but I haven't been able to ...
|
why is the value of MESSAGE_TEXT null?
Other variables are set.
BEGIN -- Continue Handler
DECLARE CONTINUE HANDLER FOR SQLSTATE '42000'
BEGIN -- Continue Handling
SET vErrHandler = 'CONTI...
|
|
|