Nullpointer Exception in J2MEmicroDb createTable function - java-me

My code is
J2MESDLIB.generateDB(true);
J2MEColumn c1 = new J2MEColumn("desc", true, J2MEColumn.ColumnType.VARCHAR, 20);
J2MEColumn c2=new J2MEColumn("date", false, J2MEColumn.ColumnType.VARCHAR, 20);
J2MEColumn c3=new J2MEColumn("type", false, J2MEColumn.ColumnType.VARCHAR, 20);
J2MEColumn c4=new J2MEColumn("assigned", false, J2MEColumn.ColumnType.VARCHAR, 100);
Vector vector=new Vector(4);
vector.addElement(c1);
vector.addElement(c2);
vector.addElement(c3);
vector.addElement(c4);
J2METable table1=J2MESDLIB.createTable("todo", vector, 1);
it gives exception at the last line
i.e java.lang.NullPointerException
java.lang.NullPointerException
at edu.upc.J2MESDLIB.J2MEDBException.(J2MEDBException.java:82)
at edu.upc.J2MESDLIB.J2MESDLIB.createTable(J2MESDLIB.java:193)
at hello.TodoRecordStore.openRecord(TodoRecordStore.java:52)

When I downloaded J2MEMicroDB from the first result of a google search, it only supported one default language for J2MEDBException messages.
I assume the version you have would have been localised.
The NullPointerException could be caused by a bad language-specific set of error messages.
Unfortunately, that only means the NullPointerException is only masking the J2MEDBException that J2MEMicroDB was trying to throw.
Given the code you posted, my only guess as to the original J2MEDBException would be that the "todo" table already exists.

Related

What are "retainedNodes" in LLVMs debug metadata?

Using the LLVM 8.0.1 library, I try to create the debug info for a function with the following code:
DIFile *Unit = DebugBuilder->createFile(CompileUnit->getFilename(), CompileUnit->getDirectory());
DIScope *FContext(Unit);
DISubprogram *SP = DebugBuilder->createFunction(
FContext, def->Name, def->Name, Unit, LineNo,
CreateFunctionType(ft, CompileUnit->getFile()), 0);
func->setSubprogram(SP);
This, however, results in IR like the following:
define i32 #main(i32 %y) !dbg !3 {
entry:
ret i32 2
}
; ...
!3 = !DISubprogram(name: "main", linkageName: "main", scope: !2, file: !2, type: !4, spFlags: 0, retainedNodes: !7)
; ...
!7 = <temporary!> !{}
Which, upon calling DebugBuilder->finalize(), throws Assertion failed: !N->isTemporary() && "Expected all forward declarations to be resolved"
I have not found a description of the retainedNodes field in the official reference nor other tutorials, and web searches only lead to uncommented sections of the LLVM source. What is the meaning or purpose of this field? How is a temporary node created there?
I found this solved by adding, before generating the DebugBuilder,
TheModule->addModuleFlag(llvm::Module::Warning, "CodeView", 1);
... as explained apparently nowhere in the official documentation.
I had the same problem with the LLVM C API (using inkwell-rs as a wrapper). I fixed this problem by invoking LLVMDIBuilderCreateFunction with IsDefinition = true and IsLocalToUnit = true. This keeps the retainedNodes metadata node, but its value is empty metadata (!{}) instead of a temporary.
I solved a similar problem by finalizing the subprogram explicitly with finalizeSubprogram.
DebugBuilder->finalizeSubprogram(SP);
This seems to resolve the temporary, but I still got some warnings, when compiling the generated IR.
If you make the function a definition by adding the DISubprogram::SPFlagDefinition flag to DebugBuilder->createFunction call, retainedNodes will be set to an empty node instead of a temporary.

Resharper unreachable code error

I have read about that error but it was 3 years ago! ReSharper says the inner if statement code is unreachable. Is there any patch to this error?
int[] t = new int[1000];
if(t!=null)
{
if(t[0] ==2)
{
}
}
From the code you've posted, the inner if statement is indeed unreachable, since the outer if always evaluates to false (t is always null).

Direct3D 10, failed on creating input layout

My application keeps failing to compile when I try to create a Vertex Layout in direct3D 10. Heres the code:
// Create the vertex input layout.
D3D10_INPUT_ELEMENT_DESC vertexDesc[] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0},
{"COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0}
};
// Create the input layout
D3D10_PASS_DESC PassDesc;
mTech->GetPassByIndex(0)->GetDesc(&PassDesc);
HR(md3dDevice->CreateInputLayout(vertexDesc, 2, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &mVertexLayout));
It fails in CreateInputLayout(), I was also under the impression that HR() is meant to catch problems such as these and make suggestions in these cases, however it doesn't appear to do that. Although as with many cases I may be completely wrong on that. The prompt that comes up is :
Unhandled exception at 0x757fd36f in CourseworkApp.exe: 0x0000087A: 0x87a.
I think this is mainly related to errors with pointers but I am unsure. Any help would be much appreciated.
You should make your color format "DXGI_FORMAT_R8G8B8A8_UNORM" and change "HR(md3dDevice->CreateInputLayout..." to "if(FAILED(md3dDevice->CreateInputLayout...)) {//Handle errors}".
I think that might help fix the problem.

Value does not fall within the expected range, while Registering Line in TAPI3.Lib

I am getting a problem while registering a line using TAPI3.Lib
This is where I get the exception:
registertoken[line] =
tobj.RegisterCallNotifications(
ia[line], true, true,
TapiConstants.TAPIMEDIATYPE_AUDIO | TapiConstants.TAPIMEDIATYPE_DATAMODEM,
1);
tobj is object of type TAPI3Lib.TAPIClass
When the compiler executes the above code then it throws the exception
Value does not fall within the expected range
Currently i am using Windows 7.

IOS Simulator 5 webview error : CALayerInvalidGeometry

I have webview inside scroll view, and that scrollview is also inside another scroll (page control).
my question is i get this following error
This is the error:
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]'
*** First throw call stack:
(0x1583052 0x196cd0a 0x152ba78 0x152b9e9 0x4c9de99 0x4c94205 0x233ebb3 0x76598e 0x96d495 0x764a5e 0x1584e1a 0x14ee821 0x622349 0x60ead4 0x615bee 0x6194e6 0x88de39 0x88d143 0x88e3cf 0x890a31 0x89098c 0x8893e7 0x5f1812 0x5f1ba2 0x5d8384 0x5cbaa9 0x20b1fa9 0x15571c5 0x14bc022 0x14ba90a 0x14b9db4 0x14b9ccb 0x20b0879 0x20b093e 0x5c9a9b 0x302d 0x2895)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
This is my code that i think the problem (because if i comment blogThumbnailWebview loadRequest:request] it is working fine. no error.
- (void) setVideoAsThumbnail:(NSString *)videoThumbnailLink
{ NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:videoThumbnailLink]];
blogThumbnailWebView .scalesPageToFit = NO;
[blogThumbnailWebView loadRequest:request];
blogThumbnailWebView.allowsInlineMediaPlayback = NO;
}
However the error is only in Simulator 5, if i use simulator 4.3 there is no error.
How can i solve that?
FYI: Im using ARC, and Xcode 4.2 SDK 5
When you initialize the webview, make sure you don't use the plain init method, but rather one like initWithFrame. By using the plain init, sometimes there is no frame allocated when the component is being used, thus throwing the CALayerInvalidGeometry error.

Resources