can this be made static

public Vector getConvertedError( String errCode) throws PropertyApplicationException
      {
            Vector v1 = new Vector();
            if( errCode.compareTo(props.getValue(ServicesConstants.ACCOUNT_NON_TELCO_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_NON_TELCO_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_NON_TELCO_ERROR_MSG));
            }
            else if ( errCode.compareTo(props.getValue(ServicesConstants.ACCOUNT_INVALID_COS_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_INVALID_COS_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_INVALID_COS_ERROR_MSG));
            }      
            else if ( errCode.compareTo(props.getValue(ServicesConstants.ACCOUNT_SIWTN_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_SIWTN_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_SIWTN_ERROR_MSG));
            }
            else if ( errCode.compareTo(props.getValue(ServicesConstants.ACCOUNT_UNE1_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_UNE1_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_UNE1_ERROR_MSG));
            }
            else if( errCode.compareTo(props.getValue(ServicesConstants.ACCOUNT_UNN1_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_UNN1_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_UNN1_ERROR_MSG));
            }
            else if( errCode.compareTo(props.getValue(ServicesConstants.CSR_NO_DATA_FOUND)) == 0)
            {
                   v1.add(props.getValue(ServicesConstants.CSR_NO_DATA_FOUND));
                   v1.add(props.getValue(ServicesConstants.CSR_NO_DATA_FOUND));
            }
            else if (errCode.compareTo(props.getValue(ServicesConstants.IM_ACCOUNT_TO_LARGE_ERROR_CODE)) == 0)
            {
                  v1.add(props.getValue(ServicesConstants.IM_ACCOUNT_TO_LARGE_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.IM_ACCOUNT_TO_LARGE_ERROR_MSG));
            }
            else if (errCode.startsWith(props.getValue(ServicesConstants.IM_SYSTEM_UNAVAIL_ERROR_CODE)) )
            {
                  v1.add(props.getValue(ServicesConstants.IM_SYSTEM_UNAVAIL_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.IM_SYSTEM_UNAVAIL_ERROR_MSG));
            }
            else if (errCode.startsWith(props.getValue(ServicesConstants.IM_INVALID_INPUT_COMB_ERROR_CODE)))
            {
                  v1.add(props.getValue(ServicesConstants.IM_INVALID_INPUT_COMB_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.IM_INVALID_INPUT_COMB_ERROR_MSG));
            }
            else if (errCode.startsWith(props.getValue(ServicesConstants.IM_SYSTEM_TIMEOUT_ERROR_CODE)))
            {
                  v1.add(props.getValue(ServicesConstants.IM_SYSTEM_TIMEOUT_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.IM_SYSTEM_TIMEOUT_ERROR_MSG));
            }
            else if(errCode.startsWith(props.getValue(ServicesConstants.ACCOUNT_TIMEOUT_ERROR_CODE)))
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_TIMEOUT_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_TIMEOUT_ERROR_MSG));
            }
            else if( errCode.startsWith(props.getValue(ServicesConstants.IM_SCHEDULED_DOWNTIME_ERROR_CODE).trim()) )
            {
                  v1.add( props.getValue(ServicesConstants.IM_SCHEDULED_DOWNTIME_ERROR_CODE));
                  v1.add( props.getValue(ServicesConstants.IM_SCHEDULED_DOWNTIME_ERROR_MSG));
            }
            else
            {
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_INVALID_ERROR_CODE));
                  v1.add(props.getValue(ServicesConstants.ACCOUNT_INVALID_ERROR_MSG));      
            }
            return v1;
      }

I guess I am confused what method to make static ? it beats me when a method can be static ? Here the input errorId can be different , but the properties file can be constant
skn73Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bobbit31Commented:
a static method is one that can be called w/o creating an instance of the class...

e.g.

public class StaticClass {
  public static int blah (String s) {
    return s + "... Blah";
  }
}

in the above case... you can just do something like (in your main class):

System.out.println(StaticClass.blah("hello world"));

if you were to remove the static from the method declaration, you would have to do:

StaticClass sc = new StaticClass();
System.out.println(sc.blah("hello world"));

that being said, what is the error you are getting?
how are you calling your method?
0
bobbit31Commented:
public static String blah (String s) {
...
}
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
(It has been a long time since I have done any Java)

When a method is static, everything it accesses must also be static, so your props variable must be declared static as well.

~IM
0
DrWarezzCommented:
>"I guess I am confused what method to make static ?"
Make this method static:

public Vector getConvertedError( String errCode);

However, as Idle_Mind correctly pointed out (unless we're both terribly mistaken), whatever you use to access it must also be static.
For example,

public static void main ( String [] args ) {
  // ... Some code ...
  Vector v_errors = getConvertedError( s_errCode );
}

(this is all assuming that the "getConvertedError()" method, is in the same class as that calling it)..

However, if you call it from a method that is NOT static, you need to create a class object, like so:

public void methodName () {
  // ... Some code ...
  ClassName o_cn = new ClassName ();  // Add any arguments to the constructor if necessary.
  Vector c_errors = o_cn.getCnvertedErrors( s_errCode );
}

I hope that helps! :-)
[r.D]
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.