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

alibaba / jetcache / #405

16 Apr 2024 05:58AM UTC coverage: 0.0% (-88.9%) from 88.866%
#405

push

areyouok
add encoding to fix coverage report

0 of 5353 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/jetcache-core/src/main/java/com/alicp/jetcache/support/KryoValueDecoder.java
1
package com.alicp.jetcache.support;
2

3
import com.esotericsoftware.kryo.Kryo;
4
import com.esotericsoftware.kryo.io.Input;
5

6
import java.io.ByteArrayInputStream;
7

8
/**
9
 * Created on 2016/10/4.
10
 *
11
 * @author huangli
12
 */
13
public class KryoValueDecoder extends AbstractValueDecoder {
14

15
    public static final KryoValueDecoder INSTANCE = new KryoValueDecoder(true);
×
16

17
    public KryoValueDecoder(boolean useIdentityNumber) {
18
        super(useIdentityNumber);
×
19
    }
×
20

21
    @Override
22
    public Object doApply(byte[] buffer) {
23
        ByteArrayInputStream in;
24
        if (useIdentityNumber) {
×
25
            in = new ByteArrayInputStream(buffer, 4, buffer.length - 4);
×
26
        } else {
27
            in = new ByteArrayInputStream(buffer);
×
28
        }
29
        Input input = new Input(in);
×
30
        KryoValueEncoder.KryoCache kryoCache = null;
×
31
        try {
32
            kryoCache =  KryoValueEncoder.kryoCacheObjectPool.borrowObject();
×
33
            Kryo kryo = kryoCache.getKryo();
×
34
            ClassLoader classLoader = KryoValueDecoder.class.getClassLoader();
×
35
            Thread t = Thread.currentThread();
×
36
            if (t != null) {
×
37
                ClassLoader ctxClassLoader = t.getContextClassLoader();
×
38
                if (ctxClassLoader != null) {
×
39
                    classLoader = ctxClassLoader;
×
40
                }
41
            }
42
            kryo.setClassLoader(classLoader);
×
43
            return kryo.readClassAndObject(input);
×
44
        }finally {
45
            if(kryoCache != null){
×
46
                KryoValueEncoder.kryoCacheObjectPool.returnObject(kryoCache);
×
47
            }
48
        }
49
    }
50
}
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

© 2025 Coveralls, Inc