Revision 9024
Added by Jing Tao about 10 years ago
src/edu/ucsb/nceas/metacat/accesscontrol/AccessControlForSingleFile.java | ||
---|---|---|
373 | 373 |
docid = IdentifierManager.getInstance().getLocalId(_guid); |
374 | 374 |
} catch (McdbDocNotFoundException e) { |
375 | 375 |
logMetacat.warn("Could not lookup docid for guid, defaulting to guid: " + _guid, e); |
376 |
} catch (SQLException e){ |
|
377 |
throw new AccessControlException("Couldn't identify the local id of the object with the specified identifier "+_guid+" since "+e.getMessage()); |
|
376 | 378 |
} |
377 | 379 |
|
378 | 380 |
output.append("<access authSystem=\"knb\" order=\"" + permOrder + "\" id=\"" + docid + "\" scope=\"document\""); |
src/edu/ucsb/nceas/metacat/MetacatHandler.java | ||
---|---|---|
2057 | 2057 |
"Document could not be deleted: " |
2058 | 2058 |
+ dnfe.getMessage()); |
2059 | 2059 |
dnfe.printStackTrace(System.out); |
2060 |
|
|
2060 |
return; |
|
2061 | 2061 |
} // end try() |
2062 |
|
|
2062 |
|
|
2063 |
} catch (SQLException sqle) { |
|
2064 |
response.setContentType("text/xml"); |
|
2065 |
out.println(this.PROLOG); |
|
2066 |
out.println(this.ERROR); |
|
2067 |
//out.println("Error deleting document!!!"); |
|
2068 |
out.println(sqle.getMessage()); |
|
2069 |
out.println(this.ERRORCLOSE); |
|
2070 |
logMetacat.error("MetacatHandler.handleDeleteAction - " + |
|
2071 |
"Document could not be deleted: " |
|
2072 |
+ sqle.getMessage()); |
|
2073 |
sqle.printStackTrace(System.out); |
|
2074 |
return; |
|
2063 | 2075 |
} // end try() |
2064 | 2076 |
|
2065 | 2077 |
// alert that it happened |
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
308 | 308 |
throw new InvalidRequest("1202", "The object with the provided " + |
309 | 309 |
"identifier was not found."); |
310 | 310 |
|
311 |
} catch (SQLException ee) { |
|
312 |
throw new ServiceFailure("1310", "The object with the provided " + |
|
313 |
"identifier "+pid.getValue()+" can't be identified since - "+ee.getMessage()); |
|
311 | 314 |
} |
312 | 315 |
|
313 | 316 |
// set the originating node |
... | ... | |
572 | 575 |
} catch (McdbDocNotFoundException e) { |
573 | 576 |
logMetacat.info("No replica found. Continuing."); |
574 | 577 |
|
578 |
} catch (SQLException ee) { |
|
579 |
throw new ServiceFailure("2151", "Couldn't identify the local id of the object with the specified identifier " |
|
580 |
+pid.getValue()+" since - "+ee.getMessage()); |
|
575 | 581 |
} |
576 | 582 |
|
577 | 583 |
// no local replica, get a replica |
... | ... | |
1015 | 1021 |
throw new ServiceFailure("2161", "The identifier specified by " + |
1016 | 1022 |
syncFailed.getPid() + " was not found on this node."); |
1017 | 1023 |
|
1024 |
} catch (SQLException e) { |
|
1025 |
throw new ServiceFailure("2161", "Couldn't identify the local id of the identifier specified by " + |
|
1026 |
syncFailed.getPid() + " since "+e.getMessage()); |
|
1018 | 1027 |
} |
1019 | 1028 |
// TODO: update the CN URL below when the CNRead.SynchronizationFailed |
1020 | 1029 |
// method is changed to include the URL as a parameter |
... | ... | |
1067 | 1076 |
throw new ServiceFailure("2181", "The object specified by " + |
1068 | 1077 |
pid.getValue() + " does not exist at this node."); |
1069 | 1078 |
|
1079 |
} catch (SQLException e) { |
|
1080 |
throw new ServiceFailure("2181", "The local id of the object specified by " + |
|
1081 |
pid.getValue() + " couldn't be identified since "+e.getMessage()); |
|
1070 | 1082 |
} |
1071 | 1083 |
|
1072 | 1084 |
Subject targetNodeSubject = session.getSubject(); |
... | ... | |
1662 | 1674 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
1663 | 1675 |
sf.initCause(e); |
1664 | 1676 |
throw sf; |
1665 |
} |
|
1677 |
} catch (SQLException e) { |
|
1678 |
// report as service failure |
|
1679 |
ServiceFailure sf = new ServiceFailure("1030", e.getMessage()); |
|
1680 |
sf.initCause(e); |
|
1681 |
throw sf; |
|
1682 |
} |
|
1666 | 1683 |
|
1667 | 1684 |
return newIdentifier; |
1668 | 1685 |
} |
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.io.InputStream; |
27 | 27 |
import java.math.BigInteger; |
28 |
import java.sql.SQLException; |
|
28 | 29 |
import java.util.ArrayList; |
29 | 30 |
import java.util.Calendar; |
30 | 31 |
import java.util.Date; |
... | ... | |
430 | 431 |
// request.getHeader("User-Agent"), session.getSubject().getValue(), |
431 | 432 |
// pid.getValue(), Event.DELETE.xmlValue()); |
432 | 433 |
|
434 |
} catch (SQLException e) { |
|
435 |
throw new ServiceFailure("4962", "Couldn't delete " + pid.getValue() + |
|
436 |
". The local id of the object with the identifier can't be identified since " + e.getMessage()); |
|
433 | 437 |
} |
434 | 438 |
|
435 | 439 |
// get the node list |
... | ... | |
576 | 580 |
// request.getHeader("User-Agent"), session.getSubject().getValue(), |
577 | 581 |
// pid.getValue(), Event.DELETE.xmlValue()); |
578 | 582 |
|
583 |
} catch (SQLException e) { |
|
584 |
throw new ServiceFailure("4972", "Couldn't archive the object " + pid.getValue() + |
|
585 |
". The local id of the object with the identifier can't be identified since "+e.getMessage()); |
|
579 | 586 |
} |
580 | 587 |
|
581 | 588 |
return pid; |
... | ... | |
1157 | 1164 |
} catch (McdbDocNotFoundException e) { |
1158 | 1165 |
// do nothing, no localId to log with |
1159 | 1166 |
logMetacat.warn("Could not log 'registerSystemMetadata' event because no localId was found for pid: " + pid.getValue()); |
1167 |
} catch (SQLException ee) { |
|
1168 |
// do nothing, no localId to log with |
|
1169 |
logMetacat.warn("Could not log 'registerSystemMetadata' event because the localId couldn't be identified for pid: " + pid.getValue()); |
|
1160 | 1170 |
} |
1161 | 1171 |
|
1162 | 1172 |
|
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java | ||
---|---|---|
217 | 217 |
localId = IdentifierManager.getInstance().getLocalId(pid.getValue()); |
218 | 218 |
} catch (McdbDocNotFoundException e) { |
219 | 219 |
throw new NotFound("1340", "The object with the provided " + "identifier was not found."); |
220 |
} catch (SQLException e) { |
|
221 |
throw new ServiceFailure("1350", "The object with the provided " + "identifier "+pid.getValue()+" couldn't be identified since "+e.getMessage()); |
|
220 | 222 |
} |
221 | 223 |
|
222 | 224 |
try { |
... | ... | |
572 | 574 |
throw new NotFound("1020", "The object specified by " + |
573 | 575 |
pid.getValue() + |
574 | 576 |
" does not exist at this node."); |
577 |
} catch (SQLException e) { |
|
578 |
throw new ServiceFailure("1030", "The object specified by "+ pid.getValue()+ |
|
579 |
" couldn't be identified at this node since "+e.getMessage()); |
|
575 | 580 |
} |
576 | 581 |
|
577 | 582 |
// check for authorization |
... | ... | |
1206 | 1211 |
" should have been in the identifier table, but it wasn't: " + |
1207 | 1212 |
e.getMessage()); |
1208 | 1213 |
|
1214 |
} catch (SQLException e) { |
|
1215 |
throw new ServiceFailure("1030", "D1NodeService.insertOrUpdateDocument() -"+ |
|
1216 |
" couldn't identify if the pid "+pid.getValue()+" is in the identifier table since "+e.getMessage()); |
|
1209 | 1217 |
} |
1210 | 1218 |
|
1211 | 1219 |
} |
... | ... | |
1451 | 1459 |
} catch (McdbDocNotFoundException e) { |
1452 | 1460 |
// do nothing, no localId to log with |
1453 | 1461 |
logMetacat.warn("Could not log 'updateSystemMetadata' event because no localId was found for pid: " + pid.getValue()); |
1462 |
} catch (SQLException e) { |
|
1463 |
logMetacat.warn("Could not log 'updateSystemMetadata' event because the localId couldn't be identified for the pid: " + pid.getValue()); |
|
1454 | 1464 |
} |
1455 | 1465 |
|
1456 | 1466 |
return true; |
... | ... | |
1601 | 1611 |
localId = IdentifierManager.getInstance().getLocalId(pid.getValue()); |
1602 | 1612 |
} catch (McdbDocNotFoundException e) { |
1603 | 1613 |
throw new NotFound("1340", "The object with the provided " + "identifier was not found."); |
1614 |
} catch (SQLException e) { |
|
1615 |
throw new ServiceFailure("1350", "The object with the provided identifier "+pid.getValue()+" couldn't be identified since "+e.getMessage()); |
|
1604 | 1616 |
} |
1605 | 1617 |
|
1606 | 1618 |
// does the subject have archive (a D1 CHANGE_PERMISSION level) privileges on the pid? |
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
795 | 795 |
* @param guid the global identifier to look up |
796 | 796 |
* @return boolean true if the identifier exists |
797 | 797 |
*/ |
798 |
public boolean mappingExists(String guid) |
|
798 |
public boolean mappingExists(String guid) throws SQLException
|
|
799 | 799 |
{ |
800 | 800 |
boolean idExists = false; |
801 | 801 |
try { |
... | ... | |
1456 | 1456 |
* @return String containing the corresponding LocalId |
1457 | 1457 |
* @throws McdbDocNotFoundException if the identifier is not found |
1458 | 1458 |
*/ |
1459 |
public String getLocalId(String guid) throws McdbDocNotFoundException { |
|
1459 |
public String getLocalId(String guid) throws McdbDocNotFoundException, SQLException {
|
|
1460 | 1460 |
|
1461 | 1461 |
String db_guid = ""; |
1462 | 1462 |
String docid = ""; |
... | ... | |
1487 | 1487 |
} catch (SQLException e) { |
1488 | 1488 |
logMetacat.error("Error while looking up the local identifier: " |
1489 | 1489 |
+ e.getMessage()); |
1490 |
throw e; |
|
1490 | 1491 |
} finally { |
1491 | 1492 |
// Return database connection to the pool |
1492 | 1493 |
DBConnectionPool.returnDBConnection(dbConn, serialNumber); |
Also available in: Unified diff
Fixed a bug that the method getLocalId swallowed an exception incorrectly in the IdentifierManager.