Skip to content

Commit

Permalink
removed some critical smells
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Jul 12, 2023
1 parent 1e75536 commit ee4ba13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,10 @@ public long reindex(long docId, String content, DocumentHistory transaction)
throws PersistenceException, ParseException {
Document doc = getExistingDocument(docId);

log.debug("Reindexing document {} - {}", docId, doc.getFileName());

String cont;
log.debug("Reindexing document {} - {}", doc.getId(), doc.getFileName());

long parsingTime;
String cont;
try {
cont = content;
parsingTime = 0;
Expand Down Expand Up @@ -517,8 +517,6 @@ public long reindex(long docId, String content, DocumentHistory transaction)
// time.
Date beforeParsing = new Date();
cont = parseDocument(doc, null);
if (transaction != null)
transaction.setComment(StringUtils.abbreviate(cont, 100));
parsingTime = TimeDiff.getTimeDifference(beforeParsing, new Date(), TimeField.MILLISECOND);
}

Expand All @@ -534,6 +532,7 @@ public long reindex(long docId, String content, DocumentHistory transaction)

if (transaction != null) {
transaction.setEvent(DocumentEvent.INDEXED.toString());
transaction.setComment(StringUtils.abbreviate(cont, 100));
transaction.setDocument(doc);
}

Expand All @@ -545,7 +544,6 @@ public long reindex(long docId, String content, DocumentHistory transaction)
markAliasesToIndex(docId);

return parsingTime;

}

private void recordIndexingError(DocumentHistory transaction, Document document, Exception exception)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
public class DocumentHistoryDS extends DataSource {

private static final String MAX = "&max=";

private static Integer getDefaultMaxHistories() {
try {
return Session.get().getConfigAsInt("gui.maxhistories");
Expand All @@ -25,13 +27,13 @@ private static Integer getDefaultMaxHistories() {
}

public DocumentHistoryDS(long docId, Integer max) {
init("data/documenthistory.xml?docId=" + docId + "&locale=" + I18N.getLocale() + "&max="
init("data/documenthistory.xml?docId=" + docId + "&locale=" + I18N.getLocale() + MAX
+ (max != null ? max : getDefaultMaxHistories()));
}

public DocumentHistoryDS(Long tenantId, String event, Integer max) {
init("data/documenthistory.xml?event=" + event + (tenantId != null ? "&tenantId=" + tenantId : "") + "&locale="
+ I18N.getLocale() + "&max=" + (max != null ? max : getDefaultMaxHistories()));
+ I18N.getLocale() + MAX + (max != null ? max : getDefaultMaxHistories()));
}

public DocumentHistoryDS(Long userId, Long docId, String events, Integer max) {
Expand All @@ -42,7 +44,7 @@ public DocumentHistoryDS(Long userId, Long docId, String events, Integer max) {
url += "&event=" + events;
if (docId != null)
url += "&docId=" + docId;
init(url + "&max=" + (max != null ? max : getDefaultMaxHistories()));
init(url + MAX + (max != null ? max : getDefaultMaxHistories()));
}

public DocumentHistoryDS(String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private Long[] getSelectedDocIds(RefreshableListGrid list) {
ListGridRecord[] selection = list.getSelectedRecords();
Long[] docIds = new Long[selection.length];
for (int i = 0; i < selection.length; i++)
docIds[i] = selection[i].getAttributeAsLong("docId");
docIds[i] = selection[i].getAttributeAsLong(DOC_ID);
return docIds;
}
}

0 comments on commit ee4ba13

Please sign in to comment.