comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 242:b35d32e507b6

Fix for flys/issue9 artifacts/trunk@1677 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Apr 2011 11:26:53 +0000
parents 3e29395ebac6
children 6de74b0b878e
comparison
equal deleted inserted replaced
241:4253995c970e 242:b35d32e507b6
497 if (!result.next()) { 497 if (!result.next()) {
498 return false; 498 return false;
499 } 499 }
500 500
501 int id = result.getInt(1); 501 int id = result.getInt(1);
502 long ttlX = result.getLong(3); 502 long ttlX = result.getLong(2);
503 503 Long ttl = result.wasNull() ? null : ttlX;
504 Long ttl = result.wasNull() ? null : Long.valueOf(ttlX); 504
505 505 String factoryName = result.getString(3);
506 if (ttl != null) { // real time to life
507 long last_access = result.getTimestamp(2).getTime();
508 if (last_access + ttlX < System.currentTimeMillis()) {
509 artifactOutdated(id);
510 return false;
511 }
512 }
513
514 String factoryName = result.getString(4);
515 506
516 if (factoryLookup == null) { 507 if (factoryLookup == null) {
517 logger.error("factory lookup == null"); 508 logger.error("factory lookup == null");
518 return false; 509 return false;
519 } 510 }
524 if (factory == null) { 515 if (factory == null) {
525 logger.error("factory '" + factoryName + "' not found"); 516 logger.error("factory '" + factoryName + "' not found");
526 return false; 517 return false;
527 } 518 }
528 519
529 byte [] bytes = result.getBytes(5); 520 byte [] bytes = result.getBytes(4);
530 521
531 loaded[0] = loader.load(factory, ttl, bytes, id); 522 loaded[0] = loader.load(factory, ttl, bytes, id);
532 return true; 523 return true;
533 } 524 }
534 }; 525 };

http://dive4elements.wald.intevation.org