Hi all,
I am getting the following error when I am loading the data into the ComboBox
and the ComboBoxes are linked to each other
I am getting the errors as below
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at client.cpm.dailyT20.CBRCPMDailyT20View.appComboBox_actionPerformed(CBRCPMDailyT20View.java:235)
at client.cpm.dailyT20.CBRCPMDailyT20View.access$1(CBRCPMDailyT20View.java:234)
at client.cpm.dailyT20.CBRCPMDailyT20View$2.actionPerformed(CBRCPMDailyT20View.java:227)
at javax.swing.JComboBox.fireActionEvent(Unknown Source)
at javax.swing.JComboBox.contentsChanged(Unknown Source)
at javax.swing.JComboBox.intervalRemoved(Unknown Source)
at javax.swing.AbstractListModel.fireIntervalRemoved(Unknown Source)
at javax.swing.DefaultComboBoxModel.removeAllElements(Unknown Source)
at javax.swing.JComboBox.removeAllItems(Unknown Source)
at client.cpm.dailyT20.CBRCPMDailyT20View.appSetComboBox_actionPerformed(CBRCPMDailyT20View.java:187)
at client.cpm.dailyT20.CBRCPMDailyT20View.access$0(CBRCPMDailyT20View.java:183)
at client.cpm.dailyT20.CBRCPMDailyT20View$1.actionPerformed(CBRCPMDailyT20View.java:175)
at javax.swing.JComboBox.fireActionEvent(Unknown Source)
at javax.swing.JComboBox.setSelectedItem(Unknown Source)
at javax.swing.JComboBox.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
and I will place the code as below
package cbrdataejb.session;
import java.rmi.RemoteException;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import cbrdataejb.database.CBRMSSQLDataBean;
import cbrutil.CBRConstants;
import com.borland.dx.dataset.DataSetData;
import com.borland.dx.sql.dataset.Load;
import com.borland.dx.sql.dataset.QueryDataSet;
import com.borland.dx.sql.dataset.QueryDescriptor;
@Stateful
public class CBRCPMDailyT20FactTable extends CBRMSSQLDataBean implements CBRCPMDailyT20FactTableRemote {
public static final String RemoteJNDIName = CBRConstants.EARFileName
+ CBRCPMDailyT20FactTable.class.getSimpleName() + "/remote";
public CBRCPMDailyT20FactTable() {
}
public void init(String db2DataSource, String msSqlDataSource, String portServer) {
super.create(db2DataSource, msSqlDataSource, portServer);
}
@Remove
public void remove() {
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public DataSetData getAppSetList() throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
try {
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("SELECT APPLICATION_SET as IDAppSet, count(*)");
selectQuery.append(" FROM T20_Summary");
selectQuery.append(" GROUP BY APPLICATION_SET");
selectQuery.append(" ORDER BY APPLICATION_SET");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getAppSetList", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public DataSetData getAppList(String appSet) throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
String appSetFil = "";
if (appSet.equals("All Application") == false) {
appSetFil = appSet;
}
try {
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("SELECT distinct APPLICATION as IDApp, count(*)");
selectQuery.append(" FROM T20_Summary");
selectQuery.append(" where APPLICATION_SET LIKE'%" + appSetFil + "%'");
selectQuery.append(" GROUP BY APPLICATION");
selectQuery.append(" ORDER BY APPLICATION");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getAppList", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public DataSetData getAppList() throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
try {
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("SELECT distinct APPLICATION as IDApp, count(*)");
selectQuery.append(" FROM T20_Summary");
selectQuery.append(" GROUP BY APPLICATION");
selectQuery.append(" ORDER BY APPLICATION");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getAppList", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
//public DataSetData getPackageList(String appSet, String app) throws RemoteException {
public DataSetData getPackageList(String app) throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
//String appSetFil = "";
String appFil = "";
/*if (appSet.equals("All Application") == false) {
appSetFil = appSet;
}*/
if (app.equals("All Application") == false) {
appFil = app;
}
try {
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("SELECT distinct PACKAGE as IDPackage, count(*)");
selectQuery.append(" FROM T20_Summary");
selectQuery.append(" where APPLICATION_SET LIKE'%" + appFil + "%'");
//selectQuery.append(" AND APPLICATION LIKE'%" + appFilP + "%'");
selectQuery.append(" GROUP BY PACKAGE ");
selectQuery.append(" ORDER BY PACKAGE ");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getPackageList", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public DataSetData getPackageList() throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
try {
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("SELECT distinct PACKAGE as IDPackage, count(*)");
selectQuery.append(" FROM T20_Summary");
selectQuery.append(" GROUP BY PACKAGE ");
selectQuery.append(" ORDER BY PACKAGE ");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getPackageList", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public DataSetData getData(String appSet, String app, String packageS ) throws RemoteException {
//public DataSetData getData(String appSet, String app, String packageS ) throws RemoteException {
QueryDataSet queryDataSet = new QueryDataSet();
try {
// set value for filter
String appSetFil = "";
String appFil = "";
String packageFil = "";
if (appSet.equals("All Application") == false) {
appSetFil = appSet;
}
if (app.equals("All Application") == false) {
appFil = app;
}
if (packageS.equals("All Package") == false) {
packageFil = packageS;
}
// Set and open the connection if is not already open!
if (!(m_msSqlDatabase.isOpen())) {
m_msSqlDatabase.setConnection(m_msSqlDatabase.getDataSource().getConnection());
}
StringBuffer selectQuery = new StringBuffer();
selectQuery.append("select APPLICATION_SET as ApplicationSet,");
selectQuery.append(" APPLICATION as Application,");
selectQuery.append(" PACKAGE as Package,");
selectQuery.append(" SUCCESS_EXECUTIONS as SE,");
selectQuery.append(" SUCCESS_MIN_TIME as SE_Min,");
selectQuery.append(" SUCCESS_MAX_TIME as SE_Max,");
selectQuery.append(" SUCCESS_AVG_TIME as SE_Avg, ");
selectQuery.append(" FAILED_EXECUTIONS as FE,");
selectQuery.append(" FAILED_MIN_TIME as FE_Max,");
selectQuery.append(" FAILED_MAX_TIME as FE_Min,");
selectQuery.append(" FAILED_AVG_TIME as FE_Avg,");
selectQuery.append(" LAST_EXECUTION_DATE as Last_Execution");
selectQuery.append(" from T20_Summary");
selectQuery.append(" where ");
if (appSet.equals("All Application") == false) {
selectQuery.append(" APPLICATION_SET LIKE'" + appSetFil + "'AND");
}
selectQuery.append(" APPLICATION LIKE '%" + appFil + "%'");
selectQuery.append(" AND PACKAGE LIKE '%" + packageFil + "%'");
//selectQuery.append(" where APPLICATION_SET LIKE'%" + appSetFil + "%'");
//selectQuery.append(" AND APPLICATION LIKE '%" + appFil + "%'");
//selectQuery.append(" AND PACKAGE LIKE'%" + packageFil + "%'");
selectQuery.append(" order by LAST_EXECUTION_DATE desc, APPLICATION_SET , APPLICATION, PACKAGE");
queryDataSet.setQuery(new QueryDescriptor(this.m_msSqlDatabase, selectQuery.toString(), null,
true, Load.ALL));
queryDataSet.open();
return DataSetData.extractDataSet(queryDataSet);
} catch (Exception e) {
e.printStackTrace();
throw new RemoteException("getData", e);
} finally {
try {
queryDataSet.close();
this.close();
} catch (Exception e) {
}
}
}
}
Hoping anyone can help as soon as possible
Thanks in advance.