[jcifs] Having problem with simply connecting with release 1.2.9

Michael B Allen mba2000 at ioplex.com
Sun Nov 12 02:21:36 GMT 2006


I have added the following code to jcifs.Config. This will ensure that
if the JRE does not support Cp850 the default OEM encoding is changed to
"US-ASCII".

This should should fix the numerous places where this error results in
things being null. I also changed NtlmPasswordAuthentication to throw
a RuntimeExcpetion instead of silently returning null.

78     try {
79       "".getBytes(DEFAULT_OEM_ENCODING);
80     } catch (UnsupportedEncodingException uee) {
81       if (log.level >= 2) {
82         log.println("WARNING: The default OEM encoding " + DEFAULT_OEM_ENCODING +
83         " does not appear to be supported by this JRE. The default encoding will be US-ASCII.");
84       }   
85       DEFAULT_OEM_ENCODING = "US-ASCII";
86     } 


On Wed, 10 May 2006 12:54:33 -0400
Michael B Allen <mba2000 at ioplex.com> wrote:

> On Wed, 10 May 2006 07:03:21 +0200
> Thomas Bley <thomas.bley at simple-groupware.de> wrote:
> 
> > Hi,
> > 
> > I also had this Exception with listFiles() (no OutputStream).
> > When running with JRE, Cp850 is not supported and the 
> > NullpointerException comes up.
> > I'm using this code to decide the right encoding for jCIFS:
> > 
> > if (java.nio.charset.Charset.isSupported("IBM850")) { // JDK
> >   jcifs.Config.setProperty( "jcifs.encoding", "Cp850" );
> > } else { // JRE
> >   jcifs.Config.setProperty( "jcifs.encoding", "Cp1252" );
> > }
> > 
> > Using Cp1252 the German Umlaute are not working in shares names, but 
> > that's not so bad.
> 
> Yeah, nothing but Cp850 is going to work I'm afraid. The proper solution
> is to use the NetrShareEnum RPC. But your solution is certainly better
> than throwing a NullPointerException.
> 
> I'll add it to The List.
> 
> Thanks,
> Mike
> 


-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/


More information about the jcifs mailing list