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


Java AuditEvent.getFileName方法代码示例

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


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

示例1: format

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public String format(AuditEvent event) {
    final String fileName = event.getFileName();
    final String message = event.getMessage();

    // avoid StringBuffer.expandCapacity
    final int bufLen = event.getFileName().length() + event.getMessage().length()
        + LENGTH_OF_ALL_SEPARATORS;
    final StringBuilder sb = new StringBuilder(bufLen);

    sb.append(fileName).append(':').append(event.getLine());
    if (event.getColumn() > 0) {
        sb.append(':').append(event.getColumn());
    }
    sb.append(": ").append(message);

    return sb.toString();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:AuditEventUtFormatter.java

示例2: addError

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
/** @see com.puppycrawl.tools.checkstyle.api.AuditListener */
public void addError(AuditEvent aEvt)
{
    final SeverityLevel severityLevel = aEvt.getSeverityLevel();
    if (mInitialized && !SeverityLevel.IGNORE.equals(severityLevel)) {
        final Log log = mLogFactory.getInstance(aEvt.getSourceName());

        final String fileName = aEvt.getFileName();
        final String message = aEvt.getMessage();

        // avoid StringBuffer.expandCapacity
        final int bufLen = message.length() + BUFFER_CUSHION;
        final StringBuffer sb = new StringBuffer(bufLen);

        sb.append("Line: ").append(aEvt.getLine());
        if (aEvt.getColumn() > 0) {
            sb.append(" Column: ").append(aEvt.getColumn());
        }
        sb.append(" Message: ").append(message);

        if (aEvt.getSeverityLevel().equals(SeverityLevel.WARNING)) {
            log.warn(sb.toString());
        }
        else if (aEvt.getSeverityLevel().equals(SeverityLevel.INFO)) {
            log.info(sb.toString());
        }
        else {
            log.error(sb.toString());
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:CommonsLoggingListener.java

示例3: addError

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public void addError(AuditEvent evt) {
    switch (evt.getSeverityLevel()) {
        case ERROR:
            String fileName = evt.getFileName();
            if (!isNullOrEmpty(baseDir)) {
                int index = fileName.indexOf(baseDir);
                if (index >= 0) {
                    fileName = fileName.substring(index + baseDir.length() + 1);
                    if (!isNullOrEmpty(project)) {
                        output.append(project).append(':');
                    }
                }
            }
            output.append(fileName).append(':').append(evt.getLine());
            if (evt.getColumn() > 0) {
                output.append(':').append(evt.getColumn());
            }
            output.append(": ").append(evt.getMessage());
            output.append('\n');
            break;
        case IGNORE:
        case INFO:
        case WARNING:
        default:
            break;
    }
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:CheckstyleRunner.java

示例4: initResource

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
private void initResource(AuditEvent event) {
    if (currentResource == null) {
        final String absoluteFilename = event.getFileName();
        currentResource = fileSystem.inputFile(fileSystem.predicates().hasAbsolutePath(
                absoluteFilename));
    }
}
 
开发者ID:checkstyle,项目名称:sonar-checkstyle,代码行数:8,代码来源:CheckstyleAuditListener.java

示例5: fileFinished

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public void fileFinished(AuditEvent event) {
    final String fileName = event.getFileName();
    final FileMessages messages = fileMessages.get(fileName);

    synchronized (writerLock) {
        writeFileMessages(fileName, messages);
    }

    fileMessages.remove(fileName);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:XMLLogger.java

示例6: addError

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public void addError(AuditEvent event) {
    if (event.getSeverityLevel() != SeverityLevel.IGNORE) {
        final String fileName = event.getFileName();
        if (fileName == null || !fileMessages.containsKey(fileName)) {
            synchronized (writerLock) {
                writeFileError(event);
            }
        }
        else {
            final FileMessages messages = fileMessages.get(fileName);
            messages.addError(event);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:16,代码来源:XMLLogger.java

示例7: addException

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public void addException(AuditEvent event, Throwable throwable) {
    final String fileName = event.getFileName();
    if (fileName == null || !fileMessages.containsKey(fileName)) {
        synchronized (writerLock) {
            writeException(throwable);
        }
    }
    else {
        final FileMessages messages = fileMessages.get(fileName);
        messages.addException(throwable);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:XMLLogger.java

示例8: format

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public String format(AuditEvent event) {
    final String fileName = event.getFileName();
    final String message = event.getMessage();

    final SeverityLevel severityLevel = event.getSeverityLevel();
    final String severityLevelName;
    if (severityLevel == SeverityLevel.WARNING) {
        // We change the name of severity level intentionally
        // to shorten the length of the log message.
        severityLevelName = "WARN";
    }
    else {
        severityLevelName = severityLevel.getName().toUpperCase(Locale.US);
    }

    // Avoid StringBuffer.expandCapacity
    final int bufLen = calculateBufferLength(event, severityLevelName.length());
    final StringBuilder sb = new StringBuilder(bufLen);

    sb.append('[').append(severityLevelName).append("] ")
        .append(fileName).append(':').append(event.getLine());
    if (event.getColumn() > 0) {
        sb.append(':').append(event.getColumn());
    }
    sb.append(": ").append(message).append(" [");
    if (event.getModuleId() == null) {
        final String checkShortName = getCheckShortName(event);
        sb.append(checkShortName);
    }
    else {
        sb.append(event.getModuleId());
    }
    sb.append(']');

    return sb.toString();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:38,代码来源:AuditEventDefaultFormatter.java

示例9: addException

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
@Override
public void addException(AuditEvent event, Throwable throwable) {
    synchronized (errorWriter) {
        final LocalizedMessage addExceptionMessage = new LocalizedMessage(0,
            Definitions.CHECKSTYLE_BUNDLE, ADD_EXCEPTION_MESSAGE,
            new String[] {event.getFileName()}, null,
            LocalizedMessage.class, null);
        errorWriter.println(addExceptionMessage.getMessage());
        throwable.printStackTrace(errorWriter);
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:DefaultLogger.java

示例10: isFileNameAndModuleNotMatching

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
/**
 * Is matching by file name and Check name.
 * @param event event
 * @return true is matching
 */
private boolean isFileNameAndModuleNotMatching(AuditEvent event) {
    return event.getFileName() == null
            || fileRegexp != null && !fileRegexp.matcher(event.getFileName()).find()
            || event.getLocalizedMessage() == null
            || moduleId != null && !moduleId.equals(event.getModuleId())
            || checkRegexp != null && !checkRegexp.matcher(event.getSourceName()).find();
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:SuppressElement.java

示例11: accept

import com.puppycrawl.tools.checkstyle.api.AuditEvent; //导入方法依赖的package包/类
public boolean accept(AuditEvent aEvent)
{
    final String fileName = aEvent.getFileName();
    return ((fileName == null) || !mFileRegexp.match(fileName));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:6,代码来源:FilesFilter.java


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