auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DuplicateChplProdNumber(final String origChplProductNumberA, final String origChplProductNumberB, final String newChplProductNumber) { super(); this.origChplProductNumberA = origChplProductNumberA; this.origChplProductNumberB = origChplProductNumberB; this.newChplProductNumber = newChplProductNumber; }

Target:
public DuplicateChplProdNumber(final String origChplProductNumberA, final String origChplProductNumberB, final String newChplProductNumber) { this.origChplProductNumberA = origChplProductNumberA; this.origChplProductNumberB = origChplProductNumberB; this.newChplProductNumber = newChplProductNumber; }
Source:
public void record(Trace trace) { log.info(serialize(trace)); }

Target:
public void record(Trace trace) { if (log.isLoggable(Logger.Level.INFO)) { String json = serialize(trace); if (json != null) { log.info(json); } } }
Source:
private boolean isChangeReviewed(ChangeData cd) throws OrmException { if (cd.messages(db).isEmpty()) { return false; } if (user instanceof IdentifiedUser) { Account.Id accountId = ((IdentifiedUser) user).getAccountId(); PatchSet.Id patchSetId = cd.currentPatchSet(db).getId(); for (ChangeMessage cm : cd.messages(db)) { if (cm.getAuthor() != null && accountId.equals(cm.getAuthor()) && cm.getPatchSetId() != null && patchSetId.equals(cm.getPatchSetId())) { return true; } } } return false; }

Target:
private boolean isChangeReviewed(ChangeData cd) throws OrmException { if (user instanceof IdentifiedUser) { PatchSet.Id patchSetId = cd.currentPatchSet(db).getId(); List<ChangeMessage> messages = db.get().changeMessages().byPatchSet(patchSetId).toList(); if (messages.isEmpty()) { return false; } Collections.sort(messages, new Comparator<ChangeMessage>() { @Override public int compare(ChangeMessage a, ChangeMessage b) { return b.getWrittenOn().compareTo(a.getWrittenOn()); } }); Account.Id currentUserId = ((IdentifiedUser) user).getAccountId(); Account.Id changeOwnerId = cd.change(db).getOwner(); for (ChangeMessage cm : messages) { if (currentUserId.equals(cm.getAuthor())) { return true; }else if (changeOwnerId.equals(cm.getAuthor())) { return false; } } } return false; }
Source:
public static final Range create(TypeKind typeKind) { switch (typeKind) { case INT: return INT_EVERYTHING; case SHORT: return SHORT_EVERYTHING; case BYTE: return BYTE_EVERYTHING; case CHAR: return CHAR_EVERYTHING; case LONG: return LONG_EVERYTHING; default: throw new IllegalArgumentException( "create(" + typeKind + "), expected INT, SHORT, BYTE, CHAR, or LONG"); } }

Target:
public static Range create(TypeKind typeKind) { switch (typeKind) { case INT: return INT_EVERYTHING; case SHORT: return SHORT_EVERYTHING; case BYTE: return BYTE_EVERYTHING; case CHAR: return CHAR_EVERYTHING; case LONG: return LONG_EVERYTHING; default: throw new IllegalArgumentException( "create(" + typeKind + "), expected INT, SHORT, BYTE, CHAR, or LONG"); } }
Source:
public Repo repo(final Repos repos) throws IOException { Repo repo = null; while (repo == null) { try { repo = repos.create( Json.createObjectBuilder() .add( "name", RandomStringUtils.randomAlphanumeric(Tv.TEN) ).add("auto_init", true).build() ); } catch (final AssertionError exception) { } } return repo; }

Target:
public Repo repo(final Repos repos) throws IOException { Repo repo = null; while (repo == null) { try { repo = repos.create( Json.createObjectBuilder() .add( "name", RandomStringUtils.randomAlphanumeric(Tv.TEN) ).add("auto_init", true).build() ); } catch (final AssertionError exception) { Logger.warn( this, "Create repository failed. Message: %s", exception.getMessage() ); } } return repo; }
Source:
public void testRequestWithNoContentLengthHeaderOrContentReturnsEmptyBody() { serverRule.startServer(); serverRule.assertRequestEquals( new Func1<HttpClient<ByteBuf, ByteBuf>, Observable<HttpClientResponse<ByteBuf>>>() { @Override public Observable<HttpClientResponse<ByteBuf>> call(HttpClient<ByteBuf, ByteBuf> client) { return client.createGet("/"); } }, "GET / HTTP/1.1\r\n" + "content-length: 0\r\n" + "host: " + serverRule.getServerAddress().toString().replaceFirst("^/", "") + "\r\n" + "\r\n"); }

Target:
public void testRequestWithNoContentLengthHeaderOrContentReturnsEmptyBody() { clientRule.sendRequest(clientRule.getHttpClient().createGet("/")); clientRule.assertEmptyBodyWithContentLengthZero(); }
Source:
private void packetReceived(XBeePacket packet) { notifyPacketReceived(packet); if (!(packet instanceof XBeeAPIPacket)) return; XBeeAPIPacket apiPacket = (XBeeAPIPacket)packet; APIFrameType apiType = apiPacket.getFrameType(); if (apiType == null) return; String address = null; byte[] data = null; boolean isBroadcastData = false; switch(apiType) { case RECEIVE_PACKET: address = ((ReceivePacket)apiPacket).get64bitAddress().toString(); data = ((ReceivePacket)apiPacket).getReceivedData(); isBroadcastData = ByteUtils.isBitEnabled(((ReceivePacket)apiPacket).getReceiveOptions(), 1); break; case RX_64: address = ((RX64Packet)apiPacket).getSourceAddress().toString(); data = ((RX64Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; case RX_16: address = ((RX16Packet)apiPacket).getSourceAddress().toString(); data = ((RX16Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; default: break; } notifySerialDataReceived(address, data, isBroadcastData); }

Target:
private void packetReceived(XBeePacket packet) { notifyPacketReceived(packet); if (!(packet instanceof XBeeAPIPacket)) return; XBeeAPIPacket apiPacket = (XBeeAPIPacket)packet; APIFrameType apiType = apiPacket.getFrameType(); if (apiType == null) return; String address = null; byte[] data = null; boolean isBroadcastData = false; switch(apiType) { case RECEIVE_PACKET: address = ((ReceivePacket)apiPacket).get64bitAddress().toString(); data = ((ReceivePacket)apiPacket).getReceivedData(); isBroadcastData = ByteUtils.isBitEnabled(((ReceivePacket)apiPacket).getReceiveOptions(), 1); break; case RX_64: address = ((RX64Packet)apiPacket).getSourceAddress().toString(); data = ((RX64Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; case RX_16: address = ((RX16Packet)apiPacket).getSourceAddress().toString(); data = ((RX16Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; default: break; } if (address != null && data != null) notifySerialDataReceived(address, data, isBroadcastData); }
Source:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vmName", "description", "domain", "os", "osType", "creationDate", "numOfMonitors", "allowConsoleReconnect", "usbPolicy", "autoSuspend", "autoStartup", "dedicatedVmForVds", "defaultDisplayType", "priority", "defaultBootSequence", "initrdUrl", "kernelUrl", "kernelParams", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_rl", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vdsGroupId", "timeZone", "stateless", "niceLevel", "memSizeMb", "numOfSockets", "cpuPerSocket", "isoPath", "userDefinedProperties", "predefinedProperties", "customProperties" })); }
Source:
public void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("C:/datos/movies.txt"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }

Target:
public void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("../movies.txt"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }
Source:
protected String getJobName(JobContext ctx, Long id) { String jobname = null; if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; String jobNamePrefix = processCtx.getSessionId() + "-"; jobname = processCtx.getProcessInstanceId() + "-" + processCtx.getTimer().getId(); if (processCtx instanceof StartProcessJobContext) { jobname = jobNamePrefix + "StartProcess-" + ((StartProcessJobContext) processCtx).getProcessId() + "-" + processCtx.getTimer().getId(); } } else if (ctx instanceof NamedJobContext) { jobname = ((NamedJobContext) ctx).getJobName(); } else { jobname = "Timer-"+ctx.getClass().getSimpleName()+ "-" + id; } return jobname; }

Target:
protected String getJobName(JobContext ctx, Long id) { String jobname = null; if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; jobname = processCtx.getSessionId() + "-" + processCtx.getProcessInstanceId() + "-" + processCtx.getTimer().getId(); if (processCtx instanceof StartProcessJobContext) { String deploymentId = (String) processCtx.getKnowledgeRuntime().getEnvironment().get(EnvironmentName.DEPLOYMENT_ID); jobname = deploymentId + "-StartProcess-" + ((StartProcessJobContext) processCtx).getProcessId() + "-" + processCtx.getTimer().getId(); } } else if (ctx instanceof NamedJobContext) { jobname = ((NamedJobContext) ctx).getJobName(); } else { jobname = "Timer-"+ctx.getClass().getSimpleName()+ "-" + id; } return jobname; }
Source:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { model.setMessage(ConstantsManager.getInstance() .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }

Target:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.ACTIVATED) { model.setMessage(ConstantsManager.getInstance() .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
private static void toggleSwitches(Block signBlock) { Sign sign = (Sign) signBlock.getState().getData(); BlockFace[] checkFaces = new BlockFace[4]; checkFaces[0] = BlockFace.UP; checkFaces[1] = BlockFace.DOWN; switch (sign.getFacing()) { case EAST: case WEST: checkFaces[2] = BlockFace.NORTH; checkFaces[3] = BlockFace.SOUTH; break; default: checkFaces[2] = BlockFace.EAST; checkFaces[3] = BlockFace.WEST; break; } for (BlockFace blockFace : checkFaces) { final Block checkBlock = signBlock.getRelative(blockFace); if (checkBlock.getType() == Material.LEVER) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(!powerable.isPowered()); checkBlock.setBlockData(powerable); } else if (Tag.BUTTONS.getValues().contains(checkBlock.getType())) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(true); checkBlock.setBlockData(powerable); powerable.setPowered(false); Runnable turnOff = () -> checkBlock.setBlockData(powerable); Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), turnOff, Tag.WOODEN_BUTTONS.getValues().contains(checkBlock.getType()) ? 30L : 20L); } } }

Target:
private static void toggleSwitches(Block signBlock) { Sign sign = (Sign) signBlock.getState().getData(); BlockFace[] checkFaces = new BlockFace[4]; checkFaces[0] = BlockFace.UP; checkFaces[1] = BlockFace.DOWN; switch (sign.getFacing()) { case EAST: case WEST: checkFaces[2] = BlockFace.NORTH; checkFaces[3] = BlockFace.SOUTH; break; default: checkFaces[2] = BlockFace.EAST; checkFaces[3] = BlockFace.WEST; break; } for (BlockFace blockFace : checkFaces) { final Block checkBlock = signBlock.getRelative(blockFace); if (checkBlock.getType() == Material.LEVER) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(!powerable.isPowered()); checkBlock.setBlockData(powerable); Switch lever = (Switch) checkBlock.getBlockData(); Block targetBlock = checkBlock.getRelative(lever.getFacing().getOppositeFace()); applyPhysicsToBlock(targetBlock); } else if (Tag.BUTTONS.getValues().contains(checkBlock.getType())) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(true); checkBlock.setBlockData(powerable); Switch button = (Switch) checkBlock.getBlockData(); Block targetBlock = checkBlock.getRelative(button.getFacing().getOppositeFace()); applyPhysicsToBlock(targetBlock); Runnable turnOff = () -> turnOffButton(checkBlock, targetBlock, powerable); Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), turnOff, Tag.WOODEN_BUTTONS.getValues().contains(checkBlock.getType()) ? 30L : 20L); } } }
Source:
public static ProgramWorkflowState getState(String identifier) { ProgramWorkflowState state = null; if (identifier != null) { try { identifier = identifier.trim(); Integer id = Integer.valueOf(identifier); state = getState(id); if (state != null) { return state; } } catch (NumberFormatException e) int index = identifier.indexOf(":"); if(index != -1){ return getMetadata(identifier, ProgramWorkflowState.class, index); } if (isValidUuidFormat(identifier)) { state = Context.getProgramWorkflowService().getStateByUuid(identifier); if (state != null) { return state; } } } return null; }

Target:
public static ProgramWorkflowState getState(String identifier) { ProgramWorkflowState state = null; if (identifier != null) { try { identifier = identifier.trim(); Integer id = Integer.valueOf(identifier); state = getState(id); if (state != null) { return state; } } catch (NumberFormatException e) state = getMetadataByMapping(ProgramWorkflowState.class, identifier); if (state != null) { return state; } if (isValidUuidFormat(identifier)) { state = Context.getProgramWorkflowService().getStateByUuid(identifier); if (state != null) { return state; } } } return null; }
Source:
public OAuth2ServiceProvider getProvider(String serviceName) { DocumentModel model = getProviderDocModel(serviceName); return model != null ? buildProvider(model): null; }

Target:
public OAuth2ServiceProvider getProvider(String serviceName) { DocumentModel model = getProviderDocModel(serviceName); return model == null ? null : buildProvider(model); }
Source:
private void tryToAddVariant(final VariantContext vc, final ReferenceSequence refSeq, final VariantContext source) { if (!refSeq.getName().equals(vc.getContig())) { throw new IllegalStateException("The contig of the VariantContext, " + vc.getContig() + ", doesnt match the ReferenceSequence: " + refSeq.getName()); } boolean mismatchesReference = false; for (final Allele allele : vc.getAlleles()) { if (allele.isReference()) { final byte[] ref = refSeq.getBases(); final String refString = StringUtil.bytesToString(ref, vc.getStart() - 1, vc.getEnd() - vc.getStart() + 1); if (!refString.equalsIgnoreCase(allele.getBaseString())) { if (vc.getAlleles().size() == 2 && vc.getAlleles().stream().map(Allele::length).allMatch(l -> l == 1) && refString.equalsIgnoreCase(vc.getAlleles().stream().filter(Allele::isNonReference).findFirst().get().getBaseString())) { sorter.add(LiftoverUtils.swapRefAlt(vc,TAGS_TO_REVERSE, TAGS_TO_DROP)); return; } mismatchesReference = true; } break; } } if (mismatchesReference) { rejects.add(new VariantContextBuilder(source) .filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .make()); failedAlleleCheck++; } else { sorter.add(vc); } }

Target:
private void tryToAddVariant(final VariantContext vc, final ReferenceSequence refSeq, final VariantContext source) { if (!refSeq.getName().equals(vc.getContig())) { throw new IllegalStateException("The contig of the VariantContext, " + vc.getContig() + ", doesnt match the ReferenceSequence: " + refSeq.getName()); } boolean mismatchesReference = false; for (final Allele allele : vc.getAlleles()) { if (allele.isReference()) { final byte[] ref = refSeq.getBases(); final String refString = StringUtil.bytesToString(ref, vc.getStart() - 1, vc.getEnd() - vc.getStart() + 1); if (!refString.equalsIgnoreCase(allele.getBaseString())) { if (vc.isBiallelic() && vc.isSNP() && refString.equalsIgnoreCase(vc.getAlternateAllele(0).getBaseString())) { sorter.add(LiftoverUtils.swapRefAlt(vc, TAGS_TO_REVERSE, TAGS_TO_DROP)); return; } mismatchesReference = true; } break; } } if (mismatchesReference) { rejects.add(new VariantContextBuilder(source) .filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .make()); failedAlleleCheck++; } else { sorter.add(vc); } }
Source:
public String getJobCoordinationUtilsFactoryClassName() { String coordinatorFactory = get(JOB_COORDINATOR_FACTORY, DEFAULT_COORDINATOR_UTILS_FACTORY); String coordinationUtilsFactory; if (Objects.equals(coordinatorFactory, AZURE_COORDINATOR_FACTORY)) { coordinationUtilsFactory = AZURE_COORDINATION_UTILS_FACTORY; } else if (Objects.equals(coordinatorFactory, PassthroughJobCoordinatorFactory.class.getName())) { coordinationUtilsFactory = PassthroughCoordinationUtilsFactory.class.getName(); } else { coordinationUtilsFactory = ZkCoordinationUtilsFactory.class.getName(); } try { Class.forName(coordinationUtilsFactory); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATOR_FACTORY + " = " + coordinationUtilsFactory, e); } return coordinationUtilsFactory; }

Target:
public String getJobCoordinationUtilsFactoryClassName() { String coordinatorFactory = get(JOB_COORDINATOR_FACTORY, DEFAULT_COORDINATOR_FACTORY); String coordinationUtilsFactory; if (AZURE_COORDINATOR_FACTORY.equals(coordinatorFactory)) { coordinationUtilsFactory = AZURE_COORDINATION_UTILS_FACTORY; } else if (PassthroughJobCoordinatorFactory.class.getName().equals(coordinatorFactory)) { coordinationUtilsFactory = PassthroughCoordinationUtilsFactory.class.getName(); } else if (ZkJobCoordinatorFactory.class.getName().equals(coordinatorFactory)) { coordinationUtilsFactory = ZkCoordinationUtilsFactory.class.getName(); } else { throw new SamzaException(String.format("Coordination factory: %s defined by the config: %s is invalid.", coordinatorFactory, JOB_COORDINATOR_FACTORY)); } try { Class.forName(coordinationUtilsFactory); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATOR_FACTORY + " = " + coordinationUtilsFactory, e); } return coordinationUtilsFactory; }
Source:
public Dictionary<String, String> decrypt(final Dictionary config) { StringEncryptor encryptor = null; Dictionary<String, String> decryptedConfig = new Hashtable<String, String>(); for (Enumeration e = config.keys(); e.hasMoreElements();) { final String key = (String) e.nextElement(); Object value = config.get(key); if (value instanceof String && isEncrypted((String)value)) { String strValue = (String) value; String cipherText = strValue.substring(ENCRYPTED_PROPERTY_PREFIX.length(), strValue.length() - ENCRYPTED_PROPERTY_SUFFIX.length()); if(encryptor == null) { try { encryptor = (StringEncryptor) this.encryptorServiceTracker.waitForService(30000); } catch (InterruptedException e1) { } } if (encryptor != null) { String plainText = encryptor.decrypt(cipherText); decryptedConfig.put(key, plainText); } } else { decryptedConfig.put(key,String.valueOf(value)); } } return decryptedConfig; }

Target:
public Dictionary<String, String> decrypt(final Dictionary config) { StringEncryptor encryptor = null; Dictionary<String, String> decryptedConfig = new Hashtable<String, String>(); for (Enumeration e = config.keys(); e.hasMoreElements();) { final String key = (String) e.nextElement(); String value = String.valueOf(config.get(key)); if (config.get(key) instanceof String && isEncrypted(value)){ String cipherText = value.substring(ENCRYPTED_PROPERTY_PREFIX.length(), value.length() - ENCRYPTED_PROPERTY_SUFFIX.length()); if(encryptor == null) { try { encryptor = (StringEncryptor) this.encryptorServiceTracker.waitForService(30000); } catch (InterruptedException e1) { } } if (encryptor != null) { String plainText = encryptor.decrypt(cipherText); decryptedConfig.put(key, plainText); } } else { decryptedConfig.put(key,value); } } return decryptedConfig; }
Source:
public CSVFileScanFragment( final DataSource source, final Schema schema, final long partitionStartByteRange, final long partitionEndByteRange, final boolean isLastWorker, @Nullable final Character delimiter, @Nullable final Character quote, @Nullable final Character escape, @Nullable final Integer numberOfSkippedLines) { this.source = (AmazonS3Source) Preconditions.checkNotNull(source, "source"); this.schema = Preconditions.checkNotNull(schema, "schema"); this.delimiter = MoreObjects.firstNonNull(delimiter, CSVFormat.DEFAULT.getDelimiter()); this.quote = MoreObjects.firstNonNull(quote, CSVFormat.DEFAULT.getQuoteCharacter()); this.escape = escape != null ? escape : CSVFormat.DEFAULT.getEscapeCharacter(); this.numberOfSkippedLines = MoreObjects.firstNonNull(numberOfSkippedLines, 0); this.partitionStartByteRange = partitionStartByteRange; this.partitionEndByteRange = partitionEndByteRange; this.isLastWorker = isLastWorker; }

Target:
public CSVFileScanFragment( final DataSource source, final Schema schema, final long partitionStartByteRange, final long partitionEndByteRange, final boolean isLastWorker, @Nullable final Character delimiter, @Nullable final Character quote, @Nullable final Character escape, @Nullable final Integer numberOfSkippedLines) { this.source = (AmazonS3Source) Preconditions.checkNotNull(source, "source"); this.schema = Preconditions.checkNotNull(schema, "schema"); this.delimiter = MoreObjects.firstNonNull(delimiter, CSVFormat.DEFAULT.getDelimiter()); this.quote = MoreObjects.firstNonNull(quote, CSVFormat.DEFAULT.getQuoteCharacter()); this.escape = escape; this.numberOfSkippedLines = MoreObjects.firstNonNull(numberOfSkippedLines, 0); this.partitionStartByteRange = partitionStartByteRange; this.partitionEndByteRange = partitionEndByteRange; this.isLastWorker = isLastWorker; maxByteRange = ((AmazonS3Source) source).getFileSize(); onLastRow = false; finishedReadingLastRow = false; flagAsIncomplete = false; }
Source:
public void setInput(Object inputElement) { fInputElement = inputElement; ITimeGraphEntry[] input = fTimeGraphContentProvider.getElements(inputElement); synchronized (fListenerNotifierLock) { fListenerNotifier = null; } if (fTimeGraphCtrl != null) { setTimeRange(input); setTopIndex(0); fSelectionBegin = SWT.DEFAULT; fSelectionEnd = SWT.DEFAULT; fSelectedEntry = null; refreshAllData(input); } }

Target:
public void setInput(Object inputElement) { fInputElement = inputElement; ITimeGraphEntry[] input = fTimeGraphContentProvider.getElements(inputElement); fListenerNotifier = null; if (fTimeGraphCtrl != null) { setTimeRange(input); setTopIndex(0); fSelectionBegin = SWT.DEFAULT; fSelectionEnd = SWT.DEFAULT; fSelectedEntry = null; refreshAllData(input); } }
Source:
public void panToPercent(double percent) { double minVisible = simplePlot.getAxes().getX().getMinimumValue(); double maxVisible = simplePlot.getAxes().getX().getMaximumValue(); double valueOnScaleShouldBe = percent * (maxRange - maxVisible + minVisible); double deltaInScale = valueOnScaleShouldBe - minVisible; double pixelsToScale = (simplePlot.getOffsetWidth() - simplePlot.getOptions().getYAxisOptions().getLabelWidth()) / (maxVisible - minVisible); Pan pan = Pan.create().setLeft(deltaInScale * pixelsToScale).setPreventEvent(true); simplePlot.pan(pan); int newHorizontalPosition = (int) ((scrollbar.getMaximumHorizontalScrollPosition() - scrollbar.getMinimumHorizontalScrollPosition()) * percent); if (newHorizontalPosition == scrollbar.getHorizontalScrollPosition()) { NativeEvent event = Document.get().createScrollEvent(); DomEvent.fireNativeEvent(event, scrollbar); } else { scrollbar.setHorizontalScrollPosition(newHorizontalPosition); } }

Target:
public void panToPercent(double percent) { double minVisible = simplePlot.getAxes().getX().getMinimumValue(); double visibleRange = getVisibleRange(); double valueOnScaleShouldBe = percent * (maxRange - visibleRange); double deltaInScale = valueOnScaleShouldBe - minVisible; double pixelsToScale = getPlotWidth() / visibleRange; Pan pan = Pan.create().setLeft(deltaInScale * pixelsToScale).setPreventEvent(true); simplePlot.pan(pan); int newHorizontalPosition = (int) ((scrollbar.getMaximumHorizontalScrollPosition() - scrollbar.getMinimumHorizontalScrollPosition()) * percent); if (newHorizontalPosition == scrollbar.getHorizontalScrollPosition()) { NativeEvent event = Document.get().createScrollEvent(); DomEvent.fireNativeEvent(event, scrollbar); } else { scrollbar.setHorizontalScrollPosition(newHorizontalPosition); } }
Source:
public void initialize() { final Class<?> outTypeClass = out() == null ? Type.class : Util .getTypeFromInterval(out()).getClass(); final Object inType = in() == null ? NativeType.class : Util .getTypeFromInterval(in()); final UnaryComputerOp<?, ?> typeComputer = Computers.unary(ops(), Ops.Copy.Type.class, outTypeClass, inType); mapComputer = RAIs.computer(ops(), Ops.Map.class, in(), typeComputer); createFunc = RAIs.function(ops(), Ops.Create.Img.class, in(), inType); }

Target:
public void initialize() { final Object outType = out() == null ? Type.class : Util .getTypeFromInterval(out()); final Object inType = in() == null ? NativeType.class : Util .getTypeFromInterval(in()); final UnaryComputerOp<?, ?> typeComputer = Computers.unary(ops(), Ops.Copy.Type.class, outType, inType); mapComputer = RAIs.computer(ops(), Ops.Map.class, in(), typeComputer); createFunc = RAIs.function(ops(), Ops.Create.Img.class, in(), inType); }
Source:
public long getMonthlySpareParts() { long partsCost = 0; for (Unit u : getUnits()) { if (u.isMothballed()) { continue; } partsCost += u.getSparePartsCost(); } return partsCost; }

Target:
private long getMonthlySpareParts() { long partsCost = 0; for (Unit u : getUnits()) { if (u.isMothballed()) { continue; } partsCost += u.getSparePartsCost(); } return partsCost; }
Source:
private void checkCFG(ControlFlowGraph cfg, FunctionTree functionTree) { Scope scope = getContext().getSymbolModel().getScope(functionTree); LiveVariableAnalysis lva = LiveVariableAnalysis.create(cfg, scope); Usages usages = lva.getUsages(); for (CfgBlock cfgBlock : cfg.blocks()) { if (isTryBlock(cfgBlock)) { return; } } for (CfgBlock cfgBlock : cfg.blocks()) { Set<Symbol> live = lva.getLiveOutSymbols(cfgBlock); for (Tree element : Lists.reverse(cfgBlock.elements())) { Usage usage = usages.getUsage(element); if (usage != null) { checkUsage(usage, live, usages); } } } raiseIssuesForNeverReadSymbols(usages); }

Target:
private void checkCFG(ControlFlowGraph cfg, FunctionTree functionTree) { for (CfgBlock cfgBlock : cfg.blocks()) { if (isTryBlock(cfgBlock)) { return; } } Scope scope = getContext().getSymbolModel().getScope(functionTree); LiveVariableAnalysis lva = LiveVariableAnalysis.create(cfg, scope); Usages usages = lva.getUsages(); for (CfgBlock cfgBlock : cfg.blocks()) { Set<Symbol> live = lva.getLiveOutSymbols(cfgBlock); for (Tree element : Lists.reverse(cfgBlock.elements())) { Usage usage = usages.getUsage(element); if (usage != null) { checkUsage(usage, live, usages); } } } raiseIssuesForNeverReadSymbols(usages); }
Source:
public void basicPagination() throws IOException { try { HELPERS.ensureBucketExists(TEST_ENV_NAME); final int numObjects = 50; CLIENT.putBulkJobSpectraS3(new PutBulkJobSpectraS3Request(TEST_ENV_NAME, createTestList(numObjects))); final GetObjectsFullDetailsLoaderFactory loaderFactory = new GetObjectsFullDetailsLoaderFactory(CLIENT, TEST_ENV_NAME, "", 10, RETRIES, false); final Set<String> foundItems = new HashSet<>(); for (final DetailedS3Object detailedS3Object : new LazyIterable<>(loaderFactory)) { LOG.info("Testing: {}", detailedS3Object.getName()); assertFalse(foundItems.contains(detailedS3Object.getName())); foundItems.add(detailedS3Object.getName()); } for (int i = 0; i < numObjects; i++) { assertTrue(foundItems.contains("obj." + i)); } } finally { deleteAllContents(CLIENT, TEST_ENV_NAME); } }

Target:
public void basicPagination() throws IOException { try { HELPERS.ensureBucketExists(TEST_ENV_NAME); final int numObjects = 55; CLIENT.putBulkJobSpectraS3(new PutBulkJobSpectraS3Request(TEST_ENV_NAME, createTestList(numObjects))); final GetObjectsFullDetailsLoaderFactory loaderFactory = new GetObjectsFullDetailsLoaderFactory(CLIENT, TEST_ENV_NAME, "", 10, RETRIES, false); final Set<String> foundItems = new HashSet<>(); for (final DetailedS3Object detailedS3Object : new LazyIterable<>(loaderFactory)) { LOG.info("Testing: {}", detailedS3Object.getName()); assertFalse(foundItems.contains(detailedS3Object.getName())); foundItems.add(detailedS3Object.getName()); } for (int i = 0; i < numObjects; i++) { assertTrue(foundItems.contains("obj." + i)); } } finally { deleteAllContents(CLIENT, TEST_ENV_NAME); } }
Source:
public void test_unmodifiableSortedSetLjava_util_SortedSet() { boolean exception = false; SortedSet ss = new TreeSet(); ss.addAll(s); SortedSet c = Collections.unmodifiableSortedSet(ss); assertTrue("Returned set is of incorrect size", c.size() == ss.size()); Iterator i = ll.iterator(); while (i.hasNext()) assertTrue("Returned set missing elements", c.contains(i.next())); try { c.add(new Object()); } catch (UnsupportedOperationException e) { exception = true; } if (!exception) { fail("Allowed modification of set"); } exception = false; try { c.remove(new Object()); } catch (UnsupportedOperationException e) { exception = true; } if (!exception) { fail("Allowed modification of set"); } exception = false; try { c.removeIf(x -> true); } catch (UnsupportedOperationException e) { exception = true; } if (!exception) { fail("Allowed modification of set"); } }

Target:
public void test_unmodifiableSortedSetLjava_util_SortedSet() { boolean exception = false; SortedSet ss = new TreeSet(); ss.addAll(s); SortedSet c = Collections.unmodifiableSortedSet(ss); assertTrue("Returned set is of incorrect size", c.size() == ss.size()); Iterator i = ll.iterator(); while (i.hasNext()) assertTrue("Returned set missing elements", c.contains(i.next())); try { c.add(new Object()); fail("Allowed modification of set"); } catch (UnsupportedOperationException e) try { c.remove(new Object()); fail("Allowed modification of set"); } catch (UnsupportedOperationException expected) try { c.removeIf(x -> true); fail("Allowed modification of set"); } catch (UnsupportedOperationException expected) }
Source:
public void registerDispatcher(final IDispatcher dispatcher, final boolean aggregationRequired) { if (aggregationRequired) { mDispatcher = new AggregatedDispatcher(dispatcher); } else { mDispatcher = new DefaultDispatcher(dispatcher); } }

Target:
public synchronized void registerDispatcher(final IDispatcher dispatcher, final boolean aggregationRequired) { if (aggregationRequired) { mDispatcher = new AggregatedDispatcher(dispatcher); } else { mDispatcher = new DefaultDispatcher(dispatcher); } }
Source:
public static String getRegistrationKeyFromGmail(String username, String courseName, String courseId) throws IOException, MessagingException { Gmail service = new GmailServiceMaker(username).makeGmailService(); ListMessagesResponse listMessagesResponse; while (true) { try { listMessagesResponse = service.users().messages().list(username).setMaxResults(5L) .setQ("is:UNREAD").execute(); break; } catch (GoogleJsonResponseException e) { if (e.getDetails().getCode() == HttpStatusCodes.STATUS_CODE_FORBIDDEN) { System.out.println(e.getDetails().getMessage()); service = new GmailServiceMaker(username, true).makeGmailService(); } else { throw e; } } } final List<Message> messageStubs = listMessagesResponse.getMessages(); if (messageStubs != null) { for (Message messageStub : messageStubs) { final Message message = service.users().messages().get(username, messageStub.getId()).setFormat("raw") .execute(); final MimeMessage email = convertFromMessageToMimeMessage(message); if (isStudentCourseJoinRegistrationEmail(email, courseName, courseId)) { final String body = getEmailMessageBodyAsText(email); final ModifyMessageRequest modifyMessageRequest = new ModifyMessageRequest() .setRemoveLabelIds(Collections.singletonList("UNREAD")); service.users().messages().modify(username, messageStub.getId(), modifyMessageRequest).execute(); return getKey(body); } } } return null; }

Target:
public static String getRegistrationKeyFromGmail(String username, String courseName, String courseId) throws IOException, MessagingException { Gmail service = new GmailServiceMaker(username).makeGmailService(); ListMessagesResponse listMessagesResponse; while (true) { try { listMessagesResponse = service.users().messages().list(username).setMaxResults(5L) .setQ("is:UNREAD").execute(); break; } catch (GoogleJsonResponseException e) { if (e.getDetails().getCode() == HttpStatusCodes.STATUS_CODE_FORBIDDEN) { System.out.println(e.getDetails().getMessage()); service = new GmailServiceMaker(username, true).makeGmailService(); } else { throw e; } } } final List<Message> messageStubs = listMessagesResponse.getMessages(); if (isEmpty(messageStubs)) { return null; } for (Message messageStub : messageStubs) { final Message message = service.users().messages().get(username, messageStub.getId()).setFormat("raw") .execute(); final MimeMessage email = convertFromMessageToMimeMessage(message); if (isStudentCourseJoinRegistrationEmail(email, courseName, courseId)) { final String body = getTextFromEmail(email); markMessageAsRead(service, username, messageStub); return getKey(body); } } return null; }
Source:
public Connection getOrConnect(@Nonnull Address address) { checkClientActive(); InetSocketAddress inetSocketAddress = inetSocketAddressCache.get(address); ClientConnection connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } synchronized (locks[abs(inetSocketAddress.hashCode() % CONCURRENT_AUTH_COUNT)]) { connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } address = translate(address); connection = createSocketConnection(address); authenticate(connection); return connection; } }

Target:
Connection getOrConnect(@Nonnull Address address) { checkClientActive(); InetSocketAddress inetSocketAddress = resolveAddress(address); ClientConnection connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } synchronized (inetSocketAddress) { connection = activeConnections.get(inetSocketAddress); if (connection != null) { return connection; } address = translate(address); connection = createSocketConnection(address); initializeToCluster(connection); return connection; } }
Source:
public EntityList getDependency(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEPENDENCY.path, entityType, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DEPENDENCY); printClientResponse(clientResponse); checkIfSuccessful(clientResponse); EntityList result = clientResponse.getEntity(EntityList.class); if (result == null || result.getElements() == null) { return new EntityList(); } return result; }

Target:
public EntityList getDependency(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEPENDENCY.path, entityType, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DEPENDENCY); printClientResponse(clientResponse); checkIfSuccessful(clientResponse); EntityList result = clientResponse.getEntity(EntityList.class); if (result == null) { return new EntityList(); } return result; }
Source:
private void fetchAndDisplayThumbnail(DisplayableContribution contribution) { String keyForLRUCache = getKeyForLRUCache(contribution.getContentUri()); String cacheUrl = thumbnailCache.get(keyForLRUCache); if (!StringUtils.isBlank(cacheUrl)) { imageView.setImageURI(cacheUrl); return; } imageView.setBackground(null); if ((contribution.getState() != Contribution.STATE_COMPLETED) && fileExists( contribution.getLocalUri())) { imageView.setImageURI(contribution.getLocalUri()); }else { Timber.d("Fetching thumbnail for %s", contribution.getFilename()); Disposable disposable = mediaDataExtractor .getMediaFromFileName(contribution.getFilename()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(media -> { thumbnailCache.put(keyForLRUCache, media.getThumbUrl()); imageView.setImageURI(media.getThumbUrl()); }); compositeDisposable.add(disposable); } }

Target:
private void fetchAndDisplayThumbnail(DisplayableContribution contribution) { String keyForLRUCache = getKeyForLRUCache(contribution.getContentUri()); String cacheUrl = thumbnailCache.get(keyForLRUCache); if (!StringUtils.isBlank(cacheUrl)) { imageView.setImageURI(cacheUrl); return; } imageView.setBackground(null); if ((contribution.getState() != Contribution.STATE_COMPLETED) && FileUtils.fileExists( contribution.getLocalUri())) { imageView.setImageURI(contribution.getLocalUri()); } else { Timber.d("Fetching thumbnail for %s", contribution.getFilename()); Disposable disposable = mediaDataExtractor .getMediaFromFileName(contribution.getFilename()) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(media -> { thumbnailCache.put(keyForLRUCache, media.getThumbUrl()); imageView.setImageURI(media.getThumbUrl()); }); compositeDisposable.add(disposable); } }
Source:
public CassandraService(MetricsManager metricsManager, CassandraKeyValueServiceConfig config, Blacklist blacklist) { this(metricsManager, config, blacklist, Optional.empty(), new Random()); }

Target:
public CassandraService(MetricsManager metricsManager, CassandraKeyValueServiceConfig config, Blacklist blacklist) { this.metricsManager = metricsManager; this.randomHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder() .safeName(MetricRegistry.name(CassandraService.class, "randomHostsSelected")).build()); this.localHostsSelected = metricsManager.getTaggedRegistry().counter(MetricName.builder() .safeName(MetricRegistry.name(CassandraService.class, "localHostsSelected")).build()); this.config = config; this.myLocationSupplier = new HostLocationSupplier(this::getSnitch, config.overrideHostLocation()); this.blacklist = blacklist; }
Source:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { List<VDS> list = new ArrayList<>(); if (vm.getStatus() == VMStatus.Paused) { return hosts; } List<VmNumaNode> vmNumaNodes = DbFacade.getInstance().getVmNumaNodeDAO().getAllVmNumaNodeByVmId(vm.getId()); for (VDS vds : hosts) { if (!isVMSwapValueLegal(vds)) { log.debugFormat("host '{0}' swap value is illegal", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__SWAP_VALUE_ILLEGAL.toString()); continue; } if (!memoryChecker.evaluate(vds, vm)) { log.debugFormat("host '{0}' has insufficient memory to run the VM", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } if (isVmNumaPinned(vmNumaNodes) && vm.getNumaTuneMode() == NumaTuneMode.STRICT && (!vds.isNumaSupport() || !canVmNumaPinnedToVds(vm, vmNumaNodes, vds))) { log.debugFormat("host '{0}' cannot accommodate memory of VM's pinned virtual NUMA nodes within host's physical NUMA nodes", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } list.add(vds); } return list; }

Target:
public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> parameters, PerHostMessages messages) { List<VDS> list = new ArrayList<>(); if (vm.getStatus() == VMStatus.Paused) { return hosts; } List<VmNumaNode> vmNumaNodes = DbFacade.getInstance().getVmNumaNodeDAO().getAllVmNumaNodeByVmId(vm.getId()); for (VDS vds : hosts) { if (!isVMSwapValueLegal(vds)) { log.debugFormat("host '{0}' swap value is illegal", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__SWAP_VALUE_ILLEGAL.toString()); continue; } if (!memoryChecker.evaluate(vds, vm)) { log.debugFormat("host '{0}' has insufficient memory to run the VM", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_ENOUGH_MEMORY.toString()); continue; } if (vm.getNumaTuneMode() == NumaTuneMode.STRICT && isVmNumaPinned(vmNumaNodes) && (!vds.isNumaSupport() || !canVmNumaPinnedToVds(vm, vmNumaNodes, vds))) { log.debugFormat("host '{0}' cannot accommodate memory of VM's pinned virtual NUMA nodes within host's physical NUMA nodes", vds.getName()); messages.addMessage(vds.getId(), VdcBllMessages.VAR__DETAIL__NOT_MEMORY_PINNED_NUMA.toString()); continue; } list.add(vds); } return list; }
Source:
public VoltTable run(byte[] licenseBytes) { VoltTable vt = constructResultTable(); File tmpLicense = new File(VoltDB.instance().getVoltDBRootPath(), tmpFileName); try { Files.write(licenseBytes, tmpLicense); } catch (IOException e) { return constructFailureResponse(vt, "Failed to write the new license to disk: " + e.getMessage(), null); } LicenseApi newLicense = MiscUtils.licenseApiFactory(tmpLicense.getAbsolutePath()); if (newLicense == null) { return constructFailureResponse(vt, "Invalid license format", tmpLicense); } Date today = Calendar.getInstance().getTime(); if (newLicense.expires().before(today)) { return constructFailureResponse(vt, "Failed to update the license because new license is expired", tmpLicense); } LicenseApi currentLicense = VoltDB.instance().getLicenseApi(); String error = MiscUtils.isLicenseChangeAllowed(newLicense, currentLicense); if (error != null) { return constructFailureResponse(vt, error, tmpLicense); } vt.addRow(VoltSystemProcedure.STATUS_OK, ""); return vt; }

Target:
public VoltTable run(byte[] licenseBytes) { VoltTable vt = constructResultTable(); File tmpLicense = new File(VoltDB.instance().getVoltDBRootPath(), tmpFileName); try { Files.write(licenseBytes, tmpLicense); } catch (IOException e) { return constructFailureResponse(vt, "Failed to write the new license to disk: " + e.getMessage(), null); } LicenseApi newLicense = MiscUtils.createLicenseApi(tmpLicense.getAbsolutePath()); if (newLicense == null) { return constructFailureResponse(vt, "Invalid license format", tmpLicense); } Date today = Calendar.getInstance().getTime(); if (newLicense.expires().before(today)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return constructFailureResponse(vt, "Failed to update the license because new license expires at " + sdf.format(newLicense.expires().getTime()), tmpLicense); } LicenseApi currentLicense = VoltDB.instance().getLicenseApi(); String error = MiscUtils.isLicenseChangeAllowed(newLicense, currentLicense); if (error != null) { return constructFailureResponse(vt, error, tmpLicense); } vt.addRow(VoltSystemProcedure.STATUS_OK, ""); return vt; }
Source:
private ActionReturnValue attachToClusters(List<NetworkCluster> networkAttachments) { networkAttachments.forEach(networkCluster -> networkCluster.setNetworkId(getNetwork().getId())); return runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments)); }

Target:
private ActionReturnValue attachToClusters(List<NetworkCluster> networkAttachments) { networkAttachments.forEach(networkCluster -> networkCluster.setNetworkId(getNetwork().getId())); return runInternalAction(ActionType.ManageNetworkClusters, new ManageNetworkClustersParameters(networkAttachments), getContext().clone().withoutLock()); }