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 no...@apache.org on 2007/04/23 10:23:36 UTC

svn commit: r531373 - in /james/jspf/branches/asynch-jspf/src: main/java/org/apache/james/jspf/core/ main/java/org/apache/james/jspf/impl/ test/java/org/apache/james/jspf/

Author: norman
Date: Mon Apr 23 01:23:34 2007
New Revision: 531373

URL: http://svn.apache.org/viewvc?view=rev&rev=531373
Log:
Move IResponse implementation to the right package and tree

Added:
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java   (with props)
Removed:
    james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/ResponseImpl.java
Modified:
    james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
    james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/AbstractYamlTest.java

Added: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java?view=auto&rev=531373
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java (added)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java Mon Apr 23 01:23:34 2007
@@ -0,0 +1,46 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.jspf.core;
+
+
+import java.util.List;
+
+public class IResponseImpl implements IResponse {
+    private Exception exception = null;
+    private List value = null;
+    private Object id = null;
+    public IResponseImpl(Object id, Exception e) {
+        this.exception = e;
+        this.id = id;
+    }
+    public IResponseImpl(Object id, List result) {
+        this.value = result;
+        this.id = id;
+    }
+    public Exception getException() {
+        return exception;
+    }
+    public Object getId() {
+        return id;
+    }
+    public Object getValue() {
+        return value;
+    }
+}
\ No newline at end of file

Propchange: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/core/IResponseImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java?view=diff&rev=531373&r1=531372&r2=531373
==============================================================================
--- james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java (original)
+++ james/jspf/branches/asynch-jspf/src/main/java/org/apache/james/jspf/impl/DNSServiceXBillImpl.java Mon Apr 23 01:23:34 2007
@@ -19,11 +19,11 @@
 
 package org.apache.james.jspf.impl;
 
-import org.apache.james.jspf.ResponseImpl;
 import org.apache.james.jspf.core.DNSService;
 import org.apache.james.jspf.core.IPAddr;
 import org.apache.james.jspf.core.Logger;
 import org.apache.james.jspf.core.IResponseQueue;
+import org.apache.james.jspf.core.IResponseImpl;
 import org.xbill.DNS.AAAARecord;
 import org.xbill.DNS.ARecord;
 import org.xbill.DNS.Lookup;
@@ -197,9 +197,9 @@
     public void getRecordsAsynch(String hostname, int recordType, Object id,
             IResponseQueue responsePool) {
         try {
-            responsePool.insertResponse(new ResponseImpl(id, getRecords(hostname, recordType)));
+            responsePool.insertResponse(new IResponseImpl(id, getRecords(hostname, recordType)));
         } catch (TimeoutException e) {
-            responsePool.insertResponse(new ResponseImpl(id, e));
+            responsePool.insertResponse(new IResponseImpl(id, e));
         }
 
     }

Modified: james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/AbstractYamlTest.java
URL: http://svn.apache.org/viewvc/james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/AbstractYamlTest.java?view=diff&rev=531373&r1=531372&r2=531373
==============================================================================
--- james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/AbstractYamlTest.java (original)
+++ james/jspf/branches/asynch-jspf/src/test/java/org/apache/james/jspf/AbstractYamlTest.java Mon Apr 23 01:23:34 2007
@@ -22,6 +22,7 @@
 import org.apache.james.jspf.core.DNSService;
 import org.apache.james.jspf.core.IResponseQueue;
 import org.apache.james.jspf.core.Logger;
+import org.apache.james.jspf.core.IResponseImpl;
 import org.apache.james.jspf.core.SPFExecutor;
 import org.apache.james.jspf.core.SPFRecordParser;
 import org.apache.james.jspf.core.StagedMultipleSPFExecutor;
@@ -341,9 +342,9 @@
         public void getRecordsAsynch(String hostname, int recordType, Object id,
                 IResponseQueue responsePool) {
             try {
-                responsePool.insertResponse(new ResponseImpl(id, getRecords(hostname, recordType)));
+                responsePool.insertResponse(new IResponseImpl(id, getRecords(hostname, recordType)));
             } catch (TimeoutException e) {
-                responsePool.insertResponse(new ResponseImpl(id, e));
+                responsePool.insertResponse(new IResponseImpl(id, e));
             }
         }
     }



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


Re: [mime4j] null charset error

Posted by GX GLIX <ma...@hotmail.com>.
Hi Norman Maurer

Thanks again your your time and suggestions,

Although  we are using windows 2003 server the JDK is 1.4, and the submitted 
bug is for jdk 1.6
As am busy with other things for the moment I only be able to look into this 
after the next few days, If I do manage to find anything I will keep you 
posted.

GX

>From: Norman Maurer <no...@apache.org>
>Reply-To: "James Developers List" <se...@james.apache.org>
>To: James Developers List <se...@james.apache.org>
>Subject: Re: [mime4j] null charset error
>Date: Tue, 24 Apr 2007 15:36:34 +0200
>
>Hi GX,
>
>what JDK and OS you using? I found some intressting stuff:
>
>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322678
>http://256.com/gray/docs/misc/java_bad_file_descriptor_close_bug.shtml
>
>bye
>Norman
>
>
>GX GLIX schrieb:
> > Hi All
> >
> > I am getting a "Null charset name" error during parsing, it seems that
> > getCharset(String charsetName) is passed an empty string... I tried
> > the following hack to fix it:
> >
> > ..........
> >    public static java.nio.charset.Charset getCharset(String
> > charsetName) {
> >        if(charsetName == null)
> >            charsetName = "ISO8859-1";
> >        java.nio.charset.Charset c =
> > java.nio.charset.Charset.forName(charsetName);
> > ............
> >
> > now the result is :
> >
> > java.io.IOException: Bad file descriptor
> >     at java.io.FileOutputStream.writeBytes(Native Method)
> >     at java.io.FileOutputStream.write(FileOutputStream.java:260)
> >     at
> > sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
> >     at
> > 
>sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
> >
> >     at
> > sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
> >     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
> >     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
> >     at java.io.BufferedWriter.flush(BufferedWriter.java:230)
> >     at org.mime4j.message.Header.writeTo(Header.java:152)
> >     at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
> >     at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
> >     at org.mime4j.message.Message.writeTo(Message.java:91)
> > any ideas anyone?
> >
> > _________________________________________________________________
> > FREE pop-up blocking with the new MSN Toolbar - get it now!
> > http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> > For additional commands, e-mail: server-dev-help@james.apache.org
> >
> >
> > !DSPAM:1,462c94fb324321289648189!
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>For additional commands, e-mail: server-dev-help@james.apache.org
>

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


Re: [mime4j] null charset error

Posted by Norman Maurer <no...@apache.org>.
Hi GX,

what JDK and OS you using? I found some intressting stuff:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6322678
http://256.com/gray/docs/misc/java_bad_file_descriptor_close_bug.shtml

bye
Norman


GX GLIX schrieb:
> Hi All
>
> I am getting a "Null charset name" error during parsing, it seems that
> getCharset(String charsetName) is passed an empty string... I tried
> the following hack to fix it:
>
> ..........
>    public static java.nio.charset.Charset getCharset(String
> charsetName) {
>        if(charsetName == null)
>            charsetName = "ISO8859-1";
>        java.nio.charset.Charset c =
> java.nio.charset.Charset.forName(charsetName);
> ............
>
> now the result is :
>
> java.io.IOException: Bad file descriptor
>     at java.io.FileOutputStream.writeBytes(Native Method)
>     at java.io.FileOutputStream.write(FileOutputStream.java:260)
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
>
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
>     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
>     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
>     at java.io.BufferedWriter.flush(BufferedWriter.java:230)
>     at org.mime4j.message.Header.writeTo(Header.java:152)
>     at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
>     at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
>     at org.mime4j.message.Message.writeTo(Message.java:91)
> any ideas anyone?
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now!
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
> !DSPAM:1,462c94fb324321289648189!
>
>


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


Re: [mime4j] null charset error

Posted by Stefano Bagnara <ap...@bago.org>.
You are calling a "Message.writeTo". Can you give us more informations 
on the path you used and other arguments you gave to that method?

You can also try to write to the same outputstream without using Mime4J 
so that we know if this is related to mime4j or simply something else to 
do with your setup / filesystem type / permissions.

Stefano

GX GLIX ha scritto:
> Hi All
> 
> I am getting a "Null charset name" error during parsing, it seems that 
> getCharset(String charsetName) is passed an empty string... I tried the 
> following hack to fix it:
> 
> ..........
>    public static java.nio.charset.Charset getCharset(String charsetName) {
>        if(charsetName == null)
>            charsetName = "ISO8859-1";
>        java.nio.charset.Charset c = 
> java.nio.charset.Charset.forName(charsetName);
> ............
> 
> now the result is :
> 
> java.io.IOException: Bad file descriptor
>     at java.io.FileOutputStream.writeBytes(Native Method)
>     at java.io.FileOutputStream.write(FileOutputStream.java:260)
>     at 
> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
>     at 
> sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
>     at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
>     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
>     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
>     at java.io.BufferedWriter.flush(BufferedWriter.java:230)
>     at org.mime4j.message.Header.writeTo(Header.java:152)
>     at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
>     at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
>     at org.mime4j.message.Message.writeTo(Message.java:91)
> any ideas anyone?
> 
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now! 
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
> 
> 
> ---------------------------------------------------------------------
> 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: [mime4j] null charset error

Posted by Niklas Therning <ni...@trillian.se>.
Yes, if possible please post the source of the message you are parsing.
That will help us fix the first problem.

Also, make sure you don't close() the OutputStream you are writing to
before your call to Message.writeTo().

/Niklas

Norman Maurer wrote:
> Can you show use the emailcontent ?
>
>
> bye
> Norman
>
> GX GLIX schrieb:
>   
>> Hi All
>>
>> I am getting a "Null charset name" error during parsing, it seems that
>> getCharset(String charsetName) is passed an empty string... I tried
>> the following hack to fix it:
>>
>> ..........
>>    public static java.nio.charset.Charset getCharset(String
>> charsetName) {
>>        if(charsetName == null)
>>            charsetName = "ISO8859-1";
>>        java.nio.charset.Charset c =
>> java.nio.charset.Charset.forName(charsetName);
>> ............
>>
>> now the result is :
>>
>> java.io.IOException: Bad file descriptor
>>     at java.io.FileOutputStream.writeBytes(Native Method)
>>     at java.io.FileOutputStream.write(FileOutputStream.java:260)
>>     at
>> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
>>     at
>> sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
>>
>>     at
>> sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
>>     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
>>     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
>>     at java.io.BufferedWriter.flush(BufferedWriter.java:230)
>>     at org.mime4j.message.Header.writeTo(Header.java:152)
>>     at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
>>     at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
>>     at org.mime4j.message.Message.writeTo(Message.java:91)
>> any ideas anyone?
>>
>> _________________________________________________________________
>> FREE pop-up blocking with the new MSN Toolbar - get it now!
>> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-dev-help@james.apache.org
>>
>>
>> !DSPAM:1,462c94fb324321289648189!
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
>   


-- 
Niklas Therning
www.spamdrain.net


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


Re: [mime4j] null charset error

Posted by Norman Maurer <no...@apache.org>.
Can you show use the emailcontent ?


bye
Norman

GX GLIX schrieb:
> Hi All
>
> I am getting a "Null charset name" error during parsing, it seems that
> getCharset(String charsetName) is passed an empty string... I tried
> the following hack to fix it:
>
> ..........
>    public static java.nio.charset.Charset getCharset(String
> charsetName) {
>        if(charsetName == null)
>            charsetName = "ISO8859-1";
>        java.nio.charset.Charset c =
> java.nio.charset.Charset.forName(charsetName);
> ............
>
> now the result is :
>
> java.io.IOException: Bad file descriptor
>     at java.io.FileOutputStream.writeBytes(Native Method)
>     at java.io.FileOutputStream.write(FileOutputStream.java:260)
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
>
>     at
> sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
>     at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
>     at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
>     at java.io.BufferedWriter.flush(BufferedWriter.java:230)
>     at org.mime4j.message.Header.writeTo(Header.java:152)
>     at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
>     at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
>     at org.mime4j.message.Message.writeTo(Message.java:91)
> any ideas anyone?
>
> _________________________________________________________________
> FREE pop-up blocking with the new MSN Toolbar - get it now!
> http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>
> !DSPAM:1,462c94fb324321289648189!
>
>


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


[mime4j] null charset error

Posted by GX GLIX <ma...@hotmail.com>.
Hi All

I am getting a "Null charset name" error during parsing, it seems that 
getCharset(String charsetName) is passed an empty string... I tried the 
following hack to fix it:

..........
    public static java.nio.charset.Charset getCharset(String charsetName) {
    	if(charsetName == null)
    		charsetName = "ISO8859-1";
    	java.nio.charset.Charset c = 
java.nio.charset.Charset.forName(charsetName);
............

now the result is :

java.io.IOException: Bad file descriptor
	at java.io.FileOutputStream.writeBytes(Native Method)
	at java.io.FileOutputStream.write(FileOutputStream.java:260)
	at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
	at 
sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
	at sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
	at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
	at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
	at java.io.BufferedWriter.flush(BufferedWriter.java:230)
	at org.mime4j.message.Header.writeTo(Header.java:152)
	at org.mime4j.message.BodyPart.writeTo(BodyPart.java:39)
	at org.mime4j.message.Multipart.writeTo(Multipart.java:178)
	at org.mime4j.message.Message.writeTo(Message.java:91)
any ideas anyone?

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


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