Hi David,
I applied the patch for DERBY-289 and tried a use case which adds a
new parameter to an existing message. I did the following:
Step 1:
First, I tried moving a message (07000) from
org.apache.derby.loc.messages_en.properties to
org.apache.derby.loc.common-messages_en.properties. I moved the
following to common-messages_en.properties:
07000=At least one parameter to the current statement is uninitialized.
SQLState.java has this:
String LANG_MISSING_PARMS = "07000";
In client driver, I changed 'checkThatAllParametersAreSet' method in
org.apache.derby.client.am.PreparedStatement to use SQLException2 with
SQLState.LANG_MISSING_PARMS.
if (!parameterSet_[i] && !parameterRegistered_[i]) {
throw new SqlException2(agent_.logWriter_,
SQLState.LANG_MISSING_PARMS);
}
I ran a repro to get this error message with client driver and it works fine.
Step 2:
Next I added a parameter to this message. For this, I kept the old
message and added another message with a new message id to
common-messages_en.properties as below:
07000=At least one parameter to the current statement is uninitialized.
07000.new=Parameter ''{0}'' not initialized.
I added 07000.new to SQLState.java:
String LANG_MISSING_PARMS = "07000";
String LANG_MISSING_PARMS2 =
"07000.new";
I added a new feature in CommonFeatures.java and set MAX_FEATURES to
this value as below:
public static int SQLSTATE_07000_NEW = 1;
public static int MAX_FEATURE = SQLSTATE_07000_NEW;
I changed client driver to use the new message:
if (!parameterSet_[i] && !parameterRegistered_[i]) {
CommonInfo cInfo = new CommonInfo();
if(cInfo.hasFeature(CommonFeatures.SQLSTATE_07000_NEW))
throw new SqlException2(agent_.logWriter_,
SQLState.LANG_MISSING_PARMS2, new Integer (i));
else
throw new SqlException2(agent_.logWriter_,
SQLState.LANG_MISSING_PARMS);
}
I ran the repro with client driver and I got the new message.
.....................
Now, I tried mixing jars.
jars from Step 1 --> v1
jars from step 2 --> v2
I used v1 jars for starting network server. At client side, I set
CLASSPATH with v1/derby.jar before v2/derbyclient.jar. Then I ran the
repro and I get the following exception:
java.util.MissingResourceException: Can't find bundle for base name
org.apache.derby.loc.client-messages.properties, locale en_US
at
java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:839)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:729)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:579)
at
org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:177)
at
org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:208)
at
org.apache.derby.common.i18n.MessageUtil.getCompleteMessage(MessageUtil.java:96)
at
org.apache.derby.client.am.SqlException2.<init>(SqlException2.java:57)
at
org.apache.derby.client.am.SqlException2.<init>(SqlException2.java:93)
at
org.apache.derby.client.am.PreparedStatement.checkThatAllParametersAreSet(PreparedStatement.java:1655)
at
org.apache.derby.client.am.PreparedStatement.flowExecute(PreparedStatement.java:1257)
at
org.apache.derby.client.am.PreparedStatement.executeX(PreparedStatement.java:908)
at
org.apache.derby.client.am.PreparedStatement.execute(PreparedStatement.java:899)
at parameter.main(parameter.java:27)
Have I missed something here? I would appreciate your help in this.
Thanks,
Deepa