Revision 63

View differences:

trunk/org.gvsig.postgresql/pom.xml
11 11
  <parent>
12 12
      <groupId>org.gvsig</groupId>
13 13
      <artifactId>org.gvsig.desktop</artifactId>
14
      <version>2.0.40</version>
14
      <version>2.0.40-SNAPSHOT</version>
15 15
  </parent>
16 16

  
17 17
  <url>https://devel.gvsig.org/redmine/projects/gvsig-postgresql</url>
trunk/org.gvsig.postgresql/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLResource.java
39 39
import org.gvsig.fmap.dal.store.jdbc.JDBCResource;
40 40
import org.gvsig.fmap.dal.store.jdbc.JDBCResourceParameters;
41 41
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCDriverClassNotFoundException;
42
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCException;
42 43
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCSQLException;
43 44
import org.slf4j.Logger;
44 45
import org.slf4j.LoggerFactory;
......
61 62
		return MessageFormat.format("PostgreSQLResource({0},{1})",
62 63
				new Object[] { params.getUrl(),params.getUser() });
63 64
	}
65
        
66
        public String toString() {
67
            try {
68
                return this.getName();
69
            } catch(Exception ex) {
70
                return super.toString();
71
            }
72
        }
64 73

  
65 74
	protected void connectToDB() throws DataException {
66 75
		if (this.dataSource != null) {
......
181 190

  
182 191
	}
183 192

  
193
        private static class CanGetConnectionException extends JDBCSQLException {
194
            public CanGetConnectionException(String datasource, SQLException cause) {
195
                super("Can't get a connection to the data source (%(datasource))", cause, "_CanGetConnectionException", 0);
196
                setValue("datasource", datasource);
197
            }
198
        }
199
    
184 200
	protected synchronized Object getTheConnection() throws DataException {
185 201
		try {
186 202
			Object conn = this.dataSource.getConnection();
187 203
			logPoolStatus("getTheConnection");
188 204
			return conn;
189 205
		} catch (SQLException e) {
190
			throw new JDBCSQLException(e);
206
			throw new CanGetConnectionException(this.toString(),e);
191 207
		}
192 208
	}	
193 209

  
trunk/org.gvsig.postgresql/org.gvsig.postgresql.provider/src/main/java/org/gvsig/fmap/dal/store/postgresql/PostgreSQLHelper.java
223 223
		this.open();
224 224

  
225 225
		return (Envelope) getResource().execute(new ResourceAction() {
226
                        public String toString() {
227
                            return "getEnvelope";
228
                        }                    
226 229
			public Object run() throws Exception {
227 230
				ResultSet rs = null;
228 231
				Statement st = null;

Also available in: Unified diff