• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wuwen5 / hessian / 17834723885

18 Sep 2025 04:10PM UTC coverage: 69.377% (+0.09%) from 69.283%
17834723885

push

github

web-flow
refactor: rename duplicate class names (#48)

* refactor: rename duplicate class names

* chore: license

1843 of 2851 branches covered (64.64%)

Branch coverage included in aggregate %.

4249 of 5930 relevant lines covered (71.65%)

3.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
hessian2-codec/src/main/java/io/github/wuwen5/hessian/io/InetAddressHandle.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *     http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17

18
package io.github.wuwen5.hessian.io;
19

20
import com.caucho.hessian.io.HessianHandle;
21
import java.io.IOException;
22
import java.net.Inet6Address;
23
import java.net.InetAddress;
24
import java.net.NetworkInterface;
25
import lombok.extern.slf4j.Slf4j;
26

27
/**
28
 * Handle for an InetAddress object.
29
 */
30
@Slf4j
4✔
31
public class InetAddressHandle implements java.io.Serializable, HessianHandle {
32

33
    private String hostName;
34
    private byte[] address;
35
    private int scopeId;
36
    private String ifname;
37

38
    public InetAddressHandle(String hostName, byte[] address) {
39
        this(hostName, address, -1, null);
6✔
40
    }
1✔
41

42
    public InetAddressHandle(String hostName, byte[] address, int scopeId, String ifname) {
2✔
43
        this.hostName = hostName;
3✔
44
        this.address = address;
3✔
45
        this.scopeId = scopeId;
3✔
46
        this.ifname = ifname;
3✔
47
    }
1✔
48

49
    private Object readResolve() {
50
        if (ifname != null) {
3✔
51
            try {
52
                NetworkInterface scopeIfname = NetworkInterface.getByName(ifname);
4✔
53
                if (scopeIfname != null) {
2!
54
                    return Inet6Address.getByAddress(this.hostName, this.address, scopeIfname);
7✔
55
                }
56
            } catch (IOException e) {
×
57
                log.debug("Failed to get network interface by name: {}", ifname, e);
×
58
            }
×
59
        }
60

61
        try {
62

63
            if (scopeId >= 0) {
3✔
64
                return Inet6Address.getByAddress(this.hostName, this.address, this.scopeId);
8✔
65
            }
66
            return InetAddress.getByAddress(this.hostName, this.address);
6✔
67
        } catch (IOException e) {
×
68
            log.debug(e.toString(), e);
×
69
            return null;
×
70
        }
71
    }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc