Project

General

Profile

« Previous | Next » 

Revision 5208

Added by daigle about 14 years ago

Move the chunking of large test element data to centralized location in DBSAXNode.writeChildNodeToDB(). Beff up logging

View differences:

Eml210SAXHandler.java
431 431
					}
432 432
					
433 433
					if (revList.size() > 0) {
434
						throw (new SAXException("Doc ID " + docid + " was deleted and cannot be updated."));
434
						throw (new SAXException("EML210SaxHandler.startElement - Doc ID " + docid + " was deleted and cannot be updated."));
435 435
					} else {
436
						throw (new SAXException("Doc ID " + docid + " was not found and cannot be updated.")); 
436
						throw (new SAXException("EML210SaxHandler.startElement - Doc ID " + docid + " was not found and cannot be updated.")); 
437 437
					}
438 438
				} catch (Exception e) {
439
					throw (new SAXException("Error in EMLSaxHandler.startElement "
440
							+ action, e));
439
                    throw (new SAXException("EML210SaxHandler.startElement - error with action " + 
440
                    		action + " : " + e.getMessage()));
441 441
				}
442 442
			}
443 443

  
......
1139 1139
		logMetacat.debug("IGNORABLEWHITESPACE");
1140 1140
		if (!handleInlineData) {
1141 1141
			DBSAXNode currentNode = (DBSAXNode) nodeStack.peek();
1142
			String data = null;
1143
			int leftover = len;
1144
			int offset = start;
1145
			boolean moredata = true;
1146

  
1147
			// This loop deals with the case where there are more characters
1148
			// than can fit in a single database text field (limit is
1149
			// MAXDATACHARS). If the text to be inserted exceeds MAXDATACHARS,
1150
			// write a series of nodes that are MAXDATACHARS long, and then the
1151
			// final node contains the remainder
1152
			while (moredata) {
1153
				if (leftover > MAXDATACHARS) {
1154
					data = new String(cbuf, offset, MAXDATACHARS);
1155
					leftover -= MAXDATACHARS;
1156
					offset += MAXDATACHARS;
1157
				} else {
1158
					data = new String(cbuf, offset, leftover);
1159
					moredata = false;
1160
				}
1161

  
1142
				String data = new String(cbuf, start, len);
1162 1143
				// compare whitespace in access top module
1163 1144
				if (processTopLevelAccess && needToCheckAccessModule) {
1164 1145
					compareWhiteSpace(currentUnchangeableAccessModuleNodeStack, data,
......
1174 1155

  
1175 1156
				}
1176 1157
				endNodeId = currentNode.writeChildNodeToDB("TEXT", null, data, docid);
1177
			}
1178 1158
		} else {
1179 1159
			// This is inline data write to file directly
1180 1160
			StringBuffer inlineWhiteSpace = new StringBuffer(new String(cbuf, start, len));

Also available in: Unified diff