The check is rather simple (standard Java API):

java.lang.Package lpkg=org.apache.lucene.LucenePackage.get();
if (lpkg==null || !lpkg.isCompatibleWith("2.2.0"))
        throw new RuntimeException("panFMP only runs with Apache Lucene
2.2.0 as a minimum requirement!");

According to Java Specs at
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Package.html,
isCompatibleWith() reads the Manifest from Lucenes Package (returned by
Lucene's API in first line) and compares the given package version with the
JAR file's, if its greater or equal everything is OK. It uses the
"Specification-Version" attribute from the manifest, which must be formatted
in the following way:

"Specification version numbers use a syntax that consists of positive
decimal integers separated by periods ".", for example "2.0" or
"1.2.3.4.5.6.7". This allows an extensible number to be used to represent
major, minor, micro, etc. versions [...]
The implementation title, version, and vendor strings identify an
implementation and are made available conveniently to enable accurate
reporting of the packages involved when a problem occurs. The contents all
three implementation strings are vendor specific. The implementation version
strings have no specified syntax and should only be compared for equality
with desired version identifiers."

So if a JAR file lists a specification version, it must be formatted in the
way, Java specifies that attribute.

Lucene's manifest was always correct, only in the last release candidate,
the incorrect version string is returned for the Specification-Version

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: diablo-1.5.0_07-b01 (Sun Microsystems Inc.)
Specification-Title: Lucene Search Engine: core
Specification-Version: 2.3-rc1
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.lucene
Implementation-Version: 2.3-rc1 609854 - buschmi - 2008-01-08 03:21:58
Implementation-Vendor: The Apache Software Foundation
X-Compile-Source-JDK: 1.4
X-Compile-Target-JDK: 1.4

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [EMAIL PROTECTED]


> -----Original Message-----
> From: Grant Ingersoll [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 08, 2008 1:39 PM
> To: java-dev@lucene.apache.org
> Subject: Re: Lucene 2.3 RC 1 available for testing
> 
> Is this an issue with Lucene or with panFMP?  What is checking for
> Lucene 2.2?  I don't see anything in here that is a problem with
> Lucene.  I would ask the panFMP maintainers to handle the problem.
> 
> -Grant
> On Jan 8, 2008, at 2:36 AM, Uwe Schindler wrote:
> 
> > Hi Michael,
> >
> > I tried the new 2.3 version today form y package "panFMP"
> (www.panFMP.org
> > ).
> > In principle it works, but the package checks on startup for the
> > minimum
> > requirements of used libraries (in my case Lucene 2.2). This is done
> > by
> > java.lang.Package.isCompatibleWith(). According to the Sun Java API,
> > the
> > "Specification" string from the package manifest must be in the format
> > "digits.digits.digits", so it gets a NumberFormatException. As the
> > specification (*the API*) of Lucene 2.3 is final, there should stand
> > 2.3.
> > The Implementation version may contain "-dev" or "-rxX", which is
> > legal.
> >
> > This will not be a problem of the release version, but it should be
> > correctly set (according to specs) in pre-releases, too, to enable
> > customers
> > to replace the Lucene by newer non-release versions.
> >
> > 2008-01-08 08:26:30,203 INFO de.pangaea.metadataportal.config.Config -
> > panFMP version 0.0-dev (panFMP Developers c/o Uwe Schindler)
> > 2008-01-08 08:26:30,203 FATAL
> > de.pangaea.metadataportal.harvester.Harvester
> > - Harvester general error:
> > java.lang.NumberFormatException: For input string: "3-rc1"
> >        at java.lang.NumberFormatException.forInputString(Unknown
> > Source)
> >        at java.lang.Integer.parseInt(Unknown Source)
> >        at java.lang.Integer.parseInt(Unknown Source)
> >        at java.lang.Package.isCompatibleWith(Unknown Source)
> >        at
> > de
> > .pangaea
> > .metadataportal.Package.checkMinimumRequirements(Package.java:69)
> >        at de.pangaea.metadataportal.config.Config.<init>(Config.java:
> > 48)
> >        at
> > de.pangaea.metadataportal.harvester.Harvester.main(Harvester.java:53)
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: [EMAIL PROTECTED]
> >
> >> -----Original Message-----
> >> From: Michael Busch [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, January 08, 2008 4:28 AM
> >> To: java-dev@lucene.apache.org
> >> Subject: Lucene 2.3 RC 1 available for testing
> >>
> >> Hi all,
> >>
> >> I just created the release artifacts (incl. maven artifacts) from the
> >> 2.3 branch and uploaded the files to
> >> http://people.apache.org/~buschmi/staging_area/lucene_2_3/rc1/.
> >>
> >> Let's try to use the next days for testing to ensure that we find
> >> serious bugs or build problems as early as possible.
> >>
> >> So please help testing the release files on different platforms with
> >> different JVM versions.
> >>
> >> Thanks to everyone in advance,
> >>
> >> -Michael
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> --------------------------
> Grant Ingersoll
> http://lucene.grantingersoll.com
> http://www.lucenebootcamp.com
> 
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to