Skip to content

Commit 49c089e

Browse files
committed
Further attempts to fix the build
1 parent 5555982 commit 49c089e

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

protobuf/src/main/java/module-info.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Protobuf Main artifact Module descriptor
22
module tools.jackson.dataformat.protobuf
33
{
4-
requires tools.jackson.core;
5-
requires tools.jackson.databind;
4+
requires transitive tools.jackson.core;
5+
requires transitive tools.jackson.databind;
66

77
// No module-info nor Automatic-Module-Name; relies on jar name:
88
requires protoparser;

protobuf/src/main/java/tools/jackson/dataformat/protobuf/ProtobufMapper.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.io.IOException;
55
import java.io.InputStream;
66
import java.net.URL;
7+
import java.util.Objects;
78
import java.util.concurrent.locks.ReentrantLock;
89

910
import tools.jackson.core.Version;
@@ -34,6 +35,13 @@ public Builder(ProtobufFactory f) {
3435
super(f);
3536
}
3637

38+
/**
39+
* NOTE: while technically public, not intended for external use
40+
* (since {@code StateImpl} is not public type)
41+
*
42+
* @param state State to restore to initialize constructed Builder
43+
*/
44+
@SuppressWarnings("exports")
3745
public Builder(StateImpl state) {
3846
super(state);
3947
}
@@ -209,15 +217,15 @@ public ProtobufSchema generateSchemaFor(TypeReference<?> type) {
209217
*/
210218

211219
public FileDescriptorSet loadDescriptorSet(URL src) throws IOException {
212-
return descriptorLoader().load(src);
220+
return descriptorLoader().load(Objects.requireNonNull(src));
213221
}
214222

215223
public FileDescriptorSet loadDescriptorSet(File src) throws IOException {
216-
return descriptorLoader().load(src);
224+
return descriptorLoader().load(Objects.requireNonNull(src));
217225
}
218226

219227
public FileDescriptorSet loadDescriptorSet(InputStream src) throws IOException {
220-
return descriptorLoader().load(src);
228+
return descriptorLoader().load(Objects.requireNonNull(src));
221229
}
222230

223231
/**

protobuf/src/main/java/tools/jackson/dataformat/protobuf/schema/DescriptorLoader.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.io.*;
44
import java.net.URL;
5+
import java.util.Objects;
56

67
import tools.jackson.databind.ObjectMapper;
78
import tools.jackson.databind.ObjectReader;
@@ -67,27 +68,27 @@ public static DescriptorLoader construct(ObjectMapper mapper,
6768

6869
public FileDescriptorSet load(URL src) throws IOException
6970
{
70-
return _reader.readValue(src);
71+
return _reader.readValue(Objects.requireNonNull(src));
7172
}
7273

7374
public FileDescriptorSet load(File src) throws IOException
7475
{
75-
return _reader.readValue(src);
76+
return _reader.readValue(Objects.requireNonNull(src));
7677
}
7778

7879
/**
7980
* Note: passed {@link java.io.InputStream} will be closed by this method.
8081
*/
8182
public FileDescriptorSet load(InputStream in) throws IOException
8283
{
83-
return _reader.readValue(in);
84+
return _reader.readValue(Objects.requireNonNull(in));
8485
}
8586

8687
/**
8788
* Note: passed {@link java.io.Reader} will be closed by this method.
8889
*/
8990
public FileDescriptorSet load(Reader r) throws IOException
9091
{
91-
return _reader.readValue(r);
92+
return _reader.readValue(Objects.requireNonNull(r));
9293
}
9394
}

protobuf/src/test/java/tools/jackson/dataformat/protobuf/schema/DescriptorLoaderTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public Main(Other o)
2828
}
2929
}
3030

31-
3231
static class Other
3332
{
3433
public int f;
@@ -68,7 +67,7 @@ public void testParsing() throws Exception
6867
// Deserialize the bytes using the descriptor
6968
// load main.desc descriptor file. This file was created by protoc - o main.desc main.proto other.proto
7069
FileDescriptorSet fds;
71-
try (InputStream in = this.getClass().getResourceAsStream("/main.desc")) {
70+
try (InputStream in = this.getClass().getResourceAsStream("/test/main.desc")) {
7271
fds = MAPPER.loadDescriptorSet(in);
7372
}
7473
ProtobufSchema schema2 = fds.schemaFor("Main");
File renamed without changes.

0 commit comments

Comments
 (0)