File tree 1 file changed +11
-3
lines changed
src/main/java/org/codehaus/plexus/archiver/zip
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 34
34
import org .codehaus .plexus .util .FileUtils ;
35
35
import org .codehaus .plexus .util .IOUtil ;
36
36
37
- import javax .annotation .WillClose ;
38
37
import java .io .ByteArrayInputStream ;
39
38
import java .io .File ;
40
39
import java .io .FileOutputStream ;
@@ -119,8 +118,7 @@ public abstract class AbstractZipArchiver
119
118
* Java versions from 8 and up round timestamp up.
120
119
* s
121
120
*/
122
- private static final boolean isJava7OrLower =
123
- Integer .parseInt ( System .getProperty ( "java.version" ).split ( "\\ ." )[1 ] ) <= 7 ;
121
+ private static final boolean isJava7OrLower = getJavaVersion ()<= 7 ;
124
122
125
123
// Renamed version of original file, if it exists
126
124
private File renamedFile = null ;
@@ -133,6 +131,16 @@ public abstract class AbstractZipArchiver
133
131
134
132
protected ZipArchiveOutputStream zipArchiveOutputStream ;
135
133
134
+ private static int getJavaVersion (){
135
+ String javaSpecVersion = System .getProperty ( "java.specification.version" );
136
+ if (javaSpecVersion .contains ("." )) {//before jdk 9
137
+ return Integer .parseInt (javaSpecVersion .split ("\\ ." )[1 ]);
138
+ }else {
139
+ return Integer .parseInt (javaSpecVersion );
140
+ }
141
+ }
142
+
143
+
136
144
public String getComment ()
137
145
{
138
146
return comment ;
You can’t perform that action at this time.
0 commit comments