This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 198992
Collapse All | Expand All

(-)a/j2ee.sun.appsrv/src/org/netbeans/modules/j2ee/sun/ide/sunresources/resourcesloader/SunResourceDataObject.java (-7 / +19 lines)
Lines 115-121 Link Here
115
    JMSBean jmsBean = null;
115
    JMSBean jmsBean = null;
116
    
116
    
117
    String resType;
117
    String resType;
118
    
118
119
    /**
120
     * Verify if array is not empty and contains at least one element.
121
     * <p/>
122
     * @param arr Array to be verified.
123
     * @return Value of <code>true</code> when <code>arr</code> contains
124
     *         at least one element or <code>false</code> when <code>arr</code>
125
     *         contains no elements or is <code>null</code>.
126
     */
127
    private static boolean notEmpty(Object[] arr) {
128
        return arr != null && arr.length > 0;
129
    }
130
119
    public SunResourceDataObject(FileObject pf, SunResourceDataLoader loader) throws DataObjectExistsException {
131
    public SunResourceDataObject(FileObject pf, SunResourceDataLoader loader) throws DataObjectExistsException {
120
        super(pf, loader);
132
        super(pf, loader);
121
        pf.addFileChangeListener((FileChangeListener) WeakListeners.create(FileChangeListener.class, this, pf));
133
        pf.addFileChangeListener((FileChangeListener) WeakListeners.create(FileChangeListener.class, this, pf));
Lines 188-194 Link Here
188
                
200
                
189
                // identify JDBC Connection Pool xml
201
                // identify JDBC Connection Pool xml
190
                JdbcConnectionPool[] pools = resources.getJdbcConnectionPool();
202
                JdbcConnectionPool[] pools = resources.getJdbcConnectionPool();
191
                if(pools != null && pools.length > 0){
203
                if(notEmpty(pools)){
192
                    ConnPoolBean currCPBean = ConnPoolBean.createBean(pools[0]);
204
                    ConnPoolBean currCPBean = ConnPoolBean.createBean(pools[0]);
193
                    type = this.JDBC_CP;
205
                    type = this.JDBC_CP;
194
                    setPool(currCPBean);
206
                    setPool(currCPBean);
Lines 196-202 Link Here
196
                
208
                
197
                // identify JDBC Resources xml
209
                // identify JDBC Resources xml
198
                JdbcResource[] dataSources = resources.getJdbcResource();
210
                JdbcResource[] dataSources = resources.getJdbcResource();
199
                if(dataSources.length != 0){
211
                if(notEmpty(dataSources)){
200
                    DataSourceBean currDSBean = DataSourceBean.createBean(dataSources[0]);
212
                    DataSourceBean currDSBean = DataSourceBean.createBean(dataSources[0]);
201
                    type = this.JDBC_DS;
213
                    type = this.JDBC_DS;
202
                    setDataSource(currDSBean);
214
                    setDataSource(currDSBean);
Lines 204-210 Link Here
204
                
216
                
205
                // import Persistence Manager Factory Resources
217
                // import Persistence Manager Factory Resources
206
                PersistenceManagerFactoryResource[] pmfResources = resources.getPersistenceManagerFactoryResource();
218
                PersistenceManagerFactoryResource[] pmfResources = resources.getPersistenceManagerFactoryResource();
207
                if(pmfResources.length != 0){
219
                if(notEmpty(pmfResources)){
208
                    PersistenceManagerBean currPMFBean = PersistenceManagerBean.createBean(pmfResources[0]);
220
                    PersistenceManagerBean currPMFBean = PersistenceManagerBean.createBean(pmfResources[0]);
209
                    type = this.PMF;
221
                    type = this.PMF;
210
                    setPersistenceManager(currPMFBean);
222
                    setPersistenceManager(currPMFBean);
Lines 212-218 Link Here
212
                
224
                
213
                // import Mail Resources
225
                // import Mail Resources
214
                MailResource[] mailResources = resources.getMailResource();
226
                MailResource[] mailResources = resources.getMailResource();
215
                if(mailResources.length != 0){
227
                if(notEmpty(mailResources)){
216
                    JavaMailSessionBean currMailBean = JavaMailSessionBean.createBean(mailResources[0]);
228
                    JavaMailSessionBean currMailBean = JavaMailSessionBean.createBean(mailResources[0]);
217
                    type = this.MAIL;
229
                    type = this.MAIL;
218
                    setMailSession(currMailBean);
230
                    setMailSession(currMailBean);
Lines 228-234 Link Here
228
                
240
                
229
                // import Admin Object Resources
241
                // import Admin Object Resources
230
                AdminObjectResource[] aoResources = resources.getAdminObjectResource();
242
                AdminObjectResource[] aoResources = resources.getAdminObjectResource();
231
                if(aoResources.length != 0){
243
                if(notEmpty(aoResources)){
232
                    JMSBean currJmsBean = JMSBean.createBean(aoResources[0]);
244
                    JMSBean currJmsBean = JMSBean.createBean(aoResources[0]);
233
                    type = this.JMS;
245
                    type = this.JMS;
234
                    setJMS(currJmsBean);
246
                    setJMS(currJmsBean);
Lines 236-242 Link Here
236
                
248
                
237
                ConnectorResource[] connResources = resources.getConnectorResource();
249
                ConnectorResource[] connResources = resources.getConnectorResource();
238
                ConnectorConnectionPool[] connPoolResources = resources.getConnectorConnectionPool();
250
                ConnectorConnectionPool[] connPoolResources = resources.getConnectorConnectionPool();
239
                if(connResources.length != 0 && connPoolResources.length != 0){
251
                if(notEmpty(connResources) && notEmpty(connPoolResources)){
240
                    JMSBean currJmsBean = JMSBean.createBean(resources);
252
                    JMSBean currJmsBean = JMSBean.createBean(resources);
241
                    type = this.JMS;
253
                    type = this.JMS;
242
                    setJMS(currJmsBean);
254
                    setJMS(currJmsBean);

Return to bug 198992