Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-02-02 10:22:52 +0000
committerEike Stepper2019-02-02 10:22:52 +0000
commit5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05 (patch)
tree2aa8c9f6cc49a7b201ee468e5f6cf86283296d1a /plugins/org.eclipse.emf.cdo.common/src
parentef98a8857ac4cd08c1c2793f4ba5e833be60bae2 (diff)
downloadcdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.tar.gz
cdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.tar.xz
cdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.zip
[544060] Add optional fragment checks for CDOIDExternals
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544060
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java3
2 files changed, 15 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
index f9565f292a..9b1130aa59 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDExternalImpl.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
import org.eclipse.net4j.util.CheckUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.ref.Interner;
import java.io.IOException;
@@ -31,13 +32,15 @@ public final class CDOIDExternalImpl extends AbstractCDOID implements CDOIDExter
{
private static final long serialVersionUID = 1L;
+ private static final boolean checkFragment = OMPlatform.INSTANCE.isProperty("org.eclipse.emf.cdo.common.id.CDOIDExternal.checkFragment");
+
private static final StringInterner INTERNER = new StringInterner();
private final String uri;
private CDOIDExternalImpl(String uri)
{
- CheckUtil.checkArg(uri, "Null not allowed");
+ checkURI(uri);
this.uri = uri;
}
@@ -119,6 +122,16 @@ public final class CDOIDExternalImpl extends AbstractCDOID implements CDOIDExter
return uri.hashCode();
}
+ static void checkURI(String uri)
+ {
+ CheckUtil.checkArg(uri, "Null not allowed");
+
+ if (checkFragment)
+ {
+ CheckUtil.checkArg(!uri.endsWith("#NNULL"), "Fragment 'NNULL' not allowed");
+ }
+ }
+
public static CDOIDExternalImpl create(String uri)
{
return INTERNER.intern(uri);
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
index 39b69521f7..eb4e356a55 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/id/CDOIDTempObjectExternalImpl.java
@@ -18,7 +18,6 @@ import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
import org.eclipse.emf.cdo.spi.common.id.AbstractCDOID;
-import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.ref.Interner;
import java.io.IOException;
@@ -38,7 +37,7 @@ public final class CDOIDTempObjectExternalImpl extends AbstractCDOID implements
private CDOIDTempObjectExternalImpl(String uri)
{
- CheckUtil.checkArg(uri, "Null not allowed");
+ CDOIDExternalImpl.checkURI(uri);
this.uri = uri;
}

Back to the top