Buggy code:
public class DistributedJDBCConfigurationImpl extends JDBCConfigurationImpl implements DistributedJDBCConfiguration { private final List < Slice > _slices = new ArrayList < Slice > ( ) ; private Slice _master ; private DistributedDataSource virtualDataSource ; protected BooleanValue lenientPlugin ; protected StringValue masterPlugin ; protected StringListValue namesPlugin ; public PluginValue distributionPolicyPlugin ; public PluginValue replicationPolicyPlugin ; protected Log log ; protected String unit ; public static final String DOT = "." ; public static final String REGEX_DOT = "\\." ; public static final String PREFIX_SLICE = ( ProductDerivation . PREFIX_SLICE ) + ( DistributedJDBCConfigurationImpl . DOT ) ; public static final String PREFIX_OPENJPA = "openjpa." ; private static Localizer _loc = Localizer . forPackage ( DistributedJDBCConfigurationImpl . class ) ; public DistributedJDBCConfigurationImpl ( ConfigurationProvider cp ) { } private String getPersistenceUnitName ( Map p ) { } private void setDiagnosticContext ( OpenJPAConfiguration conf , String unit ) { } public List < String > getActiveSliceNames ( ) { } public List < String > getAvailableSliceNames ( ) { } public List < Slice > getSlices ( Slice ... statuses ) { } public Slice getMaster ( ) { } public Slice getSlice ( String name ) { } public Slice getSlice ( String name , boolean mustExist ) { } public DistributionPolicy getDistributionPolicyInstance ( ) { } public String getDistributionPolicy ( ) { } public void setDistributionPolicyInstance ( DistributionPolicy policy ) { } public void setDistributionPolicy ( String policy ) { } public ReplicationPolicy getReplicationPolicyInstance ( ) { } public String getReplicationPolicy ( ) { } public void setReplicationPolicyInstance ( ReplicationPolicy policy ) { } public void setReplicationPolicy ( String policy ) { } public DistributedDataSource getConnectionFactory ( ) { } public boolean isLenient ( ) { } private DistributedDataSource createDistributedDataStore ( ) { } DataSource createDataSource ( Slice slice ) throws Exception { JDBCConfiguration conf = ( ( JDBCConfiguration ) ( slice . getConfiguration ( ) ) ) ; Log log = conf . getConfigurationLog ( ) ; String url = getConnectionInfo ( conf ) ; if ( log . isInfoEnabled ( ) ) log . info ( DistributedJDBCConfigurationImpl . _loc . get ( "slice-connect" , slice , url ) ) ; DataSource ds = DataSourceFactory . newDataSource ( conf , false ) ; <START_BUG> DecoratingDataSource dds = new DecoratingDataSource ( ds ) ; <END_BUG> ds = DataSourceFactory . installDBDictionary ( conf . getDBDictionaryInstance ( ) , dds , conf , false ) ; verifyDataSource ( slice , ds , conf ) ; return ds ; } String getConnectionInfo ( OpenJPAConfiguration conf ) { } boolean isXACompliant ( DataSource ds ) { } private boolean verifyDataSource ( Slice slice , DataSource ds , JDBCConfiguration conf ) { } private void handleBadConnection ( boolean isLenient , Slice slice , Throwable ex ) { } void setSlices ( Map original ) { } protected Slice newSlice ( String key , Map original ) { } private List < String > findSlices ( Map p ) { } private List < String > scanForSliceNames ( Map p ) { } private static int getPartCount ( String s ) { } private static String chopHead ( String s , String head ) { } private static String chopTail ( String s , String tail ) { } Map createSliceProperties ( Map original , String slice ) { } private void setMaster ( Map original ) { } public Slice addSlice ( String name , Map newProps ) { } }

Fix:
DecoratingDataSource dds = DecoratingDataSource . newDecoratingDataSource ( ds ) ;