Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

93134: ACE-3702 - RepositoryDescriptor throws null ptr exception if called when no valid license is found


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94936 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 12:11:21 +00:00
parent 66f799f3c6
commit c9c1246722
2 changed files with 10 additions and 11 deletions

View File

@@ -22,7 +22,6 @@ import java.io.InputStream;
import java.lang.reflect.Constructor;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.error.ExceptionStackUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
@@ -137,7 +136,9 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
{
synchronized (this.currentRepoDescriptorLock)
{
return this.currentRepoDescriptor;
// this should be updated when the License is verified - but it is possible that no License at all
// is available and this will be in an known state - do not allow a null value to be returned
return this.currentRepoDescriptor != null ? this.currentRepoDescriptor : new UnknownDescriptor();
}
}
@@ -269,8 +270,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
}
};
Descriptor installed = helper.doInTransaction(getDescriptorCallback, false, false);
if(installed != null)
if (installed != null)
{
installedRepoDescriptor = installed;
}
@@ -278,7 +278,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
{
installedRepoDescriptor = new UnknownDescriptor();
}
/*
* Initialize license service if on classpath.
* If no class exists a dummy license service is used.
@@ -296,7 +296,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
((ConfigurableApplicationContext) applicationContext).getBeanFactory().registerSingleton(
"licenseService", licenseService);
}
// Load heart-beat special service (even if disabled at the moment)
heartBeat = constructSpecialService("org.alfresco.enterprise.heartbeat.HeartBeat");
@@ -513,11 +513,11 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
}
/**
* @return <b>1.0.0</b> always
* @return <b>0.0.0</b> always
*/
public VersionNumber getVersionNumber()
{
return new VersionNumber("1.0.0");
return new VersionNumber("0.0.0");
}
/**
@@ -525,7 +525,7 @@ public class DescriptorServiceImpl extends AbstractLifecycleBean
*/
public String getVersion()
{
return "Unknown (pre 1.0.0 RC2)";
return "Unknown";
}
/**

View File

@@ -156,8 +156,7 @@ public class DescriptorStartupLog extends AbstractLifecycleBean
}
// Log Repository Descriptors
// MER - work around for currentRepositoryDescriptor == null
if (logger.isInfoEnabled() && descriptorService.getCurrentRepositoryDescriptor() != null)
if (logger.isInfoEnabled())
{
logger.info("Server Mode :" + serverModeProvider.getServerMode());
Descriptor serverDescriptor = descriptorService.getServerDescriptor();