Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2008-10-12 05:51:52 -0400
committerEike Stepper2008-10-12 05:51:52 -0400
commite0226346621dbb3f3be0ed9b91153f6aa71f6b43 (patch)
treef5b536be630b74309d14abbe2c6a8ce0af26feec
parent130ad0ac7c3df041dcf8e73e2f8301baaae7725e (diff)
downloadcdo-e0226346621dbb3f3be0ed9b91153f6aa71f6b43.tar.gz
cdo-e0226346621dbb3f3be0ed9b91153f6aa71f6b43.tar.xz
cdo-e0226346621dbb3f3be0ed9b91153f6aa71f6b43.zip
[249332] NPE due to missing protocol in SignalActor.<init>
https://bugs.eclipse.org/bugs/show_bug.cgi?id=249332
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java12
2 files changed, 29 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 590affb668..9d3b84f70b 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -32,6 +32,7 @@ import org.eclipse.emf.cdo.server.IView;
import org.eclipse.emf.cdo.server.SessionCreationException;
import org.eclipse.emf.cdo.spi.common.InternalCDORevision;
+import org.eclipse.net4j.channel.IChannel;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.container.Container;
import org.eclipse.net4j.util.event.IListener;
@@ -40,6 +41,7 @@ import org.eclipse.net4j.util.io.ExtendedDataOutput;
import org.eclipse.net4j.util.io.StringCompressor;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import java.io.IOException;
import java.text.MessageFormat;
@@ -150,6 +152,11 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
public View[] getViews()
{
checkActive();
+ return getViewsArray();
+ }
+
+ private View[] getViewsArray()
+ {
return views.values().toArray(new View[views.size()]);
}
@@ -237,11 +244,20 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
}
}
}
+
try
{
if (!dirtyIDs.isEmpty() || !newDeltas.isEmpty() || !detachedObjects.isEmpty())
{
- new CommitNotificationRequest(protocol.getChannel(), timeStamp, dirtyIDs, detachedObjects, newDeltas).send();
+ IChannel channel = protocol.getChannel();
+ if (LifecycleUtil.isActive(channel))
+ {
+ new CommitNotificationRequest(channel, timeStamp, dirtyIDs, detachedObjects, newDeltas).send();
+ }
+ else
+ {
+ OM.LOG.warn("Session channel is inactive: " + this);
+ }
}
}
catch (Exception ex)
@@ -331,7 +347,7 @@ public class Session extends Container<IView> implements ISession, CDOIDProvider
protocol = null;
protocolListener = null;
- for (IView view : views.values().toArray(new View[views.size()]))
+ for (IView view : getViewsArray())
{
view.close();
}
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java
index dd6cbdb7c2..81f1c4c953 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/protocol/CDOServerRequest.java
@@ -37,7 +37,7 @@ public abstract class CDOServerRequest extends Request
{
public CDOServerRequest(IChannel channel)
{
- super((SignalProtocol)channel.getReceiveHandler());
+ super(extractProtocol(channel));
}
@Override
@@ -122,4 +122,14 @@ public abstract class CDOServerRequest extends Request
}
protected abstract void requesting(CDODataOutput out) throws IOException;
+
+ private static SignalProtocol extractProtocol(IChannel channel)
+ {
+ if (LifecycleUtil.isActive(channel))
+ {
+ return (SignalProtocol)channel.getReceiveHandler();
+ }
+
+ throw new IllegalStateException("Channel is inactive: " + channel);
+ }
}

Back to the top