diff --git a/.gitignore b/.gitignore
index d557c95..ff93777 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
*.iws
build
out
+logs
diff --git a/RELEASE.md b/RELEASE.md
index d2e9783..a6fe356 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,3 +1,7 @@
+1.8.1 (2012/06/26)
+------------------
+* improved DB password masking to mask special characters (non alpha-numeric) as well
+
1.8.0 (2012/03/31)
------------------
* implemented [ticket #6](https://github.com/linkedin/linkedin-utils/issues/6): _Using Jackson JSON (de)serializer_ (thanks for the help from Zoran @ LinkedIn)
@@ -41,7 +45,7 @@ Note that ``prettyPrint`` returns a slightly different output than before (keys
------------------
* fixed [bug #1](https://github.com/linkedin/linkedin-utils/issues/1): _GroovyIOUtils.cat leaks memory_
- revisited several concepts dealing with the creation of temporary files
+ revisited several concepts dealing with the creation of temporary files
1.3.0 (2011/01/17)
------------------
@@ -59,4 +63,4 @@ Note that ``prettyPrint`` returns a slightly different output than before (keys
1.0.0 (2010/11/05)
------------------
-* First release
\ No newline at end of file
+* First release
diff --git a/org.linkedin.util-groovy/src/main/groovy/org/linkedin/groovy/util/io/DataMaskingInputStream.groovy b/org.linkedin.util-groovy/src/main/groovy/org/linkedin/groovy/util/io/DataMaskingInputStream.groovy
index ed9f29e..0c430a1 100644
--- a/org.linkedin.util-groovy/src/main/groovy/org/linkedin/groovy/util/io/DataMaskingInputStream.groovy
+++ b/org.linkedin.util-groovy/src/main/groovy/org/linkedin/groovy/util/io/DataMaskingInputStream.groovy
@@ -113,8 +113,12 @@ public class DataMaskingInputStream extends FilterInputStream {
value = "********"
}
+ if(value.contains('password=')){
+ value=value.replaceAll("password=[^&]*", "password=********")
+ }
+
if (value.contains('oracle')) {
- value = value.replaceAll("\\w*/\\w*", '********/********')
+ value = value.replaceAll("\\w*/[^@]*", '********/********')
}
return "${prefix}${key}${middle}${value}${suffix}"
diff --git a/org.linkedin.util-groovy/src/test/groovy/test/util/io/TestDataMaskingInputStream.groovy b/org.linkedin.util-groovy/src/test/groovy/test/util/io/TestDataMaskingInputStream.groovy
new file mode 100644
index 0000000..24fadd1
--- /dev/null
+++ b/org.linkedin.util-groovy/src/test/groovy/test/util/io/TestDataMaskingInputStream.groovy
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010-2010 LinkedIn, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package test.util.io
+
+import org.linkedin.groovy.util.io.DataMaskingInputStream
+
+/**
+ * User: hhan
+ * Date: 6/18/12
+ * Time: 3:16 PM
+ * @author hhan@linkedin.com
+ */
+class TestDataMaskingInputStream extends GroovyTestCase {
+
+ void testOracleDBContent()
+ {
+ def input = ' \n'
+
+ DataMaskingInputStream stream = new DataMaskingInputStream(new ByteArrayInputStream(input.getBytes("UTF-8")))
+ def lines = stream.readLines()
+ stream.close()
+ assertTrue(lines.size() == 1)
+
+ String line = lines[0].trim()
+ String expected = ''
+ assertEquals(line, expected)
+ }
+
+ void testMySQLDBContent()
+ {
+ def input = ' \n'
+
+ DataMaskingInputStream stream = new DataMaskingInputStream(new ByteArrayInputStream(input.getBytes("UTF-8")))
+ def lines = stream.readLines()
+ stream.close()
+ assertTrue(lines.size() == 1)
+
+ String line = lines[0].trim()
+ String expected = ''
+ assertEquals(line, expected)
+ }
+
+}
diff --git a/project-spec.groovy b/project-spec.groovy
index 7ea1771..ef0dc5f 100644
--- a/project-spec.groovy
+++ b/project-spec.groovy
@@ -18,7 +18,7 @@
spec = [
name: 'linkedin-utils',
group: 'org.linkedin',
- version: '1.8.0',
+ version: '1.8.1',
versions: [
groovy: '1.7.5',