-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
Cause Known
-
sparc
-
solaris_8
Name: yg153347 Date: 09/22/2004
Filed By : SPB JCK team
JDK : java full version "1.5.0-rc-b63"
JCK : 1.5
Platform[s] : Solaris
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test[s]: None
Problem description
===================
After the registration of user-defined SyncProvider implementation
impossible to get its VendorName and VersionID. In this case the
calls of getVendor() and getVersion() always return null.
Please see minimized test below which shows the issue.
Minimized test:
===============
------- Test.java --------------
import java.util.Enumeration;
import javax.sql.rowset.spi.*;
import java.sql.SQLException;
import javax.sql.RowSetReader;
import javax.sql.RowSetWriter;
import javax.sql.RowSetInternal;
public class Test {
public static void main(String[] args) {
String providerName = "MyProvider";
try {
regProvider(providerName);
try {
printListOfRegisteredProviders(
SyncFactory.getRegisteredProviders());
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println("Unexpected exception while getting "
+ "list of registered providers.");
}
} finally {
unregProvider(providerName);
}
}
private static void regProvider(String s) {
try {
SyncFactory.registerProvider(s);
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println(
"Unexpected exception while registering of \""
+ s + "\".");
}
}
private static void unregProvider(String s) {
try {
SyncFactory.unregisterProvider(s);
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println(
"Unexpected exception while unregistering of \""
+ s + "\".");
}
}
private static void printListOfRegisteredProviders(
Enumeration providers) {
System.out.println("List of registered providers: ");
int k = 0;
while(providers.hasMoreElements()){
SyncProvider sp = (SyncProvider) providers.nextElement();
k++;
System.out.println(k + ") ProviderID: " +
sp.getProviderID() +
" Vendor: " + sp.getVendor() +
" Version: " + sp.getVersion());
}
System.out.println("------------------------------");
System.out.println("Total: " + k);
}
}
------- end-of-Test.java -------
------- MyProvider.java --------------
import java.util.Enumeration;
import javax.sql.rowset.spi.*;
import java.sql.SQLException;
import javax.sql.RowSetReader;
import javax.sql.RowSetWriter;
import javax.sql.RowSetInternal;
public class MyProvider extends SyncProvider {
private String providerID;
private RowSetReader reader;
private RowSetWriter writer;
public MyProvider() {
providerID = getClass().getName();
}
public String getProviderID() {
return providerID;
}
public void setRowSetReader(RowSetReader reader)
throws SQLException {
reader = reader;
}
public void setRowSetWriter(RowSetWriter writer)
throws SQLException {
writer = writer;
}
public RowSetReader getRowSetReader() {
return reader;
}
public RowSetWriter getRowSetWriter() {
return writer;
}
public int getProviderGrade() {
return SyncProvider.GRADE_NONE;
}
public int supportsUpdatableView() {
return SyncProvider.NONUPDATABLE_VIEW_SYNC;
}
public int getDataSourceLock() throws SyncProviderException {
return SyncProvider.DATASOURCE_NO_LOCK;
}
public void setDataSourceLock(int lock)
throws SyncProviderException {
}
public RowSetInternal getRowSetInternal() {
return null;
}
public String getVendor() {
return "My Vendor";
}
public String getVersion() {
return "0.1";
}
}
------- end-of-MyProvider.java -------
Minimized test output:
======================
<gyi@mars> javac MyProvider.java
<gyi@mars> javac Test.java
<gyi@mars> java -version
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode)
<gyi@mars> java Test
List of registered providers:
1) ProviderID: MyProvider Vendor: null Version: null
2) ProviderID: com.sun.rowset.providers.RIOptimisticProvider
Vendor: Sun Microsystems Inc Version: 1.0
3) ProviderID: com.sun.rowset.providers.RIXMLProvider Vendor:
Sun Microsystems Inc. Version: 1.0
------------------------------
Total: 3
======================================================================
======================================================================
Filed By : SPB JCK team
JDK : java full version "1.5.0-rc-b63"
JCK : 1.5
Platform[s] : Solaris
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test[s]: None
Problem description
===================
After the registration of user-defined SyncProvider implementation
impossible to get its VendorName and VersionID. In this case the
calls of getVendor() and getVersion() always return null.
Please see minimized test below which shows the issue.
Minimized test:
===============
------- Test.java --------------
import java.util.Enumeration;
import javax.sql.rowset.spi.*;
import java.sql.SQLException;
import javax.sql.RowSetReader;
import javax.sql.RowSetWriter;
import javax.sql.RowSetInternal;
public class Test {
public static void main(String[] args) {
String providerName = "MyProvider";
try {
regProvider(providerName);
try {
printListOfRegisteredProviders(
SyncFactory.getRegisteredProviders());
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println("Unexpected exception while getting "
+ "list of registered providers.");
}
} finally {
unregProvider(providerName);
}
}
private static void regProvider(String s) {
try {
SyncFactory.registerProvider(s);
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println(
"Unexpected exception while registering of \""
+ s + "\".");
}
}
private static void unregProvider(String s) {
try {
SyncFactory.unregisterProvider(s);
} catch (SyncFactoryException e) {
e.printStackTrace(System.out);
System.out.println(
"Unexpected exception while unregistering of \""
+ s + "\".");
}
}
private static void printListOfRegisteredProviders(
Enumeration providers) {
System.out.println("List of registered providers: ");
int k = 0;
while(providers.hasMoreElements()){
SyncProvider sp = (SyncProvider) providers.nextElement();
k++;
System.out.println(k + ") ProviderID: " +
sp.getProviderID() +
" Vendor: " + sp.getVendor() +
" Version: " + sp.getVersion());
}
System.out.println("------------------------------");
System.out.println("Total: " + k);
}
}
------- end-of-Test.java -------
------- MyProvider.java --------------
import java.util.Enumeration;
import javax.sql.rowset.spi.*;
import java.sql.SQLException;
import javax.sql.RowSetReader;
import javax.sql.RowSetWriter;
import javax.sql.RowSetInternal;
public class MyProvider extends SyncProvider {
private String providerID;
private RowSetReader reader;
private RowSetWriter writer;
public MyProvider() {
providerID = getClass().getName();
}
public String getProviderID() {
return providerID;
}
public void setRowSetReader(RowSetReader reader)
throws SQLException {
reader = reader;
}
public void setRowSetWriter(RowSetWriter writer)
throws SQLException {
writer = writer;
}
public RowSetReader getRowSetReader() {
return reader;
}
public RowSetWriter getRowSetWriter() {
return writer;
}
public int getProviderGrade() {
return SyncProvider.GRADE_NONE;
}
public int supportsUpdatableView() {
return SyncProvider.NONUPDATABLE_VIEW_SYNC;
}
public int getDataSourceLock() throws SyncProviderException {
return SyncProvider.DATASOURCE_NO_LOCK;
}
public void setDataSourceLock(int lock)
throws SyncProviderException {
}
public RowSetInternal getRowSetInternal() {
return null;
}
public String getVendor() {
return "My Vendor";
}
public String getVersion() {
return "0.1";
}
}
------- end-of-MyProvider.java -------
Minimized test output:
======================
<gyi@mars> javac MyProvider.java
<gyi@mars> javac Test.java
<gyi@mars> java -version
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode)
<gyi@mars> java Test
List of registered providers:
1) ProviderID: MyProvider Vendor: null Version: null
2) ProviderID: com.sun.rowset.providers.RIOptimisticProvider
Vendor: Sun Microsystems Inc Version: 1.0
3) ProviderID: com.sun.rowset.providers.RIXMLProvider Vendor:
Sun Microsystems Inc. Version: 1.0
------------------------------
Total: 3
======================================================================
======================================================================