LayerAdapterFactory.java
3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.adapter.Adaptable
* org.apache.sling.api.adapter.AdapterFactory
*/
package com.day.image.internal;
import com.day.image.Layer;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.adapter.Adaptable;
import org.apache.sling.api.adapter.AdapterFactory;
import javax.imageio.IIOException;
import java.io.IOException;
import java.io.InputStream;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
@Component
@Service
@Properties(value={@Property(name="adaptables", value={"org.apache.sling.api.adapter.Adaptable"}), @Property(name="adapters", value={"com.day.image.Layer"}), @Property(name="adapter.condition", value={"If the adaptable can be adapted to an InputStream."})})
public class LayerAdapterFactory
implements AdapterFactory {
/*
* WARNING - Removed try catching itself - possible behaviour change.
* Loose catch block
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
* Lifted jumps to return sites
*/
public <AdapterType> AdapterType getAdapter(Object object, Class<AdapterType> type) {
if (type != Layer.class) return null;
if (!(object instanceof Adaptable)) return null;
Adaptable source = (Adaptable)object;
InputStream ins = (InputStream)source.adaptTo(InputStream.class);
if (ins == null) return null;
Layer layer = new Layer(ins);
if (ins == null) return (AdapterType)layer;
try {
ins.close();
return (AdapterType)layer;
}
catch (IOException ioe) {
// empty catch block
}
return (AdapterType)layer;
catch (IIOException iioe) {
if (ins == null) return null;
try {
ins.close();
return null;
}
catch (IOException ioe) {
return null;
}
catch (IOException ioe) {
if (ins == null) return null;
try {
ins.close();
return null;
}
catch (IOException ioe) {
return null;
}
catch (OutOfMemoryError oome) {
if (ins == null) return null;
try {
ins.close();
return null;
}
catch (IOException ioe) {
return null;
}
catch (Throwable t) {
if (ins == null) return null;
try {
ins.close();
return null;
}
catch (IOException ioe) {
return null;
}
catch (Throwable throwable) {
if (ins == null) throw throwable;
try {
ins.close();
throw throwable;
}
catch (IOException ioe) {
// empty catch block
}
throw throwable;
}
}
}
}
}
}
}