Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Properties file

 
Med Shabe
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently Properties file is not meant to be read dynamically. In other words, I cannot go through a directory and create Properties files basd on available files that have attribute=value format.
Pleass, could someone show me the way on how to go about doing the above. I need to read values from files and upload them onto table.

Thanks.
 
Junilu Lacar
Bartender
Pie
Posts: 7328
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try the load() method:

hth,
Junilu
[This message has been edited by JUNILU LACAR (edited October 16, 2001).]
 
Med Shabe
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the load method but the execution doesn't make it that far. The funnier (or more upsetting) thing is that it sees the file but then it throws FileNotFoundException and sometimes NullPointerException on my face.
 
Junilu Lacar
Bartender
Pie
Posts: 7328
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Med,
Post some code and we'll see if we can get to the bottom of this.
Junilu
 
Med Shabe
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've tried making this as short as possible: Let me know if you need more.
Appreciate you guys looking into this.
dataFile is of type String, that's what getFileWithExtension returns.
ICONFEED is of Properties type.
Program does not makes it beyond the while.
.
.
.
while ((dataFile = getFileWithExtension(dirPath, fileExt))!= null )
{
if (dataFile == null)
System.out.println(dataFile + "not found!");
System.out.println("File: " + dataFile);
FileInputStream fisdat = new FileInputStream(dataFile);
boolean Renresult = copyFile(dirPath,logDir);
System.out.println("Moving" + dataFile);

ICONFEED.load(fisdat);
System.out.println("Loaded " + fisdat);
System.out.println("Processing: " + dataFile);
("Reading dataFile " + dataFile);
System.out.println("Reading properties");
Feed = ICONFEED.getProperty("FEED");
}
System.out.println("No more files to process!");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic