auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean canDoAction() { boolean toReturn = false; if (VdcActionType.RecoveryStoragePool.equals(getActionType()) && !IrsBrokerCommand.tryLockIrsProxyData(getStoragePool().getId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_DURING_RECONSTRUCT); return false; } else { IrsBrokerCommand.lockIrsProxyData(getStoragePool().getId()); } try { toReturn = performChecks(); } catch (Exception e) { toReturn = false; } finally { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); } return toReturn; }

Target:
protected boolean canDoAction() { boolean toReturn = false; if (VdcActionType.RecoveryStoragePool.equals(getActionType()) && !IrsBrokerCommand.tryLockIrsProxyData(getStoragePool().getId())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_DURING_RECONSTRUCT); } else { if (!IrsBrokerCommand.lockIrsProxyData(getStoragePool().getId())) { return false; } } try { toReturn = performChecks(); } catch (Exception e) { toReturn = false; } finally { if (toReturn) { IrsBrokerCommand.unLockIrsProxyData(getStoragePool().getId()); } } return toReturn; }
Source:
private void findTargetGroupsAndFire( final ReturnFire returnFire, final String stepName, final boolean defending, final GamePlayer firingPlayer, final Predicate<Unit> firingUnitPredicate, final Collection<Unit> firingUnits, final Collection<Unit> firingUnitsWaitingToDie, final Collection<Unit> enemyUnits, final Collection<Unit> enemyUnitsWaitingToDie) { Collection<Unit> firing = new ArrayList<>(firingUnits); firing.addAll(firingUnitsWaitingToDie); firing = CollectionUtils.getMatches(firing, firingUnitPredicate); if (!defending && !Properties.getAlliedAirIndependent(gameData)) { firing = CollectionUtils.getMatches(firing, Matches.unitIsOwnedBy(attacker)); } final List<Unit> allEnemyUnitsAliveOrWaitingToDie = new ArrayList<>(enemyUnits); allEnemyUnitsAliveOrWaitingToDie.addAll(enemyUnitsWaitingToDie); final List<Unit> allFriendlyUnitsAliveOrWaitingToDie = new ArrayList<>(firingUnits); allFriendlyUnitsAliveOrWaitingToDie.addAll(firingUnitsWaitingToDie); for (final TargetGroup firingGroup : TargetGroup.newTargetGroups(firing, enemyUnits)) { fire( stepName, firingGroup.getFiringUnits(firing), firingGroup.getTargetUnits(enemyUnits), allEnemyUnitsAliveOrWaitingToDie, allFriendlyUnitsAliveOrWaitingToDie, defending, returnFire, firingGroup.getMessage(firingPlayer)); } }

Target:
private void findTargetGroupsAndFire( final ReturnFire returnFire, final String stepName, final boolean defending, final GamePlayer firingPlayer, final Predicate<Unit> firingUnitPredicate, final Collection<Unit> firingUnits, final Collection<Unit> firingUnitsWaitingToDie, final Collection<Unit> enemyUnits, final Collection<Unit> enemyUnitsWaitingToDie) { Collection<Unit> firing = new ArrayList<>(firingUnits); firing.addAll(firingUnitsWaitingToDie); firing = CollectionUtils.getMatches(firing, firingUnitPredicate); if (!defending && !Properties.getAlliedAirIndependent(gameData)) { firing = CollectionUtils.getMatches(firing, Matches.unitIsOwnedBy(attacker)); } final List<Unit> allEnemyUnitsAliveOrWaitingToDie = new ArrayList<>(enemyUnits); allEnemyUnitsAliveOrWaitingToDie.addAll(enemyUnitsWaitingToDie); final List<Unit> allFriendlyUnitsAliveOrWaitingToDie = new ArrayList<>(firingUnits); allFriendlyUnitsAliveOrWaitingToDie.addAll(firingUnitsWaitingToDie); for (final TargetGroup firingGroup : TargetGroup.newTargetGroups(firing, enemyUnits)) { fire( stepName, firingGroup.getFiringUnits(firing), firingGroup.getTargetUnits(enemyUnits), allEnemyUnitsAliveOrWaitingToDie, allFriendlyUnitsAliveOrWaitingToDie, defending, returnFire, firingPlayer.getName() + " fire, "); } }
Source:
public void testNestedExpressions() { exressionTransformTest("${Prop1:${Prop2:default}1}", "default1"); }

Target:
public void testNestedExpressions() { expressionTransformTest("${Prop1:${Prop2:default}}", "default"); }
Source:
protected void localFileReflectionAttack(HttpMessage msg) { Matcher matcher; String localFile; String response; String payload = null; try { String requestBody = createLfrPayload(msg.getRequestBody().toString()); for (int idx = 0; idx < LOCAL_FILE_TARGETS.length; idx++) { localFile = LOCAL_FILE_TARGETS[idx]; payload = MessageFormat.format(requestBody, localFile); msg.setRequestBody(payload); sendAndReceive(msg); response = msg.getResponseBody().toString(); matcher = LOCAL_FILE_PATTERNS[idx].matcher(response); if (matcher.find()) { newAlert() .setConfidence(Alert.CONFIDENCE_MEDIUM) .setAttack(payload) .setEvidence(matcher.group()) .setMessage(msg) .raise(); } if (isStop()) { return; } } } catch (IOException ex) { log.warn( "XXE Injection vulnerability check failed for payload [" + payload + "] due to an I/O error", ex); } }

Target:
private void localFileReflectionAttack(HttpMessage msg) { String payload = null; try { String requestBody = createLfrPayload(msg.getRequestBody().toString()); for (int idx = 0; idx < LOCAL_FILE_TARGETS.length; idx++) { String localFile = LOCAL_FILE_TARGETS[idx]; payload = MessageFormat.format(requestBody, localFile); msg.setRequestBody(payload); sendAndReceive(msg); String response = msg.getResponseBody().toString(); Matcher matcher = LOCAL_FILE_PATTERNS[idx].matcher(response); if (matcher.find()) { newAlert() .setConfidence(Alert.CONFIDENCE_MEDIUM) .setAttack(payload) .setEvidence(matcher.group()) .setMessage(msg) .raise(); } if (isStop()) { return; } } } catch (IOException ex) { log.warn( "XXE Injection vulnerability check failed for payload [" + payload + "] due to an I/O error", ex); } }
Source:
public void testTagWithColon() { final SAMRecordSetBuilder samBuilder = new SAMRecordSetBuilder(); samBuilder.addUnmappedFragment("Hi,Mom!"); final SAMRecord rec = samBuilder.iterator().next(); final String valueWithColons = "A:B::C:::"; rec.setAttribute(SAMTag.CQ.name(), valueWithColons); final ByteArrayOutputStream os = new ByteArrayOutputStream(); final SAMFileWriter textWriter = new SAMFileWriterFactory().makeSAMWriter(samBuilder.getHeader(), true, os); textWriter.addAlignment(rec); textWriter.close(); final SamReader reader = SamReaderFactory.makeDefault().open(SamInputResource.of(new ByteArrayInputStream(os.toByteArray()))); final SAMRecord recFromText = reader.iterator().next(); Assert.assertEquals(recFromText.getAttribute(SAMTag.CQ.name()), valueWithColons); }

Target:
public void testTagWithColon() { final SAMRecordSetBuilder samBuilder = new SAMRecordSetBuilder(); samBuilder.addUnmappedFragment("Hi,Mom!"); final SAMRecord rec = samBuilder.iterator().next(); final String valueWithColons = "A:B::C:::"; rec.setAttribute(SAMTag.CQ.name(), valueWithColons); final ByteArrayOutputStream os = new ByteArrayOutputStream(); final SAMFileWriter textWriter = new SAMFileWriterFactory().makeSAMWriter(samBuilder.getHeader(), true, os); textWriter.addAlignment(rec); textWriter.close(); final SamReader reader = SamReaderFactory.makeDefault().open(SamInputResource.of(new ByteArrayInputStream(os.toByteArray()))); final SAMRecord recFromText = reader.iterator().next(); Assert.assertEquals(recFromText.getAttribute(SAMTag.CQ.name()), valueWithColons); CloserUtil.close(reader); }
Source:
public void testGetAllEntitiesForStorageDomain() { List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomainByEntityType(FixturesTool.STORAGE_DOAMIN_NFS2_1, null); assertTrue("There should be entities fetched for the specified storage domain", !ovfEntityDataList.isEmpty()); assertEquals("A Template and a VM should be fetched for the specified storage domain", 2, ovfEntityDataList.size()); }

Target:
public void testGetAllEntitiesForStorageDomain() { List<OvfEntityData> ovfEntityDataList = dao.getAllForStorageDomainByEntityType(FixturesTool.STORAGE_DOAMIN_NFS2_1, null); assertEquals("A Template and a VM should be fetched for the specified storage domain", 2, ovfEntityDataList.size()); }
Source:
protected static URI makeURI(String host, String requestURI, String rawQueryString) { try { return new URI( "http", host, requestURI, rawQueryString == null ? null : URLDecoder.decode(rawQueryString, "UTF-8"), null ); } catch (UnsupportedEncodingException | URISyntaxException e) { log.error(e, "Unable to rewrite URI", e.getMessage()); throw Throwables.propagate(e); } }

Target:
protected static URI makeURI(String host, String requestURI, String rawQueryString) { try { return new URI( "http", host, requestURI, rawQueryString == null ? null : URLDecoder.decode(rawQueryString, "UTF-8"), null ); } catch (UnsupportedEncodingException | URISyntaxException e) { log.error(e, "Unable to rewrite URI [%s]", e.getMessage()); throw Throwables.propagate(e); } }
Source:
private void populateChangeRow(final int row, final ChangeInfo c, final ChangeRowFormatter changeRowFormatter) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (changeRowFormatter != null) { removeChangeStyle(row, changeRowFormatter); final String rowStyle = changeRowFormatter.getRowStyle(c); if (rowStyle != null) { table.getRowFormatter().addStyleName(row, rowStyle); } s = changeRowFormatter.getDisplayText(c, s); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); table.setText(row, C_PATCHSET_NUM, "" + c.getPatchSetId().get()); table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); setRowItem(row, c); }

Target:
private void populateChangeRow(final int row, final ChangeInfo c, final ChangeRowFormatter changeRowFormatter) { ChangeCache cache = ChangeCache.get(c.getId()); cache.getChangeInfoCache().set(c); table.setWidget(row, C_ARROW, null); if (Gerrit.isSignedIn()) { table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); } String s = Util.cropSubject(c.getSubject()); if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { s += " (" + c.getStatus().name() + ")"; } if (changeRowFormatter != null) { removeChangeStyle(row, changeRowFormatter); final String rowStyle = changeRowFormatter.getRowStyle(c); if (rowStyle != null) { table.getRowFormatter().addStyleName(row, rowStyle); } s = changeRowFormatter.getDisplayText(c, s); } table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); table.setWidget(row, C_OWNER, link(c.getOwner())); table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey(), c .getStatus())); table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c .getStatus(), c.getBranch(), c.getTopic())); final PatchSet.Id patchSetId = c.getPatchSetId(); String patchSetNumber = "-"; if (patchSetId != null) { patchSetNumber = "" + patchSetId.get(); } table.setText(row, C_PATCHSET_NUM, patchSetNumber); table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); setRowItem(row, c); }
Source:
private static String getDescription(@NotNull Throwable t) { boolean isAndroid = false; for (StackTraceElement el : t.getStackTrace()) { if (el.getClassName().contains("android")) { isAndroid = true; break; } } String prefix = isAndroid ? "android:" : ""; String desc = prefix + t.toString(); if (desc.length() > 150) { desc = desc.substring(0, 150); } return desc; }

Target:
public static String getDescription(@NotNull Throwable t) { boolean isAndroid = false; for (StackTraceElement el : t.getStackTrace()) { if (el.getClassName().contains("android")) { isAndroid = true; break; } } String sourceLocation = ""; if (t.getStackTrace().length > 0) { StackTraceElement loc = t.getStackTrace()[0]; sourceLocation = " @ " + loc.getFileName() + ":" + loc.getLineNumber(); } String prefix = isAndroid ? "android:" : ""; String desc = prefix + t.getClass().getSimpleName() + sourceLocation; if (desc.length() > 150) { desc = desc.substring(0, 150); } return desc; }
Source:
@Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException { initializeImpl(); MetricRegistry discoReg = ((IgniteEx)ignite()).context().metric().registry(metricName("io", "discovery")); stats = new TcpDiscoveryStatistics(discoReg); discoReg.register("MessageWorkerQueueSize", () -> impl.getMessageWorkerQueueSize(), "Message worker queue current size"); discoReg.register("CurrentTopologyVersion", () -> impl.getCurrentTopologyVersion(), "Current topology version"); discoReg.register("Coordinator", () -> impl.getCoordinator(), UUID.class, "Coordinator ID"); registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class); impl.spiStart(igniteInstanceName); }

Target:
@Override public void spiStart(@Nullable String igniteInstanceName) throws IgniteSpiException { initializeImpl(); registerMBean(igniteInstanceName, new TcpDiscoverySpiMBeanImpl(this), TcpDiscoverySpiMBean.class); impl.spiStart(igniteInstanceName); }
Source:
protected void executeCommand() { executeInNewTransaction(new TransactionMethod<Void>() { public Void runInTransaction() { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; } }); Map<String, Map<Long, List<VDS>>> lunToSize = refreshLunSizeAllVds(getParameters().getLunIds()); List<String> succeededRefreshLuns = new ArrayList<>(); for (Map.Entry<String, Map<Long, List<VDS>>> entry : lunToSize.entrySet()) { if (entry.getValue().size() != 1) { log.error("Failed to refresh device " + entry.getKey() + " Not all VDS are seeing the same size"); } else{ String lunId = entry.getKey(); Long pvSize = resizePV(lunId); succeededRefreshLuns.add(lunId); log.error("PV size " + entry.getKey() + " :" + pvSize); } } updateStorageDomainData(); refreshPVAllVds(succeededRefreshLuns); executeInNewTransaction(new TransactionMethod<Void>() { public Void runInTransaction() { setStorageDomainStatus(StorageDomainStatus.Active, null); getCompensationContext().resetCompensation(); return null; } }); setSucceeded(true); }

Target:
protected void executeCommand() { executeInNewTransaction(new TransactionMethod<Void>() { public Void runInTransaction() { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; } }); setSucceeded(false); List<String> lunsToRefresh = getParameters().getLunIds(); Map<String, List<VDS>> lunToFailedVDS = refreshLunSizeAllVds(lunsToRefresh); if (!lunToFailedVDS.isEmpty()) { ArrayList<String> failedVds = new ArrayList<>(); for (Map.Entry<String, List<VDS>> entry : lunToFailedVDS.entrySet()) { String lunId = entry.getKey(); List<VDS> vdsList = entry.getValue(); log.error("Failed to refresh device " + lunId + " Not all VDS are seeing the same size " + "VDS :" + vdsList); String vdsListString = StringUtils.join(getVdsNameList(vdsList), ", "); failedVds.add("LUN :" + lunId + "VDS: " + vdsListString); } changeStorageDomainToActive(); throw new VdcBLLException(VdcBllErrors.REFRESH_LUN_ERROR, "Failed to refresh LUNs. Not all VDS are seeing the same size " + failedVds); } resizePVs(lunsToRefresh); updateStorageDomainData(); refreshPVAllVds(lunsToRefresh); changeStorageDomainToActive(); setSucceeded(true); }
Source:
public MotorConstant(String name, Motor motor, double motorSpeed) { super("motorConstant", motor); this.motor = motor; this.motorSpeed = motorSpeed; }

Target:
public MotorConstant(String name, Motor motor, double motorSpeed) { super(); setName(name); this.motor = motor; this.motorSpeed = motorSpeed; addRequirements(motor); }
Source:
void transportFactory() { @SuppressWarnings("unchecked") TransportFactory factory = InMemoryTransportFactory.newInstance(); assertEquals(factory, builder.setTransportFactory(factory) .getTransportFactory() .get()); }

Target:
void transportFactory() { TransportFactory factory = InMemoryTransportFactory.newInstance(); assertEquals(factory, builder.setTransportFactory(factory) .getTransportFactory() .get()); }
Source:
static TrileadVersionSupport getTrileadSupport() { try { Thread.currentThread().getContextClassLoader().loadClass("com.trilead.ssh2.signature.KeyAlgorithmManager"); return createaVersion9Instance(); } catch (ReflectiveOperationException e) { return new LegacyTrileadVersionSupport(); } }

Target:
static TrileadVersionSupport getTrileadSupport() { try { if (isAfterTrilead8()) { return createVersion9Instance(); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Could not create Trilead support class. Using legacy Trilead features", e); } return new LegacyTrileadVersionSupport(); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { IReplicationController rc = getSelectedElement(event, IReplicationController.class); if(rc != null) { scaleUsing(event, rc, rc.getName()); return null; } IServiceWrapper deployment = getSelectedElement(event, IServiceWrapper.class); if(deployment == null) { IResourceWrapper<?, IOpenshiftUIElement<?,?>> wrapper = getSelectedElement(event, IResourceWrapper.class); if(wrapper != null && wrapper.getWrapped() instanceof IPod && !ResourceUtils.isBuildPod((IPod)wrapper.getWrapped())) { deployment = (IServiceWrapper)wrapper.getParent(); } } if(deployment != null) { Collection<IResourceWrapper<?, ?>> rcs = deployment.getResourcesOfKind(ResourceKind.REPLICATION_CONTROLLER); if(!rcs.isEmpty()) { rc = (IReplicationController) rcs.iterator().next().getWrapped(); scaleUsing(event, rc, deployment.getWrapped().getName()); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IReplicationController rc = getSelectedElement(event, IReplicationController.class); if(rc != null) { scaleUsing(event, rc, rc.getName()); } else { IServiceWrapper deployment = getSelectedElement(event, IServiceWrapper.class); if(deployment == null) { IResourceWrapper<?, IOpenshiftUIElement<?,?>> wrapper = getSelectedElement(event, IResourceWrapper.class); deployment = getServiceWrapperForRunningPod(wrapper); } if (deployment != null) { rc = getReplicationController(deployment); if (rc != null) { scaleUsing(event, rc, deployment.getWrapped().getName()); } } } return null; }
Source:
public void completeDefaultIpConfiguration(IpConfiguration ipConfiguration) { if (ipConfiguration.getIPv4Addresses().isEmpty()) { final IPv4Address ipv4Address = NetworkCommonUtils.createDefaultIpv4Address(); ipConfiguration.setIPv4Addresses(Collections.singletonList(ipv4Address)); } if (ipConfiguration.getIpV6Addresses().isEmpty()) { final IpV6Address ipv6Address = NetworkCommonUtils.createDefaultIpv6Address(); ipConfiguration.setIpV6Addresses(Collections.singletonList(ipv6Address)); } }

Target:
private void completeDefaultIpConfiguration(IpConfiguration ipConfiguration) { if (ipConfiguration.getIPv4Addresses().isEmpty()) { final IPv4Address ipv4Address = NetworkCommonUtils.createDefaultIpv4Address(); ipConfiguration.setIPv4Addresses(Collections.singletonList(ipv4Address)); } if (ipConfiguration.getIpV6Addresses().isEmpty()) { final IpV6Address ipv6Address = NetworkCommonUtils.createDefaultIpv6Address(); ipConfiguration.setIpV6Addresses(Collections.singletonList(ipv6Address)); } }
Source:
public void testOneWayMapping() { LUNs model = new LUNs(); model.setVendorId("vendor_id_1"); model.setProductId("product_id_1"); model.setLunMapping(5); model.setSerial("some_serial"); model.setvolume_group_id("volume_group_id_1"); model.setStorageDomainId(Guid.Empty); model.setDiskId(Guid.Empty); model.setStatus(org.ovirt.engine.core.common.businessentities.LunStatus.Free); LogicalUnit entity = StorageLogicalUnitMapper.map(model, (LogicalUnit)null); assertEquals(entity.getVendorId(), "vendor_id_1"); assertEquals(entity.getProductId(), "product_id_1"); assertEquals(entity.getSerial(), "some_serial"); assertEquals(entity.getLunMapping(), new Integer(5)); assertEquals(entity.getVolumeGroupId(), "volume_group_id_1"); assertEquals(entity.getStorageDomainId(), Guid.Empty.toString()); assertEquals(entity.getDiskId(), Guid.Empty.toString()); assertEquals(entity.getStatus(), LunStatus.Free.name()); }

Target:
public void testOneWayMapping() { LUNs model = new LUNs(); model.setVendorId("vendor_id_1"); model.setProductId("product_id_1"); model.setLunMapping(5); model.setSerial("some_serial"); model.setvolume_group_id("volume_group_id_1"); model.setStorageDomainId(Guid.Empty); model.setDiskId(Guid.Empty); model.setStatus(org.ovirt.engine.core.common.businessentities.LunStatus.Free); LogicalUnit entity = StorageLogicalUnitMapper.map(model, (LogicalUnit)null); assertEquals(entity.getVendorId(), "vendor_id_1"); assertEquals(entity.getProductId(), "product_id_1"); assertEquals(entity.getSerial(), "some_serial"); assertEquals(entity.getLunMapping(), new Integer(5)); assertEquals(entity.getVolumeGroupId(), "volume_group_id_1"); assertEquals(entity.getStorageDomainId(), Guid.Empty.toString()); assertEquals(entity.getDiskId(), Guid.Empty.toString()); assertEquals(entity.getStatus(), LunStatus.Free.value()); }
Source:
public void deleteFile(String path) { boolean isFolder = path.substring(path.length() - 1).equals("/"); if (!isFolder) { deleteObject(path); } else { throw new RuntimeException("Folder was passed in to deleteFile: " + path); } }

Target:
public void deleteFile(String path) { if (!path.endsWith(PATH_SEPARATOR)) { deleteObject(path); } else { throw new RuntimeException("Folder was passed in to deleteFile: " + path); } }
Source:
private void clearVm(VM vm, VmExitStatus exitStatus, String exitMessage) { if (vm.getStatus() != VMStatus.MigratingFrom) { if (vm.getStatus() != VMStatus.Suspended && vm.getStatus() != VMStatus.Down) { ResourceManager.getInstance().InternalSetVmStatus(vm, VMStatus.Down, exitStatus, exitMessage); } vm.getDynamicData().setCpuName(null); addVmDynamicToList(vm.getDynamicData()); addVmStatisticsToList(vm.getStatisticsData()); addVmInterfaceStatisticsToList(vm.getInterfaces()); if (!ResourceManager.getInstance().IsVmInAsyncRunningList(vm.getId())) { _vmsMovedToDown.add(vm.getId()); } } }

Target:
private void clearVm(VM vm, VmExitStatus exitStatus, String exitMessage) { if (vm.getStatus() != VMStatus.MigratingFrom) { if (vm.getStatus() != VMStatus.Suspended && vm.getStatus() != VMStatus.Down) { ResourceManager.getInstance().InternalSetVmStatus(vm, VMStatus.Down, exitStatus, exitMessage); } addVmDynamicToList(vm.getDynamicData()); addVmStatisticsToList(vm.getStatisticsData()); addVmInterfaceStatisticsToList(vm.getInterfaces()); if (!ResourceManager.getInstance().IsVmInAsyncRunningList(vm.getId())) { _vmsMovedToDown.add(vm.getId()); } } }
Source:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); try { response = urlopen.open("<LINK_0>"); Matcher matcher = reAccounts.matcher(response); while (matcher.find()) { accounts.add(new Account(Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)), matcher.group(1).trim())); balance = balance.add(Helpers.parseBalance(matcher.group(3))); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } finally { super.updateComplete(); } }

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); response = urlopen.open("<LINK_0>"); Matcher matcher = reAccounts.matcher(response); while (matcher.find()) { accounts.add(new Account(Html.fromHtml(matcher.group(2)).toString().trim(), Helpers.parseBalance(matcher.group(3)), matcher.group(1).trim())); balance = balance.add(Helpers.parseBalance(matcher.group(3))); } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
public void testLongTableNameLengthFailsCassandra() throws IOException { Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE); int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT + 1; String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x")); TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName); assertThatThrownBy(() -> schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Internal table name %s is too long, exceeds Cassandra limit (%s). " + "If using a table prefix, please ensure that the concatenation " + "of the prefix with the internal table name is below the KVS limit. " + "If running using a different KVS, set the ignoreTableNameLength flag.", longTableName, AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT); }

Target:
public void testLongTableNameLengthFailsCassandra() throws IOException { Schema schema = new Schema("Table", TEST_PACKAGE, Namespace.EMPTY_NAMESPACE); int longLengthCassandra = AtlasDbConstants.CASSANDRA_TABLE_NAME_CHAR_LIMIT + 1; String longTableName = String.join("", Collections.nCopies(longLengthCassandra, "x")); TableReference tableRef = TableReference.createWithEmptyNamespace(longTableName); List<CharacterLimitType> kvsList = new ArrayList<CharacterLimitType>(); kvsList.add(CharacterLimitType.CASSANDRA); assertThatThrownBy(() -> schema.addTableDefinition(longTableName, getSimpleTableDefinition(tableRef))) .isInstanceOf(IllegalArgumentException.class) .hasMessage(getErrorMessage(longTableName, kvsList)); }
Source:
public Session startSession() throws ConnectionException, TransportException { checkConnected(); checkAuthenticated(); final SessionChannel sess = (remoteCharset != null)? new SessionChannel(conn, remoteCharset) : new SessionChannel(conn); sess.open(); return sess; }

Target:
public Session startSession() throws ConnectionException, TransportException { checkConnected(); checkAuthenticated(); final SessionChannel sess = new SessionChannel(conn, remoteCharset); sess.open(); return sess; }
Source:
public List<OnmsResource> getResourcesForParent(OnmsResource parent) { if (!NodeResourceType.isNode(parent)) { return Collections.emptyList(); } final OnmsNode node = ResourceTypeUtils.getNodeFromResource(parent); final List<OnmsResource> resources = Lists.newLinkedList(); final Collection<LocationIpInterface> statuses = m_locationSpecificStatusDao.findStatusChangesForNodeForUniqueMonitorAndInterface(node.getId()); for (LocationIpInterface status : statuses) { String definitionName = status.getLocation().getLocationName(); String id = status.getLocation().getLocationName(); final OnmsIpInterface ipInterface = status.getIpInterface(); String ipAddr = InetAddressUtils.str(ipInterface.getIpAddress()); if (m_resourceStorageDao.exists(getRelativeInterfacePath(id, ipAddr), 0)) { resources.add(createResource(definitionName, id, ipAddr)); } } return OnmsResource.sortIntoResourceList(resources); }

Target:
public List<OnmsResource> getResourcesForParent(OnmsResource parent) { if (!NodeResourceType.isNode(parent)) { return Collections.emptyList(); } final OnmsNode node = ResourceTypeUtils.getNodeFromResource(parent); final List<OnmsResource> resources = Lists.newLinkedList(); final Collection<LocationIpInterface> statuses = m_locationSpecificStatusDao.findStatusChangesForNodeForUniqueMonitorAndInterface(node.getId()); for (LocationIpInterface status : statuses) { String location = status.getLocation().getLocationName(); final OnmsIpInterface ipInterface = status.getIpInterface(); String ipAddr = InetAddressUtils.str(ipInterface.getIpAddress()); if (m_resourceStorageDao.exists(getRelativeInterfacePath(location, ipAddr), 0)) { resources.add(createResource(location, ipAddr)); } } return OnmsResource.sortIntoResourceList(resources); }
Source:
public Builder setLength(int length) { if (length > 0) { this.length = length; return this; } else { throw new IllegalArgumentException("Length shoud be positive. Incase of live streaming, length is expected to be null"); } }

Target:
public Builder setLength(int length) { return setLength(UInt16.from(length)); }
Source:
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (!isInit) return invoker.invoke(invocation); TraceContext invocationContext = currentTraceContext.get(); RpcContext rpcContext = RpcContext.getContext(); Kind kind = rpcContext.isProviderSide() ? Kind.SERVER : Kind.CLIENT; Span span; DubboRequest request; if (kind.equals(Kind.CLIENT)) { Map<String, String> attachments = RpcContext.getContext().getAttachments(); DubboClientRequest clientRequest = new DubboClientRequest(invoker, invocation, attachments); request = clientRequest; span = clientHandler.handleSendWithParent(clientRequest, invocationContext); } else { DubboServerRequest serverRequest = new DubboServerRequest(invoker, invocation); request = serverRequest; span = serverHandler.handleReceive(serverRequest); } boolean deferFinish = false; Scope scope = currentTraceContext.newScope(span.context()); Result result = null; Throwable error = null; try { result = invoker.invoke(invocation); error = result.getException(); Future<Object> future = rpcContext.getFuture(); if (future instanceof CompletableFuture) { deferFinish = true; ((CompletableFuture<?>) future) .whenComplete(FinishSpan.create(this, request, result, span)); } return result; } catch (Throwable e) { propagateIfFatal(e); error = e; throw e; } finally { if (!deferFinish) FinishSpan.finish(this, request, result, error, span); scope.close(); } }

Target:
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { if (!isInit) return invoker.invoke(invocation); TraceContext invocationContext = currentTraceContext.get(); RpcContext rpcContext = RpcContext.getContext(); Kind kind = rpcContext.isProviderSide() ? Kind.SERVER : Kind.CLIENT; Span span; DubboRequest request; if (kind.equals(Kind.CLIENT)) { Map<String, String> attachments = RpcContext.getContext().getAttachments(); DubboClientRequest clientRequest = new DubboClientRequest(invoker, invocation, attachments); request = clientRequest; span = clientHandler.handleSendWithParent(clientRequest, invocationContext); } else { DubboServerRequest serverRequest = new DubboServerRequest(invoker, invocation); request = serverRequest; span = serverHandler.handleReceive(serverRequest); } boolean isSynchronous = true; Scope scope = currentTraceContext.newScope(span.context()); Result result = null; Throwable error = null; try { result = invoker.invoke(invocation); error = result.getException(); CompletableFuture<Object> future = rpcContext.getCompletableFuture(); if (future != null) { isSynchronous = false; future.whenComplete(FinishSpan.create(this, request, result, span)); } return result; } catch (Throwable e) { propagateIfFatal(e); error = e; throw e; } finally { if (isSynchronous) FinishSpan.finish(this, request, result, error, span); scope.close(); } }
Source:
public static CustomTxtTraceDefinition load(String definitionName) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) { String empty = ""; ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes()); return new InputSource(bais); } }; db.setEntityResolver(resolver); db.setErrorHandler(new ErrorHandler() { @Override public void error(SAXParseException saxparseexception) throws SAXException { } @Override public void warning(SAXParseException saxparseexception) throws SAXException { } @Override public void fatalError(SAXParseException saxparseexception) throws SAXException { throw saxparseexception; } }); CustomTxtTraceDefinition value = lookupDefinition(definitionName, db, CUSTOM_TXT_TRACE_DEFINITIONS_PATH_NAME); if( value == null ) { return lookupDefinition(definitionName, db, CUSTOM_TXT_TRACE_DEFINITIONS_DEFAULT_PATH_NAME); } return value; } catch (ParserConfigurationException e) { Activator.logError("Error loading CustomTxtTraceDefinition: definitionName=" + definitionName, e); } catch (SAXException e) { Activator.logError("Error loading CustomTxtTraceDefinition: definitionName=" + definitionName, e); } catch (IOException e) { Activator.logError("Error loading CustomTxtTraceDefinition: definitionName=" + definitionName, e); } return null; }

Target:
public static CustomTxtTraceDefinition load(String definitionName) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); EntityResolver resolver = new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) { String empty = ""; ByteArrayInputStream bais = new ByteArrayInputStream(empty.getBytes()); return new InputSource(bais); } }; db.setEntityResolver(resolver); db.setErrorHandler(new ErrorHandler() { @Override public void error(SAXParseException saxparseexception) throws SAXException { } @Override public void warning(SAXParseException saxparseexception) throws SAXException { } @Override public void fatalError(SAXParseException saxparseexception) throws SAXException { throw saxparseexception; } }); CustomTxtTraceDefinition value = lookupDefinition(definitionName, db, CUSTOM_TXT_TRACE_DEFINITIONS_PATH_NAME); if (value == null) { return lookupDefinition(definitionName, db, CUSTOM_TXT_TRACE_DEFINITIONS_DEFAULT_PATH_NAME); } return value; } catch (ParserConfigurationException | SAXException | IOException e ) { Activator.logError("Error loading CustomTxtTraceDefinition: definitionName=" + definitionName, e); } return null; }
Source:
public String getRoutingStyle() { ConnectorStyle connectorStyle = getConnectorStyle(); if (connectorStyle != null) { return connectorStyle.getRouting().getLiteral(); } return null; }

Target:
public Routing getRoutingStyle() { ConnectorStyle connectorStyle = getConnectorStyle(); if (connectorStyle != null) { return connectorStyle.getRouting(); } return null; }
Source:
public boolean hasNext() { if (newEpoch || epochs == numEpochs) { log.info("Epoch " + epochs + ", number of batches completed " + lastBatch); newEpoch = false; } if (iter == null) return (epochs < numEpochs) && ((batchedDS.size() != 0 && batchedDS.size() > batch) || batchedDS.size() == 0); else return (epochs < numEpochs) || (iter.hasNext() && (epochs == 0 || epochs == numEpochs)); }

Target:
public boolean hasNext() { if (newEpoch) { log.info("Epoch " + epochs + ", number of batches completed " + lastBatch); newEpoch = false; } if (iter == null) return (epochs < numEpochs) && ((!batchedDS.isEmpty() && batchedDS.size() > batch) || batchedDS.isEmpty()); else return (epochs < numEpochs) || (iter.hasNext() && (epochs == 0 || epochs == numEpochs)); }
Source:
static <E,T> Validation<E,T> invalid(Supplier<? extends E> supplier) { return new Invalid<>(supplier.get()); }

Target:
static <E,T> Validation<E,T> invalid(Supplier<? extends E> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return new Invalid<>(supplier.get()); }
Source:
private void verifyAndMergeCheckpoints(final Collection<TaskGroup> taskGroupsToVerify) { final List<ListenableFuture<Boolean>> futures = new ArrayList<>(); for (TaskGroup taskGroup : taskGroupsToVerify) { futures.add(workerExec.submit(() -> { verifyAndMergeCheckpoints(taskGroup); return true; })); } try { Futures.allAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new RuntimeException(e); } }

Target:
private void verifyAndMergeCheckpoints(final Collection<TaskGroup> taskGroupsToVerify) { final List<ListenableFuture<?>> futures = new ArrayList<>(); for (TaskGroup taskGroup : taskGroupsToVerify) { futures.add(workerExec.submit(() -> verifyAndMergeCheckpoints(taskGroup))); } try { Futures.allAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new RuntimeException(e); } }
Source:
private List<T> convertToT(List<String> vals) { List<T> convertedList = new ArrayList<T>(); for(String val : vals) { convertedList.add(super.convertToT(val)); } return convertedList; }

Target:
private List<T> convertToT(List<String> vals) { List<T> convertedList = new ArrayList<T>(); for(String val : vals) { convertedList.add(convertToT(val)); } return convertedList; }
Source:
private static boolean isJavaxScriptSource(String source) { return isJavascriptSource(source); }

Target:
public static boolean isJavaxScriptSource(String source) { return isJavascriptSource(source) || isRubySource(source); }
Source:
public AboutPageView(final Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); $(buttonCanada).click(new Function() { @Override public boolean f(Event e) { $(canada).show(); $(quebec).hide(); return false; } }); $(buttonQuebec).click(new Function() { @Override public boolean f(Event e) { $(quebec).show(); $(canada).hide(); return false; } }); }

Target:
public AboutPageView(final Binder uiBinder) { initWidget(uiBinder.createAndBindUi(this)); $(buttonCanada).click(new Function() { @Override public void f() { $(canada).show(); $(quebec).hide(); } }); $(buttonQuebec).click(new Function() { @Override public void f() { $(quebec).show(); $(canada).hide(); } }); }
Source:
private void cleanUpForRetry() { runtime.getAddressSpaceView().invalidateClientCache(); runtime.getObjectsView().getObjectCache().clear(); runtime.getStreamsView().getStreamCache().clear(); findAndSetLogHead(); findAndSetLogTail(); nextRead = logHead; resetAddressProcessed(); }

Target:
private void cleanUpForRetry() { runtime.getAddressSpaceView().invalidateClientCache(); runtime.getObjectsView().getObjectCache().clear(); runtime.getStreamsView().getStreamCache().clear(); log.info("retry fastobject loader head " + logHead + " tail " + logTail); }
Source:
public void showInherited(boolean visible) { for (int r = 0; r < table.getRowCount(); r++) { if (table.getWidget(r, 2) instanceof Hyperlink) { table.getRowFormatter().setVisible(r, visible); } } }

Target:
public void showInherited(boolean visible) { for (int r = 0; r < table.getRowCount(); r++) { if (getRowItem(r) != null && getRowItem(r).isInherited()) { table.getRowFormatter().setVisible(r, visible); } } }
Source:
public static String getRandomEmail() { StringBuilder sb = new StringBuilder(UUID.randomUUID().toString().toLowerCase()); sb.append('@'); sb.append("realm.io"); return sb.toString(); }

Target:
public static String getRandomEmail() { StringBuilder sb = new StringBuilder(UUID.randomUUID().toString().toLowerCase()); sb.append('@'); sb.append("androidtest.realm.io"); return sb.toString(); }
Source:
public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId, Instant requestTimestamp) { this.numCores = numCores; this.memoryMB = memoryMB; this.preferredHost = preferredHost; this.requestId = UUID.randomUUID().toString(); this.processorId = processorId; this.requestTimestamp = requestTimestamp; this.faultDomains = new HashSet<>(); log.info("SamzaResourceRequest created for Processor ID: on host: at time: with Request ID: {}", this.processorId, this.preferredHost, this.requestTimestamp, this.requestId); }

Target:
public SamzaResourceRequest(int numCores, int memoryMB, String preferredHost, String processorId, Instant requestTimestamp) { this.numCores = numCores; this.memoryMB = memoryMB; this.preferredHost = preferredHost; this.requestId = UUID.randomUUID().toString(); this.processorId = processorId; this.requestTimestamp = requestTimestamp; this.faultDomains = new HashSet<>(); log.info("SamzaResourceRequest created for Processor ID: on host: at time: with Request ID: {}, and the following list of fault domains: {}", this.processorId, this.preferredHost, this.requestTimestamp, this.requestId, this.faultDomains); }
Source:
public LineItemBean create(final LineItem lineItem) { final LineItemBean bean = fillBean(new LineItemBean(), lineItem); final List<ProductAttributeBean> attributes = lineItem.getVariant().getAttributes().stream() .filter(attr -> productDataConfig.getSelectableAttributes().contains(attr.getName())) .map(attr -> productAttributeBeanFactory.create(attr)) .collect(toList()); bean.setAttributes(attributes); return bean; }

Target:
public LineItemBean create(final LineItem lineItem) { final LineItemBean bean = new LineItemBean(); initialize(bean, lineItem); return bean; }
Source:
public Stream(int column, StreamKind streamKind, int length, boolean useVInts) { this(column, streamKind, length, useVInts, ColumnEncoding.ORC_SEQUENCE_ID); }

Target:
public Stream(int column, StreamKind streamKind, int length, boolean useVInts) { this(column, streamKind, length, useVInts, ColumnEncoding.DEFAULT_SEQUENCE_ID); }
Source:
public void onBindViewHolder(ViewHolder vh, int position) { switch (vh.getItemViewType()) { case CONTENT_CARD_VIEW_TYPE: ContentViewHolder holder = (ContentViewHolder) vh; int quotePosition = position - position / adModulus; Quote q = generator.getQuote(quotePosition); holder.txtName.setText(q.name); holder.txtQuote.setText(q.quote); setHeadShot(holder.imgHeadShot, q.url); break; case AD_CARD_VIEW_TYPE: final AdViewHolder adViewHolder = (AdViewHolder) vh; sdk.request( new Request.Builder() .addPlacement(new Placement("div1", NETWORK_ID, SITE_ID, 5)) .build(), new ResponseListener() { @Override public void success(Response response) { Decision decision = response.getDecision("div1"); Content content = decision.getContents().get(0); adViewHolder.setClickUrl(decision.getClickUrl()); loadAdContent(adViewHolder, content, decision.getImpressionUrl()); Log.d(TAG, "Title: " + content.getTitle()); adViewHolder.txtName.setText(content.getTitle()); Object q = content.getCustomData("quote"); if (q != null) { Log.d(TAG, "Quote: " + q.toString()); adViewHolder.txtQuote.setText(q.toString()); } else { adViewHolder.txtQuote.setText("Quote unavailable"); } } @Override public void error(RetrofitError error) { Log.d(TAG, "Error: " + error.getMessage()); } } ); default: break; } }

Target:
public void onBindViewHolder(ViewHolder vh, int position) { switch (vh.getItemViewType()) { case CONTENT_CARD_VIEW_TYPE: ContentViewHolder holder = (ContentViewHolder) vh; int quotePosition = position - position / adModulus; Quote q = generator.getQuote(quotePosition); holder.txtName.setText(q.name); holder.txtQuote.setText(q.quote); setHeadShot(holder.imgView, q.url); break; case AD_CARD_VIEW_TYPE: final AdViewHolder adViewHolder = (AdViewHolder) vh; sdk.request( new Request.Builder() .addPlacement(new Placement("div1", NETWORK_ID, SITE_ID, 5).setFlightId(FLIGHT_ID)) .build(), new ResponseListener() { @Override public void success(Response response) { Decision decision = response.getDecision("div1"); loadAdContent(adViewHolder, decision); } @Override public void error(RetrofitError error) { Log.d(TAG, "Error: " + error.getMessage()); } } ); default: break; } }
Source:
public Collection<RunningTask> awaitRunningTasks() { try { runningTaskLatch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } return runningTasks.values(); }

Target:
public Collection<RunningTask> awaitRunningTasks() { try { runningTaskLatch.await(); } catch (final InterruptedException e) { throw new RuntimeException(e); } return runningTasks.values(); }
Source:
public LocalCorruptionHandler( List<TimeLockCorruptionNotifier> corruptionNotifiers) { this.corruptionNotifiers = corruptionNotifiers; this.executorService = PTExecutors.newFixedThreadPool(corruptionNotifiers.size()); this.corruptionNotifyRetryer = new Retryer<>(StopStrategies.stopAfterAttempt(5), WaitStrategies.fixedWait(200, TimeUnit.MILLISECONDS), attempt -> !attempt.hasResult()); }

Target:
public LocalCorruptionHandler( List<TimeLockCorruptionNotifier> corruptionNotifiers) { this.corruptionNotifiers = corruptionNotifiers; this.corruptionNotifyRetryer = new Retryer<>(StopStrategies.stopAfterAttempt(5), WaitStrategies.fixedWait(200, TimeUnit.MILLISECONDS), attempt -> !attempt.hasResult()); }
Source:
public PushButtonMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType+" Payload Len -> "+this.payload.length); if (this.payload.length == PUSH_BUTTON_PAYLOAD_LEN) { if (this.payload[0] == 0x50) isRetransmission = true; if (this.payload[1] == 0x0) mode = PushButtonMode.ECO; else if (this.payload[1] == 0x1) mode = PushButtonMode.AUTO; } else logger.error("Got "+this.msgType+" message with incorrect length!"); }

Target:
public PushButtonMsg(String rawMsg) { super(rawMsg); logger.debug(this.msgType + " Payload Len -> " + this.payload.length); if (this.payload.length == PUSH_BUTTON_PAYLOAD_LEN) { if (this.payload[0] == 0x50) isRetransmission = true; if (this.payload[1] == 0x0) mode = PushButtonMode.ECO; else if (this.payload[1] == 0x1) mode = PushButtonMode.AUTO; } else { logger.error("Got " + this.msgType + " message with incorrect length!"); } }
Source:
public void initRepo() throws Exception { section = session.createDocumentModel("/", "Section", "Section"); section.setPropertyValue("dc:title", "Section"); section = session.createDocument(section); session.save(); section = session.getDocument(section.getRef()); fileToPublish = session.createDocumentModel("/", "FileToPublish", "File"); fileToPublish.setPropertyValue("dc:title", "File"); fileToPublish = session.createDocument(fileToPublish); session.save(); fileToPublish = session.getDocument(fileToPublish.getRef()); }

Target:
public void initRepo() throws Exception { section = session.createDocumentModel("/", "Section", "Section"); section.setPropertyValue("dc:title", "Section"); section = session.createDocument(section); fileToPublish = session.createDocumentModel("/", "FileToPublish", "File"); fileToPublish.setPropertyValue("dc:title", "File"); fileToPublish = session.createDocument(fileToPublish); session.save(); }