File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
dubbo-common/src/main/java/org/apache/dubbo/common Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -144,14 +144,18 @@ private static String getPrefixDigits(String v) {
144144 public static String getVersion (Class <?> cls , String defaultVersion ) {
145145 try {
146146 // find version info from MANIFEST.MF first
147- String version = cls .getPackage ().getImplementationVersion ();
148- if (!StringUtils .isEmpty (version )) {
149- return version ;
150- }
151-
152- version = cls .getPackage ().getSpecificationVersion ();
153- if (!StringUtils .isEmpty (version )) {
154- return version ;
147+ Package pkg = cls .getPackage ();
148+ String version = null ;
149+ if (pkg != null ) {
150+ version = pkg .getImplementationVersion ();
151+ if (!StringUtils .isEmpty (version )) {
152+ return version ;
153+ }
154+
155+ version = pkg .getSpecificationVersion ();
156+ if (!StringUtils .isEmpty (version )) {
157+ return version ;
158+ }
155159 }
156160
157161 // guess version fro jar file name if nothing's found from MANIFEST.MF
You can’t perform that action at this time.
0 commit comments