Skip to content

Commit b2b54d5

Browse files
author
Vladimir Kotal
committed
use IndexTimestamp, fix imports, copyright
1 parent 381f3e1 commit b2b54d5

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/SystemController.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
*/
1919

2020
/*
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.
2222
*/
2323
package org.opengrok.web.api.v1.controller;
2424

2525
import com.fasterxml.jackson.core.JsonProcessingException;
2626
import com.fasterxml.jackson.databind.ObjectMapper;
27-
import com.fasterxml.jackson.databind.SerializationFeature;
2827
import com.fasterxml.jackson.databind.util.StdDateFormat;
28+
import org.opengrok.indexer.configuration.IndexTimestamp;
2929
import org.opengrok.indexer.configuration.RuntimeEnvironment;
3030
import org.opengrok.indexer.web.EftarFile;
3131
import org.opengrok.indexer.logger.LoggerFactory;
@@ -41,9 +41,7 @@
4141
import javax.ws.rs.Path;
4242
import javax.ws.rs.Produces;
4343
import javax.ws.rs.core.MediaType;
44-
import java.io.File;
4544
import java.io.IOException;
46-
import java.nio.file.Paths;
4745
import java.util.Collections;
4846
import java.util.Date;
4947
import java.util.Set;
@@ -88,8 +86,7 @@ public void loadPathDescriptions(@Valid final PathDescription[] descriptions) th
8886
@Path("/indextime")
8987
@Produces(MediaType.APPLICATION_JSON)
9088
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();
9390
ObjectMapper mapper = new ObjectMapper();
9491
// StdDateFormat is ISO8601 since jackson 2.9
9592
mapper.setDateFormat(new StdDateFormat().withColonInTimeZone(true));

0 commit comments

Comments
 (0)