if (parentElement instanceof TreeParent) {
if (sortChildren) {
Object[] tmpArr = ((TreeParent) parentElement).getChildren();
+ if (tmpArr == null)
+ return new Object[0];
TreeParent[] arr = new TreeParent[tmpArr.length];
for (int i = 0; i < tmpArr.length; i++)
arr[i] = (TreeParent) tmpArr[i];
return arr;
} else
return ((TreeParent) parentElement).getChildren();
- } else
+ } else
return new Object[0];
}
setParent(parent);
}
- public Session getSession() {
+ public synchronized Session getSession() {
return session;
}
- public Node getRootNode() {
+ public synchronized Node getRootNode() {
try {
if (session != null)
return session.getRootNode();
}
}
- public void login() {
+ public synchronized void login() {
try {
session = ((RepositoryElem) getParent()).repositoryLogin(getName());
} catch (RepositoryException e) {
}
/** Logouts the session, does not nothing if there is no live session. */
- public void logout() {
+ public synchronized void logout() {
clearChildren();
JcrUtils.logoutQuietly(session);
+ session = null;
}
@Override
- public boolean hasChildren() {
+ public synchronized boolean hasChildren() {
try {
if (isConnected())
return session.getRootNode().hasNodes();