Author: ajamtli
Date: 2006-04-19 12:05:50 +0200 (Wed, 19 Apr 2006)
New Revision: 2767

Modified:
   trunk/src/java/no/schibstedsok/front/searchportal/result/Decoder.java
Log:
Making sure the infotext is not cut in the middle of a HTML tag. 

Modified: trunk/src/java/no/schibstedsok/front/searchportal/result/Decoder.java
===================================================================
--- trunk/src/java/no/schibstedsok/front/searchportal/result/Decoder.java       
2006-04-19 09:28:16 UTC (rev 2766)
+++ trunk/src/java/no/schibstedsok/front/searchportal/result/Decoder.java       
2006-04-19 10:05:50 UTC (rev 2767)
@@ -36,8 +36,13 @@
             if (s.length() < length) {
                 length = s.length();
                 s = s.substring(0, length);
-            } else
+            } else {
+                /* Make sure we are not cutting the string in the middle of a 
HTML tag. */
+                if (s.indexOf("<",length) > s.indexOf(">", length)){
+                    length = s.indexOf(">", length) + 1;
+                }
                 s = s.substring(0, length) + "..";
+            }
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
         }

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to