JAVA erreur inccomprise
katsuo49
Messages postés
330
Date d'inscription
Statut
Membre
Dernière intervention
-
katsuo49 Messages postés 330 Date d'inscription Statut Membre Dernière intervention -
katsuo49 Messages postés 330 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je dévollope avec le logiciel éclipse.
J'essais de faire lire un fichier à mon programme, puis écrire ce qu'il lit + les données à ajouter. je l'ai déjà fais une fois pour un autre tread et pas de problème mais la quoique je fasse toujours pareil.
Voila la thread concerné:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import javax.swing.JOptionPane;
public class OuvrirNewElement implements ActionListener {
@SuppressWarnings("static-access")
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
JOptionPane jop = new JOptionPane();
String nom_serie = jop.showInputDialog(null, "Indiquez le nom de la série à sélectionner:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone1 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 1:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone2 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 2:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone3 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 3:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone4 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 4:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
ObjectInputStream ois;
ObjectOutputStream oos;
try {
ois = new ObjectInputStream(
new BufferedInputStream(
new FileInputStream(
new File(nom_serie+".mangatheque"))));
oos = new ObjectOutputStream(
new BufferedOutputStream(
new FileOutputStream(
new File(nom_serie+".mangatheque"))));
try {
oos.writeObject(new ObjetSerie(((ObjetTableauSerie)ois.readObject()).toString()));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
//Nous allons écrire chaque objet Game dans le fichier
oos.writeObject(new ObjetSerie(nom_serie, collone1, collone2, collone3, collone4));
//NE PAS OUBLIER DE FERMER LE FLUX ! ! !
oos.close();
//On récupère maintenant les données !
try {
System.out.println(((ObjetSerie)ois.readObject()).toString());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
voila le message d'erreur:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at OuvrirNewElement.actionPerformed(OuvrirNewElement.java:70)
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.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.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.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)
Merci d'avance
je dévollope avec le logiciel éclipse.
J'essais de faire lire un fichier à mon programme, puis écrire ce qu'il lit + les données à ajouter. je l'ai déjà fais une fois pour un autre tread et pas de problème mais la quoique je fasse toujours pareil.
Voila la thread concerné:
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import javax.swing.JOptionPane;
public class OuvrirNewElement implements ActionListener {
@SuppressWarnings("static-access")
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
JOptionPane jop = new JOptionPane();
String nom_serie = jop.showInputDialog(null, "Indiquez le nom de la série à sélectionner:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone1 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 1:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone2 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 2:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone3 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 3:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
String collone4 = jop.showInputDialog(null, "Indiquez le contenue de la Collone 4:", "Ajout d'un nouvel élément", JOptionPane.QUESTION_MESSAGE);
ObjectInputStream ois;
ObjectOutputStream oos;
try {
ois = new ObjectInputStream(
new BufferedInputStream(
new FileInputStream(
new File(nom_serie+".mangatheque"))));
oos = new ObjectOutputStream(
new BufferedOutputStream(
new FileOutputStream(
new File(nom_serie+".mangatheque"))));
try {
oos.writeObject(new ObjetSerie(((ObjetTableauSerie)ois.readObject()).toString()));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
//Nous allons écrire chaque objet Game dans le fichier
oos.writeObject(new ObjetSerie(nom_serie, collone1, collone2, collone3, collone4));
//NE PAS OUBLIER DE FERMER LE FLUX ! ! !
oos.close();
//On récupère maintenant les données !
try {
System.out.println(((ObjetSerie)ois.readObject()).toString());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
voila le message d'erreur:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at OuvrirNewElement.actionPerformed(OuvrirNewElement.java:70)
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.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.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.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)
Merci d'avance
A voir également:
- JAVA erreur inccomprise
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo