Revision 4440
Added by daigle about 16 years ago
src/edu/ucsb/nceas/metacat/admin/SkinsAdmin.java | ||
---|---|---|
203 | 203 |
|
204 | 204 |
// Try to create backup directories if necessary. |
205 | 205 |
String backupDir = PropertyService.getBackupDir(); |
206 |
if (!FileUtil.createDirectory(backupDir)) { |
|
207 |
String errorString = "Could not create directory: " + backupDir; |
|
206 |
try { |
|
207 |
FileUtil.createDirectory(backupDir); |
|
208 |
} catch (IOException ioe) { |
|
209 |
String errorString = "Could not create directory: " + backupDir + |
|
210 |
" : " + ioe.getMessage(); |
|
208 | 211 |
logMetacat.error(errorString); |
209 | 212 |
validationErrors.add(errorString); |
210 | 213 |
} |
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java | ||
---|---|---|
179 | 179 |
|
180 | 180 |
// Try to create backup directories if necessary. |
181 | 181 |
String backupDir = PropertyService.getBackupDir(); |
182 |
if (!FileUtil.createDirectory(backupDir)) { |
|
183 |
String errorString = "Could not create directory: " + backupDir; |
|
182 |
try { |
|
183 |
FileUtil.createDirectory(backupDir); |
|
184 |
} catch (IOException ioe) { |
|
185 |
String errorString = "Could not create directory: " + backupDir + |
|
186 |
" : " + ioe.getMessage(); |
|
184 | 187 |
logMetacat.error(errorString); |
185 | 188 |
validationErrors.add(errorString); |
186 | 189 |
} |
187 | 190 |
|
188 | 191 |
// Try to create data directories if necessary. |
189 | 192 |
String dataDir = PropertyService.getProperty("application.datafilepath"); |
190 |
if (!FileUtil.createDirectory(dataDir)) { |
|
191 |
String errorString = "Could not create directory: " + dataDir; |
|
193 |
try { |
|
194 |
FileUtil.createDirectory(dataDir); |
|
195 |
} catch (IOException ioe) { |
|
196 |
String errorString = "Could not create directory: " + dataDir + |
|
197 |
" : " + ioe.getMessage(); |
|
192 | 198 |
logMetacat.error(errorString); |
193 | 199 |
validationErrors.add(errorString); |
194 | 200 |
} |
195 | 201 |
|
196 | 202 |
// Try to create inline-data directories if necessary. |
197 | 203 |
String inlineDataDir = PropertyService.getProperty("application.inlinedatafilepath"); |
198 |
if (!FileUtil.createDirectory(inlineDataDir)) { |
|
199 |
String errorString = "Could not create directory: " + inlineDataDir; |
|
204 |
try { |
|
205 |
FileUtil.createDirectory(inlineDataDir); |
|
206 |
} catch (IOException ioe) { |
|
207 |
String errorString = "Could not create directory: " + inlineDataDir + |
|
208 |
" : " + ioe.getMessage(); |
|
200 | 209 |
logMetacat.error(errorString); |
201 | 210 |
validationErrors.add(errorString); |
202 | 211 |
} |
203 | 212 |
|
204 | 213 |
// Try to create document directories if necessary. |
205 | 214 |
String documentfilepath = PropertyService.getProperty("application.documentfilepath"); |
206 |
if (!FileUtil.createDirectory(documentfilepath)) { |
|
207 |
String errorString = "Could not create directory: " + documentfilepath; |
|
215 |
try { |
|
216 |
FileUtil.createDirectory(documentfilepath); |
|
217 |
} catch (IOException ioe) { |
|
218 |
String errorString = "Could not create directory: " + documentfilepath + |
|
219 |
" : " + ioe.getMessage(); |
|
208 | 220 |
logMetacat.error(errorString); |
209 | 221 |
validationErrors.add(errorString); |
210 | 222 |
} |
211 | 223 |
|
212 | 224 |
// Try to create temporary directories if necessary. |
213 | 225 |
String tempDir = PropertyService.getProperty("application.tempDir"); |
214 |
if (!FileUtil.createDirectory(tempDir)) { |
|
215 |
String errorString = "Could not create directory: " + tempDir; |
|
226 |
try { |
|
227 |
FileUtil.createDirectory(tempDir); |
|
228 |
} catch (IOException ioe) { |
|
229 |
String errorString = "Could not create directory: " + tempDir + |
|
230 |
" : " + ioe.getMessage(); |
|
216 | 231 |
logMetacat.error(errorString); |
217 | 232 |
validationErrors.add(errorString); |
218 | 233 |
} |
... | ... | |
228 | 243 |
+ "processing system properties page: " + gpe.getMessage(); |
229 | 244 |
logMetacat.error(errorMessage); |
230 | 245 |
processingErrors.add(errorMessage); |
231 |
} catch (IOException ioe) { |
|
232 |
String errorMessage = "IO problem while processing system " |
|
233 |
+ "properties page: " + ioe.getMessage(); |
|
234 |
logMetacat.error(errorMessage); |
|
235 |
processingErrors.add(errorMessage); |
|
236 |
} |
|
246 |
} |
|
237 | 247 |
|
238 | 248 |
try { |
239 | 249 |
if (validationErrors.size() > 0 || processingErrors.size() > 0) { |
src/edu/ucsb/nceas/metacat/admin/LDAPAdmin.java | ||
---|---|---|
38 | 38 |
import org.apache.log4j.Logger; |
39 | 39 |
|
40 | 40 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
41 |
import edu.ucsb.nceas.metacat.util.LDAPUtil; |
|
42 | 41 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
43 |
import edu.ucsb.nceas.metacat.util.UtilException; |
|
44 | 42 |
import edu.ucsb.nceas.utilities.FileUtil; |
45 | 43 |
import edu.ucsb.nceas.utilities.GeneralPropertyException; |
46 | 44 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
... | ... | |
170 | 168 |
// Try to create data file and backup directories if |
171 | 169 |
// necessary. |
172 | 170 |
String backupDir = PropertyService.getBackupDir(); |
173 |
if (!FileUtil.createDirectory(backupDir)) { |
|
174 |
String errorString = "Could not create directory: " + backupDir; |
|
171 |
try { |
|
172 |
FileUtil.createDirectory(backupDir); |
|
173 |
} catch (IOException ioe) { |
|
174 |
String errorString = "Could not create directory: " + backupDir |
|
175 |
+ " : " + ioe.getMessage(); |
|
175 | 176 |
logMetacat.error(errorString); |
176 | 177 |
validationErrors.add(errorString); |
177 | 178 |
} |
... | ... | |
188 | 189 |
+ "processing LDAP properties page: " + gpe.getMessage(); |
189 | 190 |
logMetacat.error(errorMessage); |
190 | 191 |
processingErrors.add(errorMessage); |
191 |
} catch (IOException ioe) { |
|
192 |
String errorMessage = "IO problem while processing LDAP " |
|
193 |
+ "properties page: " + ioe.getMessage(); |
|
194 |
logMetacat.error(errorMessage); |
|
195 |
processingErrors.add(errorMessage); |
|
196 | 192 |
} |
197 | 193 |
|
198 | 194 |
try { |
src/edu/ucsb/nceas/metacat/admin/OrganizationAdmin.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import java.io.IOException; |
30 | 30 |
import java.util.Set; |
31 |
import java.util.SortedMap; |
|
32 | 31 |
import java.util.Vector; |
33 | 32 |
|
34 | 33 |
import javax.servlet.ServletException; |
... | ... | |
43 | 42 |
import edu.ucsb.nceas.metacat.util.UtilException; |
44 | 43 |
import edu.ucsb.nceas.utilities.FileUtil; |
45 | 44 |
import edu.ucsb.nceas.utilities.GeneralPropertyException; |
46 |
import edu.ucsb.nceas.utilities.MetaDataProperty; |
|
47 | 45 |
import edu.ucsb.nceas.utilities.PropertiesMetaData; |
48 | 46 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
49 | 47 |
import edu.ucsb.nceas.utilities.SortedProperties; |
... | ... | |
173 | 171 |
// Try to create data file and backup directories if |
174 | 172 |
// necessary. |
175 | 173 |
String backupDir = PropertyService.getBackupDir(); |
176 |
if (!FileUtil.createDirectory(backupDir)) { |
|
177 |
String errorString = "Could not create directory: " + backupDir; |
|
174 |
try { |
|
175 |
FileUtil.createDirectory(backupDir); |
|
176 |
} catch (IOException ioe) { |
|
177 |
String errorString = "Could not create directory: " + backupDir |
|
178 |
+ " : " + ioe.getMessage(); |
|
178 | 179 |
logMetacat.error(errorString); |
179 | 180 |
validationErrors.add(errorString); |
180 | 181 |
} |
... | ... | |
191 | 192 |
+ "processing organization properties page: " + gpe.getMessage(); |
192 | 193 |
logMetacat.error(errorMessage); |
193 | 194 |
processingErrors.add(errorMessage); |
194 |
} catch (IOException ioe) { |
|
195 |
String errorMessage = "IO problem while processing organization " |
|
196 |
+ "properties page: " + ioe.getMessage(); |
|
197 |
logMetacat.error(errorMessage); |
|
198 |
processingErrors.add(errorMessage); |
|
199 | 195 |
} catch (UtilException ue) { |
200 | 196 |
String errorMessage = "Error in utilities while: " |
201 | 197 |
+ "processing organization properties page: " + ue.getMessage(); |
Also available in: Unified diff
change the FileUtil.createDirectory calls to catch an exception on error.