当前位置: 首页>>代码示例>>Java>>正文


Java IOException.getLocalizedMessage方法代码示例

本文整理汇总了Java中java.io.IOException.getLocalizedMessage方法的典型用法代码示例。如果您正苦于以下问题:Java IOException.getLocalizedMessage方法的具体用法?Java IOException.getLocalizedMessage怎么用?Java IOException.getLocalizedMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.IOException的用法示例。


在下文中一共展示了IOException.getLocalizedMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAsText

import java.io.IOException; //导入方法依赖的package包/类
/** Overrides superclass method.
 * @exception IllegalArgumentException if <code>null</code> value
 * is passes in or some io problem by converting occured */
public void setAsText(String text) throws IllegalArgumentException {
    try {
        if(text == null) {
            throw new IllegalArgumentException("Inserted value can't be null."); // NOI18N
        }
        Properties prop = new Properties();
        InputStream is = new ByteArrayInputStream(
            text.replace(';', '\n').getBytes("ISO8859_1") // NOI18N
        );
        prop.load(is);
        setValue(prop);
    } catch(IOException ioe) {
        IllegalArgumentException iae = new IllegalArgumentException (ioe.getMessage());
        String msg = ioe.getLocalizedMessage();
        if (msg == null) {
            msg = MessageFormat.format(
            NbBundle.getMessage(
                PropertiesEditor.class, "FMT_EXC_GENERIC_BAD_VALUE"), new Object[] {text}); //NOI18N
        }
        UIExceptions.annotateUser(iae, iae.getMessage(), msg, ioe, new Date());
        throw iae;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:PropertiesEditor.java

示例2: perform

import java.io.IOException; //导入方法依赖的package包/类
/**
 * It shows a dialog and let user selct his options. Then it performs them.
 */
public final void perform() {
    try {
        init(); // throws IOException
        showDialog(); // throws IOException
    } catch (IOException exc) {
        //if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug(exc);
        
        NotifyDescriptor nd = new NotifyDescriptor.Message(exc.getLocalizedMessage(), NotifyDescriptor.WARNING_MESSAGE);
        DialogDisplayer.getDefault().notify(nd);
        
        if (isLastInBatch()) {
            active = false;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:TransformPerformer.java

示例3: readProtectedPropertiesFromDisk

import java.io.IOException; //导入方法依赖的package包/类
/**
 * Returns a {@link ProtectedNiFiRegistryProperties} instance loaded from the
 * serialized form in the file. Responsible for actually reading from disk
 * and deserializing the properties. Returns a protected instance to allow
 * for decryption operations.
 *
 * @param file the file containing serialized properties
 * @return the ProtectedNiFiProperties instance
 */
ProtectedNiFiRegistryProperties readProtectedPropertiesFromDisk(File file) {
    if (file == null || !file.exists() || !file.canRead()) {
        String path = (file == null ? "missing file" : file.getAbsolutePath());
        logger.error("Cannot read from '{}' -- file is missing or not readable", path);
        throw new IllegalArgumentException("NiFi Registry properties file missing or unreadable");
    }

    final NiFiRegistryProperties rawProperties = new NiFiRegistryProperties();
    try (final FileReader reader = new FileReader(file)) {
        rawProperties.load(reader);
        logger.info("Loaded {} properties from {}", rawProperties.size(), file.getAbsolutePath());
        ProtectedNiFiRegistryProperties protectedNiFiRegistryProperties = new ProtectedNiFiRegistryProperties(rawProperties);
        return protectedNiFiRegistryProperties;
    } catch (final IOException ioe) {
        logger.error("Cannot load properties file due to " + ioe.getLocalizedMessage());
        throw new RuntimeException("Cannot load properties file due to " + ioe.getLocalizedMessage(), ioe);
    }
}
 
开发者ID:apache,项目名称:nifi-registry,代码行数:28,代码来源:NiFiRegistryPropertiesLoader.java

示例4: setGameEnableXP

import java.io.IOException; //导入方法依赖的package包/类
public static String setGameEnableXP(String bw, boolean isEnabled) {
	if (isEnabled) {
		enabled.add(bw);
	} else {
		enabled.remove(bw);
	}
	enable.set("enabledGame", ListUtils.hashSetToList(enabled));
	try {
		enable.save(e_file);
	} catch (IOException e) {
		e.printStackTrace();
		return e.getLocalizedMessage();
	}
	return "";
}
 
开发者ID:Ldcr993519867,项目名称:BedwarsXP,代码行数:16,代码来源:Config.java

示例5: getInputStream

import java.io.IOException; //导入方法依赖的package包/类
private InputStream getInputStream() throws FileNotFoundException {
    try {
        return new ReaderInputStream(new StringReader(content.getContent()));
    } catch (IOException ex) {
        throw new FileNotFoundException(ex.getLocalizedMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SourceFS.java

示例6: DominatorTree

import java.io.IOException; //导入方法依赖的package包/类
DominatorTree(HprofHeap h, LongBuffer multiParents) {
    heap = h;
    multipleParents = multiParents;
    currentMultipleParents = multipleParents;
    map = new LongHashMap(multiParents.getSize());
    dirtySet = new LongSet();
    try {
        revertedMultipleParents = multiParents.revertBuffer();
    } catch (IOException ex) {
        throw new IllegalArgumentException(ex.getLocalizedMessage(),ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:DominatorTree.java

示例7: setLogfile

import java.io.IOException; //导入方法依赖的package包/类
public void setLogfile(File lgfl) {
    try {
        logStream = new PrintStream(new FileOutputStream(lgfl));
    } catch (IOException ioe) {
        throw new BuildException(ioe.getLocalizedMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SelectJars.java

示例8: delete

import java.io.IOException; //导入方法依赖的package包/类
@Override
public void delete(final String id) {
    final File file = new File(root + "/" + id);
    try {
        if (!Files.deleteIfExists(file.toPath())) {
            throw new NoSuchFileException("File: " + id + " not found in system!");
        }
    } catch (IOException e) {
        throw new FileNotFoundException(e.getLocalizedMessage());
    }
}
 
开发者ID:akraskovski,项目名称:product-management-system,代码行数:12,代码来源:ImageService.java

示例9: convert

import java.io.IOException; //导入方法依赖的package包/类
public void convert(String sourceName, String destName,
	ProgressListener progressListener, Decoder.Params decoderParams)
	throws JavaLayerException
{
	if (destName.length()==0)
		destName = null;
	try {
		InputStream in = openInput(sourceName);
		convert(in, destName, progressListener, decoderParams);
		in.close();
	} catch(IOException ioe) {
		throw new JavaLayerException(ioe.getLocalizedMessage(), ioe);
	}
}
 
开发者ID:EndlessBot,项目名称:jLib,代码行数:15,代码来源:Converter.java

示例10: compile

import java.io.IOException; //导入方法依赖的package包/类
public static Matcher compile(String query) {
  try {
    CodePointCharStream input = CharStreams.fromReader(new StringReader(query));
    ExprLexer lexer = new ExprLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    ExprParser parser = new ExprParser(tokens);
    ParseTree tree = parser.expr();
    Visitor visitor = new Visitor();
    visitor.visit(tree);
    return visitor.expression().normalize();
  } catch (IOException e) {
    throw new RuntimeException(e.getLocalizedMessage(), e);
  }
}
 
开发者ID:before,项目名称:simple-text-search-library,代码行数:15,代码来源:Pattern.java

示例11: onInit

import java.io.IOException; //导入方法依赖的package包/类
@Override
public void onInit(BaseGame game, Entity entity) {
    super.init(game, entity);

    // load texture atlas
    game.getAssetManager().load(this.textureAtlasPath, TextureAtlas.class);
    game.getAssetManager().finishLoadingAsset(this.textureAtlasPath);
    this.atlas = game.getAssetManager().get(this.textureAtlasPath, TextureAtlas.class);

    Map<String, Integer> map = null;

    try {
        // parse all available animations
        map = AtlasUtils.getAvailableAnimations(this.textureAtlasPath);
    } catch (IOException e) {
        e.printStackTrace();
        throw new RuntimeException("Couldnt parse texture altas: " + this.textureAtlasPath + ", exception: "
                + e.getLocalizedMessage());
    }

    // create all animations in cache
    this.createCachedAnimations(map);

    // little quick & dirty fix
    String animationName = this.currentAnimationName;
    this.currentAnimationName = "";

    // set first animation
    this.setCurrentAnimationName(animationName);

    // update texture region component
    updateTextureRegionComponent();
}
 
开发者ID:opensourcegamedev,项目名称:SpaceChaos,代码行数:34,代码来源:AtlasAnimationComponent.java

示例12: getMessage

import java.io.IOException; //导入方法依赖的package包/类
/**
 * Get a detail message from an IOException.
 * Most, but not all, instances of IOException provide a non-null result
 * for getLocalizedMessage().  But some instances return null: in these
 * cases, fallover to getMessage(), and if even that is null, return the
 * name of the exception itself.
 * @param e an IOException
 * @return a string to include in a compiler diagnostic
 */
public static String getMessage(IOException e) {
    String s = e.getLocalizedMessage();
    if (s != null)
        return s;
    s = e.getMessage();
    if (s != null)
        return s;
    return e.toString();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:JavacFileManager.java

示例13: deliver

import java.io.IOException; //导入方法依赖的package包/类
/**
 *
 * @param ctx
 * @param tx
 * @return
 * @throws ReplicationException
 */
@Override
public ReplicationResult deliver(TransportContext ctx, ReplicationTransaction tx) throws ReplicationException {
  ReplicationLog log = tx.getLog();
  try {
    RestClient restClient = elasticSearchService.getRestClient();
    ReplicationActionType replicationType = tx.getAction().getType();
    if (replicationType == ReplicationActionType.TEST) {
      return doTest(ctx, tx, restClient);
    }
    else {
      log.info(getClass().getSimpleName() + ": ---------------------------------------");
      if (tx.getContent() == ReplicationContent.VOID) {
        LOG.warn("No Replication Content provided");
        return new ReplicationResult(true, 0, "No Replication Content provided for path " + tx.getAction().getPath());
      }
      switch (replicationType) {
        case ACTIVATE:
          return doActivate(ctx, tx, restClient);
        case DEACTIVATE:
          return doDeactivate(ctx, tx, restClient);
        default:
          log.warn(getClass().getSimpleName() + ": Replication action type" + replicationType + " not supported.");
          throw new ReplicationException("Replication action type " + replicationType + " not supported.");
      }
    }
  }
  catch (JSONException jex) {
    LOG.error("JSON was invalid", jex);
    return new ReplicationResult(false, 0, jex.getLocalizedMessage());
  }
  catch (IOException ioe) {
    log.error(getClass().getSimpleName() + ": Could not perform Indexing due to " + ioe.getLocalizedMessage());
    LOG.error("Could not perform Indexing", ioe);
    return new ReplicationResult(false, 0, ioe.getLocalizedMessage());
  }
}
 
开发者ID:deveth0,项目名称:elasticsearch-aem,代码行数:44,代码来源:ElasticSearchTransportHandler.java

示例14: run

import java.io.IOException; //导入方法依赖的package包/类
public boolean run() throws Util.Exit {

        Util util = new Util(log, diagnosticListener);

        if (noArgs || help) {
            showHelp();
            return help; // treat noArgs as an error for purposes of exit code
        }

        if (version || fullVersion) {
            showVersion(fullVersion);
            return true;
        }

        util.verbose = verbose;

        Gen g;

        if (llni)
            g = new LLNI(doubleAlign, util);
        else {
//            if (stubs)
//                throw new BadArgs("jni.no.stubs");
            g = new JNI(util);
        }

        if (ofile != null) {
            if (!(fileManager instanceof StandardJavaFileManager)) {
                diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-o"));
                return false;
            }
            Iterable<? extends JavaFileObject> iter =
                    ((StandardJavaFileManager) fileManager).getJavaFileObjectsFromFiles(Collections.singleton(ofile));
            JavaFileObject fo = iter.iterator().next();
            g.setOutFile(fo);
        } else {
            if (odir != null) {
                if (!(fileManager instanceof StandardJavaFileManager)) {
                    diagnosticListener.report(createDiagnostic("err.cant.use.option.for.fm", "-d"));
                    return false;
                }

                if (!odir.exists())
                    if (!odir.mkdirs())
                        util.error("cant.create.dir", odir.toString());
                try {
                    ((StandardJavaFileManager) fileManager).setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(odir));
                } catch (IOException e) {
                    Object msg = e.getLocalizedMessage();
                    if (msg == null) {
                        msg = e;
                    }
                    diagnosticListener.report(createDiagnostic("err.ioerror", odir, msg));
                    return false;
                }
            }
            g.setFileManager(fileManager);
        }

        /*
         * Force set to false will turn off smarts about checking file
         * content before writing.
         */
        g.setForce(force);

        if (fileManager instanceof JavahFileManager)
            ((JavahFileManager) fileManager).setSymbolFileEnabled(false);

        JavaCompiler c = ToolProvider.getSystemJavaCompiler();
        List<String> opts = new ArrayList<String>();
        opts.add("-proc:only");
        opts.addAll(javac_extras);
        CompilationTask t = c.getTask(log, fileManager, diagnosticListener, opts, classes, null);
        JavahProcessor p = new JavahProcessor(g);
        t.setProcessors(Collections.singleton(p));

        boolean ok = t.call();
        if (p.exit != null)
            throw new Util.Exit(p.exit);
        return ok;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:82,代码来源:JavahTask.java

示例15: run

import java.io.IOException; //导入方法依赖的package包/类
@Override
public void run() {
    if (EventQueue.isDispatchThread()) {
        if (cancelled) {
            return;
        }
        
        FileObject fob = source.matchingObj.getFileObject(); 
        String mimeType = fob.getMIMEType();
        //We don't want the swing html editor kit, and even if we 
        //do get it, it will frequently throw a random NPE 
        //in StyleSheet.removeHTMLTags that appears to be a swing bug
        if ("text/html".equals(mimeType)) {                         //NOI18N
            mimeType = "text/plain";                                //NOI18N
        }
        textDisplayer.setText(text,
                              mimeType,
                              getLocation());
        done = true;
    }  else {
        
        /* called from the request processor's thread */
        
        if (Thread.interrupted()) {
            return;
        }
        
        String invalidityDescription
                = source.matchingObj.getInvalidityDescription();
        if (invalidityDescription != null) {
            text = invalidityDescription;
        } else {
            try {
                text = source.matchingObj.getText();
            } catch (ClosedByInterruptException cbie) {
                cancelled = true;
                return;
            } catch (IOException ioe) {
                text = ioe.getLocalizedMessage();
                
//                cancel();
            }
        }
        
        if (Thread.interrupted()) {
            return;
        }
        
        EventQueue.invokeLater(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:TextFetcher.java


注:本文中的java.io.IOException.getLocalizedMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。