Project

General

Profile

« Previous | Next » 

Revision 8510

minor changes to error msgs

View differences:

src/edu/ucsb/nceas/metacat/dataone/SyncAccessPolicy.java
7 7
 *             National Center for Ecological Analysis and Synthesis
8 8
 *    Authors: Peter Slaughter
9 9
 *
10
 *   '$Author: slaughter $'
10
 *   '$Author$'
11 11
 *     '$Date:$'
12 12
 * '$Revision:$'
13 13
 *
......
109 109
		AccessPolicy cnAccessPolicy = null;
110 110
		String guid = null;
111 111
		AccessPolicy mnAccessPolicy = null;
112
		Identifier pid = null;
112
		Identifier pid = new Identifier();
113 113
		ObjectInfo objInfo = null;
114
		pid = new Identifier();
115 114
		Session session = null;
116 115
		List<Identifier> syncedIds = new ArrayList<Identifier>();
117 116
		SystemMetadata cnSysMeta = null;
......
132 131
				// Get sm, access policy for requested localId
133 132
				mnSysMeta = IdentifierManager.getInstance().getSystemMetadata(
134 133
						pid.getValue());
135

  
136 134
			} catch (McdbDocNotFoundException e) {
137 135
				logMetacat.error("Error syncing access policy of pid: "
138 136
						+ pid.getValue() + " pid not found: " + e.getMessage());
......
145 143
					.debug("Getting access policy for pid: " + pid.getValue());
146 144

  
147 145
			mnAccessPolicy = mnSysMeta.getAccessPolicy();
148
			// logMetacat.debug("pid: " +
149
			// mnSysMeta.getIdentifier().toString());
150

  
146
			
151 147
			// Get sm, access policy for requested pid from the CN
152

  
153 148
			try {
154 149
				cnSysMeta = cn.getSystemMetadata(pid);
155 150
			} catch (Exception e) {
156 151
				logMetacat.error("Error getting system metadata for pid: "
157 152
						+ pid.getValue() + " from cn: " + e.getMessage());
153
				continue;
158 154
			}
159 155
			logMetacat.debug("Getting access policy from CN for pid: "
160 156
					+ pid.getValue());
161

  
162 157
			cnAccessPolicy = cnSysMeta.getAccessPolicy();
163 158
			logMetacat.debug("Diffing access policies (MN,CN) for pid: "
164 159
					+ pid.getValue());
......
176 171
					// Add this pid to the list of pids that were successfully
177 172
					// synced
178 173
					syncedIds.add(pid);
174
				} catch (NotAuthorized na) {
175
					logMetacat
176
							.error("Error syncing CN with access policy of pid: "
177
									+ pid.getValue()
178
									+ " user not authorized: "
179
									+ na.getMessage());
180
					throw na;
181
				} catch (ServiceFailure sf) {
182
					logMetacat
183
							.error("Error syncing CN with access policy of pid: "
184
									+ pid.getValue()
185
									+ " Service failure: "
186
									+ sf.getMessage());
187
					throw sf;
179 188
				} catch (Exception e) {
180
					logMetacat.error("Error setting access policy of pid: "
181
							+ pid.getValue() + " with cn: " + e.getMessage());
189
					logMetacat
190
							.error("Error syncing CN with access policy of pid: "
191
									+ pid.getValue() + e.getMessage());
192
					throw e;
182 193
				}
183

  
184 194
			}
185 195
			logMetacat.debug("Done with pid: " + pid.getValue());
186 196
		}
......
228 238
		// syncAll, and
229 239
		// what sync(ObjectList...) expects
230 240
		for (String guid : guidsToSync) {
231

  
232 241
			try {
233 242
				sm = IdentifierManager.getInstance().getSystemMetadata(guid);
234 243
			} catch (Exception e) {
......
236 245
						+ e.getMessage());
237 246
			}
238 247

  
239
			logMetacat.debug("Got sm for guid: " + guid);
240 248
			ObjectInfo oi = new ObjectInfo();
241

  
242 249
			Identifier id = new Identifier();
243 250
			id.setValue(guid);
244 251
			oi.setIdentifier(id);
245

  
246 252
			oi.setDateSysMetadataModified(sm.getDateSysMetadataModified());
247

  
248 253
			oi.setChecksum(sm.getChecksum());
249 254
			oi.setFormatId(sm.getFormatId());
250 255
			oi.setSize(sm.getSize());
251 256

  

Also available in: Unified diff