You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Bernhard Messer <bm...@apache.org> on 2004/11/15 21:47:46 UTC

jdk 1.3 versus jdk 1.4

Hi,

since the last changes in lucene, we are not longer backward compatible 
with jdk 1.3. All the pure guys, running IBM WebSphere 4.x with IBM JDK 
1.3, lost their chances to run lucene newer than version 1.4.2. 
Especially in huge companies, where it is not so trivial to upgrade to a 
new java version, this could reduce the acceptance for lucene

There are two major reasons for loosing the compatibility:
 - the new MMapDirectory class
 - several code parts like:
    ...
    catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
    ...

I think we simply can ignore the first one because MMapDirectory is 
optional anyway. This is an acceptable price for using outdated software ;-)
The second problem could be solved easily using the string constructor 
in java.lang.RuntimeException which is available since 1.0.
At least we have to document it somehow. There is a chapter "What are 
Lucene system requirements" in the faq. Is this an ideal place to 
document it.

I'd like to make the changes for being backward compatible as far as 
possible. Does anybody disagree ?

Bernhard



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: jdk 1.3 versus jdk 1.4

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Tuesday 16 November 2004 13:15, Bernhard Messer wrote:
> >On Monday 15 November 2004 13:47, Bernhard Messer wrote:
> >>Hi,
...
> >The reason this is sometimes useful is that knowledge about nested
> > exception is very useful for debugging; especially line numbers.
> > (in my case I use it to keep Woodstox XML-parser 1.2 compatible, while
> > using LinkedHashMap, and nested exceptions, if possible)
> >
> >The solution is not a one-liner though (if someone is interested, let me
> > know and I can point you to the source code), so maybe it's easier to
> > just "dumb it down" to using String constructor. But I just thought I'll
> > mention that it can be completely resolved if it seems worthwhile. :-)
>
> you're right, i like the idea creating a nested exception. For the
> particular case, it would be enough to create a NestedRuntimeException
> which works under both JVM's.

Or, the alternate way; 1.4 has Throwable.initCause(), so that you can do:

...
} catch (IOException ie) {
  Throwable t = new RuntimeException("Problems!!!");
  t.initCause(ie);
  throw t;
}

instead of

} catch (IOException ie) {
  throw new RuntimeException("Problems", ie);
}

And because of this, you can create a simple utility method that

(a) Takes two Throwables as arguments (new exception to throw,
  the nested exception)
(b) Uses reflection to find method Throwable.initCause(); catching
  NoSuchMethodException for 1.3
(c) If (b) returns (non-null), call Method on the first Throwable, passing
  second one as argument.

This utility method can actually be called either from code that constructs 
the exception; or in case of a derived exception, from its constructor.

Above may sound more complicated than it really is.... it's less than 10 lines 
of code, all in all.

Anyway, I don't have a strong preference either way, but if someone feels it 
worth pursuing, feel free to implement the idea :-)

-+ Tatu +-


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: jdk 1.3 versus jdk 1.4

Posted by Bernhard Messer <bm...@apache.org>.
>On Monday 15 November 2004 13:47, Bernhard Messer wrote:
>  
>
>>Hi,
>>
>>since the last changes in lucene, we are not longer backward compatible
>>with jdk 1.3. All the pure guys, running IBM WebSphere 4.x with IBM JDK
>>1.3, lost their chances to run lucene newer than version 1.4.2.
>>Especially in huge companies, where it is not so trivial to upgrade to a
>>new java version, this could reduce the acceptance for lucene
>>
>>There are two major reasons for loosing the compatibility:
>>    
>>
>...
>  
>
>> - several code parts like:
>>    ...
>>    catch (ClassNotFoundException e) {
>>      throw new RuntimeException(e);
>>    }
>>    ...
>>;-) The second problem could be solved easily using the string constructor
>>in java.lang.RuntimeException which is available since 1.0.
>>At least we have to document it somehow. There is a chapter "What are
>>Lucene system requirements" in the faq. Is this an ideal place to
>>document it.
>>
>>I'd like to make the changes for being backward compatible as far as
>>possible. Does anybody disagree ?
>>    
>>
>
>It is also possible to solve this second problem in a way that both allows 
>Lucene code to use proper Exception nesting, if available (running on 1.4+), 
>and omit it if not (1.3). This can be done using bit of Reflection.
>
>The reason this is sometimes useful is that knowledge about nested exception 
>is very useful for debugging; especially line numbers.
> (in my case I use it to keep Woodstox XML-parser 1.2 compatible, while using 
>LinkedHashMap, and nested exceptions, if possible)
>
>The solution is not a one-liner though (if someone is interested, let me know 
>and I can point you to the source code), so maybe it's easier to just "dumb 
>it down" to using String constructor. But I just thought I'll mention that it 
>can be completely resolved if it seems worthwhile. :-)
>  
>
you're right, i like the idea creating a nested exception. For the 
particular case, it would be enough to create a NestedRuntimeException 
which works under both JVM's.

bernhard

>---------------------------------------------------------------------
>To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>  
>


Re: jdk 1.3 versus jdk 1.4

Posted by Tatu Saloranta <ta...@hypermall.net>.
On Monday 15 November 2004 13:47, Bernhard Messer wrote:
> Hi,
>
> since the last changes in lucene, we are not longer backward compatible
> with jdk 1.3. All the pure guys, running IBM WebSphere 4.x with IBM JDK
> 1.3, lost their chances to run lucene newer than version 1.4.2.
> Especially in huge companies, where it is not so trivial to upgrade to a
> new java version, this could reduce the acceptance for lucene
>
> There are two major reasons for loosing the compatibility:
...
>  - several code parts like:
>     ...
>     catch (ClassNotFoundException e) {
>       throw new RuntimeException(e);
>     }
>     ...
> ;-) The second problem could be solved easily using the string constructor
> in java.lang.RuntimeException which is available since 1.0.
> At least we have to document it somehow. There is a chapter "What are
> Lucene system requirements" in the faq. Is this an ideal place to
> document it.
>
> I'd like to make the changes for being backward compatible as far as
> possible. Does anybody disagree ?

It is also possible to solve this second problem in a way that both allows 
Lucene code to use proper Exception nesting, if available (running on 1.4+), 
and omit it if not (1.3). This can be done using bit of Reflection.

The reason this is sometimes useful is that knowledge about nested exception 
is very useful for debugging; especially line numbers.
 (in my case I use it to keep Woodstox XML-parser 1.2 compatible, while using 
LinkedHashMap, and nested exceptions, if possible)

The solution is not a one-liner though (if someone is interested, let me know 
and I can point you to the source code), so maybe it's easier to just "dumb 
it down" to using String constructor. But I just thought I'll mention that it 
can be completely resolved if it seems worthwhile. :-)

-+ Tatu +-


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: jdk 1.3 versus jdk 1.4

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
What about making Lucene 2.0 require Java 1.4?  I'd think this would be 
reasonable.  JDK 1.4.x has proven itself and is the baseline for all 
the work I personally do.  Or is this too much of a hardship on a large 
number of Lucene users?  Or could those Lucene users be fine with 
Lucene 1.x until they can upgrade their JVM?

I'm a fan of breaking backwards compatibility when it is a burden to 
keep.

	Erik


On Nov 16, 2004, at 5:42 AM, Otis Gospodnetic wrote:
> Go ahead and do it - we've make the same changes in other places in the
> code for the same reason before.
>
> Otis
>
> --- Bernhard Messer <bm...@apache.org> wrote:
>
>> Hi,
>>
>> since the last changes in lucene, we are not longer backward
>> compatible
>> with jdk 1.3. All the pure guys, running IBM WebSphere 4.x with IBM
>> JDK
>> 1.3, lost their chances to run lucene newer than version 1.4.2.
>> Especially in huge companies, where it is not so trivial to upgrade
>> to a
>> new java version, this could reduce the acceptance for lucene
>>
>> There are two major reasons for loosing the compatibility:
>>  - the new MMapDirectory class
>>  - several code parts like:
>>     ...
>>     catch (ClassNotFoundException e) {
>>       throw new RuntimeException(e);
>>     }
>>     ...
>>
>> I think we simply can ignore the first one because MMapDirectory is
>> optional anyway. This is an acceptable price for using outdated
>> software ;-)
>> The second problem could be solved easily using the string
>> constructor
>> in java.lang.RuntimeException which is available since 1.0.
>> At least we have to document it somehow. There is a chapter "What are
>>
>> Lucene system requirements" in the faq. Is this an ideal place to
>> document it.
>>
>> I'd like to make the changes for being backward compatible as far as
>> possible. Does anybody disagree ?
>>
>> Bernhard
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: jdk 1.3 versus jdk 1.4

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Go ahead and do it - we've make the same changes in other places in the
code for the same reason before.

Otis

--- Bernhard Messer <bm...@apache.org> wrote:

> Hi,
> 
> since the last changes in lucene, we are not longer backward
> compatible 
> with jdk 1.3. All the pure guys, running IBM WebSphere 4.x with IBM
> JDK 
> 1.3, lost their chances to run lucene newer than version 1.4.2. 
> Especially in huge companies, where it is not so trivial to upgrade
> to a 
> new java version, this could reduce the acceptance for lucene
> 
> There are two major reasons for loosing the compatibility:
>  - the new MMapDirectory class
>  - several code parts like:
>     ...
>     catch (ClassNotFoundException e) {
>       throw new RuntimeException(e);
>     }
>     ...
> 
> I think we simply can ignore the first one because MMapDirectory is 
> optional anyway. This is an acceptable price for using outdated
> software ;-)
> The second problem could be solved easily using the string
> constructor 
> in java.lang.RuntimeException which is available since 1.0.
> At least we have to document it somehow. There is a chapter "What are
> 
> Lucene system requirements" in the faq. Is this an ideal place to 
> document it.
> 
> I'd like to make the changes for being backward compatible as far as 
> possible. Does anybody disagree ?
> 
> Bernhard
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org