Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 26, 2020. It is now read-only.
/JxnetPublic archive

Commit02feaa3

Browse files
committed
Set to java 6 and add deprecated classes
1 parentf34190a commit02feaa3

File tree

16 files changed

+96
-16
lines changed

16 files changed

+96
-16
lines changed

‎gradle/configure.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ext {
77

88
NAME='Jxnet'
99
GROUP='com.ardikars.jxnet'
10-
VERSION='1.5.3.RELEASE'
10+
VERSION='1.5.4.RC1'
1111
DESCRIPTION='Jxnet is a java library for capturing and sending network packet.'
1212

1313
NDK_HOME="${System.env.NDK_HOME}"
@@ -19,7 +19,7 @@ ext {
1919
MAVEN_LOCAL_REPOSITORY="${rootDir}/build/repository"
2020
//MAVEN_LOCAL_REPOSITORY = "${System.env.HOME}/.m2/repository"
2121

22-
JAVA_VERSION='1.7'
22+
JAVA_VERSION='1.6'
2323
JUNIT_VERSION='4.12'
2424
MOCKITO_VERSION='2.13.0'
2525
GRADLE_VERSION='5.0'

‎jxnet-context/src/main/java/com/ardikars/jxnet/context/ApplicationContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ public PcapTimestampPrecision pcapGetTStampPrecision() throws PcapCloseException
428428

429429
@Override
430430
publicPcapCodepcapListDataLinks(List<DataLinkType>dtlBuffer)throwsPcapCloseException,PlatformNotSupportedException {
431-
List<Integer>buffers =newArrayList<>();
431+
List<Integer>buffers =newArrayList<Integer>();
432432
intresult =Jxnet.PcapListDataLinks(pcap,buffers);
433433
if (result ==0) {
434434
dtlBuffer.clear();// clear buffer.
@@ -443,7 +443,7 @@ public PcapCode pcapListDataLinks(List<DataLinkType> dtlBuffer) throws PcapClose
443443

444444
@Override
445445
publicPcapCodepcapListTStampTypes(List<PcapTimestampType>tstampTypesp)throwsPcapCloseException,PlatformNotSupportedException {
446-
List<Integer>buffers =newArrayList<>();
446+
List<Integer>buffers =newArrayList<Integer>();
447447
intresult =Jxnet.PcapListTStampTypes(pcap,buffers);
448448
if (result ==0) {
449449
tstampTypesp.clear();// clear buffer.

‎jxnet-core/src/main/java/com/ardikars/jxnet/DataLinkType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class DataLinkType extends NamedNumber<Short, DataLinkType> {
5050
publicstaticfinalDataLinkTypeLINUX_SLL =newDataLinkType((short)113,"Linux SLL");
5151

5252
privatestaticfinalMap<DataLinkType,Short>registry =
53-
newHashMap<>();
53+
newHashMap<DataLinkType,Short>();
5454

5555
publicDataLinkType(Shortvalue,Stringname) {
5656
super(value,name);

‎jxnet-core/src/main/java/com/ardikars/jxnet/SockAddr.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public static final class Family extends NamedNumber<Short, Family> {
122122

123123
privatestaticfinallongserialVersionUID =3311056956556965869L;
124124

125-
privatestaticfinalMap<Short,Family>registry =newHashMap<>();
125+
privatestaticfinalMap<Short,Family>registry =newHashMap<Short,Family>();
126126

127127
publicstaticfinalFamilyAF_INET =newFamily((short)2,"Internet IP Protocol");
128128

‎jxnet-core/src/test/java/com/ardikars/jxnet/JxnetTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,9 @@ public void Test36_FindHardwareAddress() {
700700
if (address.length ==6) {
701701
System.out.println(MacAddress.valueOf(address));
702702
}
703-
}catch (DeviceNotFoundException |PlatformNotSupportedExceptione) {
703+
}catch (DeviceNotFoundExceptione) {
704+
System.out.println(e.getMessage());
705+
}catch (PlatformNotSupportedExceptione) {
704706
System.out.println(e.getMessage());
705707
}
706708
}

‎jxnet-example/src/main/java/com/ardikars/jxnet/example/Application.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ public static void main(String[] args) throws InterruptedException {
110110
try {
111111
byte[]hardwareAddress =Jxnet.FindHardwareAddress(pcapIf.getName());
112112
LOGGER.info("\tMAC Address : " +MacAddress.valueOf(hardwareAddress));
113-
}catch (PlatformNotSupportedException |DeviceNotFoundExceptione) {
113+
}catch (PlatformNotSupportedExceptione) {
114+
LOGGER.warning(e.getMessage());
115+
}catch (DeviceNotFoundExceptione) {
114116
LOGGER.warning(e.getMessage());
115117
}
116118
}else {
@@ -153,7 +155,7 @@ public void nextPacket(String user, PcapPktHdr pktHdr, ByteBuffer buffer) {
153155
*/
154156
publicstaticPcapIfpcapIf(StringBuildererrbuf)throwsDeviceNotFoundException {
155157
Stringsource =Application.source;
156-
List<PcapIf>alldevsp =newArrayList<>();
158+
List<PcapIf>alldevsp =newArrayList<PcapIf>();
157159
if (PcapFindAllDevs(alldevsp,errbuf) !=OK &&LOGGER.isLoggable(Level.WARNING)) {
158160
LOGGER.warning("Error: {}" +errbuf.toString());
159161
}

‎jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/JxnetAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public JxnetAutoConfiguration(JxnetConfigurationProperties properties) {
105105
//@ConditionalOnBean(StringBuilder.class)
106106
@Bean(PCAP_IF_BEAN_NAME)
107107
publicPcapIfpcapIf(@Qualifier(ERRBUF_BEAN_NAME)StringBuildererrbuf)throwsDeviceNotFoundException {
108-
List<PcapIf>alldevsp =newArrayList<>();
108+
List<PcapIf>alldevsp =newArrayList<PcapIf>();
109109
if (PcapFindAllDevs(alldevsp,errbuf) !=OK) {
110110
thrownewNativeException(errbuf.toString());
111111
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright (C) 2015-2018 Jxnet
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
packagecom.ardikars.jxnet.spring.boot.autoconfigure;
19+
20+
importcom.ardikars.common.tuple.Pair;
21+
importcom.ardikars.jxnet.PcapPktHdr;
22+
importio.netty.buffer.ByteBuf;
23+
24+
importjava.util.concurrent.Future;
25+
26+
/**
27+
* Callback function used for capturing packets.
28+
*
29+
* @author <a href="mailto:contact@ardikars.com">Ardika Rommy Sanjaya</a>
30+
* @since 1.5.4
31+
*/
32+
publicinterfaceNettyAsyncBufferHandler<T>extendsHandler<T,Future<Pair<PcapPktHdr,ByteBuf>>> {
33+
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright (C) 2015-2018 Jxnet
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Lesser General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Lesser General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
packagecom.ardikars.jxnet.spring.boot.autoconfigure;
19+
20+
importcom.ardikars.common.tuple.Pair;
21+
importcom.ardikars.jxnet.PcapPktHdr;
22+
importio.netty.buffer.ByteBuf;
23+
24+
importjava.util.concurrent.Future;
25+
26+
/**
27+
* Callback function used for capturing packets.
28+
*
29+
* @author <a href="mailto:contact@ardikars.com">Ardika Rommy Sanjaya</a>
30+
* @since 1.5.4
31+
*/
32+
publicinterfaceNioAsyncBufferHandler<T>extendsHandler<T,Future<Pair<PcapPktHdr,ByteBuf>>> {
33+
34+
}

‎jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAsyncHandlerConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public void nextPacket(final T user, final PcapPktHdr h, final ByteBuffer bytes)
4646
publicvoidrun() {
4747
try {
4848
getHandler().next(user,Tuple.of(h,decode(bytes)));
49-
}catch (ExecutionException |InterruptedExceptione) {
49+
}catch (ExecutionExceptione) {
50+
LOGGER.warn(e);
51+
}catch (InterruptedExceptione) {
5052
LOGGER.warn(e);
5153
}
5254
}

‎jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketHandlerConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ public Pair<PcapPktHdr, Packet> call() throws Exception {
5757
});
5858
try {
5959
getHandler().next(user,packet);
60-
}catch (ExecutionException |InterruptedExceptione) {
61-
LOGGER.warn(e.getMessage());
60+
}catch (ExecutionExceptione) {
61+
LOGGER.warn(e);
62+
}catch (InterruptedExceptione) {
63+
LOGGER.warn(e);
6264
}
6365
}
6466

‎jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/netty/NettyBufferAsyncHandlerConfiguration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ public Pair<PcapPktHdr, ByteBuf> call() throws Exception {
5959
});
6060
try {
6161
getHandler().next(user,packet);
62-
}catch (ExecutionException |InterruptedExceptione) {
62+
}catch (ExecutionExceptione) {
63+
LOGGER.warn(e);
64+
}catch (InterruptedExceptione) {
6365
LOGGER.warn(e);
6466
}
6567
}

‎jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferAsyncHandlerConfiguration.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ public class NioBufferAsyncHandlerConfiguration<T> extends HandlerConfigurer<T,
4848
publicvoidnextPacket(Tuser,PcapPktHdrh,ByteBufferbytes) {
4949
try {
5050
getHandler().next(user,Tuple.of(h,bytes));
51-
}catch (ExecutionException |InterruptedExceptione) {
52-
LOGGER.debug(e);
51+
}catch (ExecutionExceptione) {
52+
LOGGER.warn(e);
53+
}catch (InterruptedExceptione) {
54+
LOGGER.warn(e);
5355
}
5456
}
5557

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp