You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2005/08/31 21:33:16 UTC
svn commit: r265559 -
/james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java
Author: bago
Date: Wed Aug 31 12:33:11 2005
New Revision: 265559
URL: http://svn.apache.org/viewcvs?rev=265559&view=rev
Log:
Fixed a bug compiling this mailet with latest jdks. The bayesian mailet does extend this class with its own anonymous inner class and the this.getClass() was returning the name of the anonymous class (e.g: ClassName$2).
Modified:
james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java
Modified: james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java?rev=265559&r1=265558&r2=265559&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java (original)
+++ james/server/trunk/src/java/org/apache/james/util/JDBCBayesianAnalyzer.java Wed Aug 31 12:33:11 2005
@@ -343,7 +343,7 @@
}
this.sqlFile = new File((String) mailetContext.getAttribute("confDir"), "sqlResources.xml").getCanonicalFile();
- sqlQueries.init(this.sqlFile, this.getClass().getName(), conn, getSqlParameters());
+ sqlQueries.init(this.sqlFile, JDBCBayesianAnalyzer.class.getName() , conn, getSqlParameters());
checkTables(conn);
} finally {
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
RE: svn commit: r265559 (ATTN: Vincenzo)
Posted by "Noel J. Bergman" <no...@devtech.com>.
> private JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer() {
> ...
> };
Right, and then when we have:
sqlQueries.init(this.sqlFile, this.getClass().getName(), ...
why would this.getClass().getName() to return anything other than the name
of the anonymous inner class?
I agree with Stefano. If it worked before, it may well have been considered
a bug in the JRE.
--- Noel
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r265559 (ATTN: Vincenzo)
Posted by Vincenzo Gianferrari Pini <vi...@praxis.it>.
Stefano Bagnara wrote:
>>In the BayesianAnalysis mailet the instantiation of
>>JDBCBayesianAnalyzer is as follows:
>>
>> private JDBCBayesianAnalyzer analyzer = new
>>JDBCBayesianAnalyzer() {
>> protected void delegatedLog(String logString) {
>> log("BayesianAnalysis: " + logString);
>> }
>> };
>>
>>May it be that a jdk change has changed the behaviour of
>>this.getClass() in this case? If true, it frightens me a
>>little bit. What is your jdk?
>>Mine is 1.4.2_07.
>>
>>Anyway, your fix makes it safer, so let's keep it.
>>
>>Vincenzo
>>
>>
>
>I don't know how/when it happened: now the this.getClass call the getClass
>of the innerclass and it find BayesianAnalysis$2 instead of
>JDBCBayesianAnalyzer.
>
>I'm using 1.4.2_07 too. I've tested with 1.5 and I keep getting the same
>result.
>
>Can you try running this code?
>
>public class Test {
>
> public Class test() {
> return(this.getClass());
> }
>
> public static void main(String[] args) {
> Test t = new Test() {
>
> };
>
> System.out.println(t.test().equals(Test.class));
>
> }
>}
>
>It returns false in all my tests.
>
>
It returns false also to me, using Sunn jdk 1.4.2_06 under windows. I
can't try it under my Sun jdk 1.4.2_07 under linux in production...
Vincenzo
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r265559 (ATTN: Vincenzo)
Posted by Stefano Bagnara <ap...@bago.org>.
> In the BayesianAnalysis mailet the instantiation of
> JDBCBayesianAnalyzer is as follows:
>
> private JDBCBayesianAnalyzer analyzer = new
> JDBCBayesianAnalyzer() {
> protected void delegatedLog(String logString) {
> log("BayesianAnalysis: " + logString);
> }
> };
>
> May it be that a jdk change has changed the behaviour of
> this.getClass() in this case? If true, it frightens me a
> little bit. What is your jdk?
> Mine is 1.4.2_07.
>
> Anyway, your fix makes it safer, so let's keep it.
>
> Vincenzo
I don't know how/when it happened: now the this.getClass call the getClass
of the innerclass and it find BayesianAnalysis$2 instead of
JDBCBayesianAnalyzer.
I'm using 1.4.2_07 too. I've tested with 1.5 and I keep getting the same
result.
Can you try running this code?
public class Test {
public Class test() {
return(this.getClass());
}
public static void main(String[] args) {
Test t = new Test() {
};
System.out.println(t.test().equals(Test.class));
}
}
It returns false in all my tests.
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r265559 (ATTN: Vincenzo)
Posted by Vincenzo Gianferrari Pini <vi...@praxis.it>.
In the BayesianAnalysis mailet the instantiation of JDBCBayesianAnalyzer
is as follows:
private JDBCBayesianAnalyzer analyzer = new JDBCBayesianAnalyzer() {
protected void delegatedLog(String logString) {
log("BayesianAnalysis: " + logString);
}
};
May it be that a jdk change has changed the behaviour of this.getClass()
in this case? If true, it frightens me a little bit. What is your jdk?
Mine is 1.4.2_07.
Anyway, your fix makes it safer, so let's keep it.
Vincenzo
Stefano Bagnara wrote:
>Vincenzo,
>
>Please review this fix: I don't understand why/how it was working before !?!
>I used your mailet since your commit and they worked but it was no more
>working and I have not found what is changed (maybe the jdk?).
>
>Stefano
>
>
>
>>Author: bago
>>Date: Wed Aug 31 12:33:11 2005
>>New Revision: 265559
>>
>>URL: http://svn.apache.org/viewcvs?rev=265559&view=rev
>>Log:
>>Fixed a bug compiling this mailet with latest jdks. The
>>bayesian mailet does extend this class with its own anonymous
>>inner class and the this.getClass() was returning the name of
>>the anonymous class (e.g: ClassName$2).
>>
>>Modified:
>>
>>james/server/trunk/src/java/org/apache/james/util/JDBCBayesian
>>Analyzer.java
>>
>>[...]
>>- sqlQueries.init(this.sqlFile,
>>this.getClass().getName(), conn, getSqlParameters());
>>+ sqlQueries.init(this.sqlFile,
>>+ JDBCBayesianAnalyzer.class.getName() , conn, getSqlParameters());
>>
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>For additional commands, e-mail: server-dev-help@james.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org
Re: svn commit: r265559 (ATTN: Vincenzo)
Posted by Stefano Bagnara <ap...@bago.org>.
Vincenzo,
Please review this fix: I don't understand why/how it was working before !?!
I used your mailet since your commit and they worked but it was no more
working and I have not found what is changed (maybe the jdk?).
Stefano
> Author: bago
> Date: Wed Aug 31 12:33:11 2005
> New Revision: 265559
>
> URL: http://svn.apache.org/viewcvs?rev=265559&view=rev
> Log:
> Fixed a bug compiling this mailet with latest jdks. The
> bayesian mailet does extend this class with its own anonymous
> inner class and the this.getClass() was returning the name of
> the anonymous class (e.g: ClassName$2).
>
> Modified:
>
> james/server/trunk/src/java/org/apache/james/util/JDBCBayesian
> Analyzer.java
>
> [...]
> - sqlQueries.init(this.sqlFile,
> this.getClass().getName(), conn, getSqlParameters());
> + sqlQueries.init(this.sqlFile,
> + JDBCBayesianAnalyzer.class.getName() , conn, getSqlParameters());
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org