You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by GitBox <gi...@apache.org> on 2017/10/28 17:35:34 UTC

[GitHub] matthiasblaesing closed pull request #200: Module review project ant

matthiasblaesing closed pull request #200: Module review project ant
URL: https://github.com/apache/incubator-netbeans/pull/200
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/openide.util/src/org/openide/util/EditableProperties.java b/openide.util/src/org/openide/util/EditableProperties.java
index 4ef396b4d..42c24c92d 100644
--- a/openide.util/src/org/openide/util/EditableProperties.java
+++ b/openide.util/src/org/openide/util/EditableProperties.java
@@ -83,7 +83,9 @@
             for (Item _i : original.items) {
                 Item i = (Item) _i.clone();
                 items.add(i);
-                itemIndex.put(i.getKey(), i);
+                if(i.getKey() != null) {
+                    itemIndex.put(i.getKey(), i);
+                }
             }
         }
     }
@@ -832,7 +834,7 @@ public SetImpl() {}
         }
         
         public int size() {
-            return state.items.size();
+            return state.itemIndex.size();
         }
         
     }
diff --git a/openide.util/test/unit/src/org/openide/util/EditablePropertiesTest.java b/openide.util/test/unit/src/org/openide/util/EditablePropertiesTest.java
index 65ce2ccf4..55b1b4a86 100644
--- a/openide.util/test/unit/src/org/openide/util/EditablePropertiesTest.java
+++ b/openide.util/test/unit/src/org/openide/util/EditablePropertiesTest.java
@@ -33,6 +33,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Properties;
 import org.netbeans.junit.NbTestCase;
 
@@ -357,6 +358,30 @@ public void testNonLatinComments() throws Exception {
         assertEquals("Reading and re-writing non-Latin chars in comments works", expected, getAsString(p));
     }
 
+    // Test consistency of size of the property list for different view of it
+    public void testConsistentSize() throws Exception {
+        EditableProperties testProperties = loadTestProperties();
+        // Enumerate entries manually
+        int count = 0;
+        for(Entry<String,String> entry: testProperties.entrySet()) {
+            count++;
+        }
+        assertEquals(testProperties.size(), count);
+        assertEquals(testProperties.size(), testProperties.entrySet().size());
+        assertEquals(testProperties.size(), testProperties.keySet().size());
+    }
+    
+    // This test ensures, that the copy constructor or EditableProperties.State
+    // does not introduce NULL keys. These NULL keys are observable from the
+    // outside by an increased number of elements.
+    public void testCopyWithIndependentComments() throws Exception {
+        EditableProperties testProperties = loadTestProperties();
+        EditableProperties test2Properties = testProperties.cloneProperties();
+        int originalSize = testProperties.size();
+        assertTrue(testProperties.containsKey("key1"));
+        testProperties.setProperty("key1", "XXX");
+        assertEquals(originalSize, testProperties.size());
+    }
     
     // helper methods:
     
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build-impl.xsl b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build-impl.xsl
index ab277e944..141b26d13 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build-impl.xsl
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build-impl.xsl
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:p="http://www.netbeans.org/ns/project/1"
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build.xsl b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build.xsl
index 096827db3..9108557a3 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build.xsl
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build.xsl
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:project="http://www.netbeans.org/ns/project/1"
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build2.xsl b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build2.xsl
index 9852314a3..46d409a25 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build2.xsl
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/build2.xsl
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:project="http://www.netbeans.org/ns/project/1"
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/extension1.xml b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/extension1.xml
index 8ebdf27b7..07147c7cd 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/extension1.xml
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/extension1.xml
@@ -1,5 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <!--
     Document   : extension1.xml.xml
     Created on : March 28, 2007, 3:56 PM
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/global.properties b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/global.properties
index 905eff7de..04ea65dc1 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/global.properties
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/global.properties
@@ -1 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
 global.prop=value5
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.properties b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.properties
index 741904947..1893d1796 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.properties
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.properties
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+
 private.prop=value2
 overridden.prop=value4
 tempdir=${java.io.tmpdir}/foo
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.xml b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.xml
index d539645c6..61407e87c 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.xml
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/private.xml
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
     <data xmlns="urn:test:private">
         <private-stuff/>
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/project-modified.xml b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/project-modified.xml
index 95c2d97a6..96052bc70 100644
--- a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/project-modified.xml
+++ b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/project-modified.xml
@@ -1,4 +1,24 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+
+-->
 <project xmlns="http://www.netbeans.org/ns/project/1">
     <type>test</type>
     <configuration>
diff --git a/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/test.txt b/project.ant/test/unit/src/org/netbeans/spi/project/support/ant/data/test.txt
deleted file mode 100644
index e69de29bb..000000000


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services