From cbfb986e90545c1d5b3508ba3c06d7d59fe7ad40 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 04 Aug 2011 16:16:48 +0000
Subject: [PATCH] Fix OPENDJ-252. Control Panel fails with a Null Pointer Exception with JDK7. Thanks to jvergara who provided a quick fix to OpenDS.
---
opends/src/guitools/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
index 47ed803c..4bdd0e4 100644
--- a/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
+++ b/opends/src/guitools/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2008-2010 Sun Microsystems, Inc.
+ * Copyright 2008-2011 Sun Microsystems, Inc.
* Portions Copyright 2011 ForgeRock AS
*/
@@ -58,7 +58,7 @@
private BackendDescriptor backend;
private long ageOfOldestMissingChange;
private Type type;
- private DN baseDn;
+ private final DN baseDn;
private int replicaID = -1;
private int hashCode;
@@ -100,6 +100,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean equals(Object v)
{
boolean equals = false;
@@ -112,9 +113,16 @@
getDn().equals(desc.getDn()) &&
(getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange()) &&
(getMissingChanges() == desc.getMissingChanges()) &&
- getBackend().getBackendID().equals(
- desc.getBackend().getBackendID()) &&
(getEntries() == desc.getEntries());
+ if (equals)
+ {
+ if ((getBackend() != null) && (desc.getBackend() != null))
+ {
+ // Only compare the backend IDs. In this context is enough
+ equals = getBackend().getBackendID().equals(
+ desc.getBackend().getBackendID());
+ }
+ }
}
}
else
@@ -127,6 +135,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int hashCode()
{
return hashCode;
@@ -145,8 +154,12 @@
}
if (returnValue == 0)
{
- returnValue = getBackend().getBackendID().compareTo(
- desc.getBackend().getBackendID());
+ if ((getBackend() != null) && (desc.getBackend() != null))
+ {
+ // Only compare the backend IDs. In this context is enough
+ returnValue = getBackend().getBackendID().compareTo(
+ desc.getBackend().getBackendID());
+ }
}
if (returnValue == 0)
{
--
Gitblit v1.10.0