Return-Path: X-Original-To: apmail-pig-dev-archive@www.apache.org Delivered-To: apmail-pig-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 48A267BA8 for ; Thu, 17 Nov 2011 15:49:17 +0000 (UTC) Received: (qmail 13234 invoked by uid 500); 17 Nov 2011 15:49:16 -0000 Delivered-To: apmail-pig-dev-archive@pig.apache.org Received: (qmail 12754 invoked by uid 500); 17 Nov 2011 15:49:15 -0000 Mailing-List: contact dev-help@pig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pig.apache.org Delivered-To: mailing list dev@pig.apache.org Received: (qmail 12734 invoked by uid 500); 17 Nov 2011 15:49:15 -0000 Delivered-To: apmail-hadoop-pig-dev@hadoop.apache.org Received: (qmail 12731 invoked by uid 99); 17 Nov 2011 15:49:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 15:49:15 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 15:49:12 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id DEBE58A3B6 for ; Thu, 17 Nov 2011 15:48:51 +0000 (UTC) Date: Thu, 17 Nov 2011 15:48:51 +0000 (UTC) From: "Gianmarco De Francisci Morales (Commented) (JIRA)" To: pig-dev@hadoop.apache.org Message-ID: <1895981950.39118.1321544931913.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <754711898.37737.1321507131850.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (PIG-2380) Expose version information more cleanly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PIG-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152110#comment-13152110 ] Gianmarco De Francisci Morales commented on PIG-2380: ----------------------------------------------------- Jonathan, the patch does not apply cleanly to trunk for me. Could you rebase it? Also, for the static initializer, running the Main class without packaging it into a jar (that means, using the build folder for the classpath) throws an exception (also in current trunk). {code} java -cp build/classes:build/ivy/lib/Pig/* org.apache.pig.Main -h 11/11/17 16:45:39 ERROR pig.Main: ERROR 2999: Unexpected internal error. unable to read pigs manifest file 11/11/17 16:45:39 WARN pig.Main: There is no log file to write to. 11/11/17 16:45:39 ERROR pig.Main: java.lang.RuntimeException: unable to read pigs manifest file at org.apache.pig.Main.getVersionString(Main.java:749) at org.apache.pig.Main.run(Main.java:249) at org.apache.pig.Main.main(Main.java:111) Caused by: java.lang.NullPointerException at java.io.File.(File.java:222) at java.util.jar.JarFile.(JarFile.java:72) at org.apache.pig.Main.getVersionString(Main.java:737) ... 2 more {code} I would propose to fix it, we don't need to throw a RuntimeException for it. Let's just warn the user and go on. > Expose version information more cleanly > --------------------------------------- > > Key: PIG-2380 > URL: https://issues.apache.org/jira/browse/PIG-2380 > Project: Pig > Issue Type: Improvement > Reporter: Jonathan Coveney > Assignee: Jonathan Coveney > Priority: Minor > Fix For: 0.11 > > Attachments: PIG2380.patch > > > Currently, there is no clean way to get version information (short of trying to instantiate a class that only exists in the version you want and catching an exception, or something like that). This patch exposes major, minor, patch, svn revision, and build time (basically, all of the pieces of the current version). > Example: > {code} > import org.apache.pig.Main; > public class Thing { > public static void main(String[] args) { > System.out.println(Main.getMajorVersion()); > System.out.println(Main.getMinorVersion()); > System.out.println(Main.getPatchVersion()); > System.out.println(Main.getSvnRevision()); > System.out.println(Main.getBuildTime()); > } > } > {code} > will return > {code} > 0 > 11 > 0 > 1202387 > Nov 15 2011, 15:37:14 > 0 > {code} > which comprises > {code} > Apache Pig version 0.11.0-SNAPSHOT (r1202387) > compiled Nov 15 2011, 15:37:14 > {code} > I've run ant test-commit, but not ant test. This can easily be ported to old version, but I only tested it against trunk. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira