Some changes to logging and error messages.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@32359 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2011-11-28 17:14:07 +00:00
parent 54e823abdd
commit f8e7d063b2
2 changed files with 68 additions and 40 deletions

View File

@@ -232,8 +232,10 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// Check if the broadcast mask is a valid numeric IP address // Check if the broadcast mask is a valid numeric IP address
if (IPAddress.isNumericAddress(broadcastAddess) == false) if (IPAddress.isNumericAddress(broadcastAddess) == false)
throw new AlfrescoRuntimeException("Invalid broadcast mask, must be n.n.n.n format"); {
throw new AlfrescoRuntimeException("CIFS Invalid broadcast mask, must be n.n.n.n format");
}
// Set the network broadcast mask // Set the network broadcast mask
cifsConfig.setBroadcastMask(broadcastAddess); cifsConfig.setBroadcastMask(broadcastAddess);
@@ -243,8 +245,10 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
String hostName = cifsConfigBean.getServerName(); String hostName = cifsConfigBean.getServerName();
if (hostName == null || hostName.length() == 0) if (hostName == null || hostName.length() == 0)
throw new AlfrescoRuntimeException("Host name not specified or invalid"); {
throw new AlfrescoRuntimeException("CIFS Host name not specified or invalid");
}
// Check if the host name contains the local name token // Check if the host name contains the local name token
int pos = hostName.indexOf(TokenLocalName); int pos = hostName.indexOf(TokenLocalName);
@@ -264,14 +268,19 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
pos += TokenLocalName.length(); pos += TokenLocalName.length();
if (pos < hostName.length()) if (pos < hostName.length())
{
hostStr.append(hostName.substring(pos)); hostStr.append(hostName.substring(pos));
}
hostName = hostStr.toString(); hostName = hostStr.toString();
// Make sure the CIFS server name does not match the local server name // Make sure the CIFS server name does not match the local server name
if (hostName.equals(srvName) && getPlatformType() == Platform.Type.WINDOWS) if (hostName.equals(srvName) && getPlatformType() == Platform.Type.WINDOWS)
{
throw new AlfrescoRuntimeException("CIFS server name must be unique"); throw new AlfrescoRuntimeException("CIFS server name must be unique");
}
} }
// Check if the host name is longer than 15 characters. NetBIOS only allows a maximum of 16 characters in // Check if the host name is longer than 15 characters. NetBIOS only allows a maximum of 16 characters in
@@ -316,9 +325,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
localDomain = "WORKGROUP"; localDomain = "WORKGROUP";
// Output a warning // Output a warning
logger.warn("CIFS, Unable to get local domain/workgroup name, using default of " + localDomain + ". This may be due to firewall settings or incorrect <broadcast> setting)");
logger.error("Failed to get local domain/workgroup name, using default of " + localDomain);
logger.error("(This may be due to firewall settings or incorrect <broadcast> setting)");
} }
// Set the local domain/workgroup that the CIFS server belongs to // Set the local domain/workgroup that the CIFS server belongs to
@@ -367,7 +374,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
} }
catch (UnknownHostException ex) catch (UnknownHostException ex)
{ {
throw new AlfrescoRuntimeException("Invalid CIFS server bind address"); throw new AlfrescoRuntimeException("CIFS Unable to bind to address :" + bindTo, ex);
} }
} }
@@ -378,8 +385,10 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
cifsConfig.setAuthenticator(authenticator); cifsConfig.setAuthenticator(authenticator);
} }
else else
{
throw new AlfrescoRuntimeException("CIFS authenticator not specified"); throw new AlfrescoRuntimeException("CIFS authenticator not specified");
}
// Check if the host announcer has been disabled // Check if the host announcer has been disabled
if (!cifsConfigBean.getHostAccouncerEnabled()) if (!cifsConfigBean.getHostAccouncerEnabled())
@@ -390,7 +399,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// Log that host announcements are not enabled // Log that host announcements are not enabled
logger.info("Host announcements not enabled"); logger.info("CIFS Host announcements not enabled");
} }
else else
{ {
@@ -406,8 +415,10 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// host announcer is enabled // host announcer is enabled
if (cifsConfig.getDomainName() == null) if (cifsConfig.getDomainName() == null)
throw new AlfrescoRuntimeException("Domain name must be specified if host announcement is enabled"); {
throw new AlfrescoRuntimeException("CIFS Domain name must be specified if host announcement is enabled");
}
// Enable host announcement // Enable host announcement
cifsConfig.setHostAnnouncer(true); cifsConfig.setHostAnnouncer(true);
@@ -449,8 +460,10 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// Check if the broadcast mask has been specified // Check if the broadcast mask has been specified
if (cifsConfig.getBroadcastMask() == null) if (cifsConfig.getBroadcastMask() == null)
throw new AlfrescoRuntimeException("Network broadcast mask not specified"); {
throw new AlfrescoRuntimeException("CIFS Network broadcast mask not specified");
}
// Check for a bind address // Check for a bind address
String bindto = netBIOSSMBConfigBean.getBindTo(); String bindto = netBIOSSMBConfigBean.getBindTo();
@@ -472,7 +485,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
} }
catch (UnknownHostException ex) catch (UnknownHostException ex)
{ {
throw new AlfrescoRuntimeException("Invalid NetBIOS bind address"); throw new AlfrescoRuntimeException("CIFS Invalid NetBIOS bind address:" + bindto, ex);
} }
} }
else if (cifsConfig.hasSMBBindAddress()) else if (cifsConfig.hasSMBBindAddress())
@@ -496,7 +509,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
} }
catch (UnknownHostException ex) catch (UnknownHostException ex)
{ {
logger.error("Failed to get local address list", ex); logger.error("CIFS Failed to get local address list", ex);
} }
// Check the address list for one or more valid local addresses filtering out the loopback // Check the address list for one or more valid local addresses filtering out the loopback
@@ -580,7 +593,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
logger.debug(" Address: " + addrs[i]); logger.debug(" Address: " + addrs[i]);
} }
else else
{
logger.debug(" No addresses"); logger.debug(" No addresses");
}
} }
// Throw an exception to stop the CIFS/NetBIOS name server from starting // Throw an exception to stop the CIFS/NetBIOS name server from starting
@@ -728,11 +743,14 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// DEBUG // DEBUG
if ( logger.isInfoEnabled()) if ( logger.isInfoEnabled())
{
logger.info("Enabled CIFS IPv6 bind address for native SMB"); logger.info("Enabled CIFS IPv6 bind address for native SMB");
}
} }
catch ( UnknownHostException ex) catch ( UnknownHostException ex)
{ {
throw new AlfrescoRuntimeException("Failed to enable IPv6 bind address, " + ex.getMessage()); throw new AlfrescoRuntimeException("CIFS Failed to enable IPv6 bind address, " + ex.getMessage());
} }
} }
@@ -1159,7 +1177,7 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
} }
catch (UnknownHostException ex) catch (UnknownHostException ex)
{ {
throw new AlfrescoRuntimeException("Invalid FTP bindto address, " + bindText); throw new AlfrescoRuntimeException("Unable to find FTP bindto address, " + bindText, ex);
} }
} }
@@ -1202,7 +1220,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// Check if the anonymous account name is valid // Check if the anonymous account name is valid
if (ftpConfig.getAnonymousFTPAccount() == null || ftpConfig.getAnonymousFTPAccount().length() == 0) if (ftpConfig.getAnonymousFTPAccount() == null || ftpConfig.getAnonymousFTPAccount().length() == 0)
{
throw new AlfrescoRuntimeException("Anonymous FTP account invalid"); throw new AlfrescoRuntimeException("Anonymous FTP account invalid");
}
} }
else else
{ {
@@ -1301,11 +1321,11 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
} }
catch (IllegalCharsetNameException ex) catch (IllegalCharsetNameException ex)
{ {
throw new AlfrescoRuntimeException("Illegal character set name, " + charSet); throw new AlfrescoRuntimeException("FTP Illegal character set name, " + charSet);
} }
catch (UnsupportedCharsetException ex) catch (UnsupportedCharsetException ex)
{ {
throw new AlfrescoRuntimeException("Unsupported character set name, " + charSet); throw new AlfrescoRuntimeException("FTP Unsupported character set name, " + charSet);
} }
} }
@@ -1480,8 +1500,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
// Range check the pool size value // Range check the pool size value
if (poolSize < 4) if (poolSize < 4)
{
throw new AlfrescoRuntimeException("NFS thread pool size is below minimum of 4"); throw new AlfrescoRuntimeException("NFS thread pool size is below minimum of 4");
}
// Set the thread pool size // Set the thread pool size
nfsConfig.setNFSThreadPoolSize(poolSize); nfsConfig.setNFSThreadPoolSize(poolSize);
@@ -1512,12 +1533,16 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
if (portMapperPort != null) if (portMapperPort != null)
{ {
nfsConfig.setPortMapperPort(portMapperPort); nfsConfig.setPortMapperPort(portMapperPort);
if ( nfsConfig.getPortMapperPort() == -1) { if ( nfsConfig.getPortMapperPort() == -1)
{
logger.info("NFS portmapper registration disabled"); logger.info("NFS portmapper registration disabled");
} }
else { else
{
if (nfsConfig.getPortMapperPort() <= 0 || nfsConfig.getPortMapperPort() >= 65535) if (nfsConfig.getPortMapperPort() <= 0 || nfsConfig.getPortMapperPort() >= 65535)
throw new AlfrescoRuntimeException("Port mapper server port out of valid range"); {
throw new AlfrescoRuntimeException("NFS Port mapper server port out of valid range");
}
} }
} }
@@ -1528,7 +1553,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
{ {
nfsConfig.setMountServerPort(mountServerPort); nfsConfig.setMountServerPort(mountServerPort);
if (nfsConfig.getMountServerPort() < 0 || nfsConfig.getMountServerPort() >= 65535) if (nfsConfig.getMountServerPort() < 0 || nfsConfig.getMountServerPort() >= 65535)
throw new AlfrescoRuntimeException("Mount server port out of valid range"); {
throw new AlfrescoRuntimeException("NFS Mount server port out of valid range");
}
} }
// Check for an NFS server port // Check for an NFS server port
@@ -1538,7 +1565,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
{ {
nfsConfig.setNFSServerPort(nfsServerPort); nfsConfig.setNFSServerPort(nfsServerPort);
if (nfsConfig.getNFSServerPort() < 0 || nfsConfig.getNFSServerPort() >= 65535) if (nfsConfig.getNFSServerPort() < 0 || nfsConfig.getNFSServerPort() >= 65535)
{
throw new AlfrescoRuntimeException("NFS server port out of valid range"); throw new AlfrescoRuntimeException("NFS server port out of valid range");
}
} }
// Check for an RPC registration port // Check for an RPC registration port
@@ -1548,7 +1577,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
{ {
nfsConfig.setRPCRegistrationPort( rpcRegisterPort); nfsConfig.setRPCRegistrationPort( rpcRegisterPort);
if ( nfsConfig.getRPCRegistrationPort() < 0 || nfsConfig.getRPCRegistrationPort() >= 65535) if ( nfsConfig.getRPCRegistrationPort() < 0 || nfsConfig.getRPCRegistrationPort() >= 65535)
{
throw new AlfrescoRuntimeException("RPC registrtion port out of valid range"); throw new AlfrescoRuntimeException("RPC registrtion port out of valid range");
}
} }
// Check for NFS debug flags // Check for NFS debug flags
@@ -1608,7 +1639,9 @@ public class ServerConfigurationBean extends AbstractServerConfigurationBean imp
nfsConfig.setRpcAuthenticator(rpcAuthenticator); nfsConfig.setRpcAuthenticator(rpcAuthenticator);
} }
else else
{
throw new AlfrescoRuntimeException("RPC authenticator configuration missing, require user mappings"); throw new AlfrescoRuntimeException("RPC authenticator configuration missing, require user mappings");
}
} }
catch (InvalidConfigurationException ex) catch (InvalidConfigurationException ex)
{ {

View File

@@ -40,6 +40,7 @@ import org.alfresco.jlan.server.SrvSession;
import org.alfresco.jlan.server.core.DeviceContext; import org.alfresco.jlan.server.core.DeviceContext;
import org.alfresco.jlan.server.core.DeviceContextException; import org.alfresco.jlan.server.core.DeviceContextException;
import org.alfresco.jlan.server.filesys.FileAction; import org.alfresco.jlan.server.filesys.FileAction;
import org.alfresco.jlan.server.filesys.FileAttribute;
import org.alfresco.jlan.server.filesys.FileInfo; import org.alfresco.jlan.server.filesys.FileInfo;
import org.alfresco.jlan.server.filesys.FileName; import org.alfresco.jlan.server.filesys.FileName;
import org.alfresco.jlan.server.filesys.FileOpenParams; import org.alfresco.jlan.server.filesys.FileOpenParams;
@@ -182,6 +183,7 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
{ {
int sharedAccess = params.getSharedAccess(); int sharedAccess = params.getSharedAccess();
String strSharedAccess = SharingMode.getSharingModeAsString(sharedAccess); String strSharedAccess = SharingMode.getSharingModeAsString(sharedAccess);
int attr = params.getAttributes();
logger.debug("createFile:" + params.getPath() logger.debug("createFile:" + params.getPath()
+ ", isDirectory: " + params.isDirectory() + ", isDirectory: " + params.isDirectory()
@@ -195,7 +197,9 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
+ ", requestExclusiveOpLock:" +params.requestExclusiveOpLock() + ", requestExclusiveOpLock:" +params.requestExclusiveOpLock()
+ ", isDeleteOnClose:" +params.isDeleteOnClose() + ", isDeleteOnClose:" +params.isDeleteOnClose()
+ ", sharedAccess: " + strSharedAccess + ", sharedAccess: " + strSharedAccess
+ ", allocationSize: " + params.getAllocationSize()); + ", allocationSize: " + params.getAllocationSize()
+ ", isHidden:" + FileAttribute.isHidden(attr)
+ ", isSystem:" + FileAttribute.isSystem(attr));
} }
long creationDateTime = params.getCreationDateTime(); long creationDateTime = params.getCreationDateTime();
@@ -313,19 +317,10 @@ public class NonTransactionalRuleContentDiskDriver implements ExtendedDiskInterf
+ ", isDeleteOnClose:" +param.isDeleteOnClose() + ", isDeleteOnClose:" +param.isDeleteOnClose()
+ ", allocationSize:" + param.getAllocationSize() + ", allocationSize:" + param.getAllocationSize()
+ ", sharedAccess: " + strSharedAccess + ", sharedAccess: " + strSharedAccess
+ ", openAction: " + param.getOpenAction() + ", openAction: " + param.getOpenAction()
); + param
);
// TODO - If we are going to truncate then don't waste time copying content. }
if (param.getOpenAction() == FileAction.NTOverwriteIf)
{
logger.debug("NTOverwriteIf");
}
if (param.getOpenAction() == FileAction.NTOverwrite)
{
logger.debug("NTOverwrite");
}
}
ContentContext tctx = (ContentContext) tree.getContext(); ContentContext tctx = (ContentContext) tree.getContext();
NodeRef rootNode = tctx.getRootNode(); NodeRef rootNode = tctx.getRootNode();