The new jars are great if only for being compiled under jdk 1.5 and therefore removing a lot of warnings generated by the Dalvik compiler.<div><br></div><div>I did some simple tests on Greek, German, French, and English bibles and all seemed fine but I did manage to throw an exception by copying a German verse, pasting the whole verse into the search field. I will raise an issue in JIRA but it is quite hard to get the error and it may have happened with the previous version of Lucene.</div>
<div><br></div><div>Thanks for all your work</div><div><br></div><div>Martin<br><br><div class="gmail_quote">On 4 December 2010 22:23, DM Smith <span dir="ltr"><<a href="mailto:dmsmith@crosswire.org">dmsmith@crosswire.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">I guess I can revert the jar back to 2.9.3. It should be compatible. Supposedly the only differences between 2.9.3 and 3.0.2 is that 3.0.2 requires Java 5 and has deprecations removed. It should not be otherwise different.<div>
<br></div><div>I'll see if we can work around it. I may be giving a patch to Lucene upstream.... Or reverting.... Or ....</div><div><br></div><div>-- DM</div><div><br><div><div><br><div><div><div></div><div class="h5">
<div>On Dec 4, 2010, at 5:10 PM, Martin Denham wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="h5">Unfortunately Android does not have java.lang.management.ManagementFactory<div><br></div><div>
The old version of Lucene never required it but the new version of Lucene does.</div><div><br></div><div><div>12-04 21:34:41.629: WARN/System.err(23160): java.lang.NoClassDefFoundError: java.lang.management.ManagementFactory</div>
<div>12-04 21:34:41.639: WARN/System.err(23160): at org.apache.lucene.store.NativeFSLockFactory.acquireTestLock(NativeFSLockFactory.java:87)</div><div>12-04 21:34:41.639: WARN/System.err(23160): at org.apache.lucene.store.NativeFSLockFactory.makeLock(NativeFSLockFactory.java:142)</div>
<div>12-04 21:34:41.649: WARN/System.err(23160): at org.apache.lucene.store.Directory.makeLock(Directory.java:106)</div><div>12-04 21:34:41.649: WARN/System.err(23160): at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1058)</div>
</div><div><br></div><div>I can't really see a reason to use ManagementFactory but here is how it is used:</div><div><br></div><div><span style="font-family:verdana;font-size:12px"><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em">
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">private</span> <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">synchronized</span> <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">void</span> acquireTestLock() {
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">if</span> (tested) <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">return</span>;
tested = true;
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// Ensure that lockDir exists and is a directory.</span>
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">if</span> (!lockDir.exists()) {
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">if</span> (!lockDir.mkdirs())
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">throw</span> <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">new</span> RuntimeException(<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"Cannot create directory: "</span> +
lockDir.getAbsolutePath());
} <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">else</span> <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">if</span> (!lockDir.isDirectory()) {
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">throw</span> <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">new</span> RuntimeException(<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"Found regular file where directory expected: "</span> +
lockDir.getAbsolutePath());
}
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// add the RuntimeMXBean's name to the lock file, to reduce the chance for</span>
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// name collisions when this code is invoked by multiple JVMs (such as in</span>
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// our tests). On most systems, the name includes the process Id.</span>
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// Also, remove any non-alphanumeric characters, so that the lock file will</span>
<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;color:rgb(17, 143, 70)">// be created for sure on all systems.</span>
String randomLockName = <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"lucene-"</span>
+ ManagementFactory.getRuntimeMXBean().getName().replaceAll(<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"[^a..zA..Z0..9]+"</span>,<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">""</span>) + <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"-"</span>
+ Long.toString(<span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(143, 17, 81)">new</span> Random().nextInt(), Character.MAX_RADIX)
+ <span style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em;font-weight:bold;color:rgb(76, 47, 191)">"-test.lock"</span>;</pre>
<pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em"><br></pre><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em">
I suppose I could edit the code and build a modified Lucene jar but I don't really want to do that. Another solution might be to go back to earlier jars but again that would lead to differences with JSword. I suppose I could disable index creation on Android because the above is only required during index creation. At the moment all I can think of is to modify the Lucene jars.</pre>
<pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em"><br></pre><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em">
Any ideas?</pre><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em"><br></pre><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em">
Thanks</pre><pre style="margin-top:0em;margin-right:0em;margin-bottom:0em;margin-left:0em;padding-top:0em;padding-right:0em;padding-bottom:0em;padding-left:0em">Martin</pre></span></div></div></div>
_______________________________________________<br>jsword-devel mailing list<br><a href="mailto:jsword-devel@crosswire.org" target="_blank">jsword-devel@crosswire.org</a><br><a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
</blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
jsword-devel mailing list<br>
<a href="mailto:jsword-devel@crosswire.org">jsword-devel@crosswire.org</a><br>
<a href="http://www.crosswire.org/mailman/listinfo/jsword-devel" target="_blank">http://www.crosswire.org/mailman/listinfo/jsword-devel</a><br>
<br></blockquote></div><br></div>