Hi,

> I'm overriding 4 classes of the java.io package

In theory, what you do should work, but making it 100% compatible with
java.io.* is very hard, if not impossible: some applications may rely on
implementation details. You could argue this is a bug in the application,
but it's still problematic to have to change the bootclasspath to use your
tool.

What I would do is keep that part (the java.io.* part) optional, so your
tool can be used without having to change the bootclasspath. Then of course
can only be used with H2 and Java 7+, but it's much cleaner and easier to
use.

Regards,
Thomas


On Tue, Apr 29, 2014 at 10:47 AM, PN <[email protected]> wrote:

> You are spot on, only that I wouldn't call it "messing with" :-)
>
> I'm overriding 4 classes of the java.io package (File, FileInputStream,
> FileOutputStream, and RandomAccessFile) to allow for a 'transparent' use of
> my custom file-system by legacy Java applications that don't know of and,
> so, cannot use custom file-systems. Thus, I've tweaked these 4 classes to
> accept scheme-prefixed filenames (e.g. "myfs:/path/to/some-file") and added
> them to bootclasspath/p option of the JVM.
>
> Thanks for spotting the cause. Since my file-system code will refuse to
> run without bootclasspath/p, is there anything I can do on the H2 side to
> get it going?
>
> Regards,
> /PN
>
> On Tuesday, April 29, 2014 1:47:29 PM UTC+5:30, Noel Grandin wrote:
>>
>> Are you messing with your bootstrap class path?
>> Because the only way getClass().getClassLoader() returns null is if the
>> class was loaded from the bootstrap class path,
>> which should not be the case here.
>>
>> On 2014-04-29 09:54, PN wrote:
>> >
>> > which is the following code:
>> >
>> >      private void testClasspath() throws IOException {
>> >          String resource = "org/h2/test/testSimple.in.txt";
>> >          InputStream in;
>> >          in = getClass().getResourceAsStream("/" + resource);
>> >          assertTrue(in != null);
>> >          in.close();
>> >          in = getClass().getClassLoader().getResourceAsStream(resource);
>>  // line 220
>> >
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to