Revision 41437

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.lib/org.gvsig.exportto.lib.api/src/main/java/org/gvsig/exportto/ExporttoServiceException.java
23 23
 */
24 24
package org.gvsig.exportto;
25 25

  
26
import org.gvsig.fmap.dal.feature.Feature;
26 27
import org.gvsig.tools.service.ServiceException;
27 28

  
28 29
/**
......
39 40
        "An error has been produced exporting a store";
40 41

  
41 42
    private static final String KEY = "_ExporttoServiceException";
43
    private Feature feature = null;
42 44

  
43 45
    /**
44 46
     * Creates a new {@link ExporttoServiceException}.
......
50 52
        super(MESSAGE, cause, KEY, serialVersionUID);
51 53
    }
52 54

  
55
    public ExporttoServiceException(Throwable cause, Feature feature) {
56
        super(MESSAGE, cause, KEY, serialVersionUID);
57
        this.feature = feature;
58
    }
59

  
53 60
    public ExporttoServiceException(String message, Throwable cause) {
54 61
        super(message, cause, KEY, serialVersionUID);
55 62
    }
63
    
64
    public Feature getFeature() {
65
        return this.feature;
66
    }
56 67
}
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.impl/src/main/java/org/gvsig/exportto/swing/impl/DefaultJExporttoServicePanel.java
262 262
    }
263 263

  
264 264
    private void showError(ExporttoServiceException e, TaskStatus taskStatus) {
265
        String message = e.getMessage();
266
        if (e.getCause() != null) {
267
            message = e.getCause().getMessage();
268
        }
265
        String message = e.getMessage();        
266
//        if (e.getCause() != null) {
267
//            message = e.getCause().getMessage();
268
//        }
269
        message = e.getMessageStack();
269 270
        
270 271
        if (message != null && message.startsWith("_")) {
271 272
            message = Messages.getText(message);
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.exportto/org.gvsig.exportto.swing/org.gvsig.exportto.swing.prov/org.gvsig.exportto.swing.prov.jdbc/src/main/java/org/gvsig/exportto/swing/prov/jdbc/ExporrtoJDBCService.java
118 118
        
119 119
        EditableFeatureType ef_type = null;
120 120
        FeatureType f_type = null;
121
        
121
        EditableFeature edit_feat = null;
122 122
        try {
123 123
            f_type = featureStore.getDefaultFeatureType();
124 124
            f_type = f_type.getCopy();
......
173 173
            taskStatus.setRangeOfValues(0, featureSet.getSize());
174 174
            int featureCount = 1;
175 175
            it1 = featureSet.fastIterator();
176
            EditableFeature edit_feat = null;
176
            
177 177
            Geometry reproj_geom = null;
178 178
            
179 179
            while (it1.hasNext()) {
......
189 189
                }
190 190
                // ================================================
191 191
                target.insert(edit_feat);
192
                
193 192
                this.taskStatus.setCurValue(featureCount);
194 193

  
195 194
                if (this.taskStatus.isCancellationRequested()) {
......
197 196
                }
198 197
                featureCount++;
199 198
            }
199
            edit_feat = null;
200 200
            target.finishEditing();
201 201

  
202 202
            /*
......
219 219

  
220 220
        } catch (Exception e) {
221 221
            taskStatus.message(e.getMessage());
222
            throw new ExporttoServiceException(e);
222
            throw new ExporttoServiceException(e,edit_feat);
223 223
        } finally {
224 224
            if (it1 != null) {
225 225
                it1.dispose();
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCServerExplorer.java
551 551

  
552 552
		try {
553 553
			result = (Boolean) helper.doConnectionAction(action);
554
		} catch (DataException e) {
555
                    throw  e;
554 556
		} catch (Exception e) {
555
			// FIXME Exception
556
			throw new RuntimeException(e);
557
                    // FIXME Exception
558
                    throw new RuntimeException(e);
557 559
		}
558 560

  
559 561
		return result.booleanValue();
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/exception/JDBCSQLException.java
42 42
	public JDBCSQLException(SQLException cause) {
43 43
		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
44 44
	}
45
        
46
	protected JDBCSQLException(String messageFormat, Throwable cause,
47
			String messageKey, long code) {
48
		super(messageFormat, cause, messageKey, code);
49
	}
45 50

  
51
	protected JDBCSQLException(String messageFormat, String messageKey,
52
			long code) {
53
		super(messageFormat, messageKey, code);
54
	}
46 55
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/exception/JDBCExecuteSQLException.java
37 37
	 */
38 38
	private static final long serialVersionUID = 634889167216570034L;
39 39

  
40
	private final static String MESSAGE_FORMAT = "An JDBC exception was throw when execute SQL: %(sql)";
40
	private final static String MESSAGE_FORMAT = "Problems executing sql: %(sql)";
41 41
	private final static String MESSAGE_KEY = "_JDBCExecuteSQLException";
42 42

  
43
	public JDBCExecuteSQLException(String sql, SQLException cause) {
43
	public JDBCExecuteSQLException(String sql, Exception cause) {
44 44
		super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
45 45
		setValue("sql", sql);
46 46
	}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCStoreProviderWriter.java
40 40
import org.gvsig.fmap.dal.feature.exception.PerformEditingException;
41 41
import org.gvsig.fmap.dal.feature.spi.FeatureProvider;
42 42
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
43
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
44 43
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
45 44
import org.gvsig.fmap.dal.store.db.FeatureTypeHelper;
46
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCException;
47 45
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCExecutePreparedSQLException;
48 46
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCExecuteSQLException;
49 47
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCPreparingSQLException;
......
437 435
				throw new JDBCExecutePreparedSQLException(sql, values, e);
438 436
			}
439 437

  
440
		} catch (SQLException e1) {
441
			throw new JDBCSQLException(e1);
438
		} catch (Exception e1) {
439
			throw new JDBCExecuteSQLException(sql, e1);
442 440
		}
443 441
	}
444 442

  
......
475 473
			resetCount();
476 474

  
477 475
		} catch (Exception e) {
478
			throw new PerformEditingException(this.getProviderName(), e);
476
			throw new PerformEditingException(this.getSourceId().toString(), e);
479 477
		}
480 478
	}
481 479

  
......
713 711
			}
714 712

  
715 713
		} catch (Exception e) {
716
			throw new PerformEditingException(this.getProviderName(), e);
714
			throw new PerformEditingException(this.getSourceId().toString(), e);
717 715
		}
718 716
	}
719 717

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCStoreProvider.java
180 180
				}
181 181
				return null;
182 182
			}
183
                        public String toString() {
184
                            return "loadFeature";
185
                        }
186

  
183 187
		});
184 188
	}
185 189

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc/JDBCHelper.java
167 167
					isOpen = true;
168 168
					return null;
169 169
				}
170
                                public String toString() {
171
                                    return "open";
172
                                }
170 173
			});
171 174
			return true;
172 175
		} catch (ResourceExecuteException e) {
......
790 793
			super(MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
791 794
			if( attributeDescriptor != null ) {
792 795
				setValue("attributeName",attributeDescriptor.getName());
793
				setValue("attributetype",attributeDescriptor.getDataTypeName());
796
				setValue("attributeType",attributeDescriptor.getDataTypeName());
794 797
			} else {
795 798
				setValue("attributeName","unknown");
796
				setValue("attributetype","unknown");
799
				setValue("attributeType","unknown");
797 800
			}
798 801
			if( object!=null ) {
799 802
				setValue("valueClass", object.getClass().getName());
......
840 843
	public Object dalValueToJDBC(
841 844
			FeatureAttributeDescriptor attributeDescriptor, Object object)
842 845
			throws WriteException {
846
            
847
                IProjection srs = null;
848
		byte[] wkb = null;
849
                Geometry geom = null;
843 850
		try {
844 851
			if (object == null) {
845 852
				return null;
......
851 858
			if (attributeDescriptor.getType() != DataTypes.GEOMETRY) {
852 859
				return object;
853 860
			}
854
			byte[] wkb = null;
855
			Geometry geom = coerce(attributeDescriptor.getGeomType(),(Geometry) object);
856
                        
857
			IProjection srs = attributeDescriptor.getSRS();
861
			geom = coerce(attributeDescriptor.getGeomType(),(Geometry) object);                        
862
			srs = attributeDescriptor.getSRS();
858 863
			if (srs != null) {
859 864
				wkb =  geom.convertToWKBForcingType(getProviderSRID(srs), attributeDescriptor.getGeomType().getType());
860 865
			} else {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.lib/src/main/java/org/gvsig/fmap/dal/resource/db/AbstractDBResourceNoBlocker.java
24 24

  
25 25
package org.gvsig.fmap.dal.resource.db;
26 26

  
27
import java.sql.SQLException;
27 28
import org.gvsig.fmap.dal.exception.DataException;
28 29
import org.gvsig.fmap.dal.exception.InitializeException;
29 30
import org.gvsig.fmap.dal.resource.ResourceParameters;
......
56 57
		super(parameters);
57 58
	}
58 59

  
60
        private static class CanConnectException extends AccessResourceException {
61
            public CanConnectException(String resource, DataException cause) {
62
                super("Can't get a connection to the resource (%(resource))", cause, "_CanConnectException", 0);
63
                setValue("resource", resource);
64
            }
65
        }
66
        private static class CanGetConnectException extends AccessResourceException {
67
            public CanGetConnectException(String datasource, DataException cause) {
68
                super("Can't get the connection of the resource (%(resource))", cause, "_CanGetConnectionException", 0);
69
                setValue("resource", datasource);
70
            }
71
        }
72
    
59 73
	/**
60 74
	 * Return a connection to the data base.<br>
61 75
	 * Connect to the Data Base if is needed
......
67 81
			try {
68 82
				this.connect();
69 83
			} catch (DataException e) {
70
				throw new AccessResourceException(this, e);
84
				throw new CanConnectException(this.toString(), e);
71 85
			}
72 86
		}
73 87
		try {
74 88
			return getTheConnection();
75 89
		} catch (DataException e) {
76
			throw new AccessResourceException(this, e);
90
			throw new CanGetConnectException(this.toString(), e);
77 91
		}
78 92
	}
79 93

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/resource/exception/AccessResourceException.java
37 37
	public AccessResourceException(Resource resource, Throwable cause) {
38 38
		super(resource, MESSAGE_FORMAT, cause, MESSAGE_KEY, serialVersionUID);
39 39
	}
40
        
41
        protected AccessResourceException(String messageFormat, Throwable cause,
42
			String messageKey, long code) {
43
		super(messageFormat, cause, messageKey, code);
44
	}
45

  
46
	protected AccessResourceException(String messageFormat, String messageKey, long code) {
47
		super(messageFormat, messageKey, code);
48
	}
40 49
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/resource/exception/ResourceExecuteException.java
36 36

  
37 37
	private static final long serialVersionUID = 1879135914687984787L;
38 38
	private final static String MESSAGE_FORMAT =
39
			"Error while executing an action in resource '%(resource)'.";
39
			"Error executing action in resource '%(resource)'.";
40 40
	private final static String MESSAGE_KEY = "_ResourceExecuteException";
41 41

  
42 42
	/**
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/exception/PerformEditingException.java
31 31
	 *
32 32
	 */
33 33
	private static final long serialVersionUID = -4303159486787919718L;
34
	private final static String MESSAGE_FORMAT = "Can't perform editing in '%(resource)s'.";
34
	private final static String MESSAGE_FORMAT = "Can't perform changes in '%(resource)s'.";
35 35
	private final static String MESSAGE_KEY = "_PerformEditingException";
36 36

  
37 37
	public PerformEditingException(String resource, Throwable cause) {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/feature/spi/AbstractFeatureStoreProvider.java
107 107
					public Object run() throws Exception {
108 108
						return internalGetFeatureProviderByReference(reference);
109 109
					}
110
                                        public String toString() {
111
                                            return "getFeatureByReference";
112
                                        }
113
                                        
110 114
				});
111 115

  
112 116
		if (featureProvider == null) {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
1213 1213
                break;
1214 1214
            }
1215 1215
        } catch (PerformEditingException pee) {
1216
            throw new WriteException(provider.getProviderName(), pee);
1216
            throw new WriteException(provider.getSourceId().toString(), pee);
1217 1217
        } catch (Exception e) {
1218 1218
            throw new FinishEditingException(e);
1219 1219
        }
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.impl/src/main/java/org/gvsig/fmap/geom/util/Converter.java
1354 1354
	}
1355 1355
	
1356 1356
	private static com.vividsolutions.jts.geom.Geometry surfaceToJts(Geometry shp, int srid) {
1357
            try {
1357 1358
		com.vividsolutions.jts.geom.Geometry geoJTS = null;
1358 1359
		int theType;
1359 1360
		int numParts = 0;
......
1605 1606
		geoJTS.setSRID(srid);
1606 1607
		
1607 1608
		return geoJTS;
1609
            } catch(RuntimeException ex) {
1610
                    logger.debug("Can't convert surface to jts.",ex);
1611
                    throw  ex;
1612
            }
1613

  
1608 1614
	}
1609 1615
	
1610 1616
	private static com.vividsolutions.jts.geom.Geometry ellipseToJts(Geometry shp, int srid) {

Also available in: Unified diff