File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes I take null point exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "I take null point exception" Watch "I take null point exception" New topic

I take null point exception

Gokce Karacayilmaz

Joined: Jun 28, 2012
Posts: 1
I want to use two pstm but I take null pointer exception. Please help me thank you.

Java code is :

private void sorgula (String bul){
ResultSet rs = null;
ResultSet rs1 = null;
PreparedStatement stm =null;

try {
String str = bul;
String[] str_array1 ;
String[] str_array2 = null;
String[] harf_array = null;
str_array1 = str.split(";");

String sql = "SELECT kelimeler from sozlukler";
stm = sifrecoz.conn.prepareStatement(sql);

for(int i =0; i < str_array1.length ; i++) {
str_array2 = str_array1 [i].split(",");}
rs = stm.executeQuery(sql);

while ( {
String yeni_kelime = rs.getString(1).trim();
for(int j =0; j < str_array2.length ; j++){
String harf_bul = "select SUBSTRING(\'"+ yeni_kelime +"\',"+str_array2 [j]+",1)";
stm = sifrecoz.conn.prepareStatement(harf_bul);

for(int k =0; k < harf_array.length ; k++) {
rs1 = stm.executeQuery(harf_bul);
harf_array [k] = harf_bul;


} catch (Exception e) {
try {
if (rs != null || rs1 != null) {
} catch (SQLException ex) { Logger.getLogger(sorgu.class.getName()).log(Level.SEVERE, null, ex); }
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859


You will get better help if you format your code using the "Code" tag (Click on the link)
Give us the line number in your code where the NPE occurs.

I do not have time to wade through your code.

Help us to help you.

I agree. Here's the link:
subject: I take null point exception
It's not a secret anymore!