Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
-->
<suppressions>
<suppress checks="." files=".*/generated/.*\.java"/>
<suppress checks="." files=".*/generated-jamon/.*\.java"/>
<suppress checks="MagicNumberCheck" files=".*/src/test/.*\.java"/>
<suppress checks="VisibilityModifier" files=".*/src/test/.*\.java"/>
<suppress checks="InterfaceIsTypeCheck" files=".*/src/main/.*\.java"/>
Expand Down
391 changes: 0 additions & 391 deletions hbase-resource-bundle/src/main/resources/supplemental-models.xml

Large diffs are not rendered by default.

64 changes: 2 additions & 62 deletions hbase-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
</dependency>
<dependency>
<groupId>org.jamon</groupId>
<artifactId>jamon-runtime</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down Expand Up @@ -479,7 +475,6 @@
<phase>generate-sources</phase>
<configuration>
<sources>
<source>${project.build.directory}/generated-jamon</source>
<source>${project.build.directory}/generated-sources/java</source>
</sources>
</configuration>
Expand Down Expand Up @@ -584,27 +579,13 @@
<jspcompiler outputdir="${generated.sources}/java" package="org.apache.hadoop.hbase.generated.master" uriroot="${project.build.directory}/jsp/master" webxml="${build.webapps}/master/WEB-INF/web.xml"/>
<mkdir dir="${build.webapps}/regionserver/WEB-INF"/>
<jspcompiler outputdir="${generated.sources}/java" package="org.apache.hadoop.hbase.generated.regionserver" uriroot="${project.build.directory}/jsp/regionserver" webxml="${build.webapps}/regionserver/WEB-INF/web.xml"/>
<mkdir dir="${build.webapps}/canary/WEB-INF"/>
<jspcompiler outputdir="${generated.sources}/java" package="org.apache.hadoop.hbase.generated.canary" uriroot="${project.build.directory}/jsp/canary" webxml="${build.webapps}/canary/WEB-INF/web.xml"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jamon</groupId>
<artifactId>jamon-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>translate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<templateSourceDir>src/main/jamon</templateSourceDir>
<templateOutputDir>target/generated-jamon</templateOutputDir>
</configuration>
</execution>
</executions>
</plugin>
<!-- Testing plugins -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down Expand Up @@ -937,22 +918,6 @@
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jamon</groupId>
<artifactId>jamon-maven-plugin</artifactId>
<versionRange>[2.3.4,)</versionRange>
<goals>
<goal>translate</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
<runOnConfiguration>true</runOnConfiguration>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -988,31 +953,6 @@
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<additionalProjectnatures>
<projectnature>org.jamon.project.jamonnature</projectnature>
</additionalProjectnatures>
<buildcommands>
<buildcommand>org.jamon.project.templateBuilder</buildcommand>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.jamon.project.markerUpdater</buildcommand>
</buildcommands>
<additionalConfig>
<file>
<name>.settings/org.jamon.prefs</name>
<content># now
eclipse.preferences.version=1
templateSourceDir=src/main/jamon
templateOutputDir=target/generated-jamon</content>
</file>
</additionalConfig>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,19 @@
package org.apache.hadoop.hbase.tool;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.hadoop.hbase.tmpl.tool.CanaryStatusTmpl;
import org.apache.yetus.audience.InterfaceAudience;

/**
* Only kept for redirecting to canary.jsp.
*/
@InterfaceAudience.Private
public class CanaryStatusServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
CanaryTool.RegionStdOutSink sink =
(CanaryTool.RegionStdOutSink) getServletContext().getAttribute("sink");
if (sink == null) {
throw new ServletException(
"RegionStdOutSink is null! The CanaryTool's InfoServer is not initialized correctly");
}

resp.setContentType("text/html");

CanaryStatusTmpl tmpl = new CanaryStatusTmpl();
tmpl.render(resp.getWriter(), sink);
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.sendRedirect(req.getContextPath() + "/canary.jsp");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.util;

import org.apache.hadoop.hbase.ServerName;
import org.apache.yetus.audience.InterfaceAudience;

/**
* Utility used by the web UI JSP pages.
*/
@InterfaceAudience.Private
public final class CanaryStatusUtil {

private CanaryStatusUtil() {
// Do not instantiate.
}

public static String serverNameLink(ServerName serverName) {
int infoPort = serverName.getPort() + 1;
String url = "//" + serverName.getHostname() + ":" + infoPort + "/";
if (infoPort > 0) {
return "<a href=\"" + url + "\">" + serverName.getServerName() + "</a>";
} else {
return serverName.getServerName();
}
Comment on lines +34 to +40
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is incorrect: when serverName.getPort() returns -1, infoPort becomes 0, but the condition checks if (infoPort > 0). This means when the port is -1, infoPort is 0, which fails the > 0 check correctly. However, when the port is valid (e.g., 12345), infoPort is 12346 (always > 0), so the link is always returned. The condition should check if the original port is valid (>= 0) before creating the link, not if infoPort > 0. The correct check should be if (serverName.getPort() >= 0) or if (infoPort > 0) should be if (serverName.getPort() >= 0).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was actually a Jamon sub-template which I converted to Java (as close as possible) and added unit tests.

I think it is correct as is because when serverName.getPort() returns -1 (invalid port), infoPort becomes 0 and then we only return serverName.getServerName(). Otherwise we use the the port to build the URL.

But please correct me if I'm wrong.

}
}
Loading