Revision 6719
Added by ben leinfelder about 13 years ago
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java | ||
---|---|---|
856 | 856 |
logMetacat.debug("Generating a pid/localId mapping"); IdentifierManager im = IdentifierManager.getInstance(); String localId = im.generateLocalId(pid.getValue(), 1); - - try { - logMetacat.debug("Case DATA: starting to write to disk."); - if (DocumentImpl.getDataFileLockGrant(localId)) { - - // Save the data file to disk using "localId" as the name - try { - String datafilepath = PropertyService.getProperty("application.datafilepath"); - + |
857 |
// Save the data file to disk using "localId" as the name |
|
858 |
String datafilepath = null; |
|
859 |
try { |
|
860 |
datafilepath = PropertyService.getProperty("application.datafilepath"); |
|
861 |
} catch (PropertyNotFoundException e) { |
|
862 |
ServiceFailure sf = new ServiceFailure("1190", "Lookup data file path" + e.getMessage()); |
|
863 |
sf.initCause(e); |
|
864 |
throw sf; |
|
865 |
} + boolean locked = false; |
|
866 |
try { |
|
867 |
locked = DocumentImpl.getDataFileLockGrant(localId); |
|
868 |
} catch (Exception e) { |
|
869 |
ServiceFailure sf = new ServiceFailure("1190", "Could not lock file for writing:" + e.getMessage()); |
|
870 |
sf.initCause(e); |
|
871 |
throw sf; |
|
872 |
} |
|
873 |
+ logMetacat.debug("Case DATA: starting to write to disk."); + if (locked) { + File dataDirectory = new File(datafilepath); dataDirectory.mkdirs(); @@ -913,18 +926,9 @@ |
|
857 | 874 |
logMetacat.debug("Scheduling replication."); ForceReplicationHandler frh = new ForceReplicationHandler( localId, "create", false, null); - - } catch (PropertyNotFoundException e) { - throw new ServiceFailure("1190", "Could not lock file for writing:" + |
858 |
e.getMessage());
|
|
859 |
- }
- }
- return localId;
- } catch (Exception e) {
- // Could not get a lock on the document, so we can not update the file now
- throw new ServiceFailure("1190", "Failed to lock file: " + e.getMessage());
- }
|
|
875 |
}
|
|
876 |
+ return localId;
|
|
860 | 877 |
} |
861 | 878 |
|
Also available in: Unified diff
make exception/error reporting clearer -- was getting lock messages when perhaps that was not the correct exception.