jerrypeng commented on a change in pull request #4577: fix issue when
submitting NAR via file url
URL: https://github.com/apache/pulsar/pull/4577#discussion_r296425709
##########
File path:
pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java
##########
@@ -318,79 +322,89 @@ public static ExtractedSinkDetails validate(SinkConfig
sinkConfig, Path archiveP
throw new IllegalArgumentException("Sink timeout must be a
positive number");
}
- String sinkClassName;
- final Class<?> typeArg;
- final ClassLoader classLoader;
- if (!isEmpty(sinkConfig.getClassName())) {
- sinkClassName = sinkConfig.getClassName();
- // We really don't know if we should use nar class loader or
regular classloader
- ClassLoader jarClassLoader = null;
- ClassLoader narClassLoader = null;
- try {
- jarClassLoader =
FunctionCommon.extractClassLoader(archivePath, uploadedInputStreamAsFile);
- } catch (Exception e) {
+
+ Class<?> typeArg;
+ ClassLoader classLoader;
+ String sinkClassName = sinkConfig.getClassName();
+ ClassLoader jarClassLoader = null;
+ ClassLoader narClassLoader = null;
+ try {
+ jarClassLoader = FunctionCommon.extractClassLoader(archivePath,
sinkPackageFile);
+ } catch (Exception e) {
Review comment:
@sijie
```
jarClassLoader = FunctionCommon.extractClassLoader(archivePath,
sinkPackageFile);
```
and
```
narClassLoader = FunctionCommon.extractNarClassLoader(archivePath,
sinkPackageFile);
```
are checks to determine if the package is a JAR or a NAR. The errors there
are not meaningful to the user.
We have to use the logic after it to determine if the what the user
submitted is valid e.g. If a JAR is submitted, a className must also be
provided or if className is not provided then the archive needs to be a NAR
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services