Project

General

Profile

« Previous | Next » 

Revision 7287

make sure we have non-null values where jibx serialization expects them for LogEntry

View differences:

src/edu/ucsb/nceas/metacat/EventLog.java
336 336
        );
337 337
        
338 338
        
339
        boolean clauseAdded = false;
339
        boolean clauseAdded = true;
340 340
        int startIndex = 0;
341 341
        int endIndex = 0;
342 342
        
......
380 380
        if (event != null) {
381 381
        	query.append("event in (");
382 382
    		query.append("?");
383
    		String eventString = event.toString();
383
    		String eventString = event.xmlValue();
384 384
    		if (event.equals(Event.CREATE)) {
385 385
    			eventString = "insert";
386 386
    		}
......
438 438
				logEntry.setIdentifier(identifier);
439 439

  
440 440
            	logEntry.setIpAddress(anonymous ? "N/A" : rs.getString(3));
441
            	logEntry.setUserAgent(rs.getString(4));
441
            	String userAgent = "N/A";
442
            	if (rs.getString(4) != null) {
443
            		userAgent = rs.getString(4);
444
            	}
445
            	logEntry.setUserAgent(userAgent);
442 446
            	
443 447
            	Subject subject = new Subject();
444 448
            	subject.setValue(anonymous ? "N/A" : rs.getString(5));
445 449
				logEntry.setSubject(subject);
446 450
				
447
				Event logEvent = Event.valueOf(rs.getString(6));
451
				
452
				String logEventString = rs.getString(6);
453
				Event logEvent = Event.convert(logEventString );
454
				if (logEvent == null) {
455
					logMetacat.info("Skipping uknown DataONE Event type: " + logEventString);
456
					continue;
457
				}
448 458
				logEntry.setEvent(logEvent);
449 459
				logEntry.setDateLogged(rs.getTimestamp(7));
450 460
				
......
472 482

  
473 483
            stmt.close();
474 484
        } catch (SQLException e) {
475
        	logMetacat.info("Error while getting log events: " + e.getMessage());
485
        	logMetacat.error("Error while getting log events: " + e.getMessage(), e);
476 486
        } finally {
477 487
            // Return database connection to the pool
478 488
            DBConnectionPool.returnDBConnection(dbConn, serialNumber);

Also available in: Unified diff