Commit 1df9df32 authored by Liang Ding's avatar Liang Ding

🎨 Fix #12307

parent 2913b9ef
......@@ -15,7 +15,6 @@
*/
package org.b3log.solo.repository.impl;
import org.apache.commons.lang.time.DateUtils;
import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level;
......@@ -32,12 +31,11 @@ import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
/**
* Archive date repository.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.8, Jan 31, 2013
* @version 1.0.0.9, Jun 6, 2017
* @since 0.3.1
*/
@Repository
......@@ -60,10 +58,9 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc
long time = 0L;
try {
time = DateUtils.parseDate(archiveDate, new String[] {"yyyy/MM"}).getTime();
time = DateUtils.parseDate(archiveDate, new String[]{"yyyy/MM"}).getTime();
} catch (final ParseException e) {
LOGGER.log(Level.ERROR, "Can not parse archive date [" + archiveDate + "]", e);
throw new RepositoryException("Can not parse archive date [" + archiveDate + "]");
return null;
}
LOGGER.log(Level.TRACE, "Archive date [{0}] parsed to time [{1}]", archiveDate, time);
......@@ -85,7 +82,7 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc
@Override
public List<JSONObject> getArchiveDates() throws RepositoryException {
final org.b3log.latke.repository.Query query = new Query().addSort(ArchiveDate.ARCHIVE_TIME, SortDirection.DESCENDING).setPageCount(
1);
1);
final JSONObject result = get(query);
final JSONArray archiveDates = result.optJSONArray(Keys.RESULTS);
......
......@@ -87,7 +87,6 @@ public class ArchiveDateQueryService {
try {
final JSONObject archiveDate = archiveDateRepository.getByArchiveDate(archiveDateString);
if (null == archiveDate) {
return null;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment