File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
src/test/java/org/codehaus/plexus/components/secdispatcher/internal Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 13
13
14
14
package org .codehaus .plexus .components .secdispatcher .internal ;
15
15
16
- import java .io .FileWriter ;
16
+ import java .io .OutputStream ;
17
17
import java .nio .charset .StandardCharsets ;
18
+ import java .nio .file .Files ;
19
+ import java .nio .file .Paths ;
18
20
import java .util .Base64 ;
19
21
import java .util .Map ;
20
22
import java .util .Set ;
@@ -49,9 +51,8 @@ private void saveSec(String masterSource) throws Exception {
49
51
sec .setMasterSource (masterSource );
50
52
sec .setMasterCipher (AESGCMNoPadding .CIPHER_ALG );
51
53
52
- try (FileWriter fw = new FileWriter ("./target/sec.xml" )) {
53
- new SecurityConfigurationStaxWriter ().write (fw , sec );
54
- fw .flush ();
54
+ try (OutputStream fos = Files .newOutputStream (Paths .get ("./target/sec.xml" ))) {
55
+ new SecurityConfigurationStaxWriter ().write (fos , sec );
55
56
}
56
57
System .setProperty (DefaultSecDispatcher .SYSTEM_PROPERTY_CONFIGURATION_LOCATION , "./target/sec.xml" );
57
58
}
Original file line number Diff line number Diff line change 13
13
14
14
package org .codehaus .plexus .components .secdispatcher .internal ;
15
15
16
- import java .io .FileWriter ;
16
+ import java .io .OutputStream ;
17
+ import java .nio .file .Files ;
18
+ import java .nio .file .Paths ;
17
19
import java .util .Map ;
18
20
19
21
import org .codehaus .plexus .components .secdispatcher .model .Config ;
@@ -54,9 +56,8 @@ private void saveSec(String masterSource) throws Exception {
54
56
55
57
sec .addConfiguration (conf );
56
58
57
- try (FileWriter fw = new FileWriter ("./target/sec1.xml" )) {
58
- new SecurityConfigurationStaxWriter ().write (fw , sec );
59
- fw .flush ();
59
+ try (OutputStream fos = Files .newOutputStream (Paths .get ("./target/sec1.xml" ))) {
60
+ new SecurityConfigurationStaxWriter ().write (fos , sec );
60
61
}
61
62
}
62
63
@@ -65,9 +66,8 @@ public void prepare() throws Exception {
65
66
System .setProperty (DefaultSecDispatcher .SYSTEM_PROPERTY_CONFIGURATION_LOCATION , "./target/sec.xml" );
66
67
SettingsSecurity sec = new SettingsSecurity ();
67
68
sec .setRelocation ("./target/sec1.xml" );
68
- try (FileWriter fw = new FileWriter ("./target/sec.xml" )) {
69
- new SecurityConfigurationStaxWriter ().write (fw , sec );
70
- fw .flush ();
69
+ try (OutputStream fos = Files .newOutputStream (Paths .get ("./target/sec.xml" ))) {
70
+ new SecurityConfigurationStaxWriter ().write (fos , sec );
71
71
}
72
72
saveSec ("magic:mighty" );
73
73
}
You can’t perform that action at this time.
0 commit comments