wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "I take null point exception" Watch "I take null point exception" New topic
Author

I take null point exception

Gokce Karacayilmaz
Greenhorn

Joined: Jun 28, 2012
Posts: 1
Hi
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 (rs.next()) {
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;

System.out.println(harf_array[k]);}}}

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

Joined: Mar 28, 2012
Posts: 860

Welcome,

You will get better help if you format your code using the "Code" tag (Click on the link)
*and*
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.


WP
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: I take null point exception
 
Similar Threads
Error in output
Different restults from Oracle and JDBC
how to check parent availability in Jtree structure in swing
Stll having problems
Need Help With Dynamic text box in JSP