Revision 41807 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/main/java/org/gvsig/fmap/mapcontext/layers/FLyrDefault.java

View differences:

FLyrDefault.java
261 261
	 * @see com.iver.cit.gvsig.fmap.layers.FLayer#getName()
262 262
	 */
263 263
	public String getName() {
264
		return (String) this.metadataContainer.getDynValue(METADATA_NAME);
264
            String name = "(unknow)";
265
            try {
266
                name = (String) this.metadataContainer.getDynValue(METADATA_NAME);
267
            } catch( Throwable th) {
268
                logger.warn("Can't retrive the layer name.");
269
            }
270
            return name;
265 271
	}
266 272

  
267 273
	/*
......
927 933
	// ========================================================
928 934
	
929 935
	public void saveToState(PersistentState state) throws PersistenceException {
936
            try {
930 937
		state.set("parentLayer", parentLayer);
931 938
		state.set("status",status);
932 939
		state.set("minScale", minScale);
......
936 943
		state.set("name", getName());
937 944
		state.set("crs", getProjection());
938 945
		state.set("properties",properties.getExtendedProperties());
946
            } catch(PersistenceException ex) {
947
                logger.warn("Can't save to persistent state the layer '"+this.getName()+"'.");
948
                throw ex;
949
            } catch(RuntimeException ex) {
950
                logger.warn("Can't save to persistent state the layer '"+this.getName()+"'.");
951
                throw ex;
952
            }
939 953
	}
940 954

  
941 955
	public void loadFromState(PersistentState state) throws PersistenceException {
956
            try {
957
		this.setDynValue(METADATA_NAME, state.getString("name"));
958
		this.setDynValue(METADATA_CRS, state.get("crs"));
959
		
942 960
		this.parentLayer = (FLayers) state.get("parentLayer");
943 961
		this.status = (FLayerStatus) state.get("status");
944 962
		this.minScale = state.getDouble("minScale");
......
946 964
		this.transparency = state.getInt("transparency");
947 965
		this.ct = (ICoordTrans) state.get("coordTrans");
948 966

  
949
		this.setDynValue(METADATA_NAME, state.getString("name"));
950
		this.setDynValue(METADATA_CRS, state.get("crs"));
951
		
952 967
                this.properties.setExtendedProperties(new Hashtable((Map)state.get("properties")));
968
            } catch(PersistenceException ex) {
969
                logger.warn("Can't load from persietent state the layer '"+this.getName()+"'.");
970
                throw ex;
971
            } catch(RuntimeException ex) {
972
                logger.warn("Can't load from persietent state the layer '"+this.getName()+"'.");
973
                throw ex;
974
            }
953 975

  
954 976
	}
955 977

  

Also available in: Unified diff