You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2012/12/07 16:17:21 UTC

svn commit: r1418353 - /stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java

Author: rwesten
Date: Fri Dec  7 15:17:20 2012
New Revision: 1418353

URL: http://svn.apache.org/viewvc?rev=1418353&view=rev
Log:
fix for STANBOL-829

Modified:
    stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java

Modified: stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java?rev=1418353&r1=1418352&r2=1418353&view=diff
==============================================================================
--- stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java (original)
+++ stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/impl/SiteManagerImpl.java Fri Dec  7 15:17:20 2012
@@ -140,19 +140,23 @@ public class SiteManagerImpl implements 
             //use a set to iterate to remove possible duplicates
             for(String prefix : new HashSet<String>(Arrays.asList(prefixArray))){
                 synchronized (prefixMap) {
-                    Collection<Site> sites = prefixMap.get(prefix);
-                    if(sites == null){
-                        sites = new CopyOnWriteArrayList<Site>();
-                        prefixMap.put(prefix, sites);
-                        //this also means that the prefix is not part of the prefixList
-                        int pos = Collections.binarySearch(prefixList, prefix);
-                        if(pos<0){
-                            prefixList.add(Math.abs(pos)-1,prefix);
+                    if(prefix == null || prefix.isEmpty()){
+                        noPrefixSites.add(referencedSite);
+                    } else {
+                        Collection<Site> sites = prefixMap.get(prefix);
+                        if(sites == null){
+                            sites = new CopyOnWriteArrayList<Site>();
+                            prefixMap.put(prefix, sites);
+                            //this also means that the prefix is not part of the prefixList
+                            int pos = Collections.binarySearch(prefixList, prefix);
+                            if(pos<0){
+                                prefixList.add(Math.abs(pos)-1,prefix);
+                            }
+                            //prefixList.add(Collections.binarySearch(prefixList, prefix)+1,prefix);
                         }
-                        //prefixList.add(Collections.binarySearch(prefixList, prefix)+1,prefix);
+                        //TODO: Sort the referencedSites based on the ServiceRanking!
+                        sites.add(referencedSite);
                     }
-                    //TODO: Sort the referencedSites based on the ServiceRanking!
-                    sites.add(referencedSite);
                 }
             }
         }