10
10
import java .time .ZoneId ;
11
11
import java .util .LinkedHashSet ;
12
12
import java .util .List ;
13
+ import java .util .Optional ;
13
14
import java .util .stream .Collectors ;
14
15
import java .util .stream .IntStream ;
15
16
16
17
import org .jabref .logic .importer .ImportFormatPreferences ;
18
+ import org .jabref .logic .importer .ParseException ;
17
19
import org .jabref .logic .importer .fileformat .BibtexParser ;
18
20
import org .jabref .model .entry .BibEntry ;
19
21
import org .jabref .model .entry .BibEntryPreferences ;
@@ -143,7 +145,7 @@ private static String toString(BibEntry entry) {
143
145
return entry .toString ();
144
146
}
145
147
146
- private static BibEntry fromString (String serializedString ) {
148
+ private static Optional < BibEntry > fromString (String serializedString ) {
147
149
try {
148
150
var importFormatPreferences = new ImportFormatPreferences (
149
151
new BibEntryPreferences ('$' ), null , null , null , null , null
@@ -153,10 +155,10 @@ private static BibEntry fromString(String serializedString) {
153
155
.map (entry -> {
154
156
entry .clearField (new UnknownField ("_jabref_shared" ));
155
157
return entry ;
156
- })
157
- . orElseThrow ();
158
- } catch ( Exception e ) {
159
- throw new RuntimeException ( e );
158
+ });
159
+ } catch ( ParseException e ) {
160
+ LOGGER . error ( "An error occurred while parsing from relation MV store." , e );
161
+ return Optional . empty ( );
160
162
}
161
163
}
162
164
@@ -177,7 +179,8 @@ public BibEntry read(ByteBuffer buff) {
177
179
int serializedEntrySize = buff .getInt ();
178
180
var serializedEntry = new byte [serializedEntrySize ];
179
181
buff .get (serializedEntry );
180
- return fromString (new String (serializedEntry , StandardCharsets .UTF_8 ));
182
+ return fromString (new String (serializedEntry , StandardCharsets .UTF_8 ))
183
+ .orElse (new BibEntry ());
181
184
}
182
185
183
186
@ Override
0 commit comments