You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Eung-ju Park <co...@isoft.co.kr> on 2001/08/03 06:09:07 UTC

NPE at FileTarget...

FileTarget logTarget = new FileTarget( new File( destination ), false, new
AvalonFormatter() );

occur below exception. I use current cvs version of logkit. What's wrong?

java.lang.NullPointerException
 at org.apache.log.output.io.FileTarget.openFile(FileTarget.java:85)
 at org.apache.log.output.io.FileTarget.<init>(FileTarget.java:45)
 at
org.zact.idk.datasource.DataSourceFactory.createLogger(DataSourceFactory.jav
a:96)
 at
org.zact.idk.datasource.DataSourceFactory.getInstance(DataSourceFactory.java
:65)
 at
org.zact.idk.datasource.DataSourceFactory.getDataSource(DataSourceFactory.ja
va:40)
 at
org.zact.idk.datasource.test.DataSourceTest.testDataSource(DataSourceTest.ja
va:29)
 at java.lang.reflect.Method.invoke(Native Method)
 at junit.framework.TestCase.runTest(TestCase.java:166)
 at junit.framework.TestCase.runBare(TestCase.java:140)
 at junit.framework.TestResult$1.protect(TestResult.java:106)
 at junit.framework.TestResult.runProtected(TestResult.java:124)
 at junit.framework.TestResult.run(TestResult.java:109)
 at junit.framework.TestCase.run(TestCase.java:131)
 at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
 at junit.extensions.TestDecorator.run(TestDecorator.java:28)
 at junit.extensions.RepeatedTest.run(RepeatedTest.java:25)
 at
com.clarkware.junitperf.ThreadedTest$TestRunner.run(ThreadedTest.java:77)
 at java.lang.Thread.run(Thread.java:484)



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


Re: NPE at FileTarget...

Posted by Berin Loritsch <bl...@apache.org>.
You will want to use the last released version of LogKit until
Peter gets done with his adjustments to LogKit

Eung-ju Park wrote:
> 
> FileTarget logTarget = new FileTarget( new File( destination ), false, new
> AvalonFormatter() );
> 
> occur below exception. I use current cvs version of logkit. What's wrong?
> 
> java.lang.NullPointerException
>  at org.apache.log.output.io.FileTarget.openFile(FileTarget.java:85)
>  at org.apache.log.output.io.FileTarget.<init>(FileTarget.java:45)
>  at
> org.zact.idk.datasource.DataSourceFactory.createLogger(DataSourceFactory.jav
> a:96)
>  at
> org.zact.idk.datasource.DataSourceFactory.getInstance(DataSourceFactory.java
> :65)
>  at
> org.zact.idk.datasource.DataSourceFactory.getDataSource(DataSourceFactory.ja
> va:40)
>  at
> org.zact.idk.datasource.test.DataSourceTest.testDataSource(DataSourceTest.ja
> va:29)
>  at java.lang.reflect.Method.invoke(Native Method)
>  at junit.framework.TestCase.runTest(TestCase.java:166)
>  at junit.framework.TestCase.runBare(TestCase.java:140)
>  at junit.framework.TestResult$1.protect(TestResult.java:106)
>  at junit.framework.TestResult.runProtected(TestResult.java:124)
>  at junit.framework.TestResult.run(TestResult.java:109)
>  at junit.framework.TestCase.run(TestCase.java:131)
>  at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
>  at junit.extensions.TestDecorator.run(TestDecorator.java:28)
>  at junit.extensions.RepeatedTest.run(RepeatedTest.java:25)
>  at
> com.clarkware.junitperf.ThreadedTest$TestRunner.run(ThreadedTest.java:77)
>  at java.lang.Thread.run(Thread.java:484)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org

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


Re: NPE at FileTarget...

Posted by Peter Donald <do...@apache.org>.
On Fri,  3 Aug 2001 18:43, Eung-ju Park wrote:
> > getCanoncialFile().getParent() may work. Theres certain idiosyncracies on
> > certain filesystems etc.
>
> yeh. new FileTarget( new File( "datasources.log" ) ).getCanonicalFile(),
> false, formatter )
> works on previous FileTarget.
> How about use getFile().getCanonicalFile().getParent() instead of
> getFile().getParentFile() at FileTarget.openFile?

done.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*

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


Re: NPE at FileTarget...

Posted by Eung-ju Park <co...@isoft.co.kr>.
> No idea - can you check latest CVS and see if it works for you ? If it
> doesn't could you send details like
yes. lastest CVS version is works.
I mean previous version occur exception when destination is not on root.

> * results of java -version
> * tell me if you are working on directories made out of symlinks
> * on an alternate filesystem (and what OS you are running).
>
> The only thing I can thing of if it still doesn't work is that *maybe*
doing
> getCanoncialFile().getParent() may work. Theres certain idiosyncracies on
> certain filesystems etc.
yeh. new FileTarget( new File( "datasources.log" ) ).getCanonicalFile(),
false, formatter )
works on previous FileTarget.
How about use getFile().getCanonicalFile().getParent() instead of
getFile().getParentFile() at FileTarget.openFile?
>
> Cheers,
>
> Pete
>
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof."                   |
> |              - John Kenneth Galbraith               |
> *-----------------------------------------------------*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
>


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


Re: NPE at FileTarget...

Posted by Peter Donald <do...@apache.org>.
On Fri,  3 Aug 2001 14:55, Eung-ju Park wrote:
> ----- Original Message -----
> From: "Peter Donald" <do...@apache.org>
> To: "Avalon Development" <av...@jakarta.apache.org>
> Sent: Friday, August 03, 2001 1:10 PM
> Subject: Re: NPE at FileTarget...
>
> > Error on my part. I assume destination is something like /mylogfile.txt
>
> (ie
>
> > at root of filesystem). In which case it has no parent file but I wasnt
> > guarding against that. Fixed in CVS.
>
> my real destination  is not exists in root filesystem.

that should be fine.

> new File( filename ) means file on current directory.
> destination variable is "datasources.log" but real destination is
> "/home/colus/foo/bar/datasource.log".
> hmm. it is a java.io.File.parent's bug?

No idea - can you check latest CVS and see if it works for you ? If it 
doesn't could you send details like
* results of java -version
* tell me if you are working on directories made out of symlinks
* on an alternate filesystem (and what OS you are running).

The only thing I can thing of if it still doesn't work is that *maybe* doing 
getCanoncialFile().getParent() may work. Theres certain idiosyncracies on 
certain filesystems etc.

Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*

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


Re: NPE at FileTarget...

Posted by Eung-ju Park <co...@isoft.co.kr>.
----- Original Message -----
From: "Peter Donald" <do...@apache.org>
To: "Avalon Development" <av...@jakarta.apache.org>
Sent: Friday, August 03, 2001 1:10 PM
Subject: Re: NPE at FileTarget...


> Error on my part. I assume destination is something like /mylogfile.txt
(ie
> at root of filesystem). In which case it has no parent file but I wasnt
> guarding against that. Fixed in CVS.

my real destination  is not exists in root filesystem.
new File( filename ) means file on current directory.
destination variable is "datasources.log" but real destination is
"/home/colus/foo/bar/datasource.log".
hmm. it is a java.io.File.parent's bug?



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


Re: NPE at FileTarget...

Posted by Peter Donald <do...@apache.org>.
Error on my part. I assume destination is something like /mylogfile.txt (ie 
at root of filesystem). In which case it has no parent file but I wasnt 
guarding against that. Fixed in CVS.

On Fri,  3 Aug 2001 14:09, Eung-ju Park wrote:
> FileTarget logTarget = new FileTarget( new File( destination ), false, new
> AvalonFormatter() );
>
> occur below exception. I use current cvs version of logkit. What's wrong?
>
> java.lang.NullPointerException
>  at org.apache.log.output.io.FileTarget.openFile(FileTarget.java:85)
>  at org.apache.log.output.io.FileTarget.<init>(FileTarget.java:45)
>  at
> org.zact.idk.datasource.DataSourceFactory.createLogger(DataSourceFactory.ja
>v a:96)
>  at
> org.zact.idk.datasource.DataSourceFactory.getInstance(DataSourceFactory.jav
>a
>
> :65)
>
>  at
> org.zact.idk.datasource.DataSourceFactory.getDataSource(DataSourceFactory.j
>a va:40)
>  at
> org.zact.idk.datasource.test.DataSourceTest.testDataSource(DataSourceTest.j
>a va:29)
>  at java.lang.reflect.Method.invoke(Native Method)
>  at junit.framework.TestCase.runTest(TestCase.java:166)
>  at junit.framework.TestCase.runBare(TestCase.java:140)
>  at junit.framework.TestResult$1.protect(TestResult.java:106)
>  at junit.framework.TestResult.runProtected(TestResult.java:124)
>  at junit.framework.TestResult.run(TestResult.java:109)
>  at junit.framework.TestCase.run(TestCase.java:131)
>  at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
>  at junit.extensions.TestDecorator.run(TestDecorator.java:28)
>  at junit.extensions.RepeatedTest.run(RepeatedTest.java:25)
>  at
> com.clarkware.junitperf.ThreadedTest$TestRunner.run(ThreadedTest.java:77)
>  at java.lang.Thread.run(Thread.java:484)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: avalon-dev-help@jakarta.apache.org
>
> 
-- 
Cheers,

Pete

*-----------------------------------------------------*
| "Faced with the choice between changing one's mind, |
| and proving that there is no need to do so - almost |
| everyone gets busy on the proof."                   |
|              - John Kenneth Galbraith               |
*-----------------------------------------------------*

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