isDirectory() Fails On Foldername With Special Characters (ÜÖÄÜÖÄß...) (Doc ID 358798.1)

Last updated on MAY 05, 2011

Applies to:

Oracle Server - Enterprise Edition - Version: 9.0.1.0 to 10.2.0.1 - Release: 9.0.1 to 10.2
Information in this document applies to any platform.

Symptoms

Directories with a special character in their name (üöäÜÖÄß), cannot be identified as
directories from within OracleJVM.

Code for Java Stored Procedure:

import java.io.File;

public class TestDirectory
{

  public static int isDirectory(String name)
  {
    //System.setProperty("file.encoding","Cp1252"); // Possible Workaround
    try
    {
      File path = new File( name );
      if (!path.exists())
      {
        return 3;
      }
      else
      {
        if (path.isDirectory())
        {
          return 2;
        }
        else
        {
          return 1;
        }
      }
    }
    catch (Exception ex) {
      ex.printStackTrace();
      return 0;
    }
  }


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms