Java 类java.rmi.server.LogStream 实例源码

项目:OpenJSharp    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:jdk8u-jdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:openjdk-jdk10    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override {@literal <} 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:openjdk9    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override {@literal <} 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:jdk8u_jdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:lookaside_java-1.8.0-openjdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:infobip-open-jdk-8    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:jdk8u-dev-jdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:jdk7-jdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:openjdk-source-code-learn    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:OLD-OpenJDK8    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:openjdk-jdk7u-jdk    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:freeVM    文件:TestLogStream.java   
public final void testGetDefaultStream001() {
    byte[] ba = { 11, 25, 64, 78, 30, 15, 65, 12, 34, 79, 66, 50, 01, 00,
            16 };
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    try {
        bas.write(ba);
        PrintStream ps1 = new PrintStream(bas);
        ls = LogStream.log("tcp");
        ls.setDefaultStream(ps1);
        PrintStream ps2 = ls.getDefaultStream();
        ps2.flush();
        assertEquals(ps1, ps2);
    } catch (Throwable e) {
        fail("Failed with:" + e);
    }
}
项目:freeVM    文件:TestLogStream.java   
public final void testGetDefaultStream003() {
    byte[] ba = { 11, 25, 64, 78, 30, 15, 65, 12, 34, 79, 66, 50, 01, 00,
            16 };
    ByteArrayOutputStream bas = new ByteArrayOutputStream();
    try {
        PrintStream ps1 = new PrintStream(bas);
        ls = LogStream.log("tcp");

        PrintStream ps2 = ls.getDefaultStream();
        ps2.flush();
        int i = 1;
        assertNotNull(ps2);

    } catch (Throwable e) {
        fail("Failed with:" + e);
    }
}
项目:openjdk-icedtea7    文件:Log.java   
/**
 * Access log for a tri-state system property.
 *
 * Need to first convert override value to a log level, taking
 * care to interpret a range of values between BRIEF, VERBOSE and
 * SILENT.
 *
 * An override < 0 is interpreted to mean that the logging
 * configuration should not be overridden. The level passed to the
 * factories createLog method will be null in this case.
 *
 * Note that if oldLogName is null and old logging is on, the
 * returned LogStreamLog will ignore the override parameter - the
 * log will never log messages.  This permits new logs that only
 * write to Loggers to do nothing when old logging is active.
 *
 * Do not call getLog multiple times on the same logger name.
 * Since this is an internal API, no checks are made to ensure
 * that multiple logs do not exist for the same logger.
 */
public static Log getLog(String loggerName, String oldLogName,
                         int override)
{
    Level level;

    if (override < 0) {
        level = null;
    } else if (override == LogStream.SILENT) {
        level = Level.OFF;
    } else if ((override > LogStream.SILENT) &&
               (override <= LogStream.BRIEF)) {
        level = BRIEF;
    } else if ((override > LogStream.BRIEF) &&
               (override <= LogStream.VERBOSE))
    {
        level = VERBOSE;
    } else {
        level = Level.FINEST;
    }
    return logFactory.createLog(loggerName, oldLogName, level);
}
项目:OpenJSharp    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:OpenJSharp    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:jdk8u-jdk    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:jdk8u-jdk    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:openjdk-jdk10    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:openjdk-jdk10    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:openjdk9    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:openjdk9    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:jdk8u_jdk    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:jdk8u_jdk    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:lookaside_java-1.8.0-openjdk    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:lookaside_java-1.8.0-openjdk    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:infobip-open-jdk-8    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:infobip-open-jdk-8    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:jdk8u-dev-jdk    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:jdk8u-dev-jdk    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:jdk7-jdk    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:jdk7-jdk    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, dont log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:openjdk-source-code-learn    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:openjdk-source-code-learn    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, dont log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:OLD-OpenJDK8    文件:Log.java   
public Log createLog(String loggerName, String oldLogName,
                     Level level)
{
    LogStream stream = null;
    if (oldLogName != null) {
        stream = LogStream.log(oldLogName);
    }
    return new LogStreamLog(stream, level);
}
项目:OLD-OpenJDK8    文件:Log.java   
private LogStreamLog(LogStream stream, Level level) {
    if ((stream != null) && (level != null)) {
        /* if the stream or level is null, don't log any
         * messages
         */
        levelValue = level.intValue();
    }
    this.stream = stream;
}
项目:cn1    文件:LogStreamTest.java   
/**
 * Test for java.rmi.server.LogStream.write(int b)
 */
public void testWriteI() throws Exception {
    //regression test for HARMONY-1271
    LogStream.log("tst").write((int)'\n');

    //regression test for HARMONY-994
    LogStream.log("tst").write(0);
}
项目:cn1    文件:LogStreamTest.java   
public void testSetOutputStreamBad() throws Exception {
    // Regression test HARMONY-1198
    try {
        LogStream ls = LogStream.log("proba");
        ls.setOutputStream(null);
        fail("Expected NPE");
    } catch (NullPointerException e) {
        // expected
    }
}
项目:cn1    文件:LogStreamTest.java   
/**
 * Test for java.rmi.server.LogStream.write(byte[], int, int)
 * testing invalid offsets/lengths. 
 */
public void testWriteArrInvalidOffLen() throws Exception {
    // Regression test for HARMONY-1691
    // list of invalid offsets/lengths pairs
    int[][] invalidPairs = new int[][] {
        { -2, 1 },
        { 0, -6 },
        { 6, 1 },
        { 0, 6 } };

    // store original default stream for LogStream
    PrintStream prevOut = LogStream.getDefaultStream();

    try {
        // set empty default stream to not print garbage to System.out/err
        LogStream.setDefaultStream(
                new PrintStream(new ByteArrayOutputStream()));
        LogStream ls = LogStream.log("test");

        for (int i = 0; i < invalidPairs.length; ++i) {
            try {
                ls.write(new byte[] { 1, 1 },
                        invalidPairs[i][0], invalidPairs[i][1]);
                fail("IndexOutOfBoundsException "
                        + "is not thrown when off = " + invalidPairs[i][0]
                        + ", len = " + invalidPairs[i][1]);
            } catch (IndexOutOfBoundsException e) {
                //expected
            }
        }
    } finally {
        // restore original stream
        LogStream.setDefaultStream(prevOut);
    }
}