IOException while trying to read the file - file

me and my friend are creating android application for our studies which works like KeePass.
The problem is that this application works on my friend phone with Android 4.0.3 and on my phone with Android 4.4.2 KitKat it doesn't. Why?
I can create database file with no exceptions, but when I try to log in it throws IOException. We think that this exception might be thrown by FileInputStream but we don't have any idea why.
Here is the code where the exception appears:
public void onClickLogon(View view){
_db = null;
FileInputStream fis = null;
try {
fis = openFileInput(this.login.getText().toString() + ".db");
_db = (PasswordDatabase) com.example.tomus.passwordwalletbeta.Security.decrypt(fis, this.login.getText().toString(), this.password.getText().toString());
fis.close();
if(_db==null){
this.info.setText("Wrong informations.");
}
else {
Intent intent = new Intent(MainActivity.this, LoggedActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("db", _db);
bundle.putString("login", login.getText().toString());
bundle.putString("password", password.getText().toString());
intent.putExtras(bundle);
this.login.setText("");
this.password.setText("");
startActivity(intent);
}
} catch (InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException e) {
this.info.setText("Wrong informations.");
} catch (FileNotFoundException e) {
this.info.setText("FileNotFound");
} catch (IOException e) {
this.info.setText("IOException");
}
}
#Edit: Here is error log, now I can see that file cannot be found. Was there any changes to creating files or pathing in 4.4.2?
Process: com.example.tomus.passwordwalletbeta, PID: 5495
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3857)
at android.view.View.performClick(View.java:4487)
at android.view.View$PerformClick.run(View.java:18746)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5077)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3852)
at android.view.View.performClick(View.java:4487)
at android.view.View$PerformClick.run(View.java:18746)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5077)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.StreamCorruptedException
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:2070)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:371)
at com.example.tomus.passwordwalletbeta.Security.decrypt(Security.java:82)
at com.example.tomus.passwordwalletbeta.MainActivity.onClickLogon(MainActivity.java:74)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3852)
at android.view.View.performClick(View.java:4487)
at android.view.View$PerformClick.run(View.java:18746)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:149)
at android.app.ActivityThread.main(ActivityThread.java:5077)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)

Related

Why Doesnt my 'AssertEquals()' method Fail?

Why doesn't my assert method fail when the two strings clearly do not match?
public void checkHomepageURL_Test1() throws Exception {
basePage.loadHomePage();
try {
System.out.println("inside try block");
Assert.assertEquals("Actual String Expected", "Im Wrong!");
System.out.println("inside try block SECOND!!");
} catch (Throwable e) {
System.out.println("BETA!!!!!!" + e.getMessage());
} finally {
System.out.println("All over now!");
}
}
New Examaple
When an assert fails it throws an Throwable. Since you have your assert inside a try-catch block, when that Throwable is raised, it will be captured by the catch block, your program will log ""BETA!!!!!!" + e.getMessage()" and then it will finish properly.
You should either:
remove your try catch block
catch Exception instead of Throwable
(the first option is the proper one for a test AFAIK)
If you remove the Catch, your error will be printed as follows in your console.
org.junit.ComparisonFailure:
Expected :Actual String Expected
Actual :Im Wrong!
<Click to see difference>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at com.scouto.test.checkHomepageURL_Test1(test.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

Error while processing the process instance in jbpm 6.4

I am triggering a process from camel to jbpm using following code.
from("timer://foo?fixedRate=true&period=500&repeatCount=1").routeId("mainRoute")
.to("log:Hello?showAll=true&multiline=true")
.process(new Processor() {
#Override
public void process(Exchange exchange) throws Exception {
`enter code here`for (Object obj : exchange.getIn().getHeaders().entrySet()) {
Map.Entry<String, Object> entry = (Map.Entry<String, Object>) obj;
System.out.println(entry.getKey() + "/" + entry.getValue());
}
final Map map = new HashMap();
map.putAll(exchange.getIn().getHeaders());
map.put("pv_candidate_name", "Hello");
exchange.getOut().setHeader("CamelJBPMParameters", map);
}
})
.setHeader(JBPMConstants.PROCESS_ID, constant("npproj.emp_recruitment3"))
.to("jbpm:http://127.0.0.1:8080/kie-wb64?userName=admin&password=xxx&deploymentId=com.nobleprog:npproj:1.0")
.convertBodyTo(String.class)
.to("log:Hello?showAll=true&multiline=true");
I logged in to bpm system and try to perform the task getting the following error in jbpm .
13:07:35,498 ERROR [org.guvnor.common.services.backend.exceptions.ExceptionUtilities] (default task-7) Exception thrown: IOException while loading process instance: Error deserializing process instance.: java.lang.IllegalArgumentException: IOException while loading process instance: Error deserializing process instance.
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:193) [jbpm-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:166) [jbpm-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.persistence.processinstance.JPAProcessInstanceManager.getProcessInstance(JPAProcessInstanceManager.java:139) [jbpm-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:286) [jbpm-flow-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.process.instance.ProcessRuntimeImpl.getProcessInstance(ProcessRuntimeImpl.java:282) [jbpm-flow-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.process.instance.ProcessRuntimeImpl.abortProcessInstance(ProcessRuntimeImpl.java:492) [jbpm-flow-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.impl.StatefulKnowledgeSessionImpl.abortProcessInstance(StatefulKnowledgeSessionImpl.java:538) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.runtime.process.AbortProcessInstanceCommand.execute(AbortProcessInstanceCommand.java:55) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.runtime.process.AbortProcessInstanceCommand.execute(AbortProcessInstanceCommand.java:30) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.impl.DefaultCommandService.execute(DefaultCommandService.java:36) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:592) [drools-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:82) [drools-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:41) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73) [drools-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
Caused by: java.io.IOException: Error deserializing process instance.
at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.readProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:477) [jbpm-flow-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.persistence.processinstance.ProcessInstanceInfo.getProcessInstance(ProcessInstanceInfo.java:185) [jbpm-persistence-jpa-6.4.0.Final.jar:6.4.0.Final]
... 74 more
Caused by: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl
at org.drools.core.common.ProjectClassLoader.tryDefineType(ProjectClassLoader.java:187) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.common.ProjectClassLoader.loadType(ProjectClassLoader.java:177) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.common.ProjectClassLoader.loadClass(ProjectClassLoader.java:143) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) [rt.jar:1.7.0_79]
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_79]
at java.lang.Class.forName(Class.java:274) [rt.jar:1.7.0_79]
at org.drools.core.util.ClassUtils.getClassFromName(ClassUtils.java:755) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:57) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.common.DroolsObjectInputStream.resolveClass(DroolsObjectInputStream.java:62) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) [rt.jar:1.7.0_79]
at java.util.ArrayList.readObject(ArrayList.java:771) [rt.jar:1.7.0_79]
at sun.reflect.GeneratedMethodAccessor158.invoke(Unknown Source) [:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_79]
at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_79]
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1893) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) [rt.jar:1.7.0_79]
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) [rt.jar:1.7.0_79]
at org.drools.core.marshalling.impl.SerializablePlaceholderResolverStrategy$SerializablePlaceholderStrategyContext.read(SerializablePlaceholderResolverStrategy.java:93) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.marshalling.impl.PersisterHelper.loadStrategiesIndex(PersisterHelper.java:327) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.marshalling.impl.PersisterHelper.loadStrategiesCheckSignature(PersisterHelper.java:273) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.drools.core.marshalling.impl.PersisterHelper.readFromStreamWithHeaderPreloaded(PersisterHelper.java:289) [drools-core-6.4.0.Final.jar:6.4.0.Final]
at org.jbpm.marshalling.impl.AbstractProtobufProcessInstanceMarshaller.readProcessInstance(AbstractProtobufProcessInstanceMarshaller.java:474) [jbpm-flow-6.4.0.Final.jar:6.4.0.Final]
... 75 more
Do I need any configuration in jbpm ? please guide
Resolved.
Added these paths to the sun/jdk/main/module.xml file in wildfly 8.
path name="com/sun/org/apache/xerces/internal/jaxp/datatype"
path name="com/sun/jndi/rmi"
Trying to find the reason.

I am working on ical4j and there is a parsing error when building a calendar. There is no illegal character in the .ics file.How to overcome it?

This is the code i am using for building an .ics file using CalendarBuilder class of ical4j. Earlier i was using FileInputStream instead of buffer but there was a "PushBackBuffer Overflow" error.I used an alternative method to increase the size of the buffer where i found this error.
Calendar c=new Calendar();
try
{br=new BufferedReader( new InputStreamReader(new FileInputStream(new File("D:\\calendar.ics"))),3000);
}
catch(FileNotFoundException e)
{
e.printStackTrace();
}
try
{
UnfoldingReader reader = new UnfoldingReader(br, 3000);
c=builder.build(reader);
}
catch(Exception e)
{
e.printStackTrace();
}
ERROR:
[Fatal Error] :1:1: Content is not allowed in prolog.
net.fortuna.ical4j.data.ParserException: Error at line 1:Could not parse XML
at net.fortuna.ical4j.data.HCalendarParser.parse(HCalendarParser.java:224)
at net.fortuna.ical4j.data.HCalendarParser.parse(HCalendarParser.java:212)
at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:210)
at hello.CalendarRepository.createEvent(CalendarRepository.java:122)
at hello.CalendarEndpoint.createEventRequest(CalendarEndpoint.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:134)
at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.invokeInternal(DefaultMethodEndpointAdapter.java:291)
at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:55)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347)
at net.fortuna.ical4j.data.HCalendarParser.parse(HCalendarParser.java:217)
... 42 more

Testng Boolean Assertions java.lang.ExceptionInInitializerError

I get this error while running the Testng program:
java.lang.ExceptionInInitializerError
at com.org.dnb.po.test.loginpagePOTest.verifyLoginpagecontrols(loginpagePOTest.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
I have two classes one for definition(class-1) and other is test(class-2)
Class 1 :
public static List<WebElement> unameBox1= driver.findElements(By.xpath(".//*[#id='username']"));
public static boolean unameboxIT = unameBox1.size() > 0;
Class2:
#Test(priority=1)
public void verifyLoginpagecontrols(){
Assert.assertTrue(unameboxIT); // Always goes into Exception as shown above
}
kindly help

C2DM not being send- No subject alternative DNS name matching android.clients.google.com found

Hi I have the following code which is supposed to c2dm to an android device. When I run it on my local machine, I get an error
stating: Exception in thread "main"
javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: No subject alternative DNS
name matching android.clients.google.com found.
Does anyone
public class MessageUtil
{
private final static String AUTH = "authentication";
private static final String UPDATE_CLIENT_AUTH = "Update-Client-Auth";
public static final String PARAM_REGISTRATION_ID = "registration_id";
public static final String PARAM_DELAY_WHILE_IDLE = "delay_while_idle";
public static final String PARAM_COLLAPSE_KEY = "collapse_key";
private static final String UTF8 = "UTF-8";
public static void main(String args[]) throws IOException
{
String auth_token=AuthenticationUtil.token;
String registrationId="c2dmregistration id of the device";
String message_title="Test";
int response=sendMessage(auth_token, registrationId,message_title);
System.out.println(response);
}
public static int sendMessage(String auth_token, String registrationId,String message_title) throws IOException
{
URL url = new URL("https://android.clients.google.com/c2dm/send");
StringBuilder postDataBuilder = new StringBuilder();
postDataBuilder.append(PARAM_REGISTRATION_ID).append("=").append(registrationId);
postDataBuilder.append("&").append(PARAM_COLLAPSE_KEY).append("=").append("0");
postDataBuilder.append("&").append("data.payload").append("=").append(URLEncoder.encode(message_title, UTF8));
byte[] postData = postDataBuilder.toString().getBytes(UTF8);
HttpURLConnection conn= (HttpURLConnection)url.openConnection();
conn.setDoOutput(true);
conn.setUseCaches(false);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
conn.setRequestProperty("Content-Length",Integer.toString(postData.length));
conn.setRequestProperty("Authorization", "GoogleLogin auth="+ auth_token);
OutputStream out = conn.getOutputStream();
out.write(postData);
out.close();
int responseCode = conn.getResponseCode();
return responseCode;
}
}
When I run this code, I'm getting the following error:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative DNS name matching android.clients.google.com found.
at sun.security.ssl.Alerts.getSSLException(Unknown Source)
at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
at sun.security.ssl.Handshaker.processLoop(Unknown Source)
at sun.security.ssl.Handshaker.process_record(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
at com.metalclub.mobile.inbox.MessageUtil.sendMessage(MessageUtil.java:45)
at com.metalclub.mobile.inbox.MessageUtil.main(MessageUtil.java:24)
Caused by: java.security.cert.CertificateException: No subject alternative DNS name matching android.clients.google.com found.
at sun.security.util.HostnameChecker.matchDNS(Unknown Source)
at sun.security.util.HostnameChecker.match(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkIdentity(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
... 14 more
You're sending the message to the wrong API endpoint. The correct URL is https://android.apis.google.com/c2dm/send

Resources