var boolean isFirstElementOnNewLineEmptyChar = false;
val lineIndent = computeNextLineIndent(nextLineIndent);
- formattedText = formattedText.replace("*/", "*/");
formattedText = NEWLINE_OR_TAB.removeFrom(formattedText);
formattedText = formattedText.replaceAll(" +", " ");
}
private static final CharMatcher AMP_MATCHER = CharMatcher.is('&');
- private static final CharMatcher GT_MATCHER = CharMatcher.is('>');
- private static final CharMatcher LT_MATCHER = CharMatcher.is('<');
+ private static final Pattern HTTP_LINK_MATCHER = Pattern.compile("<http(.+)>");
def encodeJavadocSymbols(String description) {
if (description.nullOrEmpty) {
return description;
}
- var ret = description.replace("*/", "*/")
-
// FIXME: Use Guava's HtmlEscapers once we have it available
- ret = AMP_MATCHER.replaceFrom(ret, "&");
- ret = GT_MATCHER.replaceFrom(ret, ">");
- ret = LT_MATCHER.replaceFrom(ret, "<");
+ var ret = AMP_MATCHER.replaceFrom(description, "&");
+ ret = HTTP_LINK_MATCHER.matcher(ret).replaceAll("<http$1>");
+ ret = ret.replace("*/", "*/")
+
return ret;
}
var StringBuilder lineBuilder = new StringBuilder();
var boolean isFirstElementOnNewLineEmptyChar = false;
- formattedText = formattedText.encodeJavadocSymbols
+ formattedText = encodeJavadocSymbols(formattedText)
formattedText = NL_MATCHER.removeFrom(formattedText)
formattedText = TAB_MATCHER.removeFrom(formattedText)
formattedText = SPACES_PATTERN.matcher(formattedText).replaceAll(" ")
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
package org.opendaylight.yangtools.sal.java.api.generator.test;
import static org.junit.Assert.assertTrue;
import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.cleanUp;
import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.getSourceFiles;
import static org.opendaylight.yangtools.sal.java.api.generator.test.CompilationTestUtils.testCompilation;
+
import com.google.common.collect.ImmutableSet;
import java.io.File;
import java.util.List;
public class EndodingInJavaDocTest extends BaseCompilationTest {
@Test
- public void testAugmentToUsesInAugment() throws Exception {
+ public void testJavadocEncodingCompilation() throws Exception {
final File sourcesOutputDir = new File(GENERATOR_OUTPUT_PATH + FS + "encoding-javadoc");
assertTrue("Failed to create test file '" + sourcesOutputDir + "'", sourcesOutputDir.mkdir());
final File compiledOutputDir = new File(COMPILER_OUTPUT_PATH + FS + "encoding-javadoc");