Skip to content

Commit c1aeea5

Browse files
committed
Update TurWCProcess.java
1 parent 880fa83 commit c1aeea5

File tree

1 file changed

+4
-11
lines changed
  • turing-web-crawler/wc-app/src/main/java/com/viglet/turing/connector/webcrawler

1 file changed

+4
-11
lines changed

turing-web-crawler/wc-app/src/main/java/com/viglet/turing/connector/webcrawler/TurWCProcess.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ public TurSNJobItem getPage(TurWCSource turWCSource, String url) {
167167
log.debug("Ignored: {}", url);
168168
}
169169
} catch (IOException e) {
170-
log.error(e.getMessage());
170+
log.error(e.getMessage(), e);
171171
}
172-
173172
return new TurSNJobItem();
174173
}
175174

@@ -178,12 +177,9 @@ private void getPageLinks(Document document) {
178177
}
179178

180179
private void addPageToQueue(String pageUrl) {
181-
if (canBeAddToQueue(pageUrl)) {
182-
if (visitedLinks.add(pageUrl) && !queueLinks.offer(pageUrl)) {
183-
log.error("Item didn't add to queue: {}", pageUrl);
184-
}
180+
if (canBeAddToQueue(pageUrl) && visitedLinks.add(pageUrl) && !queueLinks.offer(pageUrl)) {
181+
log.error("Item didn't add to queue: {}", pageUrl);
185182
}
186-
187183
}
188184

189185
private boolean isValidToAddQueue(String pageUrl) {
@@ -279,7 +275,6 @@ private static void addItemToArray(Map<String, Object> attributes, String attrib
279275
.stream().map(String.class::cast).toList());
280276
attributeValues.add(attributeValue);
281277
attributes.put(attributeName, attributeValues);
282-
283278
}
284279

285280
private void addFirstItemToAttribute(String attributeName,
@@ -288,7 +283,6 @@ private void addFirstItemToAttribute(String attributeName,
288283
attributes.put(attributeName, attributeValue);
289284
}
290285

291-
292286
private void sendToTuring() {
293287
if (log.isDebugEnabled()) {
294288
for (TurSNJobItem turSNJobItem : turSNJobItems) {
@@ -342,7 +336,6 @@ private boolean canBeAddToQueue(String pageUrl) {
342336
}
343337

344338

345-
346339
private static boolean isJavascriptUrl(String pageUrl) {
347340
return pageUrl.contains(JAVASCRIPT);
348341
}
@@ -427,4 +420,4 @@ private String getUrlWithoutParameters(String url) {
427420
return url;
428421
}
429422
}
430-
}
423+
}

0 commit comments

Comments
 (0)