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

x33g5p2x  于2022-01-16 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(98)

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

IOException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Constructor. Loads the constants needed for computations. They are exactly like the ones the blender uses. Each
 * deriving class should override this method and load its own constraints.
 */
public NoiseGenerator() {
  LOGGER.fine("Loading noise constants.");
  InputStream is = NoiseGenerator.class.getResourceAsStream("noiseconstants.dat");
  try {
    ObjectInputStream ois = new ObjectInputStream(is);
    hashpntf = (float[]) ois.readObject();
    hash = (short[]) ois.readObject();
    hashvectf = (float[]) ois.readObject();
    p = (short[]) ois.readObject();
    g = (float[][]) ois.readObject();
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  } catch (ClassNotFoundException e) {
    assert false : "Constants' classes should be arrays of primitive types, so they are ALWAYS known!";
  } finally {
    if (is != null) {
      try {
        is.close();
      } catch (IOException e) {
        LOGGER.log(Level.WARNING, e.getLocalizedMessage());
      }
    }
  }
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void doExportTree() {
 JFileChooser chooser = new JFileChooser();
 chooser.setSelectedFile(new File("./tree.png"));
 FileNameExtensionFilter filter = new FileNameExtensionFilter("PNG images", "png");
 chooser.setFileFilter(filter);
 int status = chooser.showSaveDialog(this);
 if (status != JFileChooser.APPROVE_OPTION)
  return;
 Dimension size = tjp.getPreferredSize();
 BufferedImage im = new BufferedImage((int) size.getWidth(),
                    (int) size.getHeight(),
                    BufferedImage.TYPE_INT_ARGB);
 Graphics2D g = im.createGraphics();
 tjp.paint(g);
 try {
  ImageIO.write(im, "png", chooser.getSelectedFile());
 } catch (IOException e) {
  JOptionPane.showMessageDialog(this, "Failed to save the tree image file.\n"
                 + e.getLocalizedMessage(), "Export Error",
                 JOptionPane.ERROR_MESSAGE);
 }
}

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

LOGGER.log(
      Level.WARNING,
      "Unable to test with this resource name: "
  LOGGER.log(
      Level.WARNING,
      "Unable to test with this resource name which does not has properties.");
try {
  properties =
      new File(testData.getDataDirectoryRoot(), ManifestLoader.PROPERTIES_FILE);
  writer.flush();
} catch (IOException e) {
  LOGGER.log(
      Level.WARNING,
      "Unable to write test data to:" + testData.getDataDirectoryRoot());
  org.junit.Assert.fail(e.getLocalizedMessage());
} finally {
  IOUtils.closeQuietly(writer);

代码示例来源:origin: org.tmatesoft.svnkit/svnkit

public static void createFormatFile(File adminDir) throws SVNException {
  OutputStream os = null;
  try {
    os = SVNFileUtil.openFileForWriting(new File(adminDir, "format"));
    os.write(FORMAT_TEXT);
  } catch (IOException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
    SVNErrorManager.error(err, e, SVNLogType.FSFS);
  } finally {
    SVNFileUtil.closeFile(os);
  }
}

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

WorldImageReader.class.toString(),
      "WorldImageReader",
      ex.getLocalizedMessage(),
      ex);
  throw new DataSourceException(ex);
        path = "//" + auth + path;
      this.source = input = new File(URLDecoder.decode(path, "UTF-8"));
    } else if (sourceURL.getProtocol().equalsIgnoreCase("http")) {
    if (tempCRS != null) {
      this.crs = (CoordinateReferenceSystem) tempCRS;
      LOGGER.log(Level.WARNING, "Using forced coordinate reference system ");
    } else readCRS();
  LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  throw new DataSourceException(e);
} catch (TransformException e) {
  LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  throw new DataSourceException(e);

代码示例来源:origin: org.jvnet.hudson.svnkit/svnkit

private void writeDumpData(OutputStream out, byte[] bytes) throws SVNException {
  try {
    out.write(bytes); 
  } catch (IOException ioe) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
    SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
  }
}

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

@Override
public void save(BackupMetadata backupMetadata) {
  File snapshotFile = new File(filename);
  if (!snapshotFile.exists()) snapshotFile.getParentFile().mkdirs();
  // Will save entire list to file.
  try (final ObjectOutputStream out =
      new ObjectOutputStream(new FileOutputStream(filename))) {
    out.writeObject(backupMetadataMap);
    out.flush();
    logger.info(
        "Snapshot status of size {} is saved to {}",
        backupMetadataMap.size(),
        filename);
  } catch (IOException e) {
    logger.error(
        "Error while trying to persist snapshot status to {}. Error: {}",
        filename,
        e.getLocalizedMessage());
  }
}

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

/**
 * Write the provided {@link RenderedImage} in the debug directory with the provided file name.
 *
 * @param raster the {@link RenderedImage} that we have to write.
 * @param fileName a {@link String} indicating where we should write it.
 */
static void writeRenderedImage(final RenderedImage raster, final String fileName) {
  if (DUMP_DIRECTORY == null)
    throw new NullPointerException(
        "Unable to write the provided coverage in the debug directory");
  if (DEBUG == false)
    throw new IllegalStateException(
        "Unable to write the provided coverage since we are not in debug mode");
  try {
    ImageIO.write(raster, "tiff", new File(DUMP_DIRECTORY, fileName + ".tiff"));
  } catch (IOException e) {
    LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-svnkit

public static void createFormatFile(File adminDir) throws SVNException {
  OutputStream os = null;
  try {
    os = SVNFileUtil.openFileForWriting(new File(adminDir, "format"));
    os.write(FORMAT_TEXT);            
  } catch (IOException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
    SVNErrorManager.error(err, e, SVNLogType.FSFS);
  } finally {
    SVNFileUtil.closeFile(os);
  }
}

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

LOGGER.log(
        java.util.logging.Level.SEVERE,
        "Error loading resources file: " + e.getLocalizedMessage(),
        e);
  } finally {
LOGGER.log(
    java.util.logging.Level.SEVERE,
    "Error loading resources file: " + e.getLocalizedMessage(),
    e);

代码示例来源:origin: org.tmatesoft.svnkit/svnkit

private void writeDumpData(OutputStream out, byte[] bytes) throws SVNException {
  try {
    out.write(bytes); 
  } catch (IOException ioe) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
    SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
  }
}

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

private void init() {
  File snapshotFile = new File(filename);
  if (!snapshotFile.exists()) {
    snapshotFile.getParentFile().mkdirs();
        "Error while trying to fetch snapshot status from {}. Error: {}. If this is first time after upgrading Priam, ignore this.",
        filename,
        e.getLocalizedMessage());
    e.printStackTrace();
  } catch (Exception e) {

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

final File prjFile = new File(prjPath);
if (prjFile.exists()) {
      LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
      LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
      LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
      } catch (IOException e) {
        if (LOGGER.isLoggable(Level.WARNING)) {
          LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
          LOGGER.log(FINE, ioe.getLocalizedMessage(), ioe);

代码示例来源:origin: org.jvnet.hudson.svnkit/svnkit

public static void createFormatFile(File adminDir) throws SVNException {
  OutputStream os = null;
  try {
    os = SVNFileUtil.openFileForWriting(new File(adminDir, "format"));
    os.write(FORMAT_TEXT);            
  } catch (IOException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
    SVNErrorManager.error(err, e, SVNLogType.FSFS);
  } finally {
    SVNFileUtil.closeFile(os);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

protected void createData(String name) throws IOException {
  File f = getFile(name);
  boolean isError = true;
  IOException creationException = null;
  String annotationMsg = null;
  try {
    isError = f.createNewFile() ? false : true;
    isError = isError ? true : (!f.exists());
    if (isError) {
      annotationMsg = NbBundle.getMessage(LocalFileSystem.class, "EXC_DataAlreadyExist", f.getName(), getDisplayName(), f.getAbsolutePath());
      creationException = new SyncFailedException(annotationMsg);
    }
  } catch (IOException iex) {
    isError = true;
    creationException = iex;
    annotationMsg = iex.getLocalizedMessage();
  }
  if (isError) {
  LOG.log(Level.INFO, "Trying to create new file {0}.", f.getPath());
    ExternalUtil.annotate(creationException, annotationMsg);
    throw creationException;
  }
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-svnkit

private void writeDumpData(OutputStream out, byte[] bytes) throws SVNException {
  try {
    out.write(bytes); 
  } catch (IOException ioe) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());
    SVNErrorManager.error(err, ioe, SVNLogType.FSFS);
  }
}

代码示例来源:origin: ankidroid/Anki-Android

/**
 * Utility method to write to a file.
 * Throws the exception, so we can report it in syncing log
 */
private static void writeToFileImpl(InputStream source, String destination) throws IOException {
  File f = new File(destination);
  try {
    Timber.d("Creating new file... = %s", destination);
    f.createNewFile();
    long startTimeMillis = System.currentTimeMillis();
    long sizeBytes = CompatHelper.getCompat().copyFile(source, destination);
    long endTimeMillis = System.currentTimeMillis();
    Timber.d("Finished writeToFile!");
    long durationSeconds = (endTimeMillis - startTimeMillis) / 1000;
    long sizeKb = sizeBytes / 1024;
    long speedKbSec = 0;
    if (endTimeMillis != startTimeMillis) {
      speedKbSec = sizeKb * 1000 / (endTimeMillis - startTimeMillis);
    }
    Timber.d("Utils.writeToFile: Size: %d Kb, Duration: %d s, Speed: %d Kb/s", sizeKb, durationSeconds, speedKbSec);
  } catch (IOException e) {
    throw new IOException(f.getName() + ": " + e.getLocalizedMessage(), e);
  }
}

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

final File prjFile = new File(base.toString());
if (prjFile.exists()) {
    LOGGER.log(Level.INFO, e.getLocalizedMessage(), e);
  } catch (IOException e) {
    LOGGER.log(Level.INFO, e.getLocalizedMessage(), e);
  } catch (FactoryException e) {
    LOGGER.log(Level.INFO, e.getLocalizedMessage(), e);
  } finally {
    if (projReader != null)
        LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
        LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);

代码示例来源:origin: org.tmatesoft/svn

public static void createFormatFile(File adminDir) throws SVNException {
  OutputStream os = null;
  try {
    os = SVNFileUtil.openFileForWriting(new File(adminDir, "format"));
    os.write(FORMAT_TEXT);            
  } catch (IOException e) {
    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage());
    SVNErrorManager.error(err, e);
  } finally {
    SVNFileUtil.closeFile(os);
  }
}

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

@Override
public AbstractGridCoverage2DReader getReader(Object source, Hints hints) {
  try {
    return new MBTilesReader(source, hints);
  } catch (IOException e) {
    LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e);
    return null;
  }
}

相关文章