Skip to content

Commit

Permalink
dnsjava NullPointerException bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
harp077 committed Dec 4, 2023
1 parent a79b46e commit 8717245
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>2.6</version>
<version>3.2.5</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf-intellij-themes</artifactId>
<version>2.6</version>
<version>3.2.5</version>
</dependency>
-->
<dependency>
Expand All @@ -72,7 +72,7 @@
<dependency>
<groupId>dnsjava</groupId>
<artifactId>dnsjava</artifactId>
<version>2.1.9</version>
<version>3.5.3</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jpacketgenerator/JPacketGeneratorGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public JPacketGeneratorGUI() throws SocketException, UnsupportedLookAndFeelExcep
ImageIcon icone = new ImageIcon(getClass().getResource("/FrameIcon-3.png"));
this.setIconImage(icone.getImage());
this.setSize(350, 280);
this.setLocation(222, 222);
this.setLocation(333, 333);
}

private void initSourceAddress() throws SocketException {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/my/harp07/PjFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class PjFrame extends javax.swing.JFrame {
public static String currentLAF = "de.muntjak.tinylookandfeel.TinyLookAndFeel";
public static String currentTheme = "lib/themes/Default.theme";
public static List<String> tinyTemes = new ArrayList<>();
public static String zagolovok = "Pure Java Network Tools, v1.0.94, build 03-12-2023";
public static String zagolovok = "Pure Java Network Tools, v1.0.95, build 04-12-2023";

public PjFrame() {
initComponents();
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/my/harp07/PjLocal.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import javax.swing.JTextArea;
import org.apache.commons.lang3.StringUtils;
import org.xbill.DNS.ResolverConfig;
//import sun.net.dns.ResolverConfiguration;

public class PjLocal {

Expand Down Expand Up @@ -47,13 +48,20 @@ public static void runLocalInfo(JTextArea ta) {
}
j++;
}
} catch (SocketException | NullPointerException ex) {
} catch (Exception ex) {
//Logger.getLogger(CdiSysInfo.class.getName()).log(Level.SEVERE, null, ex);
}
info = info + "-----------\nLocal DNS-servers:\n";
Arrays.asList(ResolverConfig.getCurrentConfig().servers())
// throw NullPointerException !!!
try {
//Arrays.asList(ResolverConfiguration.open().nameservers())
ResolverConfig.getCurrentConfig().servers()
.stream()
.forEach(x -> info = info + x + "\n");
//System.out.println(ResolverConfig.getCurrentConfig().servers());
} catch (Exception ee) {
info = info + "no DNS-servers\n";
}
info = info + "\n";
ta.setText(info);
}
Expand Down

0 comments on commit 8717245

Please sign in to comment.