Hi I'm getting nullpointerexception at rs.next() or rs.getString(1) it is really weird that sometimes rs.next() works fine and it throws nullpointerexception at rs.getString("PRODUCTCODE"),sometimes it throws npe at rs.getString("PRODDATE") i dont understand why rs.getString() thows npe while rs.next() works fine
Here is my code
{
ResultSet rs = null;
String query = "";
BarcodeBean bi = null;
try {
query = "SELECT * FROM TABLE(GET_BARCODEINFO('"barcode.trim()"'))";
statement = connection.createStatement();
Logger.getInstance().getLogger().logInfo(query);
rs = statement.executeQuery(query);
bi = new BarcodeBean();
if (rs == null){
if(rs.next()){
bi.setUrunKodu(rs.getString("PRODUCTCODE"));
bi.setImalatMakineKodu(rs.getString("PRODMACHINECODE"));
bi.setOperatorSicilNo(rs.getString("OPERATORID"));
bi.setImalatTarihi(rs.getString("PRODDATE"));
bi.setImalatVardiyasi(rs.getString("PRODSHIFT"));
bi.setSeriNumarasi(rs.getString("SERIALNUMBER"));
bi.setSirtTarihi(rs.getString("SIRTTARIHI"));
}
}
} catch (SQLException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
} finally {
DatabaseUtility.close(rs);
DatabaseUtility.close(statement);
}
}