pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] sijie commented on a change in pull request #3678: [Pulsar Functions] Add support for multiple sinks/sources in a single NAR file.
Date Thu, 28 Feb 2019 03:06:00 GMT
sijie commented on a change in pull request #3678: [Pulsar Functions] Add support for multiple
sinks/sources in a single NAR file.
URL: https://github.com/apache/pulsar/pull/3678#discussion_r261032111
 
 

 ##########
 File path: pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java
 ##########
 @@ -297,7 +299,21 @@ public static ExtractedSinkDetails validate(SinkConfig sinkConfig, Path
archiveP
         if (!isEmpty(sinkConfig.getClassName())) {
             sinkClassName = sinkConfig.getClassName();
             try {
-                classLoader = Utils.extractClassLoader(archivePath, functionPkgUrl, uploadedInputStreamAsFile);
+                String ext = null;
+            	if (!isEmpty(functionPkgUrl)) {
+            		File file = Utils.extractFileFromPkg(functionPkgUrl);
+            		ext = FilenameUtils.getExtension(file.getName());
+            	} else if (archivePath != null) {
+            		ext = FilenameUtils.getExtension(archivePath.getFileName().toString());
+            	} else if (uploadedInputStreamAsFile != null) {
+            		ext = FilenameUtils.getExtension(uploadedInputStreamAsFile.getName());
+            	}
+            	
+            	if ("nar".equalsIgnoreCase(ext)) {
+            	   classLoader = Utils.extractNarClassLoader(archivePath, functionPkgUrl, uploadedInputStreamAsFile);
 
 Review comment:
   wrong indent 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message