Hallo,
ich habe ein kleines Tool programmiert dass eine Datei ausliest, den Inhalt als StringBuilder speichert und dann an einen String weitergibt. Danach wird dieser in ein Array eingespeichert. Leider crasht das Programm immer an dieser Stelle:
Hier der dazu gehörige Code:
FileHandler.java:120
Ich hoffe ihr könnt mir helfen!
JavaGamer
ich habe ein kleines Tool programmiert dass eine Datei ausliest, den Inhalt als StringBuilder speichert und dann an einen String weitergibt. Danach wird dieser in ein Array eingespeichert. Leider crasht das Programm immer an dieser Stelle:
Code:
[INFO] Initialize Installer
[ERROR]java.lang.NullPointerException
at java.util.Arrays$ArrayList.<init>(Unknown Source)
at java.util.Arrays.asList(Unknown Source)
at minecraftplaye.installer.handlers.FileHandler.readServer(FileHandler.java:120)
at minecraftplaye.installer.handlers.FileHandler.getZip(FileHandler.java:72)
at minecraftplaye.installer.gui.DescriptionGui.<init>(DescriptionGui.java:22)
at minecraftplaye.installer.handlers.ActionHandler.actionPerformed(ActionHandler.java:23)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Hier der dazu gehörige Code:
Java:
private static void readServer(ZipFile zFile, ZipEntry entry)
{
try
{
@SuppressWarnings("resource")
BufferedInputStream is = new BufferedInputStream(zFile.getInputStream(entry));
StringBuilder strb = new StringBuilder();
while(is.available() > 0)
{
strb.append((char)is.read());
}
is.close();
String temp = strb.toString();
System.out.println(temp);
if(entry.getName().equals("Server.txt"))
downloadServer = temp.split(System.getProperty("line.separator").toString());
else if(entry.getName().equals("Client.txt"))
downloadClient = temp.split(System.getProperty("line.separator"));
downloadServerList = new ArrayList<String>(Arrays.asList(downloadServer));
downloadClientList = new ArrayList<String>(Arrays.asList(downloadClient));
for(int i = 0; i < downloadClientList.size(); i++)
System.out.println(downloadClientList.get(i).toString());
if(downloadServerList != null && !downloadServerList.isEmpty())
{
downloadClientList.addAll(downloadServerList);
InstallationHandler.removeDuplicatedEntries(downloadServerList);
}
if(downloadClientList != null && !downloadClientList.isEmpty())
InstallationHandler.removeDuplicatedEntries(downloadClientList);
}
catch(FileNotFoundException e)
{
Logger.log2(Level.ERROR, e, "Die Datei konnte nicht gefunden werden", "FileHandler - FileNotFoundException");
}
catch(NullPointerException e)
{
Logger.log2(Level.ERROR, e, "Die Datei konnte nicht gefunden werden oder ist null", "FileHandler - NullPointerException");
}
catch(IOException e)
{
Logger.log2(Level.FATAL, e, "Unbekannter Fehler beim Verarbeiten der Datei: " + StartUpGui.modpackDir.getAbsolutePath(), "FileHandler - IOException");
}
}
FileHandler.java:120
Java:
downloadClientList = new ArrayList<String>(Arrays.asList(downloadClient));
Ich hoffe ihr könnt mir helfen!
JavaGamer