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


Java Log.error方法代码示例

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


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

示例1: tryConnect

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private Socket tryConnect() throws IOException, InterruptedException {
    makeSureServerIsRunning(portFile);
    int attempt = 0;
    while (true) {
        Log.debug("Trying to connect. Attempt " + (++attempt) + " of " + MAX_CONNECT_ATTEMPTS);
        try {
            return makeConnectionAttempt();
        } catch (IOException ex) {
            Log.error("Connection attempt failed: " + ex.getMessage());
            if (attempt >= MAX_CONNECT_ATTEMPTS) {
                Log.error("Giving up");
                throw new IOException("Could not connect to server", ex);
            }
        }
        Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SjavacClient.java

示例2: shutdown

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
@Override
public void shutdown() {
    Log.debug("Shutting down PooledSjavac");
    pool.shutdown(); // Disable new tasks from being submitted
    try {
        // Wait a while for existing tasks to terminate
        if (!pool.awaitTermination(60, TimeUnit.SECONDS)) {
            pool.shutdownNow(); // Cancel currently executing tasks
            // Wait a while for tasks to respond to being cancelled
            if (!pool.awaitTermination(60, TimeUnit.SECONDS))
                Log.error("ThreadPool did not terminate");
        }
    } catch (InterruptedException ie) {
      // (Re-)Cancel if current thread also interrupted
      pool.shutdownNow();
      // Preserve interrupt status
      Thread.currentThread().interrupt();
    }

    delegate.shutdown();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:PooledSjavac.java

示例3: validateOptions

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private static boolean validateOptions(Options options) {

        String err = null;

        if (options.getDestDir() == null) {
            err = "Please specify output directory.";
        } else if (options.isJavaFilesAmongJavacArgs()) {
            err = "Sjavac does not handle explicit compilation of single .java files.";
        } else if (!options.getImplicitPolicy().equals("none")) {
            err = "The only allowed setting for sjavac is -implicit:none";
        } else if (options.getSources().isEmpty() && options.getStateDir() != null) {
            err = "You have to specify -src when using --state-dir.";
        } else if (options.getTranslationRules().size() > 1
                && options.getGenSrcDir() == null) {
            err = "You have translators but no gensrc dir (-s) specified!";
        }

        if (err != null)
            Log.error(err);

        return err == null;

    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:SjavacImpl.java

示例4: createIfMissing

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private static boolean createIfMissing(Path dir) {

        if (Files.isDirectory(dir))
            return true;

        if (Files.exists(dir)) {
            Log.error(dir + " is not a directory.");
            return false;
        }

        try {
            Files.createDirectories(dir);
        } catch (IOException e) {
            Log.error("Could not create directory: " + e.getMessage());
            return false;
        }

        return true;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:SjavacImpl.java

示例5: run

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
public static int run(String[] args, Writer out, Writer err) {

        Log.setLogForCurrentThread(new Log(out, err));

        Options options;
        try {
            options = Options.parseArgs(args);
        } catch (IllegalArgumentException e) {
            Log.error(e.getMessage());
            return Result.CMDERR.exitCode;
        }

        Log.setLogLevel(options.getLogLevel());

        Log.debug("==========================================================");
        Log.debug("Launching sjavac client with the following parameters:");
        Log.debug("    " + options.getStateArgsString());
        Log.debug("==========================================================");

        // Prepare sjavac object
        boolean useServer = options.getServerConf() != null;
        Sjavac sjavac = useServer ? new SjavacClient(options) : new SjavacImpl();

        // Perform compilation
        Result result = sjavac.compile(args);

        // If sjavac is running in the foreground we should shut it down at this point
        if (!useServer) {
            sjavac.shutdown();
        }

        return result.exitCode;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ClientMain.java

示例6: checkInternalErrorLog

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private void checkInternalErrorLog() {
    Path errorLog = ServerMain.getErrorLog().getLogDestination();
    if (errorLog != null) {
        Log.error("Server has encountered an internal error. See " + errorLog.toAbsolutePath()
                + " for details.");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:RequestHandler.java

示例7: srcDstOverlap

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
private static boolean srcDstOverlap(List<SourceLocation> locs, Path dest) {
    for (SourceLocation loc : locs) {
        if (isOverlapping(loc.getPath(), dest)) {
            Log.error("Source location " + loc.getPath() + " overlaps with destination " + dest);
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:SjavacImpl.java

示例8: run

import com.sun.tools.sjavac.Log; //导入方法依赖的package包/类
@Override
public void run() {

    try (BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         PrintWriter out = new PrintWriter(socket.getOutputStream(), true)) {

        // Set up logging for this thread. Stream back logging messages to
        // client on the format format "level:msg".
        Log.setLogForCurrentThread(new Log(out, out) {
            @Override
            protected boolean isLevelLogged(Level l) {
                // Make sure it is up to the client to decide whether or
                // not this message should be displayed.
                return true;
            }

            @Override
            protected void printLogMsg(Level msgLevel, String msg) {
                // Follow sjavac server/client protocol: Send one line
                // at a time and prefix with message with "level:".
                Util.getLines(msg)
                    .map(line -> msgLevel + ":" + line)
                    .forEach(line -> super.printLogMsg(msgLevel, line));
            }
        });

        // Read argument array
        int n = Integer.parseInt(in.readLine());
        String[] args = new String[n];
        for (int i = 0; i < n; i++) {
            args[i] = in.readLine();
        }

        // If there has been any internal errors, notify client
        checkInternalErrorLog();

        // Perform compilation
        Main.Result rc = sjavac.compile(args);

        // Send return code back to client
        out.println(LINE_TYPE_RC + ":" + rc.name());

        // Check for internal errors again.
        checkInternalErrorLog();
    } catch (Exception ex) {
        // Not much to be done at this point. The client side request
        // code will most likely throw an IOException and the
        // compilation will fail.
        Log.error(ex);
    } finally {
        Log.setLogForCurrentThread(null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:RequestHandler.java


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