janhoy commented on code in PR #3784:
URL: https://github.com/apache/solr/pull/3784#discussion_r2443397830
##########
solr/modules/extraction/src/java/org/apache/solr/handler/extraction/ExtractingRequestHandler.java:
##########
@@ -60,85 +52,74 @@ public PermissionNameProvider.Name
getPermissionName(AuthorizationContext reques
@Override
public void inform(SolrCore core) {
try {
- // Store tika config location (backend-specific)
- this.tikaConfigLoc = (String) initArgs.get(CONFIG_LOCATION);
-
- String parseContextConfigLoc = (String)
initArgs.get(PARSE_CONTEXT_CONFIG);
- if (parseContextConfigLoc == null) { // default:
- parseContextConfig = new ParseContextConfig();
- } else {
- parseContextConfig =
- new ParseContextConfig(core.getResourceLoader(),
parseContextConfigLoc);
- }
-
- // Always create local backend
- this.localBackend = new LocalTikaExtractionBackend(core, tikaConfigLoc,
parseContextConfig);
-
- // Optionally create Tika Server backend if URL configured
- String tikaServerUrl = (String)
initArgs.get(ExtractingParams.TIKASERVER_URL);
- if (tikaServerUrl != null && !tikaServerUrl.trim().isEmpty()) {
- int timeoutSecs = 0;
- Object initTimeout =
initArgs.get(ExtractingParams.TIKASERVER_TIMEOUT_SECS);
- if (initTimeout != null) {
- try {
- timeoutSecs = Integer.parseInt(String.valueOf(initTimeout));
- } catch (NumberFormatException nfe) {
- throw new SolrException(
- ErrorCode.SERVER_ERROR,
- "Invalid value for '"
- + ExtractingParams.TIKASERVER_TIMEOUT_SECS
- + "': "
- + initTimeout,
- nfe);
- }
- }
- Object maxCharsObj =
initArgs.get(ExtractingParams.TIKASERVER_MAX_CHARS);
- long maxCharsLimit =
TikaServerExtractionBackend.DEFAULT_MAXCHARS_LIMIT;
- if (maxCharsObj != null) {
- try {
- maxCharsLimit = Long.parseLong(String.valueOf(maxCharsObj));
- } catch (NumberFormatException nfe) {
- throw new SolrException(
- ErrorCode.SERVER_ERROR,
- "Invalid value for '"
- + ExtractingParams.TIKASERVER_MAX_CHARS
- + "': "
- + maxCharsObj);
- }
- }
- this.tikaServerBackend =
- new TikaServerExtractionBackend(tikaServerUrl, timeoutSecs,
initArgs, maxCharsLimit);
+ // Fail if using old unsupported configuration
+ if (initArgs.get("tika.config") != null ||
initArgs.get("parseContext.config") != null) {
+ log.error(
+ "The 'tika.config' and 'parseContext.config' parameters are no
longer supported since Solr 10.");
+ throw new SolrException(
Review Comment:
I like to fail fast on errors. If a user bring in an old solrconfig.xml with
one of these config parameters, Solr will now log a clear error and the
initialization of `ExtractingRequestHandler` fails. This is better than the
user believing they have configured Tika when they have not. They should
already know since they will have stood up a TikaServer and hopefully read some
docs, but still.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]