Revision 44678 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.h2/src/main/java/org/gvsig/fmap/dal/store/h2/H2SpatialHelper.java

View differences:

H2SpatialHelper.java
241 241
    }
242 242

  
243 243
    private ConnectionProvider connectionProvider = null;
244
   
244
 
245
    /**
246
     * Constructor for use only for testing purposes.
247
     */
248
    public H2SpatialHelper() { 
249
        super(null);
250
    }
251
  
245 252
    public H2SpatialHelper(JDBCConnectionParameters connectionParameters) {
246 253
        super(connectionParameters);
247 254
        this.srssolver = new SRSSolverBase(this);
......
251 258
    public synchronized Connection  getConnection() throws AccessResourceException {
252 259
        try {
253 260
            if (this.connectionProvider == null) {
254
                this.connectionProvider = new ConnectionProvider(this.getConnectionParameters());
261
              H2SpatialConnectionParameters connectionParameters = this.getConnectionParameters();
262
              if( connectionParameters==null ) {
263
                return null; // Testing mode?
264
              }
265
              this.connectionProvider = new ConnectionProvider(connectionParameters);
255 266
            }
256 267
            Connection connection = this.connectionProvider.getConnection();
257 268
            if( LOGGER.isDebugEnabled() ) {
......
265 276

  
266 277
    @Override
267 278
    public void closeConnection(Connection connection) {
279
      if( connection!=null ) { // In test ???
268 280
        LOGGER.debug("closeConnection: connection = "+connection.hashCode());
269
        super.closeConnection(connection);
281
      }
282
      super.closeConnection(connection);
270 283
    }
271 284
    
272 285
    @Override

Also available in: Unified diff