File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/main/java/com/maxmind/db Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -235,14 +235,14 @@ public <T> Networks<T> networks(
235235 Class <T > typeParameterClass ) throws
236236 InvalidNetworkException , ClosedDatabaseException , InvalidDatabaseException {
237237 try {
238- InetAddress ipv4 = InetAddress .getByAddress (new byte [4 ]);
239- InetAddress ipv6 = InetAddress .getByAddress (new byte [16 ]);
240- Network ipAllV4 = new Network (ipv4 , 0 ); // Mask 32.
241- Network ipAllV6 = new Network (ipv6 , 0 ); // Mask 128.
242-
243238 if (this .getMetadata ().getIpVersion () == 6 ) {
239+ InetAddress ipv6 = InetAddress .getByAddress (new byte [16 ]);
240+ Network ipAllV6 = new Network (ipv6 , 0 ); // Mask 128.
244241 return this .networksWithin (ipAllV6 , includeAliasedNetworks , typeParameterClass );
245242 }
243+
244+ InetAddress ipv4 = InetAddress .getByAddress (new byte [4 ]);
245+ Network ipAllV4 = new Network (ipv4 , 0 ); // Mask 32.
246246 return this .networksWithin (ipAllV4 , includeAliasedNetworks , typeParameterClass );
247247 } catch (UnknownHostException e ) {
248248 /* This is returned by getByAddress. This should never happen
You can’t perform that action at this time.
0 commit comments