Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6931011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:31:19+00:00 2026-05-27T11:31:19+00:00

My application has many properties/text configuration files. Is there a common way to validate

  • 0

My application has many properties/text configuration files. Is there a common way to validate these kind of files? May be some tools or something like xsd?
The files are large (more 1000 rows), so I frequently make mistake. Information in file in majority of cases – is path to different directories. So it will be good if they exist and are consistent. E.g.
if I have

mydata.root="c:\data"

and after I have:

myreports=${mydata.root}/reports

that will be good check that c:\data and c:\data\report exist

and not written (some hundreds rows down) e.g.

myreports=${mdata.root}/reports
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:31:19+00:00Added an answer on May 27, 2026 at 11:31 am

    You could do this validation in your build file.

    For example, the following build file defines a macrodef validate-file-property which validates that a specified property is defined and that it exists as a file or dir in the file system.

    <project default="init">
    
      <property file="test.properties"/>
    
      <target name="init">
        <validate-file-property property="program.files" type="dir"/>
        <validate-file-property property="mydata.root" type="dir"/>
        <validate-file-property property="foo"/>
      </target>
    
      <macrodef name="validate-file-property">
        <attribute name="property"/>
        <attribute name="type" default="file"/>
        <sequential>
          <fail unless="@{property}" message="The property '@{property}' is undefinded."/>
          <available file="${@{property}}" property="@{property}.exists" type="@{type}"/>
          <fail unless="@{property}.exists" message="The @{type} '@{property}' with value '${@{property}}' does not exist."/>
        </sequential>
      </macrodef>
    
    </project>
    

    You need to decide when to validate the properties, and you need to validate them explicitly – as shown in the init target in this example.

    BTW, if you used a standardized pattern to name properties which refer to files or directories – e.g. my.special.file, my.build.dir – then you could use a shell script to discover all relevant properties and write all your validate-file-property elements . Something like this:

    awk -F= '/\.(file|dir)/{ printf "<validate-file-property property=\"%s\" type=\"%s\"/>\n", $1, gensub(/.*\.(file|dir)/, "\\1", "g", $1) }' *.properties
    

    You could paste the output into your build file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application has many models, many of which contain percentage data. These are represented
Our application has many controls that are created dynamically. For example, a navigation pane
I have an application that has many different types of objects that each persist
I have a multithreaded application that has many concurrent operations going on at once.
I'm currently working on a large and old C++ application that has had many
I'm building WPF client application. I'm following MVC pattern. The project solution has many
Suppose user has opened my web application in many different browser windows. After sometime
Consider a production planning application with many products. Each product has a list of
I have an SecurityGroup entity witch has Memebers and Application properties. Application is a
I'm developing a WPF/PRISM based application. The parent view(usercontrol) has many regions in it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.