Bnojour, voilà j'ai un problème avec mon code JAVA, j'arrive pas à lire un fichier, voici le code :
public static void main(String[] args)
{
String path = "W:/ZUDA0/RSA/test/Analyse_DomainesFonctionnels";
Domaine dom = new Domaine();
ArrayList<Domaine> domaines = new ArrayList<Domaine>();
try {
domaines = dom.getAllDomaines(path);
} catch (IOException e) {
// TODO Bloc catch auto-généré
e.printStackTrace();
}
ArrayList<Domaine> listeDomaines = new ArrayList<Domaine>();
for (int i=0; i<domaines.size(); i++)
{
if (domaines.get(i).isFile(".emx"))
{
try {
domaines.get(i).getLiensData();
}
catch (IOException e)
{
e.printStackTrace();
}
listeDomaines.add(domaines.get(i));
}
}
System.out.println(listeDomaines.get(0).toString());
}
et les 2-3 méthodes utiles de ma classe Domaine :
public ArrayList<Domaine> getAllDomaines(String path) throws IOException
{
ArrayList<File> parcours = new ArrayList<File>();
ArrayList<Domaine> domaines = new ArrayList<Domaine>();
File rep = new File(path);
if (rep.isDirectory())
{
File[] list = rep.listFiles();
if (list != null)
{
for ( int i = 0; i < list.length; i++)
{
File domaine = new File (list[i].getName());
// Appel récursif sur les sous-répertoires
parcours.add(domaine);
}
}
else
{
System.err.println(rep + " : Erreur de lecture.");
}
}
for (int i=0; i<parcours.size(); i++)
{
domaines.add(new Domaine (parcours.get(i)));
}
return domaines;
}
public void getLiensData() throws IOException
{
String chaine;
int i=0;
BufferedReader fichier_source = new BufferedReader(new FileReader(this.objet));
while((chaine = fichier_source.readLine())!= null)
{
if (i>1)
{
String [] ligne = chaine.split("\n");
if (ligne[0].split(" ").equals("<references xmi:type=\"uml:Package\" href=\""))
{
liens.add(new File(ligne[0]));
}
}
}
}
Voilà en gros je veux lire un fichier xml (dont l'extension est en .emx) mais quand j'exécute, ça me donne ça : java.io.FileNotFoundException: Assurances.emx (Le fichier spécifié est introuvable)