Skip to content

Commit

Permalink
Filter null or zero length events
Browse files Browse the repository at this point in the history
  • Loading branch information
rveen committed Jan 3, 2013
1 parent 6fbc55e commit 93beeb2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
Binary file modified ogdl.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions ogdl.jardesc
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
<jar path="ogdl/ogdl.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ogdl/ogdl.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<jar path="ogdl-java/ogdl.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/ogdl-java/ogdl.jardesc" exportErrors="false" exportWarnings="true" includeDirectoryEntries="false" overwrite="true" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
Expand All @@ -11,6 +11,6 @@
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
<javaElement handleIdentifier="=ogdl/src"/>
<javaElement handleIdentifier="=ogdl-java/src"/>
</selectedElements>
</jardesc>
4 changes: 4 additions & 0 deletions src/ogdl/Graph.java
Expand Up @@ -49,6 +49,10 @@ public class Graph implements IGraph
public static final String _OBJ = Types.OBJECT;

public Graph() {
/* Warning: _NULL cannot be a zero length string unless EventHandlerGraph.event() is
* modified. Events with null length are currently ignored, and also not written to
* OGDL binary (see OgdlBinarryEmitter).
*/
this.name = _NULL;
}

Expand Down
10 changes: 10 additions & 0 deletions src/ogdl/OgdlBinaryEmitter.java
Expand Up @@ -27,6 +27,9 @@ public static void write(IGraph g, OutputStream out) throws IOException
final byte[] h = { 1, 'G', 0 };
out_write(bout,h);

/* This filtering of _NULL should not be necessary, but
* currently is needed at the reception side.
*/
if (! g.getName().equals(Graph._NULL))
_writeBinary(0,g,bout);
else
Expand All @@ -47,6 +50,9 @@ public static byte[] write(IGraph g) throws IOException
final byte[] h = { 1, 'G', 0 };
out_write(bout,h);

/* This filtering of _NULL should not be necessary, but
* currently is needed at the reception side.
*/
if (! g.getName().equals(Graph._NULL))
_writeBinary(0,g,bout);
else
Expand Down Expand Up @@ -80,6 +86,10 @@ private static void _writeBinary(int lev, IGraph g, OutputStream out) throws IOE

private static void writeTextNode (int level, String s, OutputStream out) throws IOException
{
/* Empty or null strings will not make it */
if (s==null || s.length()==0)
return;

// write level
multiByteInteger(level+1,out);
// write text
Expand Down
3 changes: 3 additions & 0 deletions src/ogdl/support/EventHandlerGraph.java
Expand Up @@ -51,6 +51,9 @@ public void clear()

public void event(String s)
{
//if (s == null || s.length() == 0)
//return;

//System.out.println("event: "+s);
if (level>200) {
System.out.println("EventHandlerGraph: ! level=200 at "+s);
Expand Down
3 changes: 2 additions & 1 deletion src/ogdl/template/Servlets.java
Expand Up @@ -20,7 +20,7 @@
import org.apache.commons.fileupload.servlet.*;
import org.apache.commons.fileupload.disk.*;

import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;
//import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable;

import java.util.TreeMap;
import java.util.Set;
Expand Down Expand Up @@ -128,6 +128,7 @@ else if (uri.endsWith(RELOAD_URL))
/* Jetty and Apache don't return anything with getRemoteUser */

String u = req.getRemoteUser();

if (u == null) {
/* try authentication header */
u = req.getHeader("authorization");
Expand Down

0 comments on commit 93beeb2

Please sign in to comment.