auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static List<String> getUserList(JdbcRealm obj) { List<String> userlist = new ArrayList<>(); Connection con = null; PreparedStatement ps = null; ResultSet rs = null; DataSource dataSource = null; String authQuery = ""; String retval[]; String tablename = ""; String username = ""; String userquery; try { dataSource = (DataSource) FieldUtils.readField(obj, "dataSource", true); authQuery = (String) FieldUtils.readField(obj, "authenticationQuery", true); LOGGER.info(authQuery); String authQueryLowerCase = authQuery.toLowerCase(); retval = authQueryLowerCase.split("from", 2); if (retval.length >= 2) { retval = retval[1].split("with|where", 2); tablename = retval[0]; retval = retval[1].split("where", 2); if (retval.length >= 2) { retval = retval[1].split("=", 2); } else { retval = retval[0].split("=", 2); } username = retval[0]; } if (StringUtils.isBlank(username) || StringUtils.isBlank(tablename)) { return userlist; } userquery = String.format("SELECT %s FROM %s", username, tablename); } catch (IllegalAccessException e) { LOGGER.error("Error while accessing dataSource for JDBC Realm", e); return null; } try { con = dataSource.getConnection(); ps = con.prepareStatement(userquery); rs = ps.executeQuery(); while (rs.next()) { userlist.add(rs.getString(1).trim()); } } catch (Exception e) { LOGGER.error("Error retrieving User list from JDBC Realm", e); } finally { JdbcUtils.closeResultSet(rs); JdbcUtils.closeStatement(ps); JdbcUtils.closeConnection(con); } return userlist; }

Target:
private static List<String> getUserList(JdbcRealm obj) { List<String> userlist = new ArrayList<>(); Connection con = null; PreparedStatement ps = null; ResultSet rs = null; DataSource dataSource = null; String authQuery = ""; String retval[]; String tablename = ""; String username = ""; String userquery; try { dataSource = (DataSource) FieldUtils.readField(obj, "dataSource", true); authQuery = (String) FieldUtils.readField(obj, "authenticationQuery", true); LOGGER.info(authQuery); String authQueryLowerCase = authQuery.toLowerCase(); retval = authQueryLowerCase.split("from", 2); if (retval.length >= 2) { retval = retval[1].split("with|where", 2); tablename = retval[0]; retval = retval[1].split("where", 2); if (retval.length >= 2) { retval = retval[1].split("=", 2); } else { retval = retval[0].split("=", 2); } username = retval[0]; } if (StringUtils.isBlank(username) || StringUtils.isBlank(tablename)) { return userlist; } userquery = String.format("SELECT %s FROM %s", username, tablename); } catch (IllegalAccessException e) { LOGGER.error("Error while accessing dataSource for JDBC Realm", e); return Lists.newArrayList(); } try { con = dataSource.getConnection(); ps = con.prepareStatement(userquery); rs = ps.executeQuery(); while (rs.next()) { userlist.add(rs.getString(1).trim()); } } catch (Exception e) { LOGGER.error("Error retrieving User list from JDBC Realm", e); } finally { JdbcUtils.closeResultSet(rs); JdbcUtils.closeStatement(ps); JdbcUtils.closeConnection(con); } return userlist; }
Source:
private String invokeAntiSamy( String context, String input ) throws ValidationException { if ( StringUtilities.isEmpty(input) ) { if (allowNull) { return null; } throw new ValidationException( context + " is required", "AntiSamy validation error: context=" + context + ", input=" + input, context ); } String canonical = super.getValid( context, input ); try { AntiSamy as = new AntiSamy(); CleanResults test = as.scan(canonical, antiSamyPolicy); List<String> errors = test.getErrorMessages(); if ( !errors.isEmpty() ) { StringBuilder sb = new StringBuilder(); for ( int i = 0; i < errors.size(); i++ ) { sb.append(errors.get(i)); if ( i != errors.size() - 1 ) { sb.append(","); } } throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input does not follow rules in antisamy-esapi.xml: context=" + context + " errors=" + sb.toString()); } return test.getCleanHTML().trim(); } catch (ScanException e) { throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input: context=" + context + " error=" + e.getMessage(), e, context ); } catch (PolicyException e) { throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input does not follow rules in antisamy-esapi.xml: context=" + context + " error=" + e.getMessage(), e, context ); } }

Target:
private String invokeAntiSamy( String context, String input ) throws ValidationException { if ( StringUtilities.isEmpty(input) ) { if (allowNull) { return null; } throw new ValidationException( context + " is required", "AntiSamy validation error: context=" + context + ", input=" + input, context ); } String canonical = super.getValid( context, input ); try { AntiSamy as = new AntiSamy(); CleanResults test = as.scan(canonical, antiSamyPolicy); List<String> errors = test.getErrorMessages(); if ( !errors.isEmpty() ) { throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input does not follow rules in antisamy-esapi.xml: context=" + context + " errors=" + errors.toString()); } return test.getCleanHTML().trim(); } catch (ScanException e) { throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input: context=" + context + " error=" + e.getMessage(), e, context ); } catch (PolicyException e) { throw new ValidationException( context + ": Invalid HTML input", "Invalid HTML input does not follow rules in antisamy-esapi.xml: context=" + context + " error=" + e.getMessage(), e, context ); } }
Source:
public void setParallel(XmlSuite.ParallelMode parallel) { if (parallel == XmlSuite.ParallelMode.FALSE || parallel == XmlSuite.ParallelMode.TRUE) { Utils.log("TestNG", 1, "[WARN] 'parallel' value 'true' and 'false' are deprecated, use 'none' instead."); parallel = XmlSuite.ParallelMode.NONE; } m_parallelMode = parallel; }

Target:
public void setParallel(XmlSuite.ParallelMode parallel) { m_parallelMode = skipDeprecatedValues(parallel); }
Source:
DeadLetterQueueReporter(KafkaProducer<byte[], byte[]> kafkaProducer, SinkConnectorConfig connConfig, ConnectorTaskId id, ErrorHandlingMetrics errorHandlingMetrics) { Objects.requireNonNull(kafkaProducer); Objects.requireNonNull(connConfig); Objects.requireNonNull(id); Objects.requireNonNull(errorHandlingMetrics); this.kafkaProducer = kafkaProducer; this.connConfig = connConfig; this.connectorTaskId = id; this.errorHandlingMetrics = errorHandlingMetrics; this.dlqTopicName = connConfig.dlqTopicName(); }

Target:
DeadLetterQueueReporter(KafkaProducer<byte[], byte[]> kafkaProducer, SinkConnectorConfig connConfig, ConnectorTaskId id, ErrorHandlingMetrics errorHandlingMetrics) { Objects.requireNonNull(kafkaProducer); Objects.requireNonNull(connConfig); Objects.requireNonNull(id); Objects.requireNonNull(errorHandlingMetrics); this.kafkaProducer = kafkaProducer; this.connConfig = connConfig; this.connectorTaskId = id; this.errorHandlingMetrics = errorHandlingMetrics; this.dlqTopicName = connConfig.dlqTopicName().trim(); }
Source:
@Override public ClientListenerResponse handle(ClientListenerRequest req) { try { if (req instanceof ClientTxAwareRequest) { if (((ClientTxAwareRequest)req).isTransactional()) { int txId = ((ClientTxAwareRequest)req).txId(); ClientTxContext txCtx = ctx.txContext(txId); if (txCtx != null) { try { txCtx.aquire(); return ((ClientRequest)req).process(ctx); } catch (IgniteCheckedException e) { throw e.getCause() instanceof IgniteClientException ? (IgniteClientException)e.getCause() : new IgniteClientException(ClientStatus.FAILED, e.getMessage(), e); } finally { try { txCtx.release(); } catch (Exception e) { log.warning("Failed to release client transaction context", e); } } } } } return ((ClientRequest)req).process(ctx); } catch (SecurityException ex) { throw new IgniteClientException( ClientStatus.SECURITY_VIOLATION, "Client is not authorized to perform this operation", ex ); } }

Target:
@Override public ClientListenerResponse handle(ClientListenerRequest req) { try { if (req instanceof ClientTxAwareRequest) { ClientTxAwareRequest req0 = (ClientTxAwareRequest)req; if (req0.isTransactional()) { int txId = req0.txId(); ClientTxContext txCtx = ctx.txContext(txId); if (txCtx != null) { try { txCtx.acquire(true); return ((ClientRequest)req).process(ctx); } catch (IgniteCheckedException e) { throw new IgniteClientException(ClientStatus.FAILED, e.getMessage(), e); } finally { try { txCtx.release(true); } catch (Exception e) { log.warning("Failed to release client transaction context", e); } } } } } return ((ClientRequest)req).process(ctx); } catch (SecurityException ex) { throw new IgniteClientException( ClientStatus.SECURITY_VIOLATION, "Client is not authorized to perform this operation", ex ); } }
Source:
public String toString() { return "Configuration [clusteringConfiguration=" + clusteringConfiguration + ", customInterceptorsConfiguration=" + customInterceptorsConfiguration + ", dataContainerConfiguration=" + dataContainerConfiguration + ", deadlockDetectionConfiguration=" + deadlockDetectionConfiguration + ", evictionConfiguration=" + evictionConfiguration + ", expirationConfiguration=" + expirationConfiguration + ", indexingConfiguration=" + indexingConfiguration + ", invocationBatchingConfiguration=" + invocationBatchingConfiguration + ", jmxStatisticsConfiguration=" + jmxStatisticsConfiguration + ", persistenceConfiguration=" + persistenceConfiguration + ", lockingConfiguration=" + lockingConfiguration + ", storeAsBinaryConfiguration=" + storeAsBinaryConfiguration + ", transactionConfiguration=" + transactionConfiguration + ", versioningConfiguration=" + versioningConfiguration + ", unsafeConfiguration=" + unsafeConfiguration + ", moduleConfiguration=" + moduleConfiguration + ", securityConfiguration=" + securityConfiguration + ", sitesConfiguration=" + sitesConfiguration + ", compatibilityConfiguration=" + compatibilityConfiguration + "]"; }

Target:
public String toString() { return "Configuration{" + "clustering=" + clusteringConfiguration + ", customInterceptors=" + customInterceptorsConfiguration + ", dataContainer=" + dataContainerConfiguration + ", deadlockDetection=" + deadlockDetectionConfiguration + ", eviction=" + evictionConfiguration + ", expiration=" + expirationConfiguration + ", indexing=" + indexingConfiguration + ", invocationBatching=" + invocationBatchingConfiguration + ", jmxStatistics=" + jmxStatisticsConfiguration + ", persistence=" + persistenceConfiguration + ", locking=" + lockingConfiguration + ", modules=" + moduleConfiguration + ", security=" + securityConfiguration + ", storeAsBinary=" + storeAsBinaryConfiguration + ", transaction=" + transactionConfiguration + ", versioning=" + versioningConfiguration + ", unsafe=" + unsafeConfiguration + ", sites=" + sitesConfiguration + ", compatibility=" + compatibilityConfiguration + '}'; }
Source:
private static synchronized void removeSession(SyncConfiguration syncConfiguration) { if (syncConfiguration == null) { throw new IllegalArgumentException("A non-empty 'syncConfiguration' is required."); } SyncSession syncSession = sessions.remove(syncConfiguration.getPath()); if (syncSession != null) { syncSession.close(); } if (sessions.size() == 0) { RealmLog.debug("last session dropped, remove network listener"); NetworkStateReceiver.removeListener(networkListener); } }

Target:
private static synchronized void removeSession(SyncConfiguration syncConfiguration) { if (syncConfiguration == null) { throw new IllegalArgumentException("A non-empty 'syncConfiguration' is required."); } SyncSession syncSession = sessions.remove(syncConfiguration.getPath()); if (syncSession != null) { syncSession.close(); } if (sessions.isEmpty()) { RealmLog.debug("last session dropped, remove network listener"); NetworkStateReceiver.removeListener(networkListener); } }
Source:
public int[][] getDrops(Item item) { if (item.getTier() >= ItemTool.TIER_WOODEN) { return new int[][]{{}}; } return new int[0][0]; }

Target:
public int[][] getDrops(Item item) { if (item.getTier() >= ItemTool.TIER_WOODEN) { return new int[][]{{Item.CAULDRON, 0, 1}}; } return new int[0][0]; }
Source:
protected void updateWipeAfterDeleteChangeability() { if (isVmAttachedToPool()) { getIsWipeAfterDelete().setIsChangeable(false); } else { getIsWipeAfterDelete().setIsChangeable(true); } }

Target:
protected void updateWipeAfterDeleteChangeability() { getIsWipeAfterDelete().setIsChangeable(!isVmAttachedToPool()); }
Source:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Inspecting GeoPackage", ProgressIndicator.UNKNOWN); try { URI loc = getSource().getLocation(); File file; try { file = new File(loc); } catch (Exception e) { throw new IllegalArgumentException("Only files are supported as data source", e); } GeoPackage gpkg = GeoPackageManager.open(file, true); Map<TypeDefinition, InstanceCollection> collections = new HashMap<>(); for (String table : gpkg.getFeatureTables()) { QName defTypeName = new QName(GeopackageSchemaBuilder.DEFAULT_NAMESPACE, table); TypeDefinition type = getSourceSchema().getType(defTypeName); if (!type.getConstraint(MappingRelevantFlag.class).isEnabled()) { type = null; } if (type == null) { for (TypeDefinition candidate : getSourceSchema().getMappingRelevantTypes()) { if (table.equals(candidate.getName().getLocalPart())) { type = candidate; break; } } } if (type == null) { reporter.warn("For table {0} no matching schema type could be identified", table); } else { FeatureDao features = gpkg.getFeatureDao(table); collections.put(type, new GeopackageFeatureCollection(features, type)); } } collection = new PerTypeInstanceCollection(collections); reporter.setSuccess(true); } catch (Exception e) { reporter.error(new IOMessageImpl("Error configuring database connection", e)); reporter.setSuccess(false); } finally { progress.end(); } return reporter; }

Target:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Inspecting GeoPackage", ProgressIndicator.UNKNOWN); try { URI loc = getSource().getLocation(); File file; try { file = new File(loc); } catch (Exception e) { throw new IllegalArgumentException("Only files are supported as data source", e); } GeoPackage gpkg = GeoPackageManager.open(file, true); Map<TypeDefinition, InstanceCollection> collections = new HashMap<>(); for (String table : gpkg.getFeatureTables()) { QName defTypeName = new QName(GeopackageSchemaBuilder.DEFAULT_NAMESPACE, table); TypeDefinition type = getSourceSchema().getType(defTypeName); if (type != null && !type.getConstraint(MappingRelevantFlag.class).isEnabled()) { type = null; } if (type == null) { for (TypeDefinition candidate : getSourceSchema().getMappingRelevantTypes()) { if (table.equals(candidate.getName().getLocalPart())) { type = candidate; break; } } } if (type == null) { reporter.warn("For table {0} no matching schema type could be identified", table); } else { FeatureDao features = gpkg.getFeatureDao(table); collections.put(type, new GeopackageFeatureCollection(features, type)); } } collection = new PerTypeInstanceCollection(collections); reporter.setSuccess(true); } catch (Exception e) { reporter.error(new IOMessageImpl("Error configuring database connection", e)); reporter.setSuccess(false); } finally { progress.end(); } return reporter; }
Source:
public GlusterStatus isVDORunning(Guid vdsId) { VDSReturnValue returnValue = resourceManager.runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vdsId, Arrays.asList("vdo"), "status")); if (!returnValue.getSucceeded()) { log.error("Failed to check VDO running status of host : '{}' ", vdsId); return GlusterStatus.UNKNOWN; } ArrayList<GlusterServerService> returnList = (ArrayList<GlusterServerService>) returnValue.getReturnValue(); if (returnList == null || returnList.isEmpty()) { log.error("Failed to check VDO running status of host : '{}' returned empty object", vdsId); return GlusterStatus.UNKNOWN; } GlusterServerService gss = returnList.get(0); if (gss != null) { return gss.getStatus().getStatusMsg().equalsIgnoreCase("Up") ? GlusterStatus.UP : GlusterStatus.DOWN; } return GlusterStatus.UNKNOWN; }

Target:
public GlusterStatus isVDORunning(Guid vdsId) { VDSReturnValue returnValue = resourceManager.runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vdsId, Arrays.asList("vdo"), "status")); if (!returnValue.getSucceeded()) { log.error("Failed to check VDO running status of host : '{}' ", vdsId); return GlusterStatus.UNKNOWN; } ArrayList<GlusterServerService> returnList = (ArrayList<GlusterServerService>) returnValue.getReturnValue(); if (returnList == null || returnList.isEmpty()) { log.error("Failed to check VDO running status of host : '{}' returned empty object", vdsId); return GlusterStatus.UNKNOWN; } GlusterServerService gss = returnList.get(0); if (gss != null) { return gss.getStatus().getStatusMsg().equalsIgnoreCase("Up") ? GlusterStatus.UP : GlusterStatus.DOWN; } log.info("Failed to check VDO running status of host : '{}' ", vdsId); return GlusterStatus.UNKNOWN; }
Source:
private boolean checkFieldPresent(@NonNull String field) { final Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((getContainedEventTypes())); Optional<@NonNull String> event = traceEvents.values().stream() .filter(fieldName -> fieldName.equals(field)) .findAny(); return event.isPresent(); }

Target:
private boolean checkFieldPresent(@NonNull String field) { final Multimap<@NonNull String, @NonNull String> traceEvents = TmfEventTypeCollectionHelper.getEventFieldNames((getContainedEventTypes())); return traceEvents.containsValue(field); }
Source:
@Override protected DescriptionEditSuccessFragment createFragment() { DescriptionEditSuccessFragment fragment = DescriptionEditSuccessFragment.newInstance(); fragment.setCallback(this); return fragment; }

Target:
@Override protected DescriptionEditSuccessFragment createFragment() { return DescriptionEditSuccessFragment.newInstance(); }
Source:
if (!isLoaded()) { log.error("Tried and failed to load Accumulo native library from " + accumuloNativeLibDirs); String ldLibraryPath = System.getProperty("java.library.path"); try { System.loadLibrary("accumulo"); loadedNativeLibraries.set(true); log.info("Loaded native map shared library from " + ldLibraryPath); } catch (Exception | UnsatisfiedLinkError e) { log.error("Tried and failed to load Accumulo native library from " + ldLibraryPath, e); } }

Target:
if (!isLoaded()) { log.error("Tried and failed to load Accumulo native library from {}", accumuloNativeLibDirs); String ldLibraryPath = System.getProperty("java.library.path"); try { System.loadLibrary("accumulo"); loadedNativeLibraries.set(true); log.info("Loaded native map shared library from " + ldLibraryPath); } catch (Exception | UnsatisfiedLinkError e) { log.error("Tried and failed to load Accumulo native library from {}", ldLibraryPath, e); } }
Source:
public synchronized void onWorkerAdded(final boolean addedEval, final String workerId) { if (addedEval) { return; } workerClockMap.put(workerId, globalMinimumClock); minimumClockWorkers.add(workerId); }

Target:
public synchronized void onWorkerAdded(final boolean addedEval, final String workerId) { if (addedEval) { return; } if (!addedEval && globalMinimumClock != INITIAL_GLOBAL_MINIMUM_CLOCK) { throw new RuntimeException( String.format("Initial worker %s is added after global minimum clock changes", workerId)); } workerClockMap.put(workerId, globalMinimumClock); minimumClockWorkers.add(workerId); }
Source:
public void shouldConcatenateOneEmptyAndOneNonEmptyLists() { final List<Integer> list = Collections.unmodifiableList( IntStream.range(0, 4) .boxed() .collect(Collectors.toList()) ); final List<Integer> actual = ListOps.concat(list, EMPTY_LIST); final List<Integer> expected = IntStream.range(0, 4) .boxed() .collect(Collectors.toList()); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void shouldConcatenateOneEmptyAndOneNonEmptyLists() { final List<Integer> list = Collections.unmodifiableList( Arrays.asList(0, 1, 2, 3, 4) ); final List<Integer> actual = ListOps.concat(list, EMPTY_LIST); final List<Integer> expected = Arrays.asList(0, 1, 2, 3, 4); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }
Source:
public void checkIfRepoStarred() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT) ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_FOUND)) .start(); final Stars truestars = new RtStars( new ApacheRequest(container.home()), RtStarsTest.repo("someuser", "starredrepo") ); MatcherAssert.assertThat( truestars.starred(), Matchers.is(true) ); final Stars falsestars = new RtStars( new ApacheRequest(container.home()), RtStarsTest.repo("otheruser", "notstarredrepo") ); MatcherAssert.assertThat( falsestars.starred(), Matchers.is(false) ); }

Target:
public void checkIfRepoStarred() throws Exception { final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT) ).next(new MkAnswer.Simple(HttpURLConnection.HTTP_NOT_FOUND)) .start(); final Stars starred = new RtStars( new ApacheRequest(container.home()), RtStarsTest.repo("someuser", "starredrepo") ); MatcherAssert.assertThat( starred.starred(), Matchers.is(true) ); final Stars unstarred = new RtStars( new ApacheRequest(container.home()), RtStarsTest.repo("otheruser", "notstarredrepo") ); MatcherAssert.assertThat( unstarred.starred(), Matchers.is(false) ); }
Source:
private static Map<String, Long> getExternalResourceAmountMap(Configuration config) { final Set<String> resourceSet = getExternalResourceSet(config); LOG.info("Enabled external resources: {}", resourceSet); if (resourceSet.isEmpty()) { return Collections.emptyMap(); } final Map<String, Long> externalResourceAmountMap = new HashMap<>(); for (String resourceName: resourceSet) { final ConfigOption<Long> amountOption = key(ExternalResourceOptions.keyWithResourceNameAndSuffix(resourceName, ExternalResourceOptions.EXTERNAL_RESOURCE_AMOUNT_SUFFIX)) .longType() .noDefaultValue(); final Long amount = config.getLong(amountOption, 0); if (amount <= 0) { LOG.warn("The amount of the should be configured with a positive value.", resourceName); break; } else { externalResourceAmountMap.put(resourceName, amount); } } return externalResourceAmountMap; }

Target:
public static Map<String, Long> getExternalResourceAmountMap(Configuration config) { final Set<String> resourceSet = getExternalResourceSet(config); LOG.info("Enabled external resources: {}", resourceSet); if (resourceSet.isEmpty()) { return Collections.emptyMap(); } final Map<String, Long> externalResourceAmountMap = new HashMap<>(); for (String resourceName: resourceSet) { final ConfigOption<Long> amountOption = key(ExternalResourceOptions.getAmountConfigOptionForResource(resourceName)) .longType() .noDefaultValue(); final Optional<Long> amountOpt = config.getOptional(amountOption); if (!amountOpt.isPresent()) { LOG.warn("The amount of the should be configured. Will ignore that resource.", resourceName); } else if (amountOpt.get() <= 0) { LOG.warn("The amount of the should be positive while finding {}. Will ignore that resource.", amountOpt.get(), resourceName); } else { externalResourceAmountMap.put(resourceName, amountOpt.get()); } } return externalResourceAmountMap; }
Source:
public DummyXAResource xaResource() { rms.addXAResourceRecovery(xaResourceRecovery()); return new DummyXAResource(); }

Target:
public DummyXAResource xaResource() { return new DummyXAResource(); }
Source:
private void runLibertyMojoDeploy() throws MojoExecutionException { deployParams.addAll(commonParams); deployParams.addAll(commonServerParams); Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), deployParams); stripConfigElements(config, deployParams); log.info("Running liberty:deploy goal"); runLibertyMojo("deploy", config); }

Target:
private void runLibertyMojoDeploy() throws MojoExecutionException { Xpp3Dom pluginConfig = (Xpp3Dom)getLibertyPlugin().getConfiguration(); if (pluginConfig != null && pluginConfig.getChild("looseApplication") != null && "false".equals(pluginConfig.getChild("looseApplication").getValue())) { log.warn("Overriding liberty plugin pararmeter, \"looseApplication\" to \"true\" and deploying application in looseApplication format"); } Xpp3Dom config = stripConfigElements(getLibertyPluginConfig(), deployParams); log.info("Running liberty:deploy goal"); runLibertyMojo("deploy", config); }
Source:
public String getAuthorityKeyID() { if(authorityKeyID == null){ byte[] authorityKey = x509Cert.getExtensionValue(AUTHORITY_KEY_ID); try { if (authorityKey != null) { DERDecoder extValA = new DERDecoder(authorityKey); extValA.skip(AUTHORITY_KEY_POSITION); int length = authorityKey.length - AUTHORITY_KEY_POSITION; authorityKeyID = Hex.encodeHexString(extValA.getBytes(length)); } } catch (WSSecurityException e) { LOG.error("Unable to convert AIK into human readable ", e.getLocalizedMessage(), e); } } return StringUtils.isEmpty(authorityKeyID) ? EMPTY_FIELD : authorityKeyID; }

Target:
public String getAuthorityKeyID() { return authorityKeyID; }
Source:
public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { CommandContext ctx = new CommandContext(new EngineContext()); ctx.getExecutionContext().setMonitored(true); Backend.getInstance().runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), ctx); } } catch (RuntimeException e) { log.error("Failed to initialize Vds on up.", e); } } }); } return isSucceeded; }

Target:
public boolean vdsUpEvent(final VDS vds) { HostStoragePoolParametersBase params = new HostStoragePoolParametersBase(vds); boolean isSucceeded = Backend.getInstance().runInternalAction(VdcActionType.InitVdsOnUp, params).getSucceeded(); if (isSucceeded) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { try { List<VmStatic> vmsToMigrate = DbFacade.getInstance().getVmStaticDao().getAllWithFailbackByVds(vds.getId()); if (!vmsToMigrate.isEmpty()) { CommandContext ctx = new CommandContext(new EngineContext()); ctx.getExecutionContext().setMonitored(true); Backend.getInstance().runInternalMultipleActions(VdcActionType.MigrateVmToServer, new ArrayList<>(createMigrateVmToServerParametersList(vmsToMigrate, vds)), ctx); } } catch (RuntimeException e) { log.error("Failed to initialize Vds on up: {}", e.getMessage()); log.debug("Exception", e); } } }); } return isSucceeded; }
Source:
protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent = node.getParent(); if (parent instanceof IASTIdExpression) { final IASTNode grandParent = parent.getParent(); if (grandParent instanceof IASTArraySubscriptExpression) { return rwInExpression((IASTArraySubscriptExpression) grandParent, parent, indirection + 1); } else if (grandParent instanceof IASTUnaryExpression) { return rwInExpression((IASTUnaryExpression) grandParent, parent, indirection); } } if (parent instanceof IASTExpression) { return rwInExpression((IASTExpression) parent, node, indirection); } else if (parent instanceof IASTStatement) { return rwInStatement((IASTStatement) parent, node, indirection); } else if (parent instanceof IASTDeclarator) { return rwInDeclarator((IASTDeclarator) parent, indirection); } else if (parent instanceof IASTEqualsInitializer) { return rwInEqualsInitializer((IASTEqualsInitializer) parent, indirection); } else if (parent instanceof IASTArrayModifier) { return READ; } else if (parent instanceof IASTInitializerList) { return rwInInitializerList((IASTInitializerList) parent, indirection); } return READ | WRITE; }

Target:
protected int rwAnyNode(IASTNode node, int indirection) { final IASTNode parent = node.getParent(); if (parent instanceof IASTExpression) { return rwInExpression((IASTExpression) parent, node, indirection); } else if (parent instanceof IASTStatement) { return rwInStatement((IASTStatement) parent, node, indirection); } else if (parent instanceof IASTDeclarator) { return rwInDeclarator((IASTDeclarator) parent, indirection); } else if (parent instanceof IASTEqualsInitializer) { return rwInEqualsInitializer((IASTEqualsInitializer) parent, indirection); } else if (parent instanceof IASTArrayModifier) { return READ; } else if (parent instanceof IASTInitializerList) { return rwInInitializerList((IASTInitializerList) parent, indirection); } return READ | WRITE; }
Source:
private static Repo repo( final MkStorage storage) throws IOException { final String test = "test"; return new MkGithub(storage, test).repos().create( Json.createObjectBuilder().add("name", test).build() ); }

Target:
private static Repo repo( final MkStorage storage) throws IOException { final String login = "test"; return new MkGithub(storage, login).repos().create( Json.createObjectBuilder().add("name", login).build() ); }
Source:
private static HashCode computeValuesHashCode(Set<String> values) { final List<String> sortedValues = new ArrayList<>(values); sortedValues.sort(Comparator.nullsFirst(Ordering.natural())); final Hasher hasher = Hashing.sha256().newHasher(); for (String v : sortedValues) { if (v == null) { hasher.putInt(0); } else { hasher.putString(v, StandardCharsets.UTF_8); } } return hasher.hash(); }

Target:
public static int computeValuesHashCode(Set<String> values) { final List<String> sortedValues = new ArrayList<>(values); sortedValues.sort(Comparator.nullsFirst(Ordering.natural())); final Hasher hasher = Hashing.sha256().newHasher(); for (String v : sortedValues) { if (v == null) { hasher.putInt(0); } else { hasher.putString(v, StandardCharsets.UTF_8); } } return hasher.hash().asInt(); }
Source:
public void testSaslPrincipalIsSignificant() throws IOException, InterruptedException { UserGroupInformation user1 = UserGroupInformation.createUserForTesting("user1", new String[0]); final KerberosToken token = EasyMock.createMock(KerberosToken.class); SaslConnectionParams saslParams1 = user1 .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); UserGroupInformation user2 = UserGroupInformation.createUserForTesting("user2", new String[0]); SaslConnectionParams saslParams2 = user2 .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); ThriftTransportKey ttk1 = new ThriftTransportKey(HostAndPort.fromParts("localhost", 9997), 1l, null, saslParams1), ttk2 = new ThriftTransportKey(HostAndPort.fromParts("localhost", 9997), 1l, null, saslParams2); assertNotEquals(ttk1, ttk2); assertNotEquals(ttk1.hashCode(), ttk2.hashCode()); }

Target:
public void testSaslPrincipalIsSignificant() throws IOException, InterruptedException { UserGroupInformation user1 = UserGroupInformation.createUserForTesting("user1", new String[0]); final KerberosToken token = EasyMock.createMock(KerberosToken.class); SaslConnectionParams saslParams1 = user1 .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); UserGroupInformation user2 = UserGroupInformation.createUserForTesting("user2", new String[0]); SaslConnectionParams saslParams2 = user2 .doAs((PrivilegedExceptionAction<SaslConnectionParams>) () -> createSaslParams(token)); ThriftTransportKey ttk1 = new ThriftTransportKey(HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams1), ttk2 = new ThriftTransportKey(HostAndPort.fromParts("localhost", 9997), 1L, null, saslParams2); assertNotEquals(ttk1, ttk2); assertNotEquals(ttk1.hashCode(), ttk2.hashCode()); }
Source:
public void testEGetNullEObjectNullFeature() { assertEquals(null, eObjectServices.eGet(null, null)); }

Target:
public void testEGetNullEObjectNullFeature() { eObjectServices.eGet(null, null); }
Source:
public URI createURI(URI location) { URI result = null; switch (oldScheme) { case "http": if (location.getPort() == -1) { result = URI.create(format("%s://%s:80", newScheme, location.getAuthority())); } break; case "https": if (location.getPort() == -1) { result = URI.create(format("%s://%s:443", newScheme, location.getAuthority())); } break; default: } if (result == null) { result = URI.create(format("%s://%s", newScheme, location.getAuthority())); } return result; }

Target:
public URI createURI(URI location) { URI result; if (location.getPort() == -1) { int port = getDefaultPortForScheme(location.getScheme()); result = URI.create(format("%s://%s:%d", newScheme, location.getAuthority(), port)); } else { result = URI.create(format("%s://%s", newScheme, location.getAuthority())); } return result; }
Source:
protected static ImmutableList<Ds3Annotation> convertAllAnnotations( final ImmutableList<Ds3Annotation> annotations, final NameMapper nameMapper) { if (annotations == null || annotations.isEmpty()) { return annotations; } ImmutableList.Builder<Ds3Annotation> builder = ImmutableList.builder(); for (final Ds3Annotation annotation : annotations) { final Ds3Annotation convertedAnnotation = new Ds3Annotation( convertName(annotation.getName(), nameMapper), convertAllAnnotationElements(annotation.getDs3AnnotationElements(), nameMapper)); builder.add(convertedAnnotation); } return builder.build(); }

Target:
protected static ImmutableList<Ds3Annotation> convertAllAnnotations( final ImmutableList<Ds3Annotation> annotations, final NameMapper nameMapper) { if (annotations == null || annotations.isEmpty()) { return annotations; } final ImmutableList.Builder<Ds3Annotation> builder = ImmutableList.builder(); for (final Ds3Annotation annotation : annotations) { final Ds3Annotation convertedAnnotation = new Ds3Annotation( convertName(annotation.getName(), nameMapper), convertAllAnnotationElements(annotation.getDs3AnnotationElements(), nameMapper)); builder.add(convertedAnnotation); } return builder.build(); }
Source:
public CUBRIDDialect() { registerColumnType( Types.BOOLEAN, "bit" ); registerColumnType( Types.TINYINT, "smallint" ); registerColumnType(Types.TIMESTAMP, "datetime"); registerColumnType(Types.TIMESTAMP, "datetimetz"); registerColumnType( Types.BINARY, "bit($l)"); registerColumnType( Types.VARBINARY, "bit varying($l)"); getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" ); getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE ); registerKeyword( "TYPE" ); registerKeyword( "YEAR" ); registerKeyword( "MONTH" ); registerKeyword( "ALIAS" ); registerKeyword( "VALUE" ); registerKeyword( "FIRST" ); registerKeyword( "ROLE" ); registerKeyword( "CLASS" ); registerKeyword( "BIT" ); registerKeyword( "TIME" ); registerKeyword( "QUERY" ); registerKeyword( "DATE" ); registerKeyword( "USER" ); registerKeyword( "ACTION" ); registerKeyword( "SYS_USER" ); registerKeyword( "ZONE" ); registerKeyword( "LANGUAGE" ); registerKeyword( "DICTIONARY" ); registerKeyword( "DATA" ); registerKeyword( "TEST" ); registerKeyword( "SUPERCLASS" ); registerKeyword( "SECTION" ); registerKeyword( "LOWER" ); registerKeyword( "LIST" ); registerKeyword( "OID" ); registerKeyword( "DAY" ); registerKeyword( "IF" ); registerKeyword( "ATTRIBUTE" ); registerKeyword( "STRING" ); registerKeyword( "SEARCH" ); }

Target:
public CUBRIDDialect() { super(); registerColumnType( Types.BOOLEAN, "bit" ); registerColumnType( Types.TINYINT, "smallint" ); registerColumnType(Types.TIMESTAMP, "datetime"); registerColumnType(Types.TIMESTAMP, "datetimetz"); registerColumnType( Types.BINARY, "bit($l)"); registerColumnType( Types.VARBINARY, "bit varying($l)"); getDefaultProperties().setProperty( Environment.USE_STREAMS_FOR_BINARY, "true" ); getDefaultProperties().setProperty( Environment.STATEMENT_BATCH_SIZE, DEFAULT_BATCH_SIZE ); registerKeyword( "TYPE" ); registerKeyword( "YEAR" ); registerKeyword( "MONTH" ); registerKeyword( "ALIAS" ); registerKeyword( "VALUE" ); registerKeyword( "FIRST" ); registerKeyword( "ROLE" ); registerKeyword( "CLASS" ); registerKeyword( "BIT" ); registerKeyword( "TIME" ); registerKeyword( "QUERY" ); registerKeyword( "DATE" ); registerKeyword( "USER" ); registerKeyword( "ACTION" ); registerKeyword( "SYS_USER" ); registerKeyword( "ZONE" ); registerKeyword( "LANGUAGE" ); registerKeyword( "DICTIONARY" ); registerKeyword( "DATA" ); registerKeyword( "TEST" ); registerKeyword( "SUPERCLASS" ); registerKeyword( "SECTION" ); registerKeyword( "LOWER" ); registerKeyword( "LIST" ); registerKeyword( "OID" ); registerKeyword( "DAY" ); registerKeyword( "IF" ); registerKeyword( "ATTRIBUTE" ); registerKeyword( "STRING" ); registerKeyword( "SEARCH" ); }
Source:
public void stop(Throwable cause) throws Exception { LOGGER.log(Level.FINE, "Stopping container step."); closeQuietly(client); }

Target:
public void stop(Throwable cause) throws Exception { LOGGER.log(Level.FINE, "Stopping container step."); closeQuietly(client, decorator); }
Source:
protected void executeQueryCommand() { GlusterGeoRepDao geoRepDao = getGeoRepDao(); List<GlusterGeoRepSession> geoRepSessions = geoRepDao.getGeoRepSessions(getParameters().getId()); if (geoRepSessions != null) { for (GlusterGeoRepSession currentSession : geoRepSessions) { List<GlusterGeoRepSessionDetails> geoRepSessionDetails = geoRepDao.getGeoRepSessionDetails(currentSession.getId()); if(geoRepSessionDetails == null) { continue; } ArrayList<GlusterGeoRepSessionDetails> currentSessionDetails = (ArrayList<GlusterGeoRepSessionDetails>) geoRepSessionDetails; currentSession.setSessionDetails(currentSessionDetails); if (currentSession.getSessionDetails() != null) { for (GlusterGeoRepSessionDetails currentDetail : currentSession.getSessionDetails()) { GlusterBrickEntity currentBrick = getGlusterBrickDao().getById(currentDetail.getMasterBrickId()); if (currentBrick != null) { currentDetail.setMasterBrickNode(currentBrick.getServerName()); } } } } } getQueryReturnValue().setReturnValue(geoRepSessions); }

Target:
protected void executeQueryCommand() { GlusterGeoRepDao geoRepDao = getGeoRepDao(); List<GlusterGeoRepSession> geoRepSessions = geoRepDao.getGeoRepSessions(getParameters().getId()); if (geoRepSessions != null) { for (GlusterGeoRepSession currentSession : geoRepSessions) { List<GlusterGeoRepSessionDetails> geoRepSessionDetails = geoRepDao.getGeoRepSessionDetails(currentSession.getId()); if(geoRepSessionDetails == null) { continue; } for (GlusterGeoRepSessionDetails currentDetail : geoRepSessionDetails) { if(currentDetail == null) { continue; } Guid currentMasterBrickId = currentDetail.getMasterBrickId(); if(currentMasterBrickId == null) { continue; } GlusterBrickEntity currentBrick = getGlusterBrickDao().getById(currentMasterBrickId); if (currentBrick != null) { currentDetail.setMasterBrickNode(currentBrick.getServerName()); } } currentSession.setSessionDetails((ArrayList<GlusterGeoRepSessionDetails>) geoRepSessionDetails); } } getQueryReturnValue().setReturnValue(geoRepSessions); }
Source:
public T execute() throws E { WikiReference currWiki = getContext().getWikiRef(); try { if (wiki != null) { getContext().setWikiRef(wiki); } return call(); } finally { getContext().setWikiRef(currWiki); } }

Target:
public T execute() throws E { checkState(wiki != null, "No wiki set for ContextExecutor"); WikiReference currWiki = getContext().getWikiRef(); try { getContext().setWikiRef(wiki); return call(); } finally { getContext().setWikiRef(currWiki); } }
Source:
public static String abbreviateName(Class<?> cls, int pkgNameDepth) { if (pkgNameDepth < 1) return cls.getSimpleName(); if (pkgNameDepth >= MAX_ABBREVIATE_NAME_LVL) return cls.getName(); String[] pkgNameParts = cls.getName().split("\\."); if (pkgNameParts.length == 1) return pkgNameParts[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < pkgNameParts.length - 1; ++i) { if( pkgNameParts[i].length() == 3 ) sb.append(pkgNameParts[i]); else { sb.append(pkgNameParts[i].charAt(0)); if (pkgNameParts[i].length() > 3) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() / 2)); if (pkgNameParts[i].length() > 1) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() - 1)); } sb.append("."); } sb.append(pkgNameParts[pkgNameParts.length - 1]); return sb.toString(); }

Target:
public static String abbreviateName(Class<?> cls, int pkgNameDepth) { if (pkgNameDepth < 1) return cls.getSimpleName(); if (pkgNameDepth >= MAX_ABBREVIATE_NAME_LVL) return cls.getName(); String[] pkgNameParts = cls.getName().split("\\."); if (pkgNameParts.length == 1) return pkgNameParts[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < pkgNameParts.length - 1; ++i) { if( pkgNameParts[i].length() == 3 ) sb.append(pkgNameParts[i]); else { sb.append(pkgNameParts[i].charAt(0)); if (pkgNameParts[i].length() > 3) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() / 2)); if (pkgNameParts[i].length() > 1) sb.append(pkgNameParts[i].charAt(pkgNameParts[i].length() - 1)); } sb.append('.'); } sb.append(pkgNameParts[pkgNameParts.length - 1]); return sb.toString(); }
Source:
public void testSplitter() throws Exception { LineSplitter splitter = new LineSplitter(); Stream<StringHandle> contentStream = splitter.split(new FileInputStream(jsonlFile)); assertNotNull(contentStream); StringHandle[] result = contentStream.toArray(size -> new StringHandle[size]); assertNotNull(result); assertEquals(result.length, Files.lines(Paths.get(jsonlFile)).count()); String[] originalResult = Files.lines(Paths.get(jsonlFile)) .toArray(size -> new String[size]); for (int i = 0; i < result.length && i < originalResult.length; i++) { assertNotNull(result[i].get()); assertEquals(result[i].get(), originalResult[i]); } }

Target:
public void testSplitter() throws Exception { LineSplitter splitter = new LineSplitter(); Stream<StringHandle> contentStream = splitter.split(new FileInputStream(jsonlFile)); assertNotNull(contentStream); String[] originalResult = Files.lines(Paths.get(jsonlFile)) .toArray(size -> new String[size]); checkContent(contentStream, splitter.getFormat(), originalResult); }
Source:
public static KeyVaultKey fromKeyId(String keyId, JsonWebKey jsonWebKey) { KeyProperties properties = new KeyProperties(); properties.unpackId(keyId); return new KeyVaultKey(properties, jsonWebKey); }

Target:
public static KeyVaultKey fromKeyId(String keyId, JsonWebKey jsonWebKey) { Objects.requireNonNull(jsonWebKey, "The Json web key cannot be null"); KeyProperties properties = new KeyProperties(); properties.unpackId(keyId); return new KeyVaultKey(properties, jsonWebKey); }
Source:
public void shouldDropIndexOnRecovery() throws IOException { CommittedTransactionRepresentation dropTransaction = prepareDropTransaction(); File storeDir = directory.graphDbDir(); GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDir ); createIndex( db ); db.shutdown(); appendDropTransactionToTransactionLog( storeDir, dropTransaction ); Monitors monitors = new Monitors(); AssertRecoveryIsPerformed recoveryMonitor = new AssertRecoveryIsPerformed(); monitors.addMonitorListener( recoveryMonitor ); db = new TestGraphDatabaseFactory().setMonitors( monitors ).newEmbeddedDatabase( storeDir ); assertTrue( recoveryMonitor.recoveryWasPerformed ); try ( Transaction tx = db.beginTx() ) { assertEquals( 0, count( db.schema().getIndexes() ) ); tx.success(); } db.shutdown(); }

Target:
public void shouldDropIndexOnRecovery() throws IOException { CommittedTransactionRepresentation dropTransaction = prepareDropTransaction(); File storeDir = directory.graphDbDir(); GraphDatabaseService db = new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDir ); createIndex( db ); db.shutdown(); appendDropTransactionToTransactionLog( storeDir, dropTransaction ); Monitors monitors = new Monitors(); AssertRecoveryIsPerformed recoveryMonitor = new AssertRecoveryIsPerformed(); monitors.addMonitorListener( recoveryMonitor ); db = new TestGraphDatabaseFactory().setMonitors( monitors ).newEmbeddedDatabase( storeDir ); try { assertTrue( recoveryMonitor.recoveryWasPerformed ); try ( Transaction tx = db.beginTx() ) { assertEquals( 0, count( db.schema().getIndexes() ) ); tx.success(); } } finally { db.shutdown(); } }
Source:
public void testCollector() { final CollectorAsserterMonitor[] mon = new CollectorAsserterMonitor[1]; final int[] numLoops = new int[] { 10000 }; TestThread t = new TestThread("Test Accumulating Monitor") { @Override public void run() { mon[0] = new CollectorAsserterMonitor(); IProgressMonitorWithBlocking wrapper = ProgressMonitorUtil.createAccumulatingProgressMonitor(mon[0], Display.getDefault()); wrapper.beginTask("Some Task", 100); for (int i = 0; i < numLoops[0]; i++) { wrapper.setTaskName("Task Name " + i); } wrapper.done(); } }; t.start(); runEventLoop(4000, t); assertNotNull(mon[0]); ArrayList<String> tasks = mon[0].getTaskNames(); int size = tasks.size(); assertFalse("No events were fired in the UI thread. No events reached our intended monitor.", size == 0); assertTrue("Events received should be less than 20% of events fired: expected=" + (numLoops[0] / 5) + ", actual=" + size, size < (numLoops[0] / 5)); assertFalse(t.isCanceled()); }

Target:
public void testCollector() { final CollectorAsserterMonitor mon = new CollectorAsserterMonitor(); final int[] numLoops = new int[] { 10000 }; IProgressMonitorWithBlocking wrapper = ProgressMonitorUtil.createAccumulatingProgressMonitor(mon, Display.getDefault()); wrapper.beginTask("Some Task", 100); for (int i = 0; i < numLoops[0]; i++) { wrapper.setTaskName("Task Name " + i); } wrapper.done(); ArrayList<String> tasks = mon.getTaskNames(); int size = tasks.size(); assertEquals(0, size); runEventLoopUntilEmpty(); tasks = mon.getTaskNames(); size = tasks.size(); assertEquals(1, size); }
Source:
public void getReport(XResultData rd) { rd.logWithFormat("AtsConfigCache\n", AtsConfigCache.instance); rd.logWithFormat("TagToConfigObject size %d\n", tagToConfigObject.keySet().size()); rd.logWithFormat("ConfigObjects size %d\n", configObjects.size()); }

Target:
public void getReport(XResultData rd) { rd.logWithFormat("TagToConfigObject size %d\n", tagToConfigObject.keySet().size()); rd.logWithFormat("ConfigObjects size %d\n", configObjects.size()); }
Source:
public void testXmlConfig() throws IOException { EmbeddedCacheManager cm = new DefaultCacheManager("jpa-config.xml"); Cache<String, KeyValueEntity> specificCache = cm.getCache("specificCache"); validateConfig(specificCache); KeyValueEntity entity = new KeyValueEntity("k", "v"); specificCache.put(entity.getK(), entity); cm.stop(); }

Target:
public void testXmlConfig() throws IOException { EmbeddedCacheManager cm = null; try { cm = new DefaultCacheManager("jpa-config.xml"); Cache<String, KeyValueEntity> specificCache = cm.getCache("specificCache"); validateConfig(specificCache); KeyValueEntity entity = new KeyValueEntity("k", "v"); specificCache.put(entity.getK(), entity); } finally { if (cm != null) cm.stop(); } }
Source:
private static void writeTargetWeightsFile(final File ponFile, final File outputFile) { Utils.regularReadableUserFile(ponFile); try (final HDF5File file = new HDF5File(ponFile, HDF5File.OpenMode.READ_ONLY)) { final HDF5PCACoveragePoN pon = new HDF5PCACoveragePoN(file); final double[] targetWeights = DoubleStream.of(pon.getTargetVariances()).boxed().mapToDouble(v -> 1/v).toArray(); ParamUtils.writeValuesToFile(targetWeights, outputFile); } }

Target:
private static void writeTargetWeightsFile(final File ponFile, final File outputFile) { Utils.regularReadableUserFile(ponFile); try (final HDF5File file = new HDF5File(ponFile, HDF5File.OpenMode.READ_ONLY)) { final HDF5PCACoveragePoN pon = new HDF5PCACoveragePoN(file); final double[] targetWeights = DoubleStream.of(pon.getTargetVariances()).map(v -> 1 / v).toArray(); ParamUtils.writeValuesToFile(targetWeights, outputFile); } }
Source:
private static Object wrapHash(String key, Multihash h) { Map<String, Object> json = new TreeMap<>(); json.put(key, h.toString()); return json; }

Target:
private static Map<String, Object> wrapHash(String key, Multihash h) { Map<String, Object> json = new TreeMap<>(); json.put(key, h.toString()); return json; }