Skip to content

Commit 63bc20b

Browse files
committed
sonarqube cleanup.
1 parent cbb575a commit 63bc20b

61 files changed

Lines changed: 1413 additions & 1156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/org/hdf5javalib/dataclass/HdfArray.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.ArrayDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68

79
/**
@@ -76,7 +78,17 @@ public byte[] getBytes() {
7678
*/
7779
@Override
7880
public String toString() {
79-
return datatype.getInstance(String.class, bytes);
81+
try {
82+
return datatype.getInstance(String.class, bytes);
83+
} catch (InvocationTargetException e) {
84+
throw new RuntimeException(e);
85+
} catch (InstantiationException e) {
86+
throw new RuntimeException(e);
87+
} catch (IllegalAccessException e) {
88+
throw new RuntimeException(e);
89+
} catch (IOException e) {
90+
throw new RuntimeException(e);
91+
}
8092
}
8193

8294
/**
@@ -103,7 +115,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
103115
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
104116
*/
105117
@Override
106-
public <T> T getInstance(Class<T> clazz) {
118+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
107119
return datatype.getInstance(clazz, bytes);
108120
}
109121
}

src/main/java/org/hdf5javalib/dataclass/HdfBitField.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.BitFieldDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68
import java.util.BitSet;
79

@@ -168,7 +170,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
168170
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
169171
*/
170172
@Override
171-
public <T> T getInstance(Class<T> clazz) {
173+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
172174
return datatype.getInstance(clazz, bytes);
173175
}
174176

src/main/java/org/hdf5javalib/dataclass/HdfCompound.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.CompoundDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68
import java.util.ArrayList;
79
import java.util.Arrays;
@@ -76,7 +78,17 @@ public HdfCompound(byte[] bytes, CompoundDatatype datatype) {
7678
*/
7779
@Override
7880
public String toString() {
79-
return datatype.getInstance(String.class, bytes);
81+
try {
82+
return datatype.getInstance(String.class, bytes);
83+
} catch (InvocationTargetException e) {
84+
throw new RuntimeException(e);
85+
} catch (InstantiationException e) {
86+
throw new RuntimeException(e);
87+
} catch (IllegalAccessException e) {
88+
throw new RuntimeException(e);
89+
} catch (IOException e) {
90+
throw new RuntimeException(e);
91+
}
8092
}
8193

8294
/**
@@ -108,7 +120,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
108120
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
109121
*/
110122
@Override
111-
public <T> T getInstance(Class<T> clazz) {
123+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
112124
return datatype.getInstance(clazz, bytes);
113125
}
114126

src/main/java/org/hdf5javalib/dataclass/HdfCompoundMember.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.CompoundMemberDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68

79
/**
@@ -64,7 +66,17 @@ public HdfCompoundMember(byte[] bytes, CompoundMemberDatatype datatype) {
6466
*/
6567
@Override
6668
public String toString() {
67-
return datatype.getInstance(HdfData.class, bytes).toString();
69+
try {
70+
return datatype.getInstance(HdfData.class, bytes).toString();
71+
} catch (InvocationTargetException e) {
72+
throw new RuntimeException(e);
73+
} catch (InstantiationException e) {
74+
throw new RuntimeException(e);
75+
} catch (IllegalAccessException e) {
76+
throw new RuntimeException(e);
77+
} catch (IOException e) {
78+
throw new RuntimeException(e);
79+
}
6880
}
6981

7082
/**
@@ -91,7 +103,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
91103
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
92104
*/
93105
@Override
94-
public <T> T getInstance(Class<T> clazz) {
106+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
95107
return datatype.getInstance(clazz, bytes);
96108
}
97109

src/main/java/org/hdf5javalib/dataclass/HdfData.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.hdf5javalib.dataclass;
22

3+
import java.io.IOException;
4+
import java.lang.reflect.InvocationTargetException;
35
import java.nio.ByteBuffer;
46

57
/**
@@ -38,5 +40,5 @@ public interface HdfData {
3840
* @return an instance of type T created from the data
3941
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
4042
*/
41-
<T> T getInstance(Class<T> clazz);
43+
<T> T getInstance(Class<T> clazz) throws InvocationTargetException, InstantiationException, IllegalAccessException, IOException;
4244
}

src/main/java/org/hdf5javalib/dataclass/HdfEnum.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.EnumDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68

79
/**
@@ -79,7 +81,17 @@ public byte[] getBytes() {
7981
*/
8082
@Override
8183
public String toString() {
82-
return datatype.getInstance(String.class, bytes);
84+
try {
85+
return datatype.getInstance(String.class, bytes);
86+
} catch (InvocationTargetException e) {
87+
throw new RuntimeException(e);
88+
} catch (InstantiationException e) {
89+
throw new RuntimeException(e);
90+
} catch (IllegalAccessException e) {
91+
throw new RuntimeException(e);
92+
} catch (IOException e) {
93+
throw new RuntimeException(e);
94+
}
8395
}
8496

8597
/**
@@ -106,7 +118,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
106118
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
107119
*/
108120
@Override
109-
public <T> T getInstance(Class<T> clazz) {
121+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
110122
return datatype.getInstance(clazz, bytes);
111123
}
112124
}

src/main/java/org/hdf5javalib/dataclass/HdfFixedPoint.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import org.hdf5javalib.utils.HdfReadUtils;
55
import org.hdf5javalib.utils.HdfWriteUtils;
66

7+
import java.io.IOException;
8+
import java.lang.reflect.InvocationTargetException;
79
import java.math.BigInteger;
810
import java.nio.ByteBuffer;
911
import java.util.Arrays;
@@ -145,7 +147,17 @@ public boolean isUndefined() {
145147
*/
146148
@Override
147149
public String toString() {
148-
return datatype.getInstance(String.class, bytes);
150+
try {
151+
return datatype.getInstance(String.class, bytes);
152+
} catch (InvocationTargetException e) {
153+
throw new RuntimeException(e);
154+
} catch (InstantiationException e) {
155+
throw new RuntimeException(e);
156+
} catch (IllegalAccessException e) {
157+
throw new RuntimeException(e);
158+
} catch (IOException e) {
159+
throw new RuntimeException(e);
160+
}
149161
}
150162

151163
/**
@@ -177,7 +189,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
177189
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
178190
*/
179191
@Override
180-
public <T> T getInstance(Class<T> clazz) {
192+
public <T> T getInstance(Class<T> clazz) throws InvocationTargetException, InstantiationException, IllegalAccessException, IOException {
181193
return datatype.getInstance(clazz, bytes);
182194
}
183195

src/main/java/org/hdf5javalib/dataclass/HdfFloatPoint.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.FloatingPointDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68

79
/**
@@ -60,7 +62,17 @@ public HdfFloatPoint(byte[] bytes, FloatingPointDatatype datatype) {
6062
*/
6163
@Override
6264
public String toString() {
63-
return datatype.getInstance(String.class, bytes);
65+
try {
66+
return datatype.getInstance(String.class, bytes);
67+
} catch (InvocationTargetException e) {
68+
throw new RuntimeException(e);
69+
} catch (InstantiationException e) {
70+
throw new RuntimeException(e);
71+
} catch (IllegalAccessException e) {
72+
throw new RuntimeException(e);
73+
} catch (IOException e) {
74+
throw new RuntimeException(e);
75+
}
6476
}
6577

6678
/**
@@ -87,7 +99,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
8799
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
88100
*/
89101
@Override
90-
public <T> T getInstance(Class<T> clazz) {
102+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
91103
return datatype.getInstance(clazz, bytes);
92104
}
93105
}

src/main/java/org/hdf5javalib/dataclass/HdfOpaque.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.OpaqueDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68

79
/**
@@ -76,7 +78,17 @@ public byte[] getBytes() {
7678
*/
7779
@Override
7880
public String toString() {
79-
return datatype.getInstance(String.class, bytes);
81+
try {
82+
return datatype.getInstance(String.class, bytes);
83+
} catch (InvocationTargetException e) {
84+
throw new RuntimeException(e);
85+
} catch (InstantiationException e) {
86+
throw new RuntimeException(e);
87+
} catch (IllegalAccessException e) {
88+
throw new RuntimeException(e);
89+
} catch (IOException e) {
90+
throw new RuntimeException(e);
91+
}
8092
}
8193

8294
/**
@@ -103,7 +115,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
103115
* @throws UnsupportedOperationException if the datatype cannot convert to the requested type
104116
*/
105117
@Override
106-
public <T> T getInstance(Class<T> clazz) {
118+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
107119
return datatype.getInstance(clazz, bytes);
108120
}
109121
}

src/main/java/org/hdf5javalib/dataclass/HdfReference.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.hdf5javalib.datatype.ReferenceDatatype;
44

5+
import java.io.IOException;
6+
import java.lang.reflect.InvocationTargetException;
57
import java.nio.ByteBuffer;
68
import java.util.Arrays;
79
import java.util.Objects;
@@ -30,7 +32,17 @@ public ReferenceDatatype getDatatype() {
3032

3133
@Override
3234
public String toString() {
33-
return datatype.toString(bytes);
35+
try {
36+
return datatype.toString(bytes);
37+
} catch (InvocationTargetException e) {
38+
throw new RuntimeException(e);
39+
} catch (InstantiationException e) {
40+
throw new RuntimeException(e);
41+
} catch (IllegalAccessException e) {
42+
throw new RuntimeException(e);
43+
} catch (IOException e) {
44+
throw new RuntimeException(e);
45+
}
3446
}
3547

3648
@Override
@@ -39,7 +51,7 @@ public void writeValueToByteBuffer(ByteBuffer buffer) {
3951
}
4052

4153
@Override
42-
public <T> T getInstance(Class<T> clazz) {
54+
public <T> T getInstance(Class<T> clazz) throws IOException, InvocationTargetException, InstantiationException, IllegalAccessException {
4355
return datatype.getInstance(clazz, bytes);
4456
}
4557

0 commit comments

Comments
 (0)