auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeSPMMergeCommand(VDSCommandType vdsCommandType) { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getSubchainInfo().getBaseImageId())); SPMColdMergeVDSCommandParameters parameters = new SPMColdMergeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getSubchainInfo()); VDSReturnValue vdsReturnValue = runVdsCommand(vdsCommandType, parameters); if (vdsReturnValue.getSucceeded()) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } }

Target:
protected void executeSPMMergeCommand(VDSCommandType vdsCommandType) { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getSubchainInfo().getImageGroupId())); SPMColdMergeVDSCommandParameters parameters = new SPMColdMergeVDSCommandParameters(getParameters().getStoragePoolId(), getParameters().getSubchainInfo()); VDSReturnValue vdsReturnValue = runVdsCommand(vdsCommandType, parameters); if (vdsReturnValue.getSucceeded()) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getTaskIdList().add(createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Realm.init(getApplicationContext()); setContentView(R.layout.activity_realm_example); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build(); Realm.deleteRealm(realmConfiguration); realm = Realm.getInstance(realmConfiguration); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_realm_example); RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().build(); Realm.deleteRealm(realmConfiguration); realm = Realm.getInstance(realmConfiguration); }
Source:
protected void processDescriptionPropertiesRecursively(SIRIUS processedDescription, SIRIUS originalDescription, TransformationCache cache) { SIRIUS currentDescription = originalDescription; while (currentDescription != null) { for (EStructuralFeature feature : currentDescription.eClass().getEAllStructuralFeatures()) { this.processDescriptionFeature(feature, processedDescription, currentDescription, cache); } currentDescription = getParentOf(currentDescription); } }

Target:
protected void processDescriptionPropertiesRecursively(SIRIUS processedDescription, SIRIUS originalDescription, TransformationCache cache) { Optional<SIRIUS> currentDescription = Optional.of(originalDescription); while (currentDescription.isPresent()) { for (EStructuralFeature feature : currentDescription.get().eClass().getEAllStructuralFeatures()) { this.processDescriptionFeature(feature, processedDescription, currentDescription.get(), cache); } currentDescription = this.getParentOf(currentDescription.get()); } }
Source:
public boolean getBooleanDeviceConfig(final String nameSpace, final String flagName) { return Boolean.parseBoolean(NetworkStackUtils.getDeviceConfigProperty(nameSpace, flagName, "false" )); }

Target:
public boolean getBooleanDeviceConfig(final String nameSpace, final String flagName) { return NetworkStackUtils.getDeviceConfigPropertyBoolean(nameSpace, flagName, false ); }
Source:
public void clearAll(CommCarePlatform platform) { cleanup(); Stack<Resource> s = this.getResourceStack(); int count = 0; while (!s.isEmpty()) { Resource r = s.pop(); try { r.getInstaller().uninstall(r, platform); count++; } catch (UnresolvedResourceException e) { } } if (count > 0) { Logger.log(LogTypes.TYPE_RESOURCES, "Cleaned up " + count + " records from table"); } storage.removeAll(); }

Target:
public void clearAll(CommCarePlatform platform) { clearByStatus(platform, RESOURCE_STATUS_ALL_RESOURCES); storage.removeAll(); }
Source:
private boolean permissionCheck(Resource resource, Action action, Map<String, Object> permission) { ResourceAction permissionResourceAction = (ResourceAction) permission.get("resourceAction"); if (action != permissionResourceAction.getAction()) { return false; } Resource permissionResource = permissionResourceAction.getResource(); if (permissionResource.getType() != resource.getType()) { return false; } String permissionResourceName = permissionResource.getName(); Pattern resourceNamePattern = Pattern.compile(permissionResourceName); Matcher resourceNameMatcher = resourceNamePattern.matcher(resource.getName()); return resourceNameMatcher.matches(); }

Target:
private boolean permissionCheck(Resource resource, Action action, Map<String, Object> permission) { ResourceAction permissionResourceAction = (ResourceAction) permission.get("resourceAction"); if (action != permissionResourceAction.getAction()) { return false; } Resource permissionResource = permissionResourceAction.getResource(); if (permissionResource.getType() != resource.getType()) { return false; } String permissionResourceName = permissionResource.getName(); Pattern resourceNamePattern = permissionPatternCache.get(permissionResourceName); Matcher resourceNameMatcher = resourceNamePattern.matcher(resource.getName()); return resourceNameMatcher.matches(); }
Source:
protected static void writeProperties(JsonGenerator jg, DocumentModel doc, String schema, ServletRequest request) throws IOException { Collection<Property> properties = doc.getPropertyObjects(schema); if (properties.isEmpty()) { return; } SchemaManager schemaManager = Framework.getService(SchemaManager.class); String prefix = schemaManager.getSchema(schema).getNamespace().prefix; if (prefix == null || prefix.length() == 0) { prefix = schema; } JSONPropertyWriter currentWriter = writer.prefix(prefix); if (request != null) { DownloadService downloadService = Framework.getService(DownloadService.class); String blobUrlPrefix = VirtualHostHelper.getBaseURL(request) + downloadService.getDownloadUrl(doc, null, null) + "/"; currentWriter = currentWriter.filesBaseUrl(blobUrlPrefix); } for (Property p : properties) { currentWriter.writeProperty(jg, p); } }

Target:
protected static void writeProperties(JsonGenerator jg, DocumentModel doc, String schema, ServletRequest request) throws IOException { Collection<Property> properties = doc.getPropertyObjects(schema); if (properties.isEmpty()) { return; } SchemaManager schemaManager = Framework.getService(SchemaManager.class); String prefix = schemaManager.getSchema(schema).getNamespace().prefix; if (prefix == null || prefix.length() == 0) { prefix = schema; } JSONPropertyWriter writer = JSONPropertyWriter.create().writeNull(false).writeEmpty(false).prefix(prefix); if (request != null) { DownloadService downloadService = Framework.getService(DownloadService.class); String blobUrlPrefix = VirtualHostHelper.getBaseURL(request) + downloadService.getDownloadUrl(doc, null, null) + "/"; writer.filesBaseUrl(blobUrlPrefix); } for (Property p : properties) { writer.writeProperty(jg, p); } }
Source:
String getReadable(long val) { String unit[] = {"", "KB", "MB", "GB", "TB" }; int cnt = 0; double d = val; while (d > 1000 && cnt < unit.length-1) { d = d/1000; cnt++; } DecimalFormat df = new DecimalFormat("#.###"); df.setRoundingMode(RoundingMode.DOWN); return cnt > 0 ? "(" + df.format(d) + unit[cnt] + ")" : unit[cnt]; }

Target:
String getReadable(long val) { String unit[] = {"", "KB", "MB", "GB", "TB" }; int cnt = 0; double d = val; while (d >= 1000 && cnt < unit.length-1) { d = d/1000; cnt++; } DecimalFormat df = new DecimalFormat("#.###"); df.setRoundingMode(RoundingMode.DOWN); return cnt > 0 ? "(" + df.format(d) + unit[cnt] + ")" : unit[cnt]; }
Source:
protected Consumer<ConditionInspector> getConditionParser() { return c -> { final FieldCondition cond = (FieldCondition) c.getCondition(); final Operator op = resolve(cond.getOperator()); switch (op) { case LESS_OR_EQUAL: case LESS_THAN: upperBound = ((Number) cond.getValues().iterator().next()).doubleValue(); break; case GREATER_THAN: case GREATER_OR_EQUAL: lowerBound = ((Number) cond.getValues().iterator().next()).doubleValue(); break; } }; }

Target:
protected Consumer<ConditionInspector> getConditionParser() { return c -> { final FieldCondition cond = (FieldCondition) c.getCondition(); final Operator op = resolve(cond.getOperator()); switch (op) { case LESS_OR_EQUAL: case LESS_THAN: upperBound = ((Number) cond.getValues().iterator().next()).doubleValue(); break; case GREATER_THAN: case GREATER_OR_EQUAL: lowerBound = ((Number) cond.getValues().iterator().next()).doubleValue(); break; case EQUALS: lowerBound = ((Number) cond.getValues().iterator().next()).doubleValue(); upperBound = ((Number) cond.getValues().iterator().next()).doubleValue(); break; } }; }
Source:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) { return false; } if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Usage:" + usageMessage); return false; } String name = args[0]; Entity[] entities; if (name.startsWith("@")) { CommandTarget target = new CommandTarget(sender, name); entities = target.getMatched(CommandUtils.getLocation(sender)); if (entities.length == 0) { sender.sendMessage(ChatColor.RED + "Selector '" + name + "' found nothing."); return false; } } else { GlowPlayer player = (GlowPlayer) Bukkit.getPlayerExact(args[0]); if (player == null) { sender.sendMessage(ChatColor.RED + "Entity '" + name + "' cannot be found"); return false; } else { entities = new Entity[] {player}; } } if (args.length >= 2) { String data = String.join(" ", Arrays.copyOfRange(args, 4, args.length)); CompoundTag tag; try { tag = Mojangson.parseCompound(data); } catch (MojangsonParseException e) { sender.sendMessage(ChatColor.RED + "Invalid Data Tag: " + e.getMessage()); return false; } for (Entity entity : entities) { if (entity instanceof GlowEntity) { CompoundTag entityTag = new CompoundTag(); EntityStorage.save((GlowEntity) entity, entityTag); if (tag.matches(entityTag)) { sender.sendMessage("Found " + CommandUtils.getName(entity)); } else { sender.sendMessage(ChatColor.RED + CommandUtils.getName(entity) + " did not match the required data structure"); } } } } else { for (Entity entity : entities) { sender.sendMessage("Found " + CommandUtils.getName(entity)); } } return true; }

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) { return false; } if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); return false; } String name = args[0]; Entity[] entities; if (name.startsWith("@")) { CommandTarget target = new CommandTarget(sender, name); entities = target.getMatched(CommandUtils.getLocation(sender)); if (entities.length == 0) { sender.sendMessage(ChatColor.RED + "Selector '" + name + "' found nothing."); return false; } } else { GlowPlayer player = (GlowPlayer) Bukkit.getPlayerExact(args[0]); if (player == null) { sender.sendMessage(ChatColor.RED + "Entity '" + name + "' cannot be found"); return false; } else { entities = new Entity[] {player}; } } if (args.length >= 2) { String data = String.join(" ", Arrays.copyOfRange(args, 1, args.length)); CompoundTag tag; try { tag = Mojangson.parseCompound(data); } catch (MojangsonParseException e) { sender.sendMessage(ChatColor.RED + "Invalid Data Tag: " + e.getMessage()); return false; } for (Entity entity : entities) { if (entity instanceof GlowEntity) { CompoundTag entityTag = new CompoundTag(); EntityStorage.save((GlowEntity) entity, entityTag); if (tag.matches(entityTag)) { sender.sendMessage("Found " + CommandUtils.getName(entity)); } else { sender.sendMessage(ChatColor.RED + CommandUtils.getName(entity) + " did not match the required data structure"); } } } } else { for (Entity entity : entities) { sender.sendMessage("Found " + CommandUtils.getName(entity)); } } return true; }
Source:
public final Integer getUnstableReturn() { return unstableReturn; }

Target:
public final Integer getUnstableReturn() { return new Integer(0).equals(unstableReturn) ? null : unstableReturn; }
Source:
public void loadScript(File file) throws FileNotFoundException, ScriptException, NoSuchMethodException { logger.info("loadScript Loading Script " + file.getName()); String extension = getFileExtension(file); ScriptEngineManager factory = new ScriptEngineManager(); if(extension != null){ engine = factory.getEngineByExtension(extension); } if (engine != null) { logger.info("EngineName: " + engine.getFactory().getEngineName()); initializeSciptGlobals(); engine.eval(new FileReader(file)); Invocable inv = (Invocable) engine; RuleSet ruleSet = (RuleSet) inv.invokeFunction("getRules"); rules.addAll(ruleSet.getRules()); } }

Target:
public void loadScript(File file) throws FileNotFoundException, ScriptException, NoSuchMethodException { logger.info("Loading Script " + file.getName()); String extension = getFileExtension(file); ScriptEngineManager factory = new ScriptEngineManager(); engine = factory.getEngineByExtension(extension); if (engine != null) { logger.info("EngineName: " + engine.getFactory().getEngineName()); initializeSciptGlobals(); engine.eval(new FileReader(file)); Invocable inv = (Invocable) engine; RuleSet ruleSet = (RuleSet) inv.invokeFunction("getRules"); rules.addAll(ruleSet.getRules()); } }
Source:
private static List<CustomFormSubmodel> getComposedSubmodels(Model modelResponse) { List<CustomFormSubmodel> subModelList = new ArrayList<>(); for (TrainResult composedTrainResultItem : modelResponse.getComposedTrainResults()) { String formType = "custom:"; if (modelResponse.getModelInfo().getModelName() != null) { formType = formType + modelResponse.getModelInfo().getModelName(); } else { formType = formType + composedTrainResultItem.getModelId().toString(); } Map<String, CustomFormModelField> fieldMap = new TreeMap<>(); composedTrainResultItem.getFields() .forEach(formFieldsReport -> fieldMap.put( formFieldsReport.getFieldName(), new CustomFormModelField( null, formFieldsReport.getFieldName(), formFieldsReport.getAccuracy()))); CustomFormSubmodel customFormSubmodel = new CustomFormSubmodel( composedTrainResultItem.getAverageModelAccuracy(), fieldMap, formType); PrivateFieldAccessHelper.set(customFormSubmodel, "modelId", composedTrainResultItem.getModelId().toString()); subModelList.add(customFormSubmodel); } return subModelList; }

Target:
private static List<CustomFormSubmodel> getComposedSubmodels(Model modelResponse) { List<CustomFormSubmodel> subModelList = new ArrayList<>(); for (TrainResult composedTrainResultItem : modelResponse.getComposedTrainResults()) { String formType = "custom:" + composedTrainResultItem.getModelId().toString(); Map<String, CustomFormModelField> fieldMap = new TreeMap<>(); composedTrainResultItem.getFields() .forEach(formFieldsReport -> fieldMap.put( formFieldsReport.getFieldName(), new CustomFormModelField( null, formFieldsReport.getFieldName(), formFieldsReport.getAccuracy()))); CustomFormSubmodel customFormSubmodel = new CustomFormSubmodel( composedTrainResultItem.getAverageModelAccuracy(), fieldMap, formType); PrivateFieldAccessHelper.set(customFormSubmodel, "modelId", composedTrainResultItem.getModelId().toString()); subModelList.add(customFormSubmodel); } return subModelList; }
Source:
public static void main(String[] args) { String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverAsyncClient receiverAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .receiver() .receiveMode(ReceiveMode.PEEK_LOCK) .isLockAutoRenewed(true) .queueName("<<queue-name>>") .isAutoComplete(false) .maxAutoLockRenewalDuration(Duration.ofSeconds(2)) .buildAsyncClient(); Disposable subscription = receiverAsyncClient.receive() .flatMap(message -> { boolean messageProcessed = false; if (messageProcessed) { return receiverAsyncClient.complete(message) .doFinally(signalType -> { System.out.println("Message completed."); }).then(); } else { return receiverAsyncClient.abandon(message) .doFinally(signalType -> { System.out.println("Message Abandoned."); }).then(); } }).subscribe(); try { Thread.sleep(Duration.ofSeconds(60).toMillis()); } catch (InterruptedException ignored) { } subscription.dispose(); receiverAsyncClient.close(); }

Target:
public static void main(String[] args) { String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverAsyncClient receiverAsyncClient = new ServiceBusClientBuilder() .connectionString(connectionString) .receiver() .receiveMode(ReceiveMode.PEEK_LOCK) .isLockAutoRenewed(true) .queueName("<<queue-name>>") .isAutoComplete(false) .maxAutoLockRenewalDuration(Duration.ofSeconds(2)) .buildAsyncClient(); Disposable subscription = receiverAsyncClient.receive() .flatMap(message -> { boolean messageProcessed = false; if (messageProcessed) { return receiverAsyncClient.complete(message).then(); } else { return receiverAsyncClient.abandon(message).then(); } }).subscribe(); try { Thread.sleep(Duration.ofSeconds(60).toMillis()); } catch (InterruptedException ignored) { } subscription.dispose(); receiverAsyncClient.close(); }
Source:
public boolean alreadyHaveOpennetNode(SimpleFieldSet fs) { try { OpennetPeerNode pn = new OpennetPeerNode(fs, node, crypto, this, node.peers, false, crypto.packetMangler); boolean isLong = pn.isLongDistance(); LRUQueue<OpennetPeerNode> peersLRU = isLong ? peersLRULong : peersLRUShort; if(peersLRU.contains(pn)) { if(logMINOR) Logger.minor(this, "Not adding "+pn.userToString()+" to opennet list as already there"); return true; } return false; } catch (Throwable t) { Logger.error(this, "Caught "+t+" parsing opennet node from fieldset", t); return false; } }

Target:
public boolean alreadyHaveOpennetNode(SimpleFieldSet fs) { try { OpennetPeerNode pn = new OpennetPeerNode(fs, node, crypto, this, node.peers, false, crypto.packetMangler); if(lruQueue(pn).contains(pn)) { if(logMINOR) Logger.minor(this, "Not adding "+pn.userToString()+" to opennet list as already there"); return true; } return false; } catch (Throwable t) { Logger.error(this, "Caught "+t+" parsing opennet node from fieldset", t); return false; } }
Source:
public Map<String, String> machineAttributes() { final Map<String, String> attributes = new HashMap<>(); for (Entry<String, String> entry : labels.entrySet()) { Matcher matcher = MACHINE_ATTRIBUTE_PATTERN.matcher(entry.getKey()); if (matcher.matches()) { String attribute = matcher.group("attribute"); attributes.put(attribute, labels.get(String.format(MACHINE_ATTR_LABEL_FMT, attribute))); } } return attributes; }

Target:
public Map<String, String> machineAttributes() { final Map<String, String> attributes = GSON.fromJson(labels.get(LABEL_MACHINE_ATTRIBUTES), mapTypeToken); if (attributes != null) { return attributes; } return new HashMap<>(); }
Source:
private ReplicatedTokenRequestSerializer() { throw new AssertionError(); }

Target:
private ReplicatedTokenRequestSerializer() { throw new AssertionError( "Should not be instantiated" ); }
Source:
private boolean isHostNetworkUnreacable(VDS vds) { VdsDynamic vdsDynamic = vds.getDynamicData(); return (vdsDynamic.getStatus() == VDSStatus.Down || vdsDynamic.getStatus() == VDSStatus.Reboot || vdsDynamic.getStatus() == VDSStatus.Kdumping || vdsDynamic.getStatus() == VDSStatus.NonResponsive || (vdsDynamic.getStatus() == VDSStatus.NonOperational || (vdsDynamic.getStatus() == VDSStatus.PendingApproval && vdsDynamic.getNonOperationalReason() == NonOperationalReason.NETWORK_UNREACHABLE)); }

Target:
private boolean isHostNetworkUnreacable(VDS vds) { VdsDynamic vdsDynamic = vds.getDynamicData(); return (vdsDynamic.getStatus() == VDSStatus.Down || vdsDynamic.getStatus() == VDSStatus.Reboot || vdsDynamic.getStatus() == VDSStatus.Kdumping || vdsDynamic.getStatus() == VDSStatus.NonResponsive || vdsDynamic.getStatus() == VDSStatus.PendingApproval || (vdsDynamic.getStatus() == VDSStatus.NonOperational && vdsDynamic.getNonOperationalReason() == NonOperationalReason.NETWORK_UNREACHABLE)); }
Source:
public void addComparisonToFixtureFor(Class<?>... fixturesFor) { for ( Class<?> fixture : fixturesFor ) { this.fixturesFor.add( fixture ); } }

Target:
public GeneratedSource addComparisonToFixtureFor(Class<?>... fixturesFor) { for ( Class<?> fixture : fixturesFor ) { this.fixturesFor.add( fixture ); } return this; }
Source:
private static double maximumPortOrLabelWidth(final NodeContext nodeContext, final PortSide portSide) { double maxResult = 0.0; for (PortContext portContext : nodeContext.portContexts.get(portSide)) { if (portContext.portLabelCell != null) { double labelWidth = portContext.portLabelCell.getMinimumWidth(); if (labelWidth > maxResult) { maxResult = labelWidth; } } if (portContext.port.getSize().x > maxResult) { maxResult = portContext.port.getSize().x; } } return maxResult; }

Target:
private static double maximumPortOrLabelWidth(final NodeContext nodeContext, final PortSide portSide) { double maxResult = 0.0; for (PortContext portContext : nodeContext.portContexts.get(portSide)) { if (portContext.portLabelCell != null) { double labelWidth = portContext.portLabelCell.getMinimumWidth(); maxResult = Math.max(maxResult, labelWidth); } maxResult = Math.max(maxResult, portContext.port.getSize().x); } return maxResult; }
Source:
public void visited(RevObject o) { lowestDepthVisited.put(o, Long.valueOf(walk.getTreeDepth())); }

Target:
public void visited(RevObject o) { lowestDepthVisited.put(o, Integer.valueOf(walk.getTreeDepth())); }
Source:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final StreamBatch that = (StreamBatch) o; if (!cursor.equals(that.cursor)) return false; if (events != null ? !events.equals(that.events) : that.events != null) return false; return metadata != null ? metadata.equals(that.metadata) : that.metadata == null; }

Target:
public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final StreamBatch that = (StreamBatch) o; if (!cursor.equals(that.cursor)) return false; if (!events.equals(that.events)) return false; return metadata != null ? metadata.equals(that.metadata) : that.metadata == null; }
Source:
public String getIdentifier() { Preconditions.checkState(args.size() == 1, "LambdaExpr has no or multiple arguments"); return args.get(0).toString(); }

Target:
public String getIdentifier() { Preconditions.checkState(args.size() < 2, "LambdaExpr has multiple arguments"); if (args.size() == 1) { return args.get(0).toString(); } return null; }
Source:
public void onSelectChange(final JQuerySelectPickerEvent event) { final String newValue = event.target.value; if (!newValue.equals(getValue())) { setPickerValue(newValue); presenter.refreshView(newValue); } }

Target:
public void onSelectChange(final JQuerySelectPickerEvent event) { final String newValue = event.target.value; if (!Objects.equals(newValue, getValue())) { setPickerValue(newValue); presenter.refreshView(newValue); } }
Source:
protected void prepareViewing() { drawRegistration.remove(); clickRegistration.remove(); if(markerRegisration != null) { markerRegisration.remove(); } }

Target:
protected void prepareViewing() { if (drawRegistration != null) { drawRegistration.remove(); drawRegistration = null; } if (clickRegistration != null) { clickRegistration.remove(); clickRegistration = null; } if (markerRegisration != null) { markerRegisration.remove(); markerRegisration = null; } }
Source:
private boolean isWatched(ZooKeeper zooKeeper, String zPath) throws KeeperException, InterruptedException { boolean watched = true; if (znodeExists.contains(zPath)) return watched; Matcher configMatcher = TABLE_SETTING_CONFIG_PATTERN.matcher(zPath); if (configMatcher.matches()) { Stat stat; try { stat = zooKeeper.exists(zPath, false); } catch (KeeperException.BadVersionException | KeeperException.NoNodeException e1) { throw new ConcurrentModificationException(); } if (stat != null) { watched = true; synchronized (znodeExists) { znodeExists.add(zPath); } } else { watched = false; } } return watched; }

Target:
private boolean isWatched(ZooKeeper zooKeeper, String zPath) throws KeeperException, InterruptedException { boolean watched = true; if (znodeExists.contains(zPath)) return watched; Matcher configMatcher = TABLE_SETTING_CONFIG_PATTERN.matcher(zPath); if (configMatcher.matches()) { Stat stat; try { stat = zooKeeper.exists(zPath, false); } catch (KeeperException.BadVersionException | KeeperException.NoNodeException e1) { throw e1; } if (stat != null) { watched = true; synchronized (znodeExists) { znodeExists.add(zPath); } } else { watched = false; } } return watched; }
Source:
private static boolean isWhitelisted(List<Identifier> ids) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < ids.size(); i++) { sb.append(ids.get(i).getValue()); if (i != ids.size() - 1) { sb.append("."); } } switch (sb.toString().toLowerCase(Locale.ROOT)) { case "queueable": case "database.batchable": case "installhandler": return true; default: break; } return false; }

Target:
private static boolean isWhitelisted(List<Identifier> ids) { String identifier = ids.stream().map(Identifier::getValue).collect(Collectors.joining(".")); switch (identifier.toLowerCase(Locale.ROOT)) { case "queueable": case "database.batchable": case "installhandler": return true; default: break; } return false; }
Source:
public void convertsToJsonWhenUrlAbsent() { final String success = "Living the dream!"; MatcherAssert.assertThat( new Statuses.StatusCreate(Status.State.SUCCESS) .withDescription(success) .withContext(Optional.of(CONTEXT)) .json().toString(), Matchers.equalTo("{\"state\":\"success\",\"description\":\"Living the dream!\",\"context\":\"jcabi/github/test\"}") ); }

Target:
public void convertsToJsonWhenUrlAbsent() { final String success = "Living the dream!"; MatcherAssert.assertThat( new Statuses.StatusCreate(Status.State.SUCCESS) .withDescription(success) .withContext(Optional.of(StatusesTest.CONTEXT)) .json().toString(), Matchers.equalTo( Json.createObjectBuilder() .add(StatusesTest.STATE_PROP, "success") .add(StatusesTest.DESCRIPTION_PROP, success) .add(StatusesTest.CONTEXT_PROP, StatusesTest.CONTEXT) .build().toString() ) ); }
Source:
public JdbiImmutables registerImmutable(Iterable<Class<?>> specs) { specs.iterator().forEachRemaining(this::registerImmutable); return this; }

Target:
public JdbiImmutables registerImmutable(Iterable<Class<?>> specs) { specs.forEach(this::registerImmutable); return this; }
Source:
public boolean validate() { validateListItems(getHost()); validateListItems(getAvailableStorageDomainTypeItems()); validateListItems(getAvailableStorageTypeItems()); getDescription().validateEntity(new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE), new SpecialAsciiI18NOrNoneValidation() }); getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() }); getWarningLowSpaceIndicator().validateEntity(new IValidation[]{ new NotEmptyValidation(), new IntegerValidation(0, StorageConstants.LOW_SPACE_THRESHOLD) }); int maxAllowedSpace = Integer.MAX_VALUE; if (!isNewStorage()) { maxAllowedSpace = getStorage().getTotalDiskSize() == 0 ? Integer.MAX_VALUE : getStorage().getTotalDiskSize(); } getCriticalSpaceActionBlocker().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, maxAllowedSpace) }); getWarningLowConfirmedSpaceIndicator().validateEntity(new IValidation[]{ new NotEmptyValidation(), new IntegerValidation(0, StorageConstants.LOW_SPACE_THRESHOLD) }); validateDiscardAfterDelete(); return getName().getIsValid() && getHost().getIsValid() && getIsValid() && getCurrentStorageItem().validate() && getDescription().getIsValid() && getComment().getIsValid() && getWarningLowSpaceIndicator().getIsValid() && getCriticalSpaceActionBlocker().getIsValid() && getWarningLowConfirmedSpaceIndicator().getIsValid() && getDiscardAfterDelete().getIsValid() && getBackup().getIsValid(); }

Target:
public boolean validate() { validateListItems(getHost()); validateListItems(getAvailableStorageDomainTypeItems()); validateListItems(getAvailableStorageTypeItems()); getDescription().validateEntity(new IValidation[] { new LengthValidation(BusinessEntitiesDefinitions.GENERAL_MAX_SIZE), new SpecialAsciiI18NOrNoneValidation() }); getComment().validateEntity(new IValidation[] { new SpecialAsciiI18NOrNoneValidation() }); getWarningLowSpaceIndicator().validateEntity(new IValidation[]{ new NotEmptyValidation(), new IntegerValidation(0, StorageConstants.LOW_SPACE_THRESHOLD) }); int maxAllowedSpace = Integer.MAX_VALUE; if (!isNewStorage() && getStorage().getTotalDiskSize() != 0 ) { maxAllowedSpace = getStorage().getTotalDiskSize(); } getCriticalSpaceActionBlocker().validateEntity(new IValidation[] { new NotEmptyValidation(), new IntegerValidation(0, maxAllowedSpace) }); getWarningLowConfirmedSpaceIndicator().validateEntity(new IValidation[]{ new NotEmptyValidation(), new IntegerValidation(0, StorageConstants.LOW_SPACE_THRESHOLD) }); validateDiscardAfterDelete(); return getName().getIsValid() && getHost().getIsValid() && getIsValid() && getCurrentStorageItem().validate() && getDescription().getIsValid() && getComment().getIsValid() && getWarningLowSpaceIndicator().getIsValid() && getCriticalSpaceActionBlocker().getIsValid() && getWarningLowConfirmedSpaceIndicator().getIsValid() && getDiscardAfterDelete().getIsValid() && getBackup().getIsValid(); }
Source:
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == RECORD_AUDIO_PERMISSION_CODE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { speechToTextManager.startSpeechToTextFlow(); } else { Toast.makeText(getContext(), R.string.speech_microphone_permission_denied, Toast.LENGTH_LONG).show(); } } }

Target:
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == RECORD_AUDIO_PERMISSION_CODE) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { speechToTextManager.startSpeechToTextFlow(); } else { UIUtils.showLongToast(R.string.speech_to_text_permission_denied, getContext()); } } }
Source:
public String getUsage() { return "robot explain --input <file> --reasoner <reasoner> --axiom <axiom> <output>"; }

Target:
public String getUsage() { return "robot explain --input <file> --axiom <axiom> --explanation <output>"; }
Source:
public AbstractRegistry(URL url) { setUrl(url); syncSaveFile = url.getParameter(Constants.REGISTRY_FILESAVE_SYNC_KEY, false); String defaultFile = System.getProperty("user.home") + "/.dubbo/dubbo-registry-" + url.getParameter(Constants.APPLICATION_KEY) + "-" + url.getAddress() + ".cache"; String filename = url.getParameter(Constants.FILE_KEY, defaultFile); File file = null; if (ConfigUtils.isNotEmpty(filename)) { file = new File(filename); if (!file.exists() && file.getParentFile() != null && !file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new IllegalArgumentException( String.format( "Invalid registry store file %s, cause: Failed to create directory %s!", file, file.getParentFile() ) ); } } } this.file = file; loadProperties(); notify(url.getBackupUrls()); }

Target:
public AbstractRegistry(URL url) { setUrl(url); syncSaveFile = url.getParameter(Constants.REGISTRY_FILESAVE_SYNC_KEY, false); String filename = getFileKey(url); File file = null; if (ConfigUtils.isNotEmpty(filename)) { file = new File(filename); if (!file.exists() && file.getParentFile() != null && !file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new IllegalArgumentException("Invalid registry cache file " + file + ", cause: Failed to create directory " + file.getParentFile() + "!"); } } } this.file = file; loadProperties(); notify(url.getBackupUrls()); }
Source:
public void shouldAlwaysGenerateTheSameValueForTheSameSeed() { IntegerRangeRandomizer bntegerRangeRandomizer = aNewIntegerRangeRandomizer(min, max, SEED); Integer i = bntegerRangeRandomizer.getRandomValue(); then(i).isEqualTo(7); }

Target:
public void shouldAlwaysGenerateTheSameValueForTheSameSeed() { IntegerRangeRandomizer integerRangeRandomizer = aNewIntegerRangeRandomizer(min, max, SEED); Integer i = integerRangeRandomizer.getRandomValue(); then(i).isEqualTo(7); }
Source:
public Centre[] getCentres(String branchId, String offset, String limit) throws MambuApiException { String urlString = new String(mambuAPIService.createUrl(APIData.CENTRES)); String jsonResponse; ParamsMap params = new ParamsMap(); params.addParam(APIData.BRANCH_ID, branchId); params.put(OFFSET, offset); params.put(LIMIT, limit); jsonResponse = mambuAPIService.executeRequest(urlString, params, Method.GET); Centre centres[] = (Centre[]) GsonUtils.createGson().fromJson(jsonResponse, Centre[].class); return centres; }

Target:
public Centre[] getCentres(String branchId, String offset, String limit) throws MambuApiException { String urlString = new String(mambuAPIService.createUrl(APIData.CENTRES)); ParamsMap params = new ParamsMap(); params.addParam(APIData.BRANCH_ID, branchId); params.put(OFFSET, offset); params.put(LIMIT, limit); String jsonResponse = mambuAPIService.executeRequest(urlString, params, Method.GET); Centre centres[] = (Centre[]) GsonUtils.createGson().fromJson(jsonResponse, Centre[].class); return centres; }
Source:
protected List<Map<String, Object>> getEntitiesFromResultSet( ResultSet resultSet) throws SQLException { ArrayList<Map<String, Object>> entities = new ArrayList<>(); while (resultSet.next()) { entities.add(getEntityFromResultSet(resultSet)); } return entities; }

Target:
protected static List<Map<String, Object>> getEntitiesFromResultSet( ResultSet resultSet) throws SQLException { ArrayList<Map<String, Object>> entities = new ArrayList<>(); while (resultSet.next()) { entities.add(getEntityFromResultSet(resultSet)); } return entities; }
Source:
public List<SongMetadata> list() { String[] proj = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.TITLE}; Cursor cursor = this.activity.getContentResolver().query( MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, null, null, null); List<SongMetadata> metadataList = new ArrayList<SongMetadata>(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { SongMetadata metadata = new SongMetadata(); metadata.setId(cursor.getLong(0)); metadata.setAlbum(cursor.getString(1)); metadata.setArtist(cursor.getString(2)); metadata.setTitle(cursor.getString(3)); metadataList.add(metadata); cursor.moveToNext(); } cursor.close(); return metadataList; }

Target:
public List<SongMetadata> list() { String[] proj = {ID, ALBUM, ARTIST, TITLE}; Cursor cursor = this.activity.getContentResolver().query(EC_URI, proj, null, null, null); List<SongMetadata> metadataList = new ArrayList<SongMetadata>(); cursor.moveToFirst(); while (!cursor.isAfterLast()) { SongMetadata metadata = new SongMetadata(); metadata.setId(cursor.getLong(cursor.getColumnIndex(ID))); metadata.setAlbum(cursor.getString(cursor.getColumnIndex(ALBUM))); metadata.setArtist(cursor.getString(cursor.getColumnIndex(ARTIST))); metadata.setTitle(cursor.getString(cursor.getColumnIndex(TITLE))); metadataList.add(metadata); cursor.moveToNext(); } cursor.close(); return metadataList; }
Source:
public Sequence<T> run(final Query<T> query, final Map<String, Object> context) { final List<Sequence<T>> listOfSequences = Lists.newArrayList(); final Sequence<T> returningSeq = baseRunner.run(query, context); listOfSequences.add(returningSeq); return new YieldingSequenceBase<T>() { @Override public <OutType> Yielder<OutType> toYielder( OutType initValue, YieldingAccumulator<OutType, T> accumulator ) { final List<SegmentDescriptor> missingSegments = getMissingSegments(context); if (missingSegments.isEmpty()) { return returningSeq.toYielder(initValue, accumulator); } for (int i = 0; i < config.numTries(); i++) { log.info("[%,d] missing segments found. Retry attempt [%,d]", missingSegments.size(), i); context.put(MISSING_SEGMENTS_KEY, Lists.newArrayList()); final Query<T> retryQuery = query.withQuerySegmentSpec( new MultipleSpecificSegmentSpec( missingSegments ) ); Sequence<T> retrySequence = baseRunner.run(retryQuery, context); listOfSequences.add(retrySequence); if (getMissingSegments(context).isEmpty()) { break; } } final List<SegmentDescriptor> finalMissingSegs = getMissingSegments(context); if (!config.returnPartialResults() && !finalMissingSegs.isEmpty()) { throw new SegmentMissingException("No results found for segments[%s]", finalMissingSegs); } return toolChest.mergeSequencesUnordered(Sequences.simple(listOfSequences)).toYielder(initValue, accumulator); } }; }

Target:
public Sequence<T> run(final Query<T> query, final Map<String, Object> context) { final List<Sequence<T>> listOfSequences = Lists.newArrayList(); listOfSequences.add(baseRunner.run(query, context)); return new YieldingSequenceBase<T>() { @Override public <OutType> Yielder<OutType> toYielder( OutType initValue, YieldingAccumulator<OutType, T> accumulator ) { final List<SegmentDescriptor> missingSegments = getMissingSegments(context); if (!missingSegments.isEmpty()) { for (int i = 0; i < config.numTries(); i++) { log.info("[%,d] missing segments found. Retry attempt [%,d]", missingSegments.size(), i); context.put(MISSING_SEGMENTS_KEY, Lists.newArrayList()); final Query<T> retryQuery = query.withQuerySegmentSpec( new MultipleSpecificSegmentSpec( missingSegments ) ); Sequence<T> retrySequence = baseRunner.run(retryQuery, context); listOfSequences.add(retrySequence); if (getMissingSegments(context).isEmpty()) { break; } } final List<SegmentDescriptor> finalMissingSegs = getMissingSegments(context); if (!finalMissingSegs.isEmpty()) { throw new SegmentMissingException("No results found for segments[%s]", finalMissingSegs); } } return toolChest.mergeSequencesUnordered(Sequences.simple(listOfSequences)).toYielder(initValue, accumulator); } }; }
Source:
public synchronized boolean setWifiEnabled(String packageName, boolean enable) throws RemoteException { enforceChangePermission(); Slog.d(TAG, "setWifiEnabled: " + enable + " pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()); mLog.trace("setWifiEnabled uid=%").c(Binder.getCallingUid()).flush(); long ident = Binder.clearCallingIdentity(); try { if (! mSettingsStore.handleWifiToggled(enable)) { return true; } } finally { Binder.restoreCallingIdentity(ident); } if (mPermissionReviewRequired) { final int wiFiEnabledState = getWifiEnabledState(); if (enable) { if (wiFiEnabledState == WifiManager.WIFI_STATE_DISABLING || wiFiEnabledState == WifiManager.WIFI_STATE_DISABLED) { if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(), WifiManager.ACTION_REQUEST_ENABLE)) { return true; } } } else if (wiFiEnabledState == WifiManager.WIFI_STATE_ENABLING || wiFiEnabledState == WifiManager.WIFI_STATE_ENABLED) { if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(), WifiManager.ACTION_REQUEST_DISABLE)) { return true; } } } mWifiController.sendMessage(CMD_WIFI_TOGGLED); return true; }

Target:
public synchronized boolean setWifiEnabled(String packageName, boolean enable) throws RemoteException { enforceChangePermission(); Slog.d(TAG, "setWifiEnabled: " + enable + " pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid()); mLog.trace("setWifiEnabled uid=% enable=%") .c(Binder.getCallingUid()) .c(enable ? "true" : "false").flush(); long ident = Binder.clearCallingIdentity(); try { if (! mSettingsStore.handleWifiToggled(enable)) { return true; } } finally { Binder.restoreCallingIdentity(ident); } if (mPermissionReviewRequired) { final int wiFiEnabledState = getWifiEnabledState(); if (enable) { if (wiFiEnabledState == WifiManager.WIFI_STATE_DISABLING || wiFiEnabledState == WifiManager.WIFI_STATE_DISABLED) { if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(), WifiManager.ACTION_REQUEST_ENABLE)) { return true; } } } else if (wiFiEnabledState == WifiManager.WIFI_STATE_ENABLING || wiFiEnabledState == WifiManager.WIFI_STATE_ENABLED) { if (startConsentUiIfNeeded(packageName, Binder.getCallingUid(), WifiManager.ACTION_REQUEST_DISABLE)) { return true; } } } mWifiController.sendMessage(CMD_WIFI_TOGGLED); return true; }
Source:
public void setup(ManagementClient managementClient, String containerId) throws Exception { ModelNode node = new ModelNode(); node.get(ADDRESS).set(PathAddress.parseCLIStyleAddress("/subsystem=ejb3").toModelNode()); node.get(OP).set(WRITE_ATTRIBUTE_OPERATION); node.get(NAME).set(EJB3SubsystemModel.ALLOW_EJB_NAME_REGEX); node.get(VALUE).set(true); managementClient.getControllerClient().execute(node); }

Target:
public void setup(ManagementClient managementClient, String containerId) throws Exception { ModelNode node = new ModelNode(); node.get(ADDRESS).set(PathAddress.parseCLIStyleAddress("/subsystem=ejb3").toModelNode()); node.get(OP).set(WRITE_ATTRIBUTE_OPERATION); node.get(NAME).set(EJB3SubsystemModel.ALLOW_EJB_NAME_REGEX); node.get(VALUE).set(true); final ModelNode result = managementClient.getControllerClient().execute(node); if (!Operations.isSuccessfulOutcome(result)) { Assert.fail(Operations.getFailureDescription(result).asString()); } }
Source:
public void clientCallback(ClientResponse response) throws Exception { m_responses[m_index] = new ClientResponseWithPartitionKey(m_partitionKey, response); m_partitionCounter.decrementAndGet(); if (m_partitionCounter.get() == 0) { m_cb.clientCallback(m_responses); } }

Target:
public void clientCallback(ClientResponse response) throws Exception { m_responses[m_index] = new ClientResponseWithPartitionKey(m_partitionKey, response); if (m_partitionCounter.decrementAndGet() == 0) { m_cb.clientCallback(m_responses); } }
Source:
public static void deleteRecursively(File file) throws IOException { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { deleteRecursively(child); } } } for (int n = 0; n < 10; n++) { try { Files.delete(file.toPath()); } catch (DirectoryNotEmptyException dnee) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (AccessDeniedException ade) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); continue; } catch (NoSuchFileException nse) { if (n == 0) throw nse; return; } return; } throw new RuntimeException("Could not delete: " + file.toPath()); }

Target:
public static void deleteRecursively(File file) throws IOException { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { deleteRecursively(child); } } } delete(file); }
Source:
public AnsibleReturnCode runCommand(AnsibleCommandBuilder command, int timeout) throws IOException, InterruptedException { log.trace("Enter AnsibleExecutor::runCommand"); if (Files.notExists(Paths.get(command.playbook()))) { log.warn("Playbook '{}' does not exists. Ensure ovirt-ansible-roles is installed.", command.playbook()); return AnsibleReturnCode.ERROR; } Path inventoryFile = null; AnsibleReturnCode returnCode = AnsibleReturnCode.UNEXPECTED_ERROR; try { inventoryFile = createInventoryFile(command); log.info("Executing Ansible command: {}", command); List<String> ansibleCommand = command.build(); File logFile = command.logFile(); ProcessBuilder ansibleProcessBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(logFile) .command(ansibleCommand) .directory(command.playbookDir().toFile()); ansibleProcessBuilder.environment() .put("ANSIBLE_CONFIG", Paths.get(command.playbookDir().toString(), "ansible.cfg").toString()); Process ansibleProcess = ansibleProcessBuilder.start(); ansibleProcess.waitFor(timeout, TimeUnit.MINUTES); returnCode = AnsibleReturnCode.values()[ansibleProcess.exitValue()]; ansibleProcess.destroy(); } finally { log.info("Ansible playbook command has exited with value: {}", returnCode); removeFile(inventoryFile); } log.trace("Exit AnsibleExecutor::runCommand"); return returnCode; }

Target:
public AnsibleReturnCode runCommand(AnsibleCommandBuilder command, int timeout) throws IOException, InterruptedException { log.trace("Enter AnsibleExecutor::runCommand"); if (Files.notExists(Paths.get(command.playbook()))) { log.warn( "Playbook '{}' does not exist, please ensure that ovirt-ansible-roles package is properly installed.", command.playbook() ); return AnsibleReturnCode.ERROR; } Path inventoryFile = null; AnsibleReturnCode returnCode = AnsibleReturnCode.UNEXPECTED_ERROR; try { inventoryFile = createInventoryFile(command); log.info("Executing Ansible command: {}", command); List<String> ansibleCommand = command.build(); File logFile = command.logFile(); ProcessBuilder ansibleProcessBuilder = new ProcessBuilder() .redirectErrorStream(true) .redirectOutput(logFile) .command(ansibleCommand) .directory(command.playbookDir().toFile()); ansibleProcessBuilder.environment() .put("ANSIBLE_CONFIG", Paths.get(command.playbookDir().toString(), "ansible.cfg").toString()); Process ansibleProcess = ansibleProcessBuilder.start(); ansibleProcess.waitFor(timeout, TimeUnit.MINUTES); returnCode = AnsibleReturnCode.values()[ansibleProcess.exitValue()]; ansibleProcess.destroy(); } finally { log.info("Ansible playbook command has exited with value: {}", returnCode); removeFile(inventoryFile); } log.trace("Exit AnsibleExecutor::runCommand"); return returnCode; }
Source:
public List<TurboUser> getUsersOfRepo(String repoId) { Optional<Model> model = getModelById(repoId); if (model.isPresent()) { return model.get().getUsers(); } else { return new ArrayList<>(); } }

Target:
public List<TurboUser> getUsersOfRepo(String repoId) { Optional<Model> model = getModelById(repoId); return model.isPresent() ? model.get().getUsers() : new ArrayList<>(); }
Source:
private AdvancedCache<?, ?> lookupIndexedCache(RestRequest request, NettyRestResponse.Builder builder) { String cacheName = request.variables().get("cacheName"); AdvancedCache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, request); if (cache == null) { builder.status(HttpResponseStatus.NOT_FOUND.code()); return null; } Configuration cacheConfiguration = cache.getCacheConfiguration(); if (!cacheConfiguration.indexing().isEnabled()) { builder.entity("cache is not indexed").status(BAD_REQUEST.code()).build(); } return cache; }

Target:
private AdvancedCache<?, ?> lookupIndexedCache(RestRequest request, NettyRestResponse.Builder builder) { String cacheName = request.variables().get("cacheName"); AdvancedCache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, request); if (cache == null) { builder.status(HttpResponseStatus.NOT_FOUND.code()); return null; } Configuration cacheConfiguration = cache.getCacheConfiguration(); if (!cacheConfiguration.indexing().enabled()) { builder.entity("cache is not indexed").status(BAD_REQUEST.code()).build(); } return cache; }
Source:
private static Date timeToUTC(Date date) { SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT")); SimpleDateFormat dateFormatLocal = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); try { date = dateFormatLocal.parse(dateFormatGmt.format(date)); } catch (ParseException e) { DAO.severe(e); date = new Date(); } return date; }

Target:
private static Date timeToUTC(Date date) { Date dateUtc; SimpleDateFormat dateFormatGmt = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); dateFormatGmt.setTimeZone(TimeZone.getTimeZone("GMT")); SimpleDateFormat dateFormatLocal = new SimpleDateFormat("yyyy-MMM-dd HH:mm:ss"); try { dateUtc = dateFormatLocal.parse(dateFormatGmt.format(date)); } catch (ParseException e) { DAO.severe(e); dateUtc = new Date(); } return dateUtc; }
Source:
public Builder schemaVersion(long schemaVersion, RealmMigration migration) { if (schemaVersion < 0) { throw new IllegalArgumentException("Realm schema version numbers must be 0 (zero) or higher. Yours was: " + schemaVersion); } if (migration == null) { throw new IllegalArgumentException("Migration cannot be null"); } this.schemaVersion = schemaVersion; this.migration = migration; return this; }

Target:
public Builder schemaVersion(long schemaVersion, RealmMigration migration) { schemaVersion(schemaVersion); if (migration == null) { throw new IllegalArgumentException("Migration cannot be null"); } this.migration = migration; return this; }