|
18 | 18 | */
|
19 | 19 |
|
20 | 20 | /*
|
21 |
| - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. |
| 21 | + * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. |
22 | 22 | */
|
23 | 23 | package org.opengrok.web.api.v1.controller;
|
24 | 24 |
|
25 | 25 | import com.fasterxml.jackson.core.JsonProcessingException;
|
26 | 26 | import com.fasterxml.jackson.databind.ObjectMapper;
|
27 |
| -import com.fasterxml.jackson.databind.SerializationFeature; |
28 | 27 | import com.fasterxml.jackson.databind.util.StdDateFormat;
|
| 28 | +import org.opengrok.indexer.configuration.IndexTimestamp; |
29 | 29 | import org.opengrok.indexer.configuration.RuntimeEnvironment;
|
30 | 30 | import org.opengrok.indexer.web.EftarFile;
|
31 | 31 | import org.opengrok.indexer.logger.LoggerFactory;
|
|
41 | 41 | import javax.ws.rs.Path;
|
42 | 42 | import javax.ws.rs.Produces;
|
43 | 43 | import javax.ws.rs.core.MediaType;
|
44 |
| -import java.io.File; |
45 | 44 | import java.io.IOException;
|
46 |
| -import java.nio.file.Paths; |
47 | 45 | import java.util.Collections;
|
48 | 46 | import java.util.Date;
|
49 | 47 | import java.util.Set;
|
@@ -88,8 +86,7 @@ public void loadPathDescriptions(@Valid final PathDescription[] descriptions) th
|
88 | 86 | @Path("/indextime")
|
89 | 87 | @Produces(MediaType.APPLICATION_JSON)
|
90 | 88 | public String getIndexTime() throws JsonProcessingException {
|
91 |
| - File indexTimeFile = Paths.get(env.getDataRootFile().toString(), "timestamp").toFile(); |
92 |
| - Date date = new Date(indexTimeFile.lastModified()); |
| 89 | + Date date = new IndexTimestamp().getDateForLastIndexRun(); |
93 | 90 | ObjectMapper mapper = new ObjectMapper();
|
94 | 91 | // StdDateFormat is ISO8601 since jackson 2.9
|
95 | 92 | mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true));
|
|
0 commit comments