java.io.FileNotFoundException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(109)

本文整理了Java中java.io.FileNotFoundException.getLocalizedMessage()方法的一些代码示例,展示了FileNotFoundException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileNotFoundException.getLocalizedMessage()方法的具体详情如下:
包路径:java.io.FileNotFoundException
类名称:FileNotFoundException
方法名:getLocalizedMessage

FileNotFoundException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: Netflix/Priam

private PGPPublicKey getPubKey() {
  InputStream pubKeyIS;
  try {
    pubKeyIS = new BufferedInputStream(new FileInputStream(config.getPgpPublicKeyLoc()));
  } catch (FileNotFoundException e) {
    logger.error(
        "Exception in reading PGP security collection ring.  Msg: {}",
        e.getLocalizedMessage());
    throw new RuntimeException("Exception in reading PGP public key", e);
  }
  try {
    return PgpUtil.readPublicKey(pubKeyIS);
  } catch (Exception e) {
    throw new RuntimeException("Exception in reading & deriving the PGP public key.", e);
  }
}

代码示例来源:origin: Netflix/Priam

@Override
public BackupVerificationResult isMetaFileValid(AbstractBackupPath metaBackupPath) {
  MetaFileBackupValidator metaFileBackupValidator = new MetaFileBackupValidator();
  BackupVerificationResult result = metaFileBackupValidator.verificationResult;
  result.remotePath = metaBackupPath.getRemotePath();
  result.snapshotInstant = metaBackupPath.getLastModified();
  Path metaFile = null;
  try {
    metaFile = downloadMetaFile(metaBackupPath);
    result.manifestAvailable = true;
    metaFileBackupValidator.readMeta(metaFile);
    result.valid = (result.filesInMetaOnly.isEmpty());
  } catch (FileNotFoundException fne) {
    logger.error(fne.getLocalizedMessage());
  } catch (IOException ioe) {
    logger.error(
        "IO Error while processing meta file: " + metaFile, ioe.getLocalizedMessage());
    ioe.printStackTrace();
  } catch (BackupRestoreException bre) {
    logger.error("Error while trying to download the manifest file: {}", metaBackupPath);
  } finally {
    if (metaFile != null) FileUtils.deleteQuietly(metaFile.toFile());
  }
  return result;
}

代码示例来源:origin: facebook/facebook-android-sdk

requestCallback).executeAsync();
} catch (final FileNotFoundException ex) {
  String message = ex.getLocalizedMessage();
  if (message == null) {
    message = "Error staging photo.";

代码示例来源:origin: geotools/geotools

public static Properties loadPropertiesFromURL(URL propsURL) {
    final Properties properties = new Properties();
    InputStream stream = null;
    InputStream openStream = null;
    try {
      openStream = propsURL.openStream();
      stream = new BufferedInputStream(openStream);
      properties.load(stream);
    } catch (FileNotFoundException e) {
      if (LOGGER.isLoggable(Level.SEVERE))
        LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
      return null;
    } catch (IOException e) {
      if (LOGGER.isLoggable(Level.SEVERE))
        LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
      return null;
    } finally {

      if (stream != null) {
        IOUtils.closeQuietly(stream);
      }
      if (openStream != null) {
        IOUtils.closeQuietly(openStream);
      }
    }
    return properties;
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Store the properties on disk
 *
 * @param properties
 * @param typeName
 */
protected void storeProperties(Properties properties, String typeName) {
  OutputStream outStream = null;
  try {
    final String propertiesPath =
        auxiliaryFolder.getAbsolutePath()
            + File.separatorChar
            + typeName
            + ".properties";
    outStream = new BufferedOutputStream(new FileOutputStream(new File(propertiesPath)));
    properties.store(outStream, null);
  } catch (FileNotFoundException e) {
    if (LOGGER.isLoggable(Level.WARNING)) {
      LOGGER.warning("Unable to store the mapping " + e.getLocalizedMessage());
    }
  } catch (IOException e) {
    if (LOGGER.isLoggable(Level.WARNING)) {
      LOGGER.warning("Unable to store the mapping " + e.getLocalizedMessage());
    }
  } finally {
    if (outStream != null) {
      IOUtils.closeQuietly(outStream);
    }
  }
}

代码示例来源:origin: geotools/geotools

/**
 * Utility method which load mapping properties from a propertiesFile.
 *
 * @param propertiesFile
 * @return
 */
private static Properties loadProperties(final String propertiesFile) {
  InputStream inStream = null;
  Properties properties = new Properties();
  try {
    File propertiesFileP = new File(propertiesFile);
    inStream = new BufferedInputStream(new FileInputStream(propertiesFileP));
    properties.load(inStream);
  } catch (FileNotFoundException e) {
    if (LOGGER.isLoggable(Level.WARNING)) {
      LOGGER.warning("Unable to store the mapping " + e.getLocalizedMessage());
    }
  } catch (IOException e) {
    if (LOGGER.isLoggable(Level.WARNING)) {
      LOGGER.warning("Unable to store the mapping " + e.getLocalizedMessage());
    }
  } finally {
    if (inStream != null) {
      IOUtils.closeQuietly(inStream);
    }
  }
  return properties;
}

代码示例来源:origin: geotools/geotools

} catch (FileNotFoundException e) {
  if (FeatureUtilities.LOGGER.isLoggable(Level.SEVERE))
    FeatureUtilities.LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  return null;
} catch (IOException e) {

代码示例来源:origin: geotools/geotools

LOGGER.warning(e.getLocalizedMessage());

代码示例来源:origin: matyb/java-koans

/**
 * conditionally create messages bundle for proper locale, not on classpath so need to handle manually
 * @return a resource bundle for default locale, or USA if default locale's language has no translated messages
 */
static ResourceBundle createResourceBundle() {
  ResourceBundle temp = null;
  try {
    temp = new PropertyResourceBundle(new FileInputStream(
      DirectoryManager.injectFileSystemSeparators(
        DirectoryManager.getProjectI18nDir(), 
            new StringBuilder("messages_").append(
                Locale.getDefault().getLanguage()).append(
                ".properties").toString())));
  } catch(FileNotFoundException x) {
    try {
      Logger.getLogger(Strings.class.getName()).log(Level.INFO, "Your default language is not supported yet. "+x.getLocalizedMessage());
      temp = new PropertyResourceBundle(new FileInputStream(
          DirectoryManager.injectFileSystemSeparators(
            DirectoryManager.getProjectI18nDir(), "messages_en.properties")));
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
  return temp;
}

代码示例来源:origin: geotools/geotools

return grid;
} catch (FileNotFoundException e) {
  LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  return null;
} catch (IOException e) {

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);

代码示例来源:origin: ukanth/afwall

public static boolean exportRules(Context ctx, final String fileName) {
  boolean res = false;
  File sdCard = Environment.getExternalStorageDirectory();
  if (isExternalStorageWritable()) {
    File dir = new File(sdCard.getAbsolutePath() + "/afwall/");
    dir.mkdirs();
    File file = new File(dir, fileName);
    try {
      FileOutputStream fOut = new FileOutputStream(file);
      OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
      //default Profile - current one
      JSONObject obj = new JSONObject(getCurrentRulesAsMap(ctx));
      JSONArray jArray = new JSONArray("[" + obj.toString() + "]");
      myOutWriter.append(jArray.toString());
      res = true;
      myOutWriter.close();
      fOut.close();
    } catch (FileNotFoundException e) {
      Log.e(TAG, e.getLocalizedMessage());
    } catch (JSONException e) {
      Log.e(TAG, e.getLocalizedMessage());
    } catch (IOException e) {
      Log.e(TAG, e.getLocalizedMessage());
    }
  }
  return res;
}

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (IOException e) {

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.INFO, e.getLocalizedMessage(), e);
} catch (IOException e) {

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.INFO, e.getLocalizedMessage(), e);
} catch (IOException e) {

代码示例来源:origin: geotools/geotools

LOGGER.fine("Unable to parse Histogram:" + e.getLocalizedMessage());

代码示例来源:origin: geotools/geotools

LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
  return null;
} catch (IOException e) {

代码示例来源:origin: ukanth/afwall

fOut.close();
} catch (FileNotFoundException e) {
  Log.d(TAG, e.getLocalizedMessage());
} catch (IOException e) {
  Log.d(TAG, e.getLocalizedMessage());

代码示例来源:origin: OpenNMS/opennms

@Override
  public OutputStream receiveUpload(String filename, String mimeType) {
    File file = new File(pendingDir, filename);
    try {
      return new FileOutputStream(file);
    } catch (FileNotFoundException e) {
      logger.warn("Unable to create file '" + file + "': " + e.getLocalizedMessage());
      return null;
    }
  }
});

相关文章