导航菜单

页面标题

页面副标题

管控平台 v5.2.3.0. - a.java 源代码

正在查看: 管控平台 v5.2.3.0. 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package io.sentry.event;

import io.sentry.event.Event;
import io.sentry.event.interfaces.SentryInterface;
import java.net.InetAddress;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.slf4j.c;

public class a {
    public static final long d = TimeUnit.HOURS.toMillis(5);
    private static final b e;

    private final Event f3230a;

    private boolean f3231b;

    private Set<String> f3232c;

    private static final class b {
        public static final long e = TimeUnit.SECONDS.toMillis(1);
        private static final org.slf4j.b f = c.i(b.class);

        private final long f3233a;

        private volatile String f3234b;

        private volatile long f3235c;
        private AtomicBoolean d;

        class CallableC0053a implements Callable<Void> {
            CallableC0053a() {
            }

            @Override
            public Void call() throws Exception {
                try {
                    b.this.f3234b = InetAddress.getLocalHost().getCanonicalHostName();
                    b.this.f3235c = System.currentTimeMillis() + b.this.f3233a;
                    b.this.d.set(false);
                    return null;
                } catch (Throwable th) {
                    b.this.d.set(false);
                    throw th;
                }
            }
        }

        public String e() {
            if (this.f3235c < System.currentTimeMillis() && this.d.compareAndSet(false, true)) {
                f();
            }
            return this.f3234b;
        }

        public void f() {
            CallableC0053a callableC0053a = new CallableC0053a();
            try {
                f.debug("Updating the hostname cache");
                FutureTask futureTask = new FutureTask(callableC0053a);
                new Thread(futureTask).start();
                futureTask.get(e, TimeUnit.MILLISECONDS);
            } catch (Exception e2) {
                this.f3235c = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(1L);
                f.debug("Localhost hostname lookup failed, keeping the value '{}'. If this persists it may mean your DNS is incorrectly configured and you may want to hardcode your server name: https://docs.sentry.io/clients/java/config/", this.f3234b, e2);
            }
        }

        private b(long j) {
            this.f3234b = "unavailable";
            this.d = new AtomicBoolean(false);
            this.f3233a = j;
        }
    }

    static {
        Charset.forName("UTF-8");
        e = new b(d);
    }

    public a() {
        this(UUID.randomUUID());
    }

    private void a() {
        if (this.f3230a.getTimestamp() == null) {
            this.f3230a.setTimestamp(new Date());
        }
        if (this.f3230a.getPlatform() == null) {
            this.f3230a.setPlatform("java");
        }
        if (this.f3230a.getSdk() == null) {
            this.f3230a.setSdk(new Sdk("sentry-java", "1.7.16-9b60b", this.f3232c));
        }
        if (this.f3230a.getServerName() == null) {
            this.f3230a.setServerName(e.e());
        }
    }

    private void d() {
        Event event = this.f3230a;
        event.setTags(Collections.unmodifiableMap(event.getTags()));
        Event event2 = this.f3230a;
        event2.setBreadcrumbs(Collections.unmodifiableList(event2.getBreadcrumbs()));
        HashMap hashMap = new HashMap();
        for (Map.Entry<String, Map<String, Object>> entry : this.f3230a.getContexts().entrySet()) {
            hashMap.put(entry.getKey(), Collections.unmodifiableMap(entry.getValue()));
        }
        this.f3230a.setContexts(Collections.unmodifiableMap(hashMap));
        Event event3 = this.f3230a;
        event3.setExtra(Collections.unmodifiableMap(event3.getExtra()));
        Event event4 = this.f3230a;
        event4.setSentryInterfaces(Collections.unmodifiableMap(event4.getSentryInterfaces()));
    }

    public synchronized Event b() {
        if (this.f3231b) {
            throw new IllegalStateException("A message can't be built twice");
        }
        a();
        d();
        this.f3231b = true;
        return this.f3230a;
    }

    public Event c() {
        return this.f3230a;
    }

    public a e(List<Breadcrumb> list) {
        this.f3230a.setBreadcrumbs(list);
        return this;
    }

    public a f(Map<String, Map<String, Object>> map) {
        this.f3230a.setContexts(map);
        return this;
    }

    public a g(String str) {
        this.f3230a.setDist(str);
        return this;
    }

    public a h(String str) {
        this.f3230a.setEnvironment(str);
        return this;
    }

    public a i(String str, Object obj) {
        this.f3230a.getExtra().put(str, obj);
        return this;
    }

    public a j(Event.Level level) {
        this.f3230a.setLevel(level);
        return this;
    }

    public a k(String str) {
        this.f3230a.setMessage(str);
        return this;
    }

    public a l(String str) {
        this.f3230a.setRelease(str);
        return this;
    }

    public a m(String str) {
        this.f3232c.add(str);
        return this;
    }

    public a n(SentryInterface sentryInterface) {
        o(sentryInterface, true);
        return this;
    }

    public a o(SentryInterface sentryInterface, boolean z) {
        if (z || !this.f3230a.getSentryInterfaces().containsKey(sentryInterface.getInterfaceName())) {
            this.f3230a.getSentryInterfaces().put(sentryInterface.getInterfaceName(), sentryInterface);
        }
        return this;
    }

    public a p(String str) {
        this.f3230a.setServerName(str);
        return this;
    }

    public a q(String str, String str2) {
        this.f3230a.getTags().put(str, str2);
        return this;
    }

    public String toString() {
        return "EventBuilder{event=" + this.f3230a + ", alreadyBuilt=" + this.f3231b + '}';
    }

    public a(UUID uuid) {
        this.f3231b = false;
        this.f3232c = new HashSet();
        this.f3230a = new Event(uuid);
    }
}