Skip to content
Snippets Groups Projects
Commit e273b36e authored by Radek Ošlejšek's avatar Radek Ošlejšek
Browse files

Fixed bug in HumanFaceFactory

parent a1ee456e
No related branches found
No related tags found
No related merge requests found
......@@ -168,11 +168,13 @@ public class HumanFaceFactory {
*/
public HumanFace getFace(String faceId) {
if (updateAccessTime(faceId)) { // in memory face
System.out.println("AAA" + faceId);
return inMemoryFaces.get(usage.get(faceId));
}
File dumpFile = dumpedFaces.get(faceId);
if (dumpFile == null) { // unknown face
System.out.println("BBB" + faceId);
return null;
}
......@@ -185,7 +187,9 @@ public class HumanFaceFactory {
executor.shutdown();
while (!executor.isTerminated()){}
face = result.get();
System.out.println("DDD" + face.getId());
} catch (InterruptedException|ExecutionException ex) {
System.out.println("EEE" + faceId);
Logger.getLogger(HumanFaceFactory.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
......@@ -227,6 +231,9 @@ public class HumanFaceFactory {
HumanFace face = inMemoryFaces.get(oldTime);
long newTime = System.currentTimeMillis();
while (inMemoryFaces.containsKey(newTime)) { // wait until we get unique ms
newTime = System.currentTimeMillis();
}
inMemoryFaces.remove(oldTime);
inMemoryFaces.put(newTime, face);
usage.put(faceId, newTime);
......
......@@ -3,10 +3,7 @@ package cz.fidentis.analyst.gui.scene;
import cz.fidentis.analyst.face.HumanFace;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Abstract class for ...
......
......@@ -66,7 +66,7 @@ public final class PostRegistrationTestTC extends TopComponent {
.setFileFilter(new FileNameExtensionFilter("obj files (*.obj)", "obj"))
.setAcceptAllFileFilterUsed(true)
.showOpenDialog();
String primFaceId = HumanFaceFactory.instance().loadFace(file1);
String secFaceId = HumanFaceFactory.instance().loadFace(file2);
HumanFace primary = HumanFaceFactory.instance().getFace(primFaceId);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment