/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/*
 * Created on 02-Oct-2003
 *
 * This class defines the JMeter version only (moved from JMeterUtils)
 *
 * Version changes no longer change the JMeterUtils source file
 * - easier to spot when JMeterUtils really changes
 * - much smaller to download when the version changes
 *
 */
package org.apache.jmeter.util;

/**
 * Utility class to define the JMeter Version string
 *
 */
public class JMeterVersion {

    /*
     * Updated: 20110807 2358
     * The previous line is set to ${DSTAMP} ${TSTAMP}, to ensure that the file is modified
     * when the SVN tag is created so it has the same revision as the tag.
     * The SVN tag can be created as follows:
     * - ensure workspace is up-to-date with SVN
     * - touch this file by running "ant touch-version"
     * - create the tag from workspace: 
     *   "svn cp . https://svn.apache.org/repos/asf/jakarta/jmeter/tags/TAGNAME"
     * - Checkout the tag
     *
     * The REVISION string is checked by the Ant build file to ensure that the value
     * agrees with the tag revision
     */
    private static final String REVISION = "$Revision$"; // will be updated by SVN

    private static final String REVID;

    static {
        String[] parts = REVISION.split("\\s+");
        if (parts.length == 3) { // Assume SVN $Revision is presemt
            REVID = " r" + parts[1]; // extract the id
        } else { // assume DSTAMP is present
            REVID = "." + REVISION;
        }
    }

    /*
     *
     * The string is made private so the compiler can't propagate it into
     * JMeterUtils. (Java compilers may make copies of final variables)
     *
     * This ensures that JMeterUtils always gets the correct
     * version, even if JMeterUtils is not re-compiled during the build.
     */
    private static final String VERSION = "2.5";

    static final String COPYRIGHT = "Copyright (c) 1998-2011 The Apache Software Foundation";

    private JMeterVersion() // Not instantiable
    {
        super();
    }

    static final String getVERSION() {
        return VERSION+REVID;
    }
}

@@ -1118,1146 +1118,246 @@
 l;%0A%0A
-/**%0A * Utility class to define the JMeter Version string%0A *%0A */%0Apublic class JMeterVersion %7B%0A%0A    /*%0A     * Updated: 20110807 2358%0A     * The previous line is set to $%7BDSTAMP%7D $%7BTSTAMP%7D, to ensure that the file is modified%0A     * when the SVN tag is created so it has the same revision as the tag.%0A     * The SVN tag can be created as follows:%0A     * - ensure workspace is up-to-date with SVN%0A     * - touch this file by running %22ant touch-version%22%0A     * - create the tag from workspace: %0A     *   %22svn cp . https://svn.apache.org/repos/asf/jakarta/jmeter/tags/TAGNAME%22%0A     * - Checkout the tag%0A     *%0A     * The REVISION string is checked by the Ant build file to ensure that the value%0A     * agrees with the tag revision%0A     */%0A    private static final String REVISION = %22$Revision$%22; // will be updated by SVN%0A%0A    private static final String REVID;%0A%0A    static %7B%0A        String%5B%5D parts = REVISION.split(%22%5C%5Cs+%22);%0A        if (parts.length == 3) %7B // Assume SVN $Revision is presemt%0A            REVID = %22 r%22 + parts%5B1%5D; // extract the id%0A        %7D else %7B // assume DSTAMP is present%0A            REVID = %22.%22 + REVISION;%0A        %7D%0A    %7D
+import java.io.IOException;%0Aimport java.io.InputStream;%0Aimport java.net.URL;%0Aimport java.util.Properties;%0A%0Aimport org.apache.commons.io.IOUtils;%0A%0A/**%0A * Utility class to define the JMeter Version string%0A *%0A */%0Apublic class JMeterVersion %7B
 %0A%0A  
@@ -1709,24 +1709,77 @@
 N = %222.5%22;%0A%0A
+    private static final String IMPLEMENTATION;%0A    %0A
     static f
@@ -1857,24 +1857,1348 @@
 undation%22;%0A%0A
+    static %7B%0A        String impl=null;%0A        final Class%3C?%3E myClass = JMeterVersion.class;%0A        // This assumes that the JMV treats a class file as a resource (not all do).%0A        URL resource = myClass.getResource(%22JMeterVersion.class%22);%0A        // For example:%0A        // jar:file:/JMeter/lib/ext/ApacheJMeter_core.jar!/org/apache/jmeter/util/JMeterVersion.class%0A        // or if using an IDE        %0A        // file:/workspaces/JMeter/build/core/org/apache/jmeter/util/JMeterVersion.class%0A%0A%0A        try %7B%0A            // Convert to URL for manifest%0A            String url = resource.toString().replaceFirst(%22!/.+%22, %22!/META-INF/MANIFEST.MF%22);%0A            resource=new URL(url);%0A            InputStream inputStream = resource.openStream();%0A            if (inputStream != null) %7B%0A                Properties props = new Properties();%0A                try %7B%0A                    props.load(inputStream);%0A                    impl = props.getProperty(%22Implementation-Version%22);%0A                %7D finally %7B%0A                    IOUtils.closeQuietly(inputStream);%0A                %7D%0A            %7D%0A        %7D catch (IOException ioe) %7B%0A            // Ignored%0A        %7D%0A        if (impl == null) %7B%0A            IMPLEMENTATION = VERSION; // default to plain version%0A        %7D else %7B%0A            IMPLEMENTATION = impl;%0A        %7D%0A    %7D%0A%0A
     private 
@@ -3321,21 +3321,22 @@
 urn 
-VERSION+REVID
+IMPLEMENTATION
 ;%0A  

Use Implementation-Version from MANIFEST.MF instead of patching JMeterVersion.java