File tree 2 files changed +18
-2
lines changed
src/main/java/ru/mystamps/web/feature/series/importing 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 35
35
import ru .mystamps .web .feature .series .importing .extractor .SiteParser ;
36
36
import ru .mystamps .web .feature .series .importing .extractor .SiteParserConfiguration ;
37
37
import ru .mystamps .web .feature .series .importing .extractor .SiteParserService ;
38
+ import ru .mystamps .web .feature .series .importing .extractor .TimedSiteParser ;
38
39
39
40
/**
40
41
* Listener of the {@link DownloadingSucceeded} event.
@@ -115,13 +116,23 @@ public void onApplicationEvent(DownloadingSucceeded event) {
115
116
seriesImportService .saveParsedData (requestId , data );
116
117
}
117
118
119
+ @ SuppressWarnings ({ "PMD.AvoidReassigningParameters" , "checkstyle:parameterassignment" })
118
120
private void migrateParser (SiteParser parser ) {
121
+ if (parser instanceof TimedSiteParser ) {
122
+ parser = ((TimedSiteParser )parser ).getOrigin ();
123
+ }
124
+
119
125
if (!(parser instanceof JsoupSiteParser )) {
120
- log .warn ("Could not migrate unknown (non-Jsoup based) parser: {}" , parser );
126
+ log .warn (
127
+ "Could not migrate unknown (non-Jsoup based) parser: {}" ,
128
+ parser .getClass ().getName ()
129
+ );
121
130
return ;
122
131
}
123
132
124
- SiteParserConfiguration cfg = ((JsoupSiteParser )parser ).toConfiguration ();
133
+ JsoupSiteParser jsoupParser = (JsoupSiteParser )parser ;
134
+
135
+ SiteParserConfiguration cfg = jsoupParser .toConfiguration ();
125
136
String url = cfg .getMatchedUrl ();
126
137
String name = cfg .getName ();
127
138
if (siteParserService .findForUrl (url ) != null ) {
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ public class TimedSiteParser implements SiteParser {
31
31
private final Logger log ;
32
32
private final SiteParser parser ;
33
33
34
+ // TODO: remove after finishing migration of the site parsers
35
+ public SiteParser getOrigin () {
36
+ return parser ;
37
+ }
38
+
34
39
@ Override
35
40
public boolean setField (String name , String value ) {
36
41
return parser .setField (name , value );
You can’t perform that action at this time.
0 commit comments