classcastexception

oracle.jdbc.OracleCallableStatement cast exception

♀尐吖头ヾ 提交于 2019-12-12 00:16:07
问题 I have a problem about casting a CallableStatement to OracleCallableStatement . It gives ClassCastException like this: java.lang.ClassCastException: oracle.jdbc.driver.OracleCallableStatementWrapper cannot be cast to oracle.jdbc.driver.OracleCallableStatement And the code is: Connection conn = qdbDataSource.getConnection(); PreparedStatement pstmt = null; Connection conn2 = ((WLConnection)conn).getVendorConnection(); try { CallableStatement cs = conn2.prepareCall("{ ?=call asr.bsc(?,?,?,?,?,?

How to get String from Intent?

南笙酒味 提交于 2019-12-11 23:50:46
问题 I wrote some code to get text from the EditView, put it in the Intent Extras and set it in a TextView on other Activity. Here is my code from the sending Activity Intent intent = new Intent(MyLayoutActivity.this, LayoutForOneActivity.class); intent.putExtra("CaptionOne", String.valueOf(txt_caption1.getText())); startActivity(intent); And here is the code from my receiving Activity Intent intent1 = getIntent(); Bundle bundle = intent1.getExtras(); if (bundle != null) { caption = bundle

ClassCastException when mocking generic type using Mockito

徘徊边缘 提交于 2019-12-11 18:57:33
问题 I have a abstract test class with a generic parameter. public abstract class AbstractCarTest<G> { ... @Mock protected G carMock; ... } I've implemented a concrete test class of it. public class TruckTest extends AbstractCarTest<Truck> { ... when(truckFactory.getTruck(anyString()).return(carMock); ... } The method signature looks like this public Truck getTruck(String name); When running TruckTest I get a ClassCastException saying java.lang.ClassCastException: org.mockito.internal.creation

How to check empty array string before creating json object in java?

微笑、不失礼 提交于 2019-12-11 18:29:54
问题 I'm getting an empty array in string as a response from server & getting ClassCastException while converting it JsonObject because it's an empty array. Here is code snippet. final String errorMessage = IOUtils.toString(errorStream); // response is "[]" if (isJson(errorMessage)) { final JsonObject jsonResult = new Gson().fromJson(errorMessage, JsonObject.class); throw new IOException(jsonResult.get("error").toString()); } else { throw new IOException("Json response is" + errorMessage); } Here

Swift ClassCastException when SKPhysicsBody.node -> SKLabelNode. Why?

…衆ロ難τιáo~ 提交于 2019-12-11 15:25:31
问题 The following code results to class cast exception. Could someone explain me why? var firstBody: SKPhysicsBody var secondBody: SKPhysicsBody firstBody = contact.bodyA secondBody = contact.bodyB projectileDidCollide(firstBody.node as SKSpriteNode, flyingLabel: secondBody.node as SKLabelNode) results in ClassCastException: libswiftCore.dylib`swift_dynamicCastObjCClassUnconditional: 0x104668980: pushq %rbp 0x104668981: movq %rsp, %rbp 0x104668984: pushq %rbx 0x104668985: pushq %rax 0x104668986:

Java generic to avoid ClassCastException

柔情痞子 提交于 2019-12-11 14:20:05
问题 Here is a piece of code I'm working on. I have a Callback object that can return a specified super type. Vehicle is one of these classes here. These classes are used as supertype for other classes like Car and Train here. interface CompletionCallBack<Result> { void onCompletion(Result result); } class Vehicle { Map<String, Object> attributes; } class Car extends Vehicle { public String getMake(){ return attributes.get("make").toString(); } } class Train extends Vehicle { public String getMake

Getting java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutParams

你离开我真会死。 提交于 2019-12-11 11:42:36
问题 Here I need to add textview at runtime. first I took reference of RelativeLayout to get layout params but unfortunately its throwing ClassCastException at RelativeLayout.LayoutParams params = (android.widget.RelativeLayout.LayoutParams)contentLayout.getLayoutParams() I also checked - FrameLayout to RelativeLayout ClassCastException even if there is no FrameLayout used, but it didn't work. Since after replacing RelativeLayout with FrameLayout, I'm unable to add rule on layoutParams. protected

Class cast exceptions with ant/jenkins generated EAR on WebSphere 6.1

我怕爱的太早我们不能终老 提交于 2019-12-11 09:51:07
问题 I'm having runtime class cast exceptions after deploying an ear generated as part of an ant build script running on Jenkins to Websphere 6.1. The cast class exceptions are in some DAO methods which cast Objects returned from SQL queries to specific classes. If i generate the EAR from within Eclipse (RAD) then the class cast exceptions don't occur, and comparing the class files from the jenkins/ant generated ear with the ones from Eclipse show different file sizes and contents. I'm trying to

Java Game - ClassCastException

Deadly 提交于 2019-12-11 08:22:57
问题 I am developing a simple java game and my scrollbar is raising an exception. The scrollbar is supposed to be a "gameslider". Exception in thread "Thread-3" java.lang.ClassCastException: sun.java2d.NullSurfaceData cannot be cast to sun.java2d.d3d.D3DSurfaceData at sun.java2d.d3d.D3DRenderer.copyArea(Unknown Source) at sun.java2d.d3d.D3DSurfaceData.copyArea(Unknown Source) at sun.java2d.SunGraphics2D.doCopyArea(Unknown Source) at sun.java2d.SunGraphics2D.copyArea(Unknown Source) at javax.swing

How to set Width and Height of FrameLayout dynamically android?

只愿长相守 提交于 2019-12-11 08:18:10
问题 I am trying to set the width and height of 2 frame layouts which are the containers for 2 fragments, both being children of a Linear Layout. However whenever I set width and height of the layout with frameLayout.setLayoutParams(new FrameLayout.LayoutParams(100,100); it is resulting in a class cast Exception java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams 回答1: use this method ... .setLayoutParams(new LinearLayout