File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
src/main/java/life/qbic/registration/openbis Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -77,26 +77,16 @@ public void process(IDataSetRegistrationTransactionV2 transaction) {
77
77
78
78
private void moveFiles (IDataSetRegistrationTransactionV2 transactionV2 , IDataSet dataSet , File provenanceFile ) {
79
79
80
- byte [] buffer = null ;
81
80
try {
82
- buffer = Files .readAllBytes (provenanceFile .toPath ().toAbsolutePath ());
81
+ var buffer = Files .readAllBytes (provenanceFile .toPath ().toAbsolutePath ());
83
82
Files .delete (provenanceFile .toPath ());
84
- transactionV2 .moveFile (transactionV2 .getIncoming ().getAbsolutePath (), dataSet );
85
- } catch (RuntimeException e ) {
86
- //recover provenance file
87
83
try {
84
+ transactionV2 .moveFile (transactionV2 .getIncoming ().getAbsolutePath (), dataSet );
85
+ } catch (Exception e ) {
88
86
Files .write (provenanceFile .toPath ().toAbsolutePath (), buffer );
89
- } catch (IOException ex ) {
90
- throw new RuntimeException (ex );
87
+ throw new RuntimeException (e );
91
88
}
92
- throw e ;
93
89
} catch (IOException e ) {
94
- //recover provenance file
95
- try {
96
- Files .write (provenanceFile .toPath ().toAbsolutePath (), buffer );
97
- } catch (IOException ex ) {
98
- throw new RuntimeException (ex );
99
- }
100
90
throw new RuntimeException (e );
101
91
}
102
92
}
You can’t perform that action at this time.
0 commit comments