@@ -119,7 +119,7 @@ private enum Modes {
119119 private boolean LASTSEEN_ENABLED ;
120120 private boolean THREAT_ENABLED ;
121121
122- private static final String _ModuleVersion = "3.0.0 " ;
122+ private static final String _ModuleVersion = "3.0.1 " ;
123123
124124 public IP2Proxy () {
125125
@@ -300,15 +300,9 @@ public int Close() {
300300 }
301301
302302 private void DestroyMappedBytes () {
303- if (_IPv4Buffer != null ) {
304- _IPv4Buffer = null ;
305- }
306- if (_IPv6Buffer != null ) {
307- _IPv6Buffer = null ;
308- }
309- if (_MapDataBuffer != null ) {
310- _MapDataBuffer = null ;
311- }
303+ _IPv4Buffer = null ;
304+ _IPv6Buffer = null ;
305+ _MapDataBuffer = null ;
312306 }
313307
314308 private void CreateMappedBytes () throws IOException {
@@ -319,42 +313,33 @@ private void CreateMappedBytes() throws IOException {
319313 final FileChannel InChannel = RF .getChannel ();
320314 CreateMappedBytes (InChannel );
321315 }
322- catch (IOException Ex ) {
323- throw Ex ;
324- }
325316 finally {
326317 if (RF != null ) {
327318 RF .close ();
328- RF = null ;
329319 }
330320 }
331321 }
332322
333323 private void CreateMappedBytes (FileChannel InChannel ) throws IOException {
334- try {
335- if (_IPv4Buffer == null ) {
336- final long _IPv4Bytes = (long )_IPv4ColumnSize * (long )_DBCount ;
337- _IPv4Offset = _BaseAddr - 1 ;
338- _IPv4Buffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _IPv4Offset , _IPv4Bytes );
339- _IPv4Buffer .order (ByteOrder .LITTLE_ENDIAN );
340- _MapDataOffset = _IPv4Offset + _IPv4Bytes ;
341- }
342-
343- if (_DBCountIPv6 > 0 && _IPv6Buffer == null ) {
344- final long _IPv6Bytes = (long )_IPv6ColumnSize * (long )_DBCountIPv6 ;
345- _IPv6Offset = _BaseAddrIPv6 - 1 ;
346- _IPv6Buffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _IPv6Offset , _IPv6Bytes );
347- _IPv6Buffer .order (ByteOrder .LITTLE_ENDIAN );
348- _MapDataOffset = _IPv6Offset + _IPv6Bytes ;
349- }
350-
351- if (_MapDataBuffer == null ) {
352- _MapDataBuffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _MapDataOffset , InChannel .size () - _MapDataOffset );
353- _MapDataBuffer .order (ByteOrder .LITTLE_ENDIAN );
354- }
324+ if (_IPv4Buffer == null ) {
325+ final long _IPv4Bytes = (long )_IPv4ColumnSize * (long )_DBCount ;
326+ _IPv4Offset = _BaseAddr - 1 ;
327+ _IPv4Buffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _IPv4Offset , _IPv4Bytes );
328+ _IPv4Buffer .order (ByteOrder .LITTLE_ENDIAN );
329+ _MapDataOffset = _IPv4Offset + _IPv4Bytes ;
355330 }
356- catch (IOException Ex ) {
357- throw Ex ;
331+
332+ if (_DBCountIPv6 > 0 && _IPv6Buffer == null ) {
333+ final long _IPv6Bytes = (long )_IPv6ColumnSize * (long )_DBCountIPv6 ;
334+ _IPv6Offset = _BaseAddrIPv6 - 1 ;
335+ _IPv6Buffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _IPv6Offset , _IPv6Bytes );
336+ _IPv6Buffer .order (ByteOrder .LITTLE_ENDIAN );
337+ _MapDataOffset = _IPv6Offset + _IPv6Bytes ;
338+ }
339+
340+ if (_MapDataBuffer == null ) {
341+ _MapDataBuffer = InChannel .map (FileChannel .MapMode .READ_ONLY , _MapDataOffset , InChannel .size () - _MapDataOffset );
342+ _MapDataBuffer .order (ByteOrder .LITTLE_ENDIAN );
358343 }
359344 }
360345
@@ -453,13 +438,9 @@ private boolean LoadBIN() throws IOException {
453438 LoadOK = true ;
454439 }
455440 }
456- catch (IOException Ex ) {
457- throw Ex ;
458- }
459441 finally {
460442 if (RF != null ) {
461443 RF .close ();
462- RF = null ;
463444 }
464445 }
465446 return LoadOK ;
@@ -847,13 +828,9 @@ public ProxyResult ProxyQuery(String IPAddress, Modes Mode) throws IOException {
847828 Result .Threat = MSG_INVALID_IP ;
848829 return Result ;
849830 }
850- catch (IOException Ex ) {
851- throw Ex ;
852- }
853831 finally {
854832 if (RF != null ) {
855833 RF .close ();
856- RF = null ;
857834 }
858835 }
859836 }
@@ -896,8 +873,6 @@ private String[] ExpandIPv6(final String IP, final int IPType) {
896873 IP2 = IP2 .replaceAll (Match + "$" , ":" + Bytes [3 ] + "." + Bytes [2 ] + "." + Bytes [1 ] + "." + Bytes [0 ]);
897874 IP2 = IP2 .replaceAll ("::" , Tmp );
898875 }
899- else {
900- }
901876 }
902877 }
903878 else if (IPType == 6 ) {
@@ -987,7 +962,6 @@ else if (IPType == 6) {
987962 Bf2 .append (Bf4 ).append (Bf3 );
988963 IP2 = Bf2 .toString ().replaceAll (":$" , "" );
989964 }
990-
991965 }
992966 else {
993967 Matcher Mat2 = Pattern6 .matcher (IP2 );
0 commit comments