I haven't coded in Java in many years, but recently I was asked to implement a java based program at work. Long story short, it did everything we needed, except it was placing the user ID in a report instead of the phone number. I should point out that the we are a partner of the company who owns the program, and I have their permission to change as needed. However, their website does not provide source code. I have requested it, but no luck after 3 weeks. So, I have to de-compile the code, and make the needed change. I have managed to make the change, and remove all compiling errors except three. They are all the same error on three different For Loops. When I attempt top compile I get the following.
FraudDetectionTool.java:655: not a statement
for ( str3 : arrayOfString2 ) {
^
FraudDetectionTool.java:655: ';' expected
for ( str3 : arrayOfString2 ) {
^
FraudDetectionTool.java:655: illegal start of expression
for ( str3 : arrayOfString2 ) {
^
FraudDetectionTool.java:655: ';' expected
for ( str3 : arrayOfString2 ) {
^
FraudDetectionTool.java:681: not a statement
for (str3 : array3) {
^
FraudDetectionTool.java:681: ';' expected
for (str3 : array3) {
^
FraudDetectionTool.java:681: illegal start of expression
for (str3 : array3) {
^
FraudDetectionTool.java:681: ';' expected
for (str3 : array3) {
^
FraudDetectionTool.java:695: not a statement
for (str3 : arrayOfString3) {
^
FraudDetectionTool.java:695: ';' expected
for (str3 : arrayOfString3) {
^
FraudDetectionTool.java:695: illegal start of expression
for (str3 : arrayOfString3) {
^
FraudDetectionTool.java:695: ';' expected
for (str3 : arrayOfString3) {
Here is the section of code that contains the first for loop. I left out the remaining portion of Main. If needed I can post the entire class (750 Lines) or Method (160 Line). What I have noticed is that str3 is initialized, but inside the For loop it is not recognized. However, if I leave the original initialization in place, and attempt to re-initialize inside the For Loop. My compiler warns me that the variable is already in use in Method Main.
public static void main(String[] paramArrayOfString)
{
initializeProperties();
init();
GenericInputChannel.initialize(true);
for (String str1 : paramArrayOfString) {
fileNames.add(str1);
}
try
{
String[] mail = EMAIL_ADDRS.split(",");
for (String str2 : mail) {
str2 = str2.replaceAll(" *", "");
emailAddresses.add(str2);
if (str2.length() > 0) {
if (DEBUG) {
System.out.println("Adding email " + str2);
}
sendEmail = true;
}
}
}
catch (Exception localException1) {
System.out.println("Error parsing email addrs " + EMAIL_ADDRS);
emailAddresses.clear();
}
if (TEST_MODE) {
System.out.println("Sending Test email");
sendEmail(true);
System.exit(0);
}
String[] arrayOfString2 = new String[1];
String str3;
if (fileNames.size() == 0)
{
File localfiler = new File(DEFAULT_BILLING_DIR);
if (((File)localfiler).exists()) {
arrayOfString2 = ((File)localfiler).list();
for ( str3 : arrayOfString2 ) {
fileNames.add(DEFAULT_BILLING_DIR + str3);
}
}
}