[jcifs] RapException
Torsten Curdt
tcurdt at managesoft.com
Mon Aug 2 14:22:20 GMT 2004
Hi!
I am using the jcifs client like this
final ServerManagement management = new ServerManagement(m_domain);
final int infoLevel = 1;
final int serverType = ServerConstants.SV_TYPE_ALL;
final ServerInfo[] info =
management.netServerEnum(infoLevel, serverType, m_domain);
Usually this works fine fine but in a network with only
two "Windows 2003 Server" machines I get an RAP exception.
public ServerInfo[] netServerEnum(int level, int serverType, String
domain) throws IOException {
ServerInfo infoTemplate = (ServerInfo)
LevelFactory.createInformationLevel(ServerInfo.class,
level);
NetServerEnum2 operation =
new NetServerEnum2(infoTemplate, serverType, domain);
int result = call(operation);
if (result == WinError.ERROR_SUCCESS) return operation.servers;
if (result != WinError.ERROR_MORE_DATA) throw new
RapException(result);
int length = operation.servers.length;
ArrayList servers = new ArrayList(length);
for (int i = 0; i < length; i++) servers.add(operation.servers[i]);
String followUpName;
do {
followUpName = operation.servers[length - 1].name;
operation = new NetServerEnum3(infoTemplate, serverType,
domain,
followUpName);
result = call(operation);
if (result == WinError.ERROR_MORE_DATA ||
result == WinError.ERROR_SUCCESS) {
length = operation.servers.length;
servers.ensureCapacity(servers.size() + length);
for (int i =
followUpName.equals(operation.servers[0].name) ?
1 : 0; i < length; i++) {
servers.add(operation.servers[i]);
}
}
} while (result == WinError.ERROR_MORE_DATA);
>>>>>>>>>>>>>> This causes the exception!
if (result != WinError.ERROR_SUCCESS) throw new
RapException(result);
<<<<<<<<<<<<<<<
return (ServerInfo[]) servers.toArray(new
ServerInfo[servers.size()]);
}
In the exception message it returns the result to be 59.
Anyone a clue what there might be the problem?
cheers
--
Torsten
More information about the jcifs
mailing list