Project

General

Profile

« Previous | Next » 

Revision 4779

Added by daigle almost 16 years ago

Do not throw exception when skin metadata file is missing. Instead, remove the skin from the available skins list, write an error message to the log and continue on. This was already done for the skins properties file.

View differences:

src/edu/ucsb/nceas/metacat/service/SkinPropertyService.java
78 78
			initialize();
79 79
		} catch (GeneralPropertyException gpe) {
80 80
			throw new ServiceException(
81
					"Properties problem while initializing PropertyService: "
81
					"Properties problem while initializing SkinPropertyService: "
82 82
							+ gpe.getMessage());
83 83
		} catch (IOException ioe) {
84
			throw new ServiceException("I/O Problem while initializing PropertyService: "
84
			throw new ServiceException("I/O Problem while initializing SkinPropertyService: "
85 85
					+ ioe.getMessage());
86 86
		}
87 87
	}
......
144 144

  
145 145
				if (FileUtil.getFileStatus(propertyFilePath) < FileUtil.EXISTS_READ_WRITABLE) {
146 146
					logMetacat.error("Skin property file: " + propertyFilePath
147
							+ " does not exist read/writable");
147
							+ " does not exist read/writable. This skin will not be available.");
148 148
					continue;
149 149
				}
150 150

  
......
155 155
				String metaDataFilePath = ServiceService.getRealSkinDir()
156 156
						+ FileUtil.getFS() + skinName + FileUtil.getFS() + skinName
157 157
						+ ".properties.metadata.xml";
158
				if (FileUtil.getFileStatus(metaDataFilePath) == FileUtil.DOES_NOT_EXIST) {
159
					throw new GeneralPropertyException(
160
							"Could not find skin property metadata file: "
161
									+ metaDataFilePath);
158
				if (FileUtil.getFileStatus(metaDataFilePath) > FileUtil.DOES_NOT_EXIST) {
159
					PropertiesMetaData skinMetaData = new PropertiesMetaData(metaDataFilePath);
160
					skinMetaDataMap.put(skinName, skinMetaData);
162 161
				} else {
163
					PropertiesMetaData skinMetaData = new PropertiesMetaData(
164
							metaDataFilePath);
165
					skinMetaDataMap.put(skinName, skinMetaData);
162
					skinPropertiesMap.remove(skinName);
163
					logMetacat.error("Could not find skin property metadata file for skin: " 
164
							+ skinName + " at: " + metaDataFilePath  
165
							+ ". This skin will not be available.");
166
					continue;
166 167
				}
167 168

  
168 169
				String backupPropertyFilePath = BACKUP_DIR + FileUtil.getFS() + skinName
......
173 174
					skinBackupProperties.load();
174 175
					skinBackupPropertiesMap.put(skinName, skinBackupProperties);
175 176
				} else {
176
					logMetacat.info("Could not find backup properties for skin: "
177
							+ skinName + ". Backup file does not exist: "
178
							+ backupPropertyFilePath);
177
					logMetacat.warn("Could not find backup properties for skin: "
178
							+ skinName + " at: " + backupPropertyFilePath);
179 179
				}
180 180
			}
181 181
		} catch (TransformerException te) {

Also available in: Unified diff