class MessageProperties {

  @Nullable static String getPropertyIfString(Message message, String name) {
    try {
      Object o = message.getObjectProperty(name);
      if (o instanceof String) return o.toString();
      return null;
    } catch (Throwable t) {
      propagateIfFatal(t);
      log(t, "error getting property {0} from message {1}", name, message);
      return null;
    }
  }

}