private static Pair processAttribute(String s, String s1) { String s2 = StringUtil.clipString(s, 50, false); if (s2.length() < s.length()) { logger.devw("The attribute key has been trimmed to a length of 50 characters"); } s = StringUtil.clipString(s1, 1000, false); if (s.length() < s1.length()) { logger.devw("The attribute value has been trimmed to a length of 1000 characters"); } return new Pair(s2, s); }
private static Pair processMetric(String s, Number number) { String s1 = StringUtil.clipString(s, 50, false); if (s1.length() < s.length()) { logger.devw("The metric key has been trimmed to a length of 50 characters"); } return new Pair(s1, number); }
public void addAttribute(String s, String s1) { this; JVM INSTR monitorenter ; if (s == null || s1 == null) { break MISSING_BLOCK_LABEL_74; } if (!decoratedEvent.hasAttribute(s) && currentNumOfAttributesAndMetrics.get() < maxAttributesAndMetrics) { s = processAttribute(s, s1); decoratedEvent.addAttribute((String)s.getKey(), (String)s.getValue()); currentNumOfAttributesAndMetrics.incrementAndGet(); } _L2: this; JVM INSTR monitorexit ; return; s; logger.e("addAttribute", s); if (true) goto _L2; else goto _L1
public class EventConstraintDecorator implements Event { private static class Pair { private Object key; private Object value; private Object getKey() { return key; } private Object getValue() { return value; } public Pair(Object obj, Object obj1) { key = obj; value = obj1; } } private static Logger logger = Logger.getLogger(com/amazon/insights/event/EventConstraintDecorator); private final AtomicInteger currentNumOfAttributesAndMetrics = new AtomicInteger(0); private final Event decoratedEvent; private final int maxAttributesAndMetrics; public EventConstraintDecorator(Event event, int i) { decoratedEvent = event; maxAttributesAndMetrics = i; } public static EventConstraintDecorator newInstance(Event event) { return new EventConstraintDecorator(event, 20); } private static Pair processAttribute(String s, String s1) { String s2 = StringUtil.clipString(s, 50, false); if (s2.length() < s.length()) { logger.devw("The attribute key has been trimmed to a length of 50 characters"); } s = StringUtil.clipString(s1, 1000, false); if (s.length() < s1.length()) { logger.devw("The attribute value has been trimmed to a length of 1000 characters"); } return new Pair(s2, s); } private static Pair processMetric(String s, Number number) { String s1 = StringUtil.clipString(s, 50, false); if (s1.length() < s.length()) { logger.devw("The metric key has been trimmed to a length of 50 characters"); } return new Pair(s1, number); } public void addAttribute(String s, String s1) { this; JVM INSTR monitorenter ; if (s == null || s1 == null) { break MISSING_BLOCK_LABEL_74; } if (!decoratedEvent.hasAttribute(s) && currentNumOfAttributesAndMetrics.get() < maxAttributesAndMetrics) { s = processAttribute(s, s1); decoratedEvent.addAttribute((String)s.getKey(), (String)s.getValue()); currentNumOfAttributesAndMetrics.incrementAndGet(); } _L2: this; JVM INSTR monitorexit ; return; s; logger.e("addAttribute", s); if (true) goto _L2; else goto _L1 _L1: s; throw s; }