summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2013-02-19 18:40:27 +1100
committerAlex Gorrod <alexg@wiredtiger.com>2013-02-19 18:40:27 +1100
commit12ea0e5961dddca704044002d95caf8b42a7e7df (patch)
treed82640a7247ac3c7284c01a51c6c1e9159da47de
parent500b2699ca50728a367d3f255db7a1c184f918b0 (diff)
downloadmongo-12ea0e5961dddca704044002d95caf8b42a7e7df.tar.gz
Fix copyright notices in Java source code.
-rw-r--r--dist/s_copyright.list10
-rw-r--r--examples/java/com/wiredtiger/examples/ex_access.java32
-rw-r--r--lang/java/src/com/wiredtiger/db/PackFormatInputStream.java34
-rw-r--r--lang/java/src/com/wiredtiger/db/PackInputStream.java33
-rw-r--r--lang/java/src/com/wiredtiger/db/PackOutputStream.java24
-rw-r--r--lang/java/src/com/wiredtiger/db/PackUtil.java8
-rw-r--r--lang/java/src/com/wiredtiger/db/WiredTigerException.java6
-rw-r--r--lang/java/src/com/wiredtiger/db/WiredTigerPackingException.java6
-rw-r--r--lang/java/wiredtiger.i4
-rw-r--r--test/java/com/wiredtiger/test/CursorTest.java26
-rw-r--r--test/java/com/wiredtiger/test/PackTest.java32
-rw-r--r--test/java/com/wiredtiger/test/WiredTigerSuite.java26
12 files changed, 210 insertions, 31 deletions
diff --git a/dist/s_copyright.list b/dist/s_copyright.list
index 359e97f1aa8..d4c7c8125d2 100644
--- a/dist/s_copyright.list
+++ b/dist/s_copyright.list
@@ -6,12 +6,22 @@ skip dist/api_err.py
skip dist/db.py
skip dist/dist.py
skip dist/flags.py
+skip dist/java_doc.py
skip dist/log.py
skip dist/log_data.py
skip dist/serial.py
skip dist/stat.py
skip dist/stat_data.py
skip docs/tools/doxypy.py
+skip lang/java/java_doc.i
+skip lang/java/src/com/wiredtiger/db/Connection.java
+skip lang/java/src/com/wiredtiger/db/Cursor.java
+skip lang/java/src/com/wiredtiger/db/SearchStatus.java
+skip lang/java/src/com/wiredtiger/db/Session.java
+skip lang/java/src/com/wiredtiger/db/wiredtiger.java
+skip lang/java/src/com/wiredtiger/db/wiredtigerConstants.java
+skip lang/java/src/com/wiredtiger/db/wiredtigerJNI.java
+skip lang/java/wiredtiger_wrap.c
skip lang/python/setup.py
skip lang/python/src/wiredtiger/service/WiredTiger.py
skip lang/python/src/wiredtiger/service/__init__.py
diff --git a/examples/java/com/wiredtiger/examples/ex_access.java b/examples/java/com/wiredtiger/examples/ex_access.java
index 56fa9845af2..9a681546c59 100644
--- a/examples/java/com/wiredtiger/examples/ex_access.java
+++ b/examples/java/com/wiredtiger/examples/ex_access.java
@@ -1,3 +1,32 @@
+/*-
+ * Public Domain 2008-2013 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * ex_access.java
+ * demonstrates how to create and access a simple table.
+ */
package com.wiredtiger.examples;
import com.wiredtiger.db.*;
@@ -14,8 +43,9 @@ public class ex_access {
c.putValueByteArray("bar".getBytes());
c.insert();
c.reset();
- while (c.next() == 0)
+ while (c.next() == 0) {
System.out.println("Got: " + c.getKeyString());
+ }
} catch (WiredTigerPackingException wtpe) {
}
conn.close(null);
diff --git a/lang/java/src/com/wiredtiger/db/PackFormatInputStream.java b/lang/java/src/com/wiredtiger/db/PackFormatInputStream.java
index a05a9f0f85f..607717ee95a 100644
--- a/lang/java/src/com/wiredtiger/db/PackFormatInputStream.java
+++ b/lang/java/src/com/wiredtiger/db/PackFormatInputStream.java
@@ -1,3 +1,10 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
+
package com.wiredtiger.db;
import java.io.ByteArrayInputStream;
@@ -68,17 +75,19 @@ public class PackFormatInputStream {
int countOff = 0;
while (PackUtil.PackSpecialCharacters.indexOf(
- format.charAt(formatOff + countOff)) != -1)
+ format.charAt(formatOff + countOff)) != -1) {
countOff++;
+ }
// Skip repeat counts and sizes
- while (Character.isDigit(format.charAt(formatOff + countOff)))
+ while (Character.isDigit(format.charAt(formatOff + countOff))) {
countOff++;
+ }
return format.charAt(formatOff + countOff);
}
/**
* Check to see if the next entry is compatible with the requested type.
- *
+ *
* \param asking the format type to match.
* \param consume indicates whether to update the stream position.
*/
@@ -89,29 +98,32 @@ public class PackFormatInputStream {
if (Character.toLowerCase(expected) != Character.toLowerCase(asking))
throw new WiredTigerPackingException(
"Format mismatch. Wanted: " + asking + ", got: " + expected);
- if (consume)
+ if (consume) {
consume();
+ }
}
/**
* Move the format stream position ahead one position.
*/
protected void consume() {
- if (formatRepeatCount > 1)
+ if (formatRepeatCount > 1) {
--formatRepeatCount;
- else if (formatRepeatCount == 1) {
+ } else if (formatRepeatCount == 1) {
formatRepeatCount = 0;
++formatOff;
} else {
while (PackUtil.PackSpecialCharacters.indexOf(
- format.charAt(formatOff)) != -1)
+ format.charAt(formatOff)) != -1) {
++formatOff;
+ }
// Don't need to worry about String or byte array size counts
// since they have already been consumed.
formatRepeatCount = getIntFromFormat(true);
- if (formatRepeatCount == 0)
+ if (formatRepeatCount == 0) {
++formatOff;
+ }
}
}
@@ -130,8 +142,9 @@ public class PackFormatInputStream {
valueLen *= 10;
valueLen += Character.digit(format.charAt(formatOff + countOff), 10);
}
- if (advance)
+ if (advance) {
formatOff += countOff;
+ }
return valueLen;
}
@@ -143,8 +156,9 @@ public class PackFormatInputStream {
*/
protected int getLengthFromFormat(boolean advance) {
int valueLen = getIntFromFormat(advance);
- if (valueLen == 0)
+ if (valueLen == 0) {
valueLen = 1;
+ }
return valueLen;
}
}
diff --git a/lang/java/src/com/wiredtiger/db/PackInputStream.java b/lang/java/src/com/wiredtiger/db/PackInputStream.java
index c75a86827dd..6082684a8bf 100644
--- a/lang/java/src/com/wiredtiger/db/PackInputStream.java
+++ b/lang/java/src/com/wiredtiger/db/PackInputStream.java
@@ -1,3 +1,9 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
package com.wiredtiger.db;
import java.io.ByteArrayInputStream;
@@ -131,8 +137,9 @@ public class PackInputStream {
throws WiredTigerPackingException {
/* TODO: padding. */
int copyLen = itemLen;
- if (itemLen > destLen)
+ if (itemLen > destLen) {
copyLen = destLen;
+ }
format.consume();
System.arraycopy(value, valueOff, dest, off, copyLen);
valueOff += itemLen;
@@ -146,8 +153,9 @@ public class PackInputStream {
boolean signed = false;
format.checkType('i', false);
if (format.getType() == 'I' ||
- format.getType() == 'L')
+ format.getType() == 'L') {
signed = true;
+ }
format.consume();
return unpackInt(signed);
}
@@ -159,8 +167,9 @@ public class PackInputStream {
throws WiredTigerPackingException {
boolean signed = false;
format.checkType('q', false);
- if (format.getType() == 'Q')
+ if (format.getType() == 'Q') {
signed = true;
+ }
format.consume();
return unpackLong(signed);
}
@@ -182,8 +191,9 @@ public class PackInputStream {
throws WiredTigerPackingException {
boolean signed = false;
format.checkType('h', false);
- if (format.getType() == 'H')
+ if (format.getType() == 'H') {
signed = true;
+ }
format.consume();
return unpackShort(signed);
}
@@ -220,8 +230,9 @@ public class PackInputStream {
throws WiredTigerPackingException {
long ret = unpackLong(true);
if ((signed && (ret > Short.MAX_VALUE || ret > Short.MIN_VALUE)) ||
- (!signed && (short)ret < 0))
+ (!signed && (short)ret < 0)) {
throw new WiredTigerPackingException("Overflow unpacking short.");
+ }
return (short)ret;
}
@@ -234,8 +245,9 @@ public class PackInputStream {
throws WiredTigerPackingException {
long ret = unpackLong(true);
if ((signed && (ret > Integer.MAX_VALUE || ret > Integer.MIN_VALUE)) ||
- (!signed && (int)ret < 0))
+ (!signed && (int)ret < 0)) {
throw new WiredTigerPackingException("Overflow unpacking integer.");
+ }
return (int)ret;
}
@@ -254,8 +266,9 @@ public class PackInputStream {
case PackUtil.NEG_MULTI_MARKER & 0xff:
len = (int)PackUtil.SIZEOF_LONG - (value[valueOff++] & 0xf);
- for (unpacked = 0xffffffff; len != 0; --len)
+ for (unpacked = 0xffffffff; len != 0; --len) {
unpacked = (unpacked << 8) | value[valueOff++] & 0xff;
+ }
break;
case PackUtil.NEG_2BYTE_MARKER & 0xff:
case (PackUtil.NEG_2BYTE_MARKER | 0x10) & 0xff:
@@ -286,8 +299,9 @@ public class PackInputStream {
// There are four length bits in the first byte.
len = (value[valueOff++] & 0xf);
- for (unpacked = 0; len != 0; --len)
+ for (unpacked = 0; len != 0; --len) {
unpacked = (unpacked << 8) | value[valueOff++] & 0xff;
+ }
unpacked += PackUtil.POS_2BYTE_MAX + 1;
break;
default:
@@ -296,8 +310,9 @@ public class PackInputStream {
}
// Check for overflow if decoding an unsigned value - since Java only
// supports signed values.
- if (!signed && unpacked < 0)
+ if (!signed && unpacked < 0) {
throw new WiredTigerPackingException("Overflow unpacking long.");
+ }
return (unpacked);
}
diff --git a/lang/java/src/com/wiredtiger/db/PackOutputStream.java b/lang/java/src/com/wiredtiger/db/PackOutputStream.java
index 78939f6565b..693f79c3ff2 100644
--- a/lang/java/src/com/wiredtiger/db/PackOutputStream.java
+++ b/lang/java/src/com/wiredtiger/db/PackOutputStream.java
@@ -1,3 +1,9 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
package com.wiredtiger.db;
import java.io.ByteArrayOutputStream;
@@ -84,8 +90,9 @@ public class PackOutputStream {
throws WiredTigerPackingException {
format.checkType('U', true);
// If this is not the last item, store the size.
- if (format.available() > 0)
+ if (format.available() > 0) {
packLong(len, false);
+ }
packed.write(value, off, len);
/* TODO: padding. */
@@ -151,8 +158,9 @@ public class PackOutputStream {
// upper case 'S' is variable length and has a null terminator.
if (fieldFormat == 's') {
stringLen = format.getLengthFromFormat(true);
- if (stringLen > value.length())
+ if (stringLen > value.length()) {
padBytes = stringLen - value.length();
+ }
} else {
stringLen = value.length();
padBytes = 1; // Null terminator
@@ -162,8 +170,9 @@ public class PackOutputStream {
// Use the default Charset.
packed.write(value.getBytes(), 0, stringLen);
- while(padBytes-- > 0)
+ while(padBytes-- > 0) {
packed.write(0);
+ }
}
/**
@@ -178,8 +187,9 @@ public class PackOutputStream {
throws WiredTigerPackingException {
int offset = 0;
- if (!signed && x < 0)
+ if (!signed && x < 0) {
throw new WiredTigerPackingException("Overflow packing long.");
+ }
if (x < PackUtil.NEG_2BYTE_MIN) {
intBuf[offset] = PackUtil.NEG_MULTI_MARKER;
@@ -195,8 +205,9 @@ public class PackOutputStream {
intBuf[offset++] |= (lz & 0xf);
for (int shift = (len - 1) << 3;
- len != 0; shift -= 8, --len)
+ len != 0; shift -= 8, --len) {
intBuf[offset++] = (byte)(x >> shift);
+ }
} else if (x < PackUtil.NEG_1BYTE_MIN) {
x -= PackUtil.NEG_2BYTE_MIN;
intBuf[offset++] =
@@ -224,8 +235,9 @@ public class PackOutputStream {
intBuf[offset++] |= (len & 0xf);
for (int shift = (len - 1) << 3;
- len != 0; --len, shift -= 8)
+ len != 0; --len, shift -= 8) {
intBuf[offset++] = (byte)(x >> shift);
+ }
}
packed.write(intBuf, 0, offset);
}
diff --git a/lang/java/src/com/wiredtiger/db/PackUtil.java b/lang/java/src/com/wiredtiger/db/PackUtil.java
index e9be3afe053..b82e0294073 100644
--- a/lang/java/src/com/wiredtiger/db/PackUtil.java
+++ b/lang/java/src/com/wiredtiger/db/PackUtil.java
@@ -1,3 +1,9 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
package com.wiredtiger.db;
import java.lang.String;
@@ -30,7 +36,7 @@ class PackUtil {
/**
* Extract bits from a value, counting from LSB == 0.
- *
+ *
* \param x The value to extract bits from.
* \param start The first bit to extract.
* \param end The last bit to extract.
diff --git a/lang/java/src/com/wiredtiger/db/WiredTigerException.java b/lang/java/src/com/wiredtiger/db/WiredTigerException.java
index 8430092789e..6424cb3a92e 100644
--- a/lang/java/src/com/wiredtiger/db/WiredTigerException.java
+++ b/lang/java/src/com/wiredtiger/db/WiredTigerException.java
@@ -1,3 +1,9 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
package com.wiredtiger.db;
/**
diff --git a/lang/java/src/com/wiredtiger/db/WiredTigerPackingException.java b/lang/java/src/com/wiredtiger/db/WiredTigerPackingException.java
index c06c3ba6fd8..1c4ab079748 100644
--- a/lang/java/src/com/wiredtiger/db/WiredTigerPackingException.java
+++ b/lang/java/src/com/wiredtiger/db/WiredTigerPackingException.java
@@ -1,3 +1,9 @@
+/*-
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * See the file LICENSE for redistribution information.
+ */
package com.wiredtiger.db;
/**
diff --git a/lang/java/wiredtiger.i b/lang/java/wiredtiger.i
index 07e6aabeaf7..a5f03ad9416 100644
--- a/lang/java/wiredtiger.i
+++ b/lang/java/wiredtiger.i
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2008-2012 WiredTiger, Inc.
+ * Copyright (c) 2008-2013 WiredTiger, Inc.
* All rights reserved.
*
* See the file LICENSE for redistribution information.
@@ -120,8 +120,8 @@ SELFHELPER(struct __wt_cursor, cursor)
*/
public ";
%enddef
-%include "java_doc.i"
+%include "java_doc.i"
/* WT_CURSOR customization. */
/* First, replace the varargs get / set methods with Java equivalents. */
diff --git a/test/java/com/wiredtiger/test/CursorTest.java b/test/java/com/wiredtiger/test/CursorTest.java
index 835366098a7..f5608e96554 100644
--- a/test/java/com/wiredtiger/test/CursorTest.java
+++ b/test/java/com/wiredtiger/test/CursorTest.java
@@ -1,3 +1,29 @@
+/*-
+ * Public Domain 2008-2013 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
package com.wiredtiger.test;
import com.wiredtiger.db.Connection;
diff --git a/test/java/com/wiredtiger/test/PackTest.java b/test/java/com/wiredtiger/test/PackTest.java
index c699e512fd5..a16d03a1fb0 100644
--- a/test/java/com/wiredtiger/test/PackTest.java
+++ b/test/java/com/wiredtiger/test/PackTest.java
@@ -1,3 +1,29 @@
+/*-
+ * Public Domain 2008-2013 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
package com.wiredtiger.test;
import com.wiredtiger.db.PackOutputStream;
@@ -188,11 +214,13 @@ public class PackTest {
PackInputStream unpacker =
new PackInputStream("QQ", packer.getValue());
long unpacked = unpacker.getLong();
- if (val1 != unpacked)
+ if (val1 != unpacked) {
System.out.println(i + " did not match " + unpacked);
+ }
unpacked = unpacker.getLong();
- if (val2 != unpacked)
+ if (val2 != unpacked) {
System.out.println(i + " did not match " + unpacked);
+ }
}
}
diff --git a/test/java/com/wiredtiger/test/WiredTigerSuite.java b/test/java/com/wiredtiger/test/WiredTigerSuite.java
index 928055bf6b7..0bdb4308871 100644
--- a/test/java/com/wiredtiger/test/WiredTigerSuite.java
+++ b/test/java/com/wiredtiger/test/WiredTigerSuite.java
@@ -1,3 +1,29 @@
+/*-
+ * Public Domain 2008-2013 WiredTiger, Inc.
+ *
+ * This is free and unencumbered software released into the public domain.
+ *
+ * Anyone is free to copy, modify, publish, use, compile, sell, or
+ * distribute this software, either in source code form or as a compiled
+ * binary, for any purpose, commercial or non-commercial, and by any
+ * means.
+ *
+ * In jurisdictions that recognize copyright laws, the author or authors
+ * of this software dedicate any and all copyright interest in the
+ * software to the public domain. We make this dedication for the benefit
+ * of the public at large and to the detriment of our heirs and
+ * successors. We intend this dedication to be an overt act of
+ * relinquishment in perpetuity of all present and future rights to this
+ * software under copyright law.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
package com.wiredtiger.test;
import org.junit.runner.RunWith;