From commits-return-23281-archive-asf-public=cust-asf.ponee.io@pulsar.apache.org Thu Feb 28 03:06:05 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9D34E180675 for ; Thu, 28 Feb 2019 04:06:03 +0100 (CET) Received: (qmail 31435 invoked by uid 500); 28 Feb 2019 03:06:02 -0000 Mailing-List: contact commits-help@pulsar.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pulsar.apache.org Delivered-To: mailing list commits@pulsar.apache.org Received: (qmail 31105 invoked by uid 99); 28 Feb 2019 03:06:01 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Feb 2019 03:06:01 +0000 From: GitBox To: commits@pulsar.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. Message-ID: <155132316076.18840.5742055909564745109.gitbox@gitbox.apache.org> Date: Thu, 28 Feb 2019 03:06:00 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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