Example usage for com.liferay.portal.kernel.util StringPool NEW_LINE

List of usage examples for com.liferay.portal.kernel.util StringPool NEW_LINE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool NEW_LINE.

Prototype

String NEW_LINE

To view the source code for com.liferay.portal.kernel.util StringPool NEW_LINE.

Click Source Link

Usage

From source file:com.liferay.portlet.usersadmin.atom.UserAtomCollectionAdapter.java

License:Open Source License

public AtomEntryContent getEntryContent(User user, AtomRequestContext atomRequestContext) {

    StringBundler content = new StringBundler();

    content.append(user.getScreenName());
    content.append(StringPool.NEW_LINE);
    content.append(user.getEmailAddress());
    content.append(StringPool.NEW_LINE);
    content.append(user.getFullName());/*from   w w w . ja  v a  2s  . c o  m*/
    content.append(StringPool.NEW_LINE);
    content.append(user.getJobTitle());
    content.append(StringPool.NEW_LINE);

    try {
        List<Address> userAddresses = user.getAddresses();

        for (Address address : userAddresses) {
            content.append(address.getStreet1());
            content.append(StringPool.NEW_LINE);
            content.append(address.getStreet2());
            content.append(StringPool.NEW_LINE);
            content.append(address.getStreet3());
            content.append(StringPool.NEW_LINE);
        }
    } catch (Exception e) {
    }

    return new AtomEntryContent(content.toString());
}

From source file:com.liferay.portlet.wiki.translators.BaseTranslator.java

License:Open Source License

private String _normalizeLineBreaks(String content) {
    content = StringUtil.replace(content, new String[] { StringPool.RETURN_NEW_LINE, StringPool.RETURN },
            new String[] { StringPool.NEW_LINE, StringPool.NEW_LINE });

    return content;
}

From source file:com.liferay.rtl.tools.RtlCssBuilder.java

License:Open Source License

/**
 * @see com.liferay.portal.util.FileImpl#read(File file)
 *///  w ww  .  ja  va  2 s .co m
private String _readFile(File file) throws IOException {
    if ((file == null) || !file.exists()) {
        return null;
    }

    RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");

    byte[] bytes = new byte[(int) randomAccessFile.length()];

    randomAccessFile.readFully(bytes);

    randomAccessFile.close();

    if (bytes == null) {
        return null;
    }

    String s = new String(bytes, StringPool.UTF8);

    return StringUtil.replace(s, StringPool.RETURN_NEW_LINE, StringPool.NEW_LINE);
}

From source file:com.liferay.socialcoding.model.impl.SVNRevisionImpl.java

License:Open Source License

public Object[] getJIRAIssueAndComments() {
    JIRAIssue jiraIssue = null;/*w w w . j a va2 s  .c  o m*/
    String comments = getComments();

    if (

    // LEP

    comments.startsWith(_LEP_PREFIX_1) || comments.startsWith(_LEP_PREFIX_2)
            || comments.startsWith(_LEP_PREFIX_3) ||

            // LPE

            comments.startsWith(_LPE_PREFIX_1) || comments.startsWith(_LPE_PREFIX_2)
            || comments.startsWith(_LPE_PREFIX_3) ||

            // LPS

            comments.startsWith(_LPS_PREFIX_1) || comments.startsWith(_LPS_PREFIX_2)
            || comments.startsWith(_LPS_PREFIX_3)) {

        comments = StringUtil.replace(comments, StringPool.NEW_LINE, StringPool.SPACE);

        int pos = comments.indexOf(StringPool.SPACE);

        if (pos == -1) {
            pos = comments.length();
        }

        String keyPrefix = null;
        String keyId = null;

        // LPE

        if (comments.startsWith(_LEP_PREFIX_1)) {
            keyPrefix = "LEP";
            keyId = comments.substring(_LEP_PREFIX_1.length(), pos);
        } else if (comments.startsWith(_LEP_PREFIX_2)) {
            keyPrefix = "LEP";
            keyId = comments.substring(_LEP_PREFIX_2.length(), pos);
        } else if (comments.startsWith(_LEP_PREFIX_3)) {
            keyPrefix = "LEP";
            keyId = comments.substring(_LEP_PREFIX_3.length(), pos);
        }

        // LPE

        if (comments.startsWith(_LPE_PREFIX_1)) {
            keyPrefix = "LPE";
            keyId = comments.substring(_LPE_PREFIX_1.length(), pos);
        } else if (comments.startsWith(_LPE_PREFIX_2)) {
            keyPrefix = "LPE";
            keyId = comments.substring(_LPE_PREFIX_2.length(), pos);
        } else if (comments.startsWith(_LPE_PREFIX_3)) {
            keyPrefix = "LPE";
            keyId = comments.substring(_LPE_PREFIX_3.length(), pos);
        }

        // LPS

        if (comments.startsWith(_LPS_PREFIX_1)) {
            keyPrefix = "LPS";
            keyId = comments.substring(_LPS_PREFIX_1.length(), pos);
        } else if (comments.startsWith(_LPS_PREFIX_2)) {
            keyPrefix = "LPS";
            keyId = comments.substring(_LPS_PREFIX_2.length(), pos);
        } else if (comments.startsWith(_LPS_PREFIX_3)) {
            keyPrefix = "LPS";
            keyId = comments.substring(_LPS_PREFIX_3.length(), pos);
        }

        comments = comments.substring(pos).trim();

        if (Validator.isNumber(keyId)) {
            try {
                jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(keyPrefix + StringPool.DASH + keyId);
            } catch (Exception e) {
            }
        }

        if (jiraIssue != null) {
            return new Object[] { jiraIssue, comments };
        }
    }

    return null;
}

From source file:com.liferay.testoauth.oauth.LiferayOAuthJSONWSClient.java

License:Open Source License

protected String formatJSON(String json) {
    StringBundler sb = new StringBundler();

    for (String token : json.split(StringPool.COMMA)) {
        if (token.startsWith(StringPool.OPEN_CURLY_BRACE)) {
            sb.append(StringPool.OPEN_CURLY_BRACE);
            sb.append(StringPool.NEW_LINE);

            token = token.substring(1);//  ww  w.j a  v  a 2s .  c o  m
        }

        sb.append(StringPool.DOUBLE_SPACE);

        if (token.endsWith(StringPool.CLOSE_CURLY_BRACE)) {
            sb.append(token.substring(0, token.length() - 1));
            sb.append(StringPool.NEW_LINE);
            sb.append(StringPool.CLOSE_CURLY_BRACE);
        } else {
            sb.append(token);
            sb.append(StringPool.COMMA);
            sb.append(StringPool.NEW_LINE);
        }
    }

    return sb.toString();
}

From source file:com.liferay.tools.sourceformatter.BaseSourceProcessorTestCase.java

License:Open Source License

protected void test(String fileName, String[] expectedErrorMessages, Integer[] lineNumbers) throws Exception {

    String fullFileName = _DIR_NAME + StringPool.SLASH + fileName;

    Tuple tuple = sourceFormatter.format(fullFileName);

    if (tuple == null) {
        return;//from   w  ww .j  a v  a2 s.  c o  m
    }

    List<String> errorMessages = (List<String>) tuple.getObject(1);

    if (!errorMessages.isEmpty() || (expectedErrorMessages.length > 0)) {
        Assert.assertEquals(expectedErrorMessages.length, errorMessages.size());

        for (int i = 0; i < errorMessages.size(); i++) {
            String actualErrorMessage = errorMessages.get(i);
            String expectedErrorMessage = expectedErrorMessages[i];

            StringBundler sb = new StringBundler(5);

            sb.append(expectedErrorMessage);
            sb.append(StringPool.SPACE);
            sb.append(fullFileName);

            if (lineNumbers != null) {
                sb.append(StringPool.SPACE);
                sb.append(lineNumbers[i]);
            }

            Assert.assertEquals(sb.toString(), actualErrorMessage);
        }
    } else {
        String actualFormattedContent = (String) tuple.getObject(0);

        try {
            File file = new File(_DIR_NAME + "/expected/" + fileName);

            String expectedFormattedContent = FileUtils.readFileToString(file, StringPool.UTF8);

            expectedFormattedContent = StringUtil.replace(expectedFormattedContent, StringPool.RETURN_NEW_LINE,
                    StringPool.NEW_LINE);

            Assert.assertEquals(expectedFormattedContent, actualFormattedContent);
        } catch (FileNotFoundException fnfe) {
            Assert.fail();
        }
    }
}

From source file:com.liferay.tools.sourceformatter.JavaClass.java

License:Open Source License

protected Tuple getJavaTermTuple(String line, String content, int index) {
    int posStartNextLine = index;

    while (!line.endsWith(StringPool.OPEN_CURLY_BRACE) && !line.endsWith(StringPool.SEMICOLON)) {

        posStartNextLine = content.indexOf(StringPool.NEW_LINE, posStartNextLine) + 1;

        int posEndNextline = content.indexOf(StringPool.NEW_LINE, posStartNextLine);

        String nextLine = content.substring(posStartNextLine, posEndNextline);

        nextLine = StringUtil.trimLeading(nextLine);

        if (line.endsWith(StringPool.OPEN_PARENTHESIS)) {
            line += nextLine;// ww  w  . j a  va 2 s .c o  m
        } else {
            line += StringPool.SPACE + nextLine;
        }
    }

    line = StringUtil.replace(line, " synchronized ", StringPool.SPACE);

    int pos = line.indexOf(StringPool.OPEN_PARENTHESIS);

    if (line.startsWith(_indent + "public static ")) {
        if (line.contains(" class ") || line.contains(" enum ")) {
            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PUBLIC_STATIC);
        }

        if (line.contains(StringPool.EQUAL) || (line.endsWith(StringPool.SEMICOLON) && (pos == -1))) {

            return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PUBLIC_STATIC);
        }

        if (pos != -1) {
            return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PUBLIC_STATIC);
        }
    } else if (line.startsWith(_indent + "public ")) {
        if (line.contains(" @interface ") || line.contains(" class ") || line.contains(" enum ")
                || line.contains(" interface ")) {

            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PUBLIC);
        }

        if (line.contains(StringPool.EQUAL) || (line.endsWith(StringPool.SEMICOLON) && (pos == -1))) {

            return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PUBLIC);
        }

        if (pos != -1) {
            int spaceCount = StringUtil.count(line.substring(0, pos), StringPool.SPACE);

            if (spaceCount == 1) {
                return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_CONSTRUCTOR_PUBLIC);
            }

            if (spaceCount > 1) {
                return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PUBLIC);
            }
        }
    } else if (line.startsWith(_indent + "protected static ")) {
        if (line.contains(" class ") || line.contains(" enum ")) {
            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PROTECTED_STATIC);
        }

        if (line.contains(StringPool.EQUAL) || (line.endsWith(StringPool.SEMICOLON) && (pos == -1))) {

            return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PROTECTED_STATIC);
        }

        if (pos != -1) {
            return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PROTECTED_STATIC);
        }
    } else if (line.startsWith(_indent + "protected ")) {
        if (line.contains(" @interface ") || line.contains(" class ") || line.contains(" enum ")
                || line.contains(" interface ")) {

            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PROTECTED);
        }

        if (pos != -1) {
            if (!line.contains(StringPool.EQUAL)) {
                int spaceCount = StringUtil.count(line.substring(0, pos), StringPool.SPACE);

                if (spaceCount == 1) {
                    return new Tuple(getConstructorOrMethodName(line, pos),
                            JavaTerm.TYPE_CONSTRUCTOR_PROTECTED);
                }

                if (spaceCount > 1) {
                    return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PROTECTED);
                }
            }
        }

        return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PROTECTED);
    } else if (line.startsWith(_indent + "private static ")) {
        if (line.contains(" class ") || line.contains(" enum ")) {
            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PRIVATE_STATIC);
        }

        if (line.contains(StringPool.EQUAL) || (line.endsWith(StringPool.SEMICOLON) && (pos == -1))) {

            return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PRIVATE_STATIC);
        }

        if (pos != -1) {
            return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PRIVATE_STATIC);
        }
    } else if (line.startsWith(_indent + "private ")) {
        if (line.contains(" @interface ") || line.contains(" class ") || line.contains(" enum ")
                || line.contains(" interface ")) {

            return new Tuple(getClassName(line), JavaTerm.TYPE_CLASS_PRIVATE);
        }

        if (line.contains(StringPool.EQUAL) || (line.endsWith(StringPool.SEMICOLON) && (pos == -1))) {

            return new Tuple(getVariableName(line), JavaTerm.TYPE_VARIABLE_PRIVATE);
        }

        if (pos != -1) {
            int spaceCount = StringUtil.count(line.substring(0, pos), StringPool.SPACE);

            if (spaceCount == 1) {
                return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_CONSTRUCTOR_PRIVATE);
            }

            if (spaceCount > 1) {
                return new Tuple(getConstructorOrMethodName(line, pos), JavaTerm.TYPE_METHOD_PRIVATE);
            }
        }
    } else if (line.startsWith(_indent + "static {")) {
        return new Tuple("static", JavaTerm.TYPE_STATIC_BLOCK);
    }

    return null;
}

From source file:com.liferay.tools.sourceformatter.JavaSourceProcessor.java

License:Open Source License

protected String checkIfClause(String ifClause, String fileName, int lineCount) throws IOException {

    String ifClauseSingleLine = StringUtil.replace(ifClause,
            new String[] { StringPool.TAB + StringPool.SPACE, StringPool.TAB,
                    StringPool.OPEN_PARENTHESIS + StringPool.NEW_LINE, StringPool.NEW_LINE },
            new String[] { StringPool.TAB, StringPool.BLANK, StringPool.OPEN_PARENTHESIS, StringPool.SPACE });

    checkIfClauseParentheses(ifClauseSingleLine, fileName, lineCount);

    return checkIfClauseTabsAndSpaces(ifClause);
}

From source file:com.liferay.tools.sourceformatter.JavaSourceProcessor.java

License:Open Source License

protected void checkLogLevel(String content, String fileName, String logLevel) {

    if (fileName.contains("Log")) {
        return;/*from  w  ww.  jav a  2  s. c o  m*/
    }

    Pattern pattern = Pattern.compile("\n(\t+)_log." + logLevel + "\\(");

    Matcher matcher = pattern.matcher(content);

    while (matcher.find()) {
        int pos = matcher.start();

        while (true) {
            pos = content.lastIndexOf(StringPool.NEW_LINE + StringPool.TAB, pos - 1);

            char c = content.charAt(pos + 2);

            if (c != CharPool.TAB) {
                break;
            }
        }

        String codeBlock = content.substring(pos, matcher.start());
        String s = "_log.is" + StringUtil.upperCaseFirstLetter(logLevel) + "Enabled()";

        if (!codeBlock.contains(s)) {
            int lineCount = StringUtil.count(content.substring(0, matcher.start(1)), StringPool.NEW_LINE);

            lineCount += 1;

            processErrorMessage(fileName, "Use " + s + ": " + fileName + " " + lineCount);
        }
    }

    return;
}

From source file:com.liferay.tools.sourceformatter.JavaSourceProcessor.java

License:Open Source License

@Override
protected String doFormat(File file, String fileName, String absolutePath, String content) throws Exception {

    if (isGenerated(content)) {
        return content;
    }/*  w ww .j av  a  2 s  .  c om*/

    String className = file.getName();

    int pos = className.lastIndexOf(StringPool.PERIOD);

    className = className.substring(0, pos);

    String packagePath = fileName;

    int packagePathX = packagePath.indexOf("/src/");

    if (packagePathX == -1) {
        packagePathX = packagePath.indexOf("/integration/") + 8;
    }

    int packagePathY = packagePath.lastIndexOf(StringPool.SLASH);

    if ((packagePathX + 5) >= packagePathY) {
        packagePath = StringPool.BLANK;
    } else {
        packagePath = packagePath.substring(packagePathX + 5, packagePathY);
    }

    packagePath = StringUtil.replace(packagePath, StringPool.SLASH, StringPool.PERIOD);

    if (packagePath.endsWith(".model")) {
        if (content.contains("extends " + className + "Model")) {
            return content;
        }
    }

    String newContent = content;

    if (newContent.contains("$\n */")) {
        processErrorMessage(fileName, "*: " + fileName);

        newContent = StringUtil.replace(newContent, "$\n */", "$\n *\n */");
    }

    newContent = fixCopyright(newContent, absolutePath, fileName);

    if (newContent.contains(className + ".java.html")) {
        processErrorMessage(fileName, "Java2HTML: " + fileName);
    }

    if (newContent.contains(" * @author Raymond Aug") && !newContent.contains(" * @author Raymond Aug\u00e9")) {

        newContent = newContent.replaceFirst("Raymond Aug.++", "Raymond Aug\u00e9");

        processErrorMessage(fileName, "UTF-8: " + fileName);
    }

    newContent = fixDataAccessConnection(className, newContent);
    newContent = fixSessionKey(fileName, newContent, sessionKeyPattern);

    newContent = StringUtil.replace(newContent,
            new String[] { "com.liferay.portal.PortalException", "com.liferay.portal.SystemException",
                    "com.liferay.util.LocalizationUtil" },
            new String[] { "com.liferay.portal.kernel.exception.PortalException",
                    "com.liferay.portal.kernel.exception.SystemException",
                    "com.liferay.portal.kernel.util.LocalizationUtil" });

    newContent = StringUtil.replace(newContent, " final static ", " static final ");

    newContent = fixCompatClassImports(absolutePath, newContent);

    newContent = stripJavaImports(newContent, packagePath, className);

    newContent = StringUtil.replace(newContent,
            new String[] { ";\n/**", "\t/*\n\t *", "catch(", "else{", "if(", "for(", "while(", "List <", "){\n",
                    "]{\n", ";;\n" },
            new String[] { ";\n\n/**", "\t/**\n\t *", "catch (", "else {", "if (", "for (", "while (", "List<",
                    ") {\n", "] {\n", ";\n" });

    while (true) {
        Matcher matcher = _incorrectLineBreakPattern.matcher(newContent);

        if (!matcher.find()) {
            break;
        }

        newContent = StringUtil.replaceFirst(newContent, StringPool.NEW_LINE, StringPool.BLANK,
                matcher.start());
    }

    newContent = sortAnnotations(newContent, StringPool.BLANK);

    Matcher matcher = _logPattern.matcher(newContent);

    if (matcher.find()) {
        String logClassName = matcher.group(1);

        if (!logClassName.equals(className)) {
            newContent = StringUtil.replaceLast(newContent, logClassName + ".class)", className + ".class)");
        }
    }

    if (!isExcluded(_staticLogVariableExclusions, absolutePath)) {
        newContent = StringUtil.replace(newContent, "private Log _log", "private static final Log _log");
    }

    if (newContent.contains("*/\npackage ")) {
        processErrorMessage(fileName, "package: " + fileName);
    }

    if (!newContent.endsWith("\n\n}") && !newContent.endsWith("{\n}")) {
        processErrorMessage(fileName, "}: " + fileName);
    }

    if (portalSource && !_allowUseServiceUtilInServiceImpl && !className.equals("BaseServiceImpl")
            && className.endsWith("ServiceImpl") && newContent.contains("ServiceUtil.")) {

        processErrorMessage(fileName, "ServiceUtil: " + fileName);
    }

    // LPS-34911

    if (portalSource && !isExcluded(_upgradeServiceUtilExclusions, absolutePath)
            && fileName.contains("/portal/upgrade/") && !fileName.contains("/test/")
            && newContent.contains("ServiceUtil.")) {

        processErrorMessage(fileName, "ServiceUtil: " + fileName);
    }

    if (!isRunsOutsidePortal(absolutePath) && !isExcluded(_proxyExclusions, absolutePath)
            && newContent.contains("import java.lang.reflect.Proxy;")) {

        processErrorMessage(fileName, "Proxy: " + fileName);
    }

    if (newContent.contains("import edu.emory.mathcs.backport.java")) {
        processErrorMessage(fileName, "edu.emory.mathcs.backport.java: " + fileName);
    }

    if (newContent.contains("import jodd.util.StringPool")) {
        processErrorMessage(fileName, "jodd.util.StringPool: " + fileName);
    }

    // LPS-45027

    if (newContent.contains("com.liferay.portal.kernel.util.UnmodifiableList")) {

        processErrorMessage(fileName, "Use java.util.Collections.unmodifiableList instead of "
                + "com.liferay.portal.kernel.util.UnmodifiableList: " + fileName);
    }

    // LPS-28266

    for (int pos1 = -1;;) {
        pos1 = newContent.indexOf(StringPool.TAB + "try {", pos1 + 1);

        if (pos1 == -1) {
            break;
        }

        int pos2 = newContent.indexOf(StringPool.TAB + "try {", pos1 + 1);
        int pos3 = newContent.indexOf("\"select count(", pos1);

        if ((pos2 != -1) && (pos3 != -1) && (pos2 < pos3)) {
            continue;
        }

        int pos4 = newContent.indexOf("rs.getLong(1)", pos1);
        int pos5 = newContent.indexOf(StringPool.TAB + "finally {", pos1);

        if ((pos3 == -1) || (pos4 == -1) || (pos5 == -1)) {
            break;
        }

        if ((pos3 < pos4) && (pos4 < pos5)) {
            processErrorMessage(fileName, "Use getInt(1) for count: " + fileName);
        }
    }

    // LPS-33070

    matcher = _processCallablePattern.matcher(content);

    if (matcher.find() && !content.contains("private static final long serialVersionUID")) {

        processErrorMessage(fileName, "Assign ProcessCallable implementation a serialVersionUID: " + fileName);
    }

    checkLanguageKeys(fileName, newContent, languageKeyPattern);

    newContent = StringUtil.replace(newContent, StringPool.TAB + "for (;;) {",
            StringPool.TAB + "while (true) {");

    // LPS-36174

    if (_checkUnprocessedExceptions && !fileName.contains("/test/")) {
        checkUnprocessedExceptions(newContent, file, packagePath, fileName);
    }

    // LPS-39508

    if (!isExcluded(_secureRandomExclusions, absolutePath) && !isRunsOutsidePortal(absolutePath)
            && content.contains("java.security.SecureRandom")
            && !content.contains("javax.crypto.KeyGenerator")) {

        processErrorMessage(fileName, "Use SecureRandomUtil or com.liferay.portal.kernel.security."
                + "SecureRandom instead of java.security.SecureRandom: " + fileName);
    }

    // LPS-41315

    checkLogLevel(newContent, fileName, "debug");
    checkLogLevel(newContent, fileName, "info");
    checkLogLevel(newContent, fileName, "trace");
    checkLogLevel(newContent, fileName, "warn");

    // LPS-46632

    checkSystemEventAnnotations(newContent, fileName);

    // LPS-41205

    if (fileName.contains("/upgrade/") && newContent.contains("LocaleUtil.getDefault()")) {

        processErrorMessage(fileName, "Use UpgradeProcessUtil.getDefaultLanguageId(companyId) "
                + "instead of LocaleUtil.getDefault(): " + fileName);
    }

    // LPS-46017

    newContent = StringUtil.replace(newContent, " static interface ", " interface ");

    // LPS-47055

    newContent = fixSystemExceptions(newContent);

    // LPS-47648

    if (portalSource && fileName.contains("/test/integration/")) {
        newContent = StringUtil.replace(newContent, "FinderCacheUtil.clearCache();", StringPool.BLANK);
    }

    // LPS-47682

    newContent = fixIncorrectParameterTypeForLanguageUtil(newContent, false, fileName);

    if (portalSource && fileName.contains("/portal-service/")
            && content.contains("import javax.servlet.jsp.")) {

        processErrorMessage(fileName, "Never import javax.servlet.jsp.* from portal-service " + fileName);
    }

    // LPS-48153

    //newContent = applyDiamondOperator(newContent);

    // LPS-49552

    checkFinderCacheInterfaceMethod(fileName, newContent);

    newContent = fixIncorrectEmptyLineBeforeCloseCurlyBrace(newContent, fileName);

    pos = newContent.indexOf("\npublic ");

    if (pos != -1) {
        String javaClassContent = newContent.substring(pos + 1);

        String beforeJavaClass = newContent.substring(0, pos + 1);

        int javaClassLineCount = StringUtil.count(beforeJavaClass, "\n") + 1;

        newContent = formatJavaTerms(className, fileName, absolutePath, newContent, javaClassContent,
                javaClassLineCount, _checkJavaFieldTypesExclusions, _javaTermAccessLevelModifierExclusions,
                _javaTermSortExclusions, _testAnnotationsExclusions);
    }

    newContent = formatJava(fileName, absolutePath, newContent);

    return StringUtil.replace(newContent, "\n\n\n", "\n\n");
}