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

🎨 Fix #12307

parent 2913b9ef
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
package org.b3log.solo.repository.impl; package org.b3log.solo.repository.impl;
import org.apache.commons.lang.time.DateUtils; import org.apache.commons.lang.time.DateUtils;
import org.b3log.latke.Keys; import org.b3log.latke.Keys;
import org.b3log.latke.logging.Level; import org.b3log.latke.logging.Level;
...@@ -32,12 +31,11 @@ import java.text.ParseException; ...@@ -32,12 +31,11 @@ import java.text.ParseException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* Archive date repository. * Archive date repository.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.3.1
*/ */
@Repository @Repository
...@@ -60,10 +58,9 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc ...@@ -60,10 +58,9 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc
long time = 0L; long time = 0L;
try { try {
time = DateUtils.parseDate(archiveDate, new String[] {"yyyy/MM"}).getTime(); time = DateUtils.parseDate(archiveDate, new String[]{"yyyy/MM"}).getTime();
} catch (final ParseException e) { } catch (final ParseException e) {
LOGGER.log(Level.ERROR, "Can not parse archive date [" + archiveDate + "]", e); return null;
throw new RepositoryException("Can not parse archive date [" + archiveDate + "]");
} }
LOGGER.log(Level.TRACE, "Archive date [{0}] parsed to time [{1}]", archiveDate, time); LOGGER.log(Level.TRACE, "Archive date [{0}] parsed to time [{1}]", archiveDate, time);
...@@ -85,7 +82,7 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc ...@@ -85,7 +82,7 @@ public class ArchiveDateRepositoryImpl extends AbstractRepository implements Arc
@Override @Override
public List<JSONObject> getArchiveDates() throws RepositoryException { public List<JSONObject> getArchiveDates() throws RepositoryException {
final org.b3log.latke.repository.Query query = new Query().addSort(ArchiveDate.ARCHIVE_TIME, SortDirection.DESCENDING).setPageCount( final org.b3log.latke.repository.Query query = new Query().addSort(ArchiveDate.ARCHIVE_TIME, SortDirection.DESCENDING).setPageCount(
1); 1);
final JSONObject result = get(query); final JSONObject result = get(query);
final JSONArray archiveDates = result.optJSONArray(Keys.RESULTS); final JSONArray archiveDates = result.optJSONArray(Keys.RESULTS);
......
...@@ -87,7 +87,6 @@ public class ArchiveDateQueryService { ...@@ -87,7 +87,6 @@ public class ArchiveDateQueryService {
try { try {
final JSONObject archiveDate = archiveDateRepository.getByArchiveDate(archiveDateString); final JSONObject archiveDate = archiveDateRepository.getByArchiveDate(archiveDateString);
if (null == archiveDate) { if (null == archiveDate) {
return null; 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