Changeset 372


Ignore:
Timestamp:
May 25, 2012, 4:00:54 PM (13 years ago)
Author:
dmik
Message:

icedtea-web: Port file naming related bits to OS/2.

Location:
trunk/icedtea-web/netx/net/sourceforge/jnlp
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/icedtea-web/netx/net/sourceforge/jnlp/config/BasicValueValidators.java

    r348 r372  
    4040import static net.sourceforge.jnlp.runtime.Translator.R;
    4141
     42import java.io.File;
    4243import java.net.URL;
    4344import java.util.Arrays;
     
    102103
    103104            String possibleFile = (String) possibleValue;
     105            if (Defaults.OS_DOS_LIKE) {
     106                if (!(Character.isLetter(possibleFile.charAt(0)) &&
     107                      possibleFile.charAt(1) == ':' &&
     108                      (possibleFile.charAt(2) == File.separatorChar ||
     109                       possibleFile.charAt(2) == '/'))) {
     110                    throw new IllegalArgumentException();
     111                }
     112            }
     113            else
    104114            if (!(possibleFile.startsWith("/"))) {
    105115                throw new IllegalArgumentException();
     
    110120        @Override
    111121        public String getPossibleValues() {
    112             return R("VVPossibleFileValues");
     122            return Defaults.OS_DOS_LIKE ? R("VVPossibleFileValuesDOS") : R("VVPossibleFileValues");
    113123        }
    114124
  • trunk/icedtea-web/netx/net/sourceforge/jnlp/config/Defaults.java

    r348 r372  
    5353
    5454    /**
     55     * Whether the OS is a DOS-like (Windows, OS/2) or not.
     56     */
     57    public static final boolean OS_DOS_LIKE =
     58        System.getProperty("os.name").startsWith("OS/2") ||
     59        System.getProperty("os.name").contains("Windows");
     60
     61    /**
    5562     * Get the default settings for deployment
    5663     */
  • trunk/icedtea-web/netx/net/sourceforge/jnlp/resources/Messages.properties

    r348 r372  
    268268VVPossibleBooleanValues=are {0} or {1}
    269269VVPossibleFileValues=include the absolute location of a file - it must begin with a /
     270VVPossibleFileValuesDOS=include the absolute location of a file - it must begin with a drive letter
    270271VVPossibleRangedIntegerValues=are in range {0} to {1} (inclusive)
    271272VVPossibleUrlValues=include any valid url (eg http://icedtea.classpath.org/hg/)
  • trunk/icedtea-web/netx/net/sourceforge/jnlp/util/FileUtils.java

    r348 r372  
    2626import java.nio.channels.FileLock;
    2727
     28import net.sourceforge.jnlp.config.Defaults;
    2829import net.sourceforge.jnlp.runtime.JNLPRuntime;
    2930
     
    178179
    179180        // remove all permissions
    180         if (!tempFile.setExecutable(false, false)) {
    181             throw new IOException(R("RRemoveXPermFailed", tempFile));
    182         }
    183         if (!tempFile.setReadable(false, false)) {
    184             throw new IOException(R("RRemoveRPermFailed", tempFile));
     181        if (!Defaults.OS_DOS_LIKE) {
     182            if (!tempFile.setExecutable(false, false)) {
     183                throw new IOException(R("RRemoveXPermFailed", tempFile));
     184            }
     185            if (!tempFile.setReadable(false, false)) {
     186                throw new IOException(R("RRemoveRPermFailed", tempFile));
     187            }
    185188        }
    186189        if (!tempFile.setWritable(false, false)) {
     
    206209        // opened the file right after it was created might still be able to
    207210        // read the data.
     211        if (Defaults.OS_DOS_LIKE) {
     212            // On OS/2 and Windows, renameTo() fails if the target exists
     213            // so delete it first
     214            file.delete();
     215        }
    208216        if (!tempFile.renameTo(file)) {
    209217            throw new IOException(R("RCantRename", tempFile, file));
Note: See TracChangeset for help on using the changeset viewer.