• Subhasish Sahu

Find/Search Hard Coded String in Files under Directories and Sub-Directories

Many times we hard code some string in files which could lead to Production issue.We seems to ignore this minor changes.Below is the code which could help to find the File/Files  in which such hard code string is present as well as shows the line in which it occurs.


1) Create a mavenized Project and add jar file dependencies such as log4j , commons-logging and commons-io in pom.xml


Code Link : https://github.com/subhasish23sahu/find_hardcoded_string


2) Build project : mvn clean install


3) Create a bat file : SEARCHSTRING.bat


@echo off

set /p input="Enter Path::"

echo "Please Note : Your logs file will be genrated in C drive "

echo "#########################################################"

java -jar SearchHardcodedString.jar %input%

pause


4) Place the jar from target folder and bat file at one place and run the bat file.





21 views0 comments