Skip to Content

Some time ago I was participating in a project which was developed mainly for NW 7.1 AS Java. However, from time to time we had to downport the whole application or particular features of it to NW 7.0 plarform which meant not only a NW realease switch, but also JVM switch (from 1.5 to 1.4). After several  sprints of such downport some common rules and techniques were worked out how to speed up the process a little bit. And I’m happy to share these techniques here.

Most helphul practices

  • Leave comments in source code in all places where any differences specific for a particular release are made. This is acceptable for the cases when there are small differences between versions.
    We practiced the
    following comments in code:
    -NW701 – indicates that the code is commented out for 7.01 release andrelevant only for 7.20;
    +NW701 – indicates that the next code is added especially for 7.01 and not relevant for 7.20;

Example:

/* -NW701 (SAP JRA is not relevant for 7.0x)
if (DestinationType.JRA == type) {
      factory = ResourceAdapterFactory.getInstance().getResourceAdapterFactory();
}*/

Example 2:

// -NW701
// vo.setSystemName(SystemName.valueOf(destination.getSID()));
// +NW701
vo.setSystemName(SystemName.valueOf(dp.getProperty(HTTPDestination.SAP_SID)));

I find this technique quite helpful especially when the downports areregular. It helps not to forget about the changes made during the previous downport and not to rewrite release-specific code in a next downport.

  • In case of big differences we isolated release-specific code in different Java classes. Such class name shall contain prefix indicating a particular release.

Example:
XMLPathUtil.java
was splitted onto XMLPathUtil_1_5.java (in 7.20) and
XMLPathUtil_1_4.java (in 7.01).

In the case XMLPathUtil.java works as dispatcher and redirects to the corresponding release-specific class. However, here it’s important that XMLPathUtil.java shall be identical for both releases. XMLPathUtil_1_5.java can be dummy in 7.01 and vice versa: XMLPathUtil_1_4.java can be dummy in 7.20.

  • Make an upport of the release-specific changes made in 7.02 back to 7.20 (if it’s possible). The goal here is to eliminate the differences at all and make the code equal. This will save time during the next downport in a future.

Example:
Code “Integer.valueOf(123)” in 7.20 shall be replaced
with “new Integer(123)” in 7.02. Let upport code “new Integer(123)” back to 7.20 to make the two source files equal.

  • Immediate notification all the team about resolved problems by e-mailing or by editing the common Wiki page. This will prevent double effort in resolving the same problems twice. Each team member should easily and quickly get an information about who is working on the particular problem he/she has faced with (common Wiki page).
  • Clear separation of components or source code areas between team members. A team member should know his area of responsibility. There should be no  uncovered areas. (For example, there could be places or application modules that left untouched during the downport. And it’ll make harder comparing them and will not save time in a future downport).
  • It’s important to have a team leader or coordinator of the downport.

Top 5 corrections due to Java 1.5 -> 1.4 differences

Java 1.5 Java 1.4
foo(1); foo(new Integer(1));
foo(true); foo(Boolean.valueOf(true));
Integer.valueOf(123) new Integer(123)
String.contains(“123”) (String.indexOf(“123”) >= 0)

enum construction

Java class with corresponding static String constants

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply