SOLR-1050 -- NPE thrown in replication admin page due to unhandled casting of null values

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@751374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-03-08 06:37:54 +00:00
parent ab7106f35f
commit 1182376282
2 changed files with 17 additions and 24 deletions

View File

@ -153,7 +153,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
for (IndexCommit c : commits.values()) {
try {
NamedList nl = new NamedList();
nl.add(CMD_INDEX_VERSION, c.getVersion());
nl.add("indexVersion", c.getVersion());
nl.add(GENERATION, c.getGeneration());
nl.add(CMD_GET_FILE_LIST, c.getFileNames().toString());
l.add(nl);

View File

@ -1,5 +1,5 @@
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8" %>
<%--
<%--
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.
@ -40,48 +40,41 @@ if (detailsMap != null)
<strong>Master</strong>
</td>
<td>
<%=slave.get("masterUrl")%>
<%
out.println((String) slave.get("masterUrl"));
NamedList nl = (NamedList) slave.get("masterDetails");
if(nl == null)
out.print(" - <b>Unreachable</b>");
%>
</td>
</tr>
<tr>
<%
NamedList nl = (NamedList) slave.get("masterDetails");
if (nl != null) {
long masterVersion = (Long) nl.get("indexVersion");
long masterGeneration = (Long) nl.get("generation");
long replicatableMasterVer = 0, replicatableMasterGen = 0;
<%
if (nl != null) {
Object replicatableMasterVer = null, replicatableMasterGen = null;
nl = (NamedList) nl.get("master");
if(nl != null){
if (nl.get("replicatableindexversion") != null)
replicatableMasterVer = (Long) nl.get("replicatableindexversion");
if (nl.get("replicatablegeneration") != null)
replicatableMasterGen = (Long) nl.get("replicatablegeneration");
}
if(nl != null){
%>
<tr>
<td>
</td>
<td>Latest Index Version:<%=masterVersion%>, Generation: <%=masterGeneration%>
<td>Latest Index Version:<%=nl.get("indexVersion")%>, Generation: <%=nl.get("generation")%>
</td>
</tr>
<tr>
<td></td>
<td>Replicatable Index Version:<%=replicatableMasterVer%>, Generation: <%=replicatableMasterGen%>
<td>Replicatable Index Version:<%=nl.get("replicatableIndexVersion")%>, Generation: <%=nl.get("replicatableGeneration")%>
</td>
</tr>
<%}%>
<%
}
}%>
<tr>
<td>
<strong>Poll Interval</strong>
</td>
<td>
<%
out.println((String) slave.get("pollInterval"));
%>
<%=slave.get("pollInterval")%>
</td>
</tr>
<%}%>