Project

General

Profile

« Previous | Next » 

Revision 894

Added by berkley over 22 years ago

fixed bug with ampersands in the returned relations in the resultset.

View differences:

MetaCatUtil.java
405 405
    }
406 406
    return options;
407 407
  }
408
  
409
  /** Normalizes the given string. Taken from configXML.java*/
410
  public static String normalize(String s)
411
  {
412
    StringBuffer str = new StringBuffer();
413

  
414
    int len = (s != null) ? s.length() : 0;
415
    for (int i = 0; i < len; i++)
416
    {
417
      char ch = s.charAt(i);
418
      switch (ch)
419
      {
420
      case '<':
421
      {
422
        str.append("&lt;");
423
        break;
424
      }
425
        case '>':
426
      {
427
        str.append("&gt;");
428
        break;
429
      }
430
      case '&':
431
      {
432
        str.append("&amp;");
433
        break;
434
      }
435
      case '"':
436
      {
437
        str.append("&quot;");
438
        break;
439
      }
440
      case '\r':
441
      case '\n':
442
      {
443
        // else, default append char
444
      }
445
      default:
446
      {
447
        str.append(ch);
448
      }
449
      }
450
    }
451
    return (str.toString());
452
  } 
453
  
408 454
}

Also available in: Unified diff