Project

General

Profile

« Previous | Next » 

Revision 4851

Added by daigle over 15 years ago

Do not read or write zero length documents to/from disk

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
1002 1002
			throw new McdbException("Could not write file: " + documentPath + " : "
1003 1003
					+ ioe.getMessage());
1004 1004
		}
1005

  
1005
		
1006
		if (FileUtil.getFileSize(documentPath) == 0) {
1007
			throw new McdbException("Attempting to read a zero length document from disk: " + documentPath);
1008
		}
1009
		
1006 1010
		readFromFileSystem(pw, user, groups, documentPath);
1007 1011
	}
1008 1012
    
......
1393 1397
		String documentDir = null;
1394 1398
		String documentPath = null;
1395 1399

  
1396
		try {		
1397
			
1400
		try {				
1398 1401
			documentDir = PropertyService.getProperty("application.documentfilepath");
1399 1402
			documentPath = documentDir + FileUtil.getFS() + accNumber;
1400 1403

  
1404
			if (xml == null || xml.equals("")) {
1405
				throw new McdbException("Attempting to write a file with no xml content: " + documentPath);
1406
			}
1407
			
1401 1408
			if (accNumber == null) {
1402 1409
				throw new McdbException("Could not write document file.  Account number is null" );
1403 1410
			}

Also available in: Unified diff