auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeQueryCommand() { if (getParameters().getGlusterServerId() == null) { getQueryReturnValue().setReturnValue(getGlusterHookDao().getGlusterHookcontent(getParameters().getGlusterHookId())); } else { GlusterHookEntity hook = getGlusterHookDao().getById(getParameters().getGlusterHookId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterHookContent, new GlusterHookVDSParameters(getParameters().getGlusterServerId(), hook.getGlusterCommand(), hook.getStage(), hook.getName())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } }

Target:
protected void executeQueryCommand() { if (getParameters().getGlusterServerId() == null) { getQueryReturnValue().setReturnValue(getGlusterHookDao().getGlusterHookContent(getParameters().getGlusterHookId())); } else { GlusterHookEntity hook = getGlusterHookDao().getById(getParameters().getGlusterHookId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterHookContent, new GlusterHookVDSParameters(getParameters().getGlusterServerId(), hook.getGlusterCommand(), hook.getStage(), hook.getName())); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } }
Source:
public void themeDefiningClassAndName_throwsException() throws ClassNotFoundException { Mockito.when(classFinder.getSubTypesOf(AppShellConfigurator.class)) .thenReturn(Collections.singleton(FaultyThemeAnnotation.class)); Mockito.when(classFinder.loadClass(FakeLumo.class.getName())) .thenReturn((Class) FakeLumo.class); IllegalStateException exception = Assert .assertThrows(IllegalStateException.class, () -> new FrontendDependencies(classFinder, false)); Assert.assertTrue("Unexpected message: " + exception.getMessage(), exception.getMessage().startsWith( "Theme name and theme class can not both be specified.")); }

Target:
public void themeDefiningClassAndName_throwsException() throws ClassNotFoundException { Mockito.when(classFinder.getSubTypesOf(AppShellConfigurator.class)) .thenReturn(Collections.singleton(FaultyThemeAnnotation.class)); Mockito.when(classFinder.loadClass(FakeLumo.class.getName())) .thenReturn((Class) FakeLumo.class); IllegalStateException exception = Assert .assertThrows(IllegalStateException.class, () -> new FrontendDependencies(classFinder, false)); Assert.assertEquals("Unexpected message for the thrown exception", "Theme name and theme class can not both be specified. " + "Theme name uses Lumo and can not be used in combination with custom theme class.", exception.getMessage()); }
Source:
public ComboBoxModel doFillPatternItems(@QueryParameter("serverName") @RelativePath("..") final String serverName) { ComboBoxModel cb = new ComboBoxModel(); if (serverName != null && !serverName.isEmpty()) { if (ANY_SERVER.equals(serverName)) { for (GerritServer server : PluginImpl.getInstance().getServers()) { cb.addAll(server.getGerritProjects()); } } else { cb.addAll(PluginImpl.getInstance().getServer(serverName).getGerritProjects()); } } return cb; }

Target:
public ComboBoxModel doFillPatternItems(@QueryParameter("serverName") @RelativePath("..") final String serverName) { Collection<String> projects = new HashSet<String>(); if (serverName != null && !serverName.isEmpty()) { if (ANY_SERVER.equals(serverName)) { for (GerritServer server : PluginImpl.getInstance().getServers()) { projects.addAll(server.getGerritProjects()); } } else { projects.addAll(PluginImpl.getInstance().getServer(serverName).getGerritProjects()); } } return new ComboBoxModel(projects); }
Source:
public PhysicalSlot reserveFreeSlot(AllocationID allocationId, ResourceProfile requiredSlotProfile) { final AllocatedSlot allocatedSlot = slotPool.reserveFreeSlot(allocationId); Preconditions.checkState(allocatedSlot.getResourceProfile().isMatching(requiredSlotProfile), ""); ResourceProfile previouslyMatchedResourceProfile = Preconditions.checkNotNull(slotToRequirementProfileMappings.get(allocationId)); updateSlotToRequirementProfileMapping(allocationId, requiredSlotProfile); adjustRequirements(previouslyMatchedResourceProfile, requiredSlotProfile); return allocatedSlot; }

Target:
public PhysicalSlot reserveFreeSlot(AllocationID allocationId, ResourceProfile requiredSlotProfile) { final AllocatedSlot allocatedSlot = slotPool.reserveFreeSlot(allocationId); Preconditions.checkState( allocatedSlot.getResourceProfile().isMatching(requiredSlotProfile), "Slot cannot fulfill the given requirement. SlotProfile={} Requirement={}", allocationId, allocatedSlot.getResourceProfile(), requiredSlotProfile); ResourceProfile previouslyMatchedResourceProfile = Preconditions.checkNotNull(slotToRequirementProfileMappings.get(allocationId)); if (!previouslyMatchedResourceProfile.equals(requiredSlotProfile)) { LOG.debug( "Adjusting requirements because a slot was reserved for a different requirement than initially assumed. Slot={} assumedRequirement={} actualRequirement={}", allocationId, previouslyMatchedResourceProfile, requiredSlotProfile); updateSlotToRequirementProfileMapping(allocationId, requiredSlotProfile); adjustRequirements(previouslyMatchedResourceProfile, requiredSlotProfile); } return allocatedSlot; }
Source:
public void deactivateOSPF() throws CapabilityException { OSPFService service = new OSPFService(); service.setEnabledState(EnabledState.ENABLED); IAction action = createActionAndCheckParams(OSPFActionSet.OSPF_DEACTIVATE, service); queueAction(action); }

Target:
public void deactivateOSPF() throws CapabilityException { OSPFService service = new OSPFService(); service.setEnabledState(EnabledState.DISABLED); IAction action = createActionAndCheckParams(OSPFActionSet.OSPF_DEACTIVATE, service); queueAction(action); }
Source:
void updateV2VJobInfos(List<V2VJobInfo> v2vJobInfos) { for (V2VJobInfo existingJobInfo : vmIdToV2VJob.values()) { if (existingJobInfo.monitor() && !v2vJobInfos.contains(existingJobInfo)) { existingJobInfo.setStatus(JobStatus.ERROR); } } if (v2vJobInfos.isEmpty()) { return; } synchronized (vmIdToV2VJob) { for (V2VJobInfo jobInfo : v2vJobInfos) { if (vmIdToV2VJob.containsKey(jobInfo.getId())) { vmIdToV2VJob.put(jobInfo.getId(), jobInfo); } } } }

Target:
void updateV2VJobInfos(List<V2VJobInfo> v2vJobInfos) { for (V2VJobInfo existingJobInfo : vmIdToV2VJob.values()) { if (existingJobInfo.isMonitored() && !v2vJobInfos.contains(existingJobInfo)) { existingJobInfo.setStatus(JobStatus.NOT_EXIST); } } if (v2vJobInfos.isEmpty()) { return; } synchronized (vmIdToV2VJob) { for (V2VJobInfo jobInfo : v2vJobInfos) { if (vmIdToV2VJob.containsKey(jobInfo.getId())) { vmIdToV2VJob.put(jobInfo.getId(), jobInfo); } } } }
Source:
public Set<PlanNode> getSources() { return sources; }

Target:
public LinkedHashSet<PlanNode> getSources() { return sources; }
Source:
public final void canGetStatus() throws IOException { final String name = UUID.randomUUID().toString(); final String path = testPathPrefix + name; final byte[] content = RandomUtils.nextBytes(5242880); ServerSideMultipartUpload upload = multipart.initiateUpload(path); MantaMultipartStatus newStatus = multipart.getStatus(upload); Assert.assertEquals(newStatus, MantaMultipartStatus.CREATED, "Created status wasn't set. Actual status: " + newStatus); MantaMultipartUploadPart part = multipart.uploadPart(upload, 1, content); multipart.complete(upload, Stream.of(part)); MantaMultipartStatus completeStatus = multipart.getStatus(upload); if (completeStatus.equals(MantaMultipartStatus.COMMITTING)) { MantaMultipartStatus lastStatus = completeStatus; for (int i = 2; i <= 15 ; i++) { try { Thread.sleep((long)Math.pow(2, i)); if (mantaClient.existsAndIsAccessible(path)) { lastStatus = null; break; } lastStatus = multipart.getStatus(upload); } catch (InterruptedException e) { return; } } if (lastStatus != MantaMultipartStatus.COMPLETED) { Assert.fail("MPU " + upload + "did not complete after multiple status checks. Last status: " + lastStatus); } } else if (completeStatus.equals(MantaMultipartStatus.COMPLETED)) { } else { Assert.fail("MPU " + upload + "in invalid status after complete invocation. Actual status: " + completeStatus); } }

Target:
public final void canGetStatus() throws IOException { final String name = UUID.randomUUID().toString(); final String path = testPathPrefix + name; final byte[] content1 = RandomUtils.nextBytes(5242880); final byte[] content2 = RandomUtils.nextBytes(1242880); ServerSideMultipartUpload upload = multipart.initiateUpload(path); MantaMultipartStatus newStatus = multipart.getStatus(upload); Assert.assertEquals(newStatus, MantaMultipartStatus.CREATED, "Created status wasn't set. Actual status: " + newStatus); MantaMultipartUploadPart part1 = multipart.uploadPart(upload, 1, content1); MantaMultipartUploadPart part2 = multipart.uploadPart(upload, 2, content2); multipart.complete(upload, Stream.of(part1, part2)); MantaMultipartStatus completeStatus = multipart.getStatus(upload); Assert.assertNotNull(completeStatus, "Status should never be null"); switch (completeStatus) { case COMMITTING: { MantaMultipartStatus lastStatus = completeStatus; for (int i = 2; i <= 15 ; i++) { try { Thread.sleep((long)Math.pow(2, i)); lastStatus = multipart.getStatus(upload); } catch (InterruptedException e) { return; } } if (lastStatus != MantaMultipartStatus.COMPLETED) { final String msg = String.format("MPU %s did not complete after " + "multiple status checks. Last status: %s", upload, lastStatus); Assert.fail(msg); } break; } case COMPLETED: { break; } default: { final String msg = String.format("MPU %s returned an unexpected status: %s", upload, completeStatus); Assert.fail(msg); } } }
Source:
private Map<String, DbParameterAccessor> readIntoParams( String objName, String query) throws SQLException { String[] nameParts = objName.toUpperCase().split("\\."); String schemaName = nameParts.length == 2 ? nameParts[0] : getConnection().getSchema(); String objectName = nameParts.length == 2 ? nameParts[1] : nameParts[0]; try (PreparedStatement dc = getConnection().prepareStatement(query)) { if (objectName.trim().startsWith("\"") && objectName.trim().endsWith("\"")) { objectName = objectName.replaceFirst("\"", ""); int i = objectName.lastIndexOf("\""); objectName = objName.substring(0, i) + objName.substring(i + 1); } dc.setString(1, objectName); dc.setString(2, schemaName); ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; while (rs.next()) { String columnName = rs.getString("PARAMETER_NAME"); String dataType = rs.getString("TYPE_NAME"); Direction direction = null; switch (rs.getString("PARAMETER_MODE")) { case "IN": direction = Direction.INPUT; break; case "INOUT": direction = Direction.INPUT_OUTPUT; break; case "OUT": direction = Direction.OUTPUT; break; case "RETURN_VALUE": direction = Direction.RETURN_VALUE; break; } DbParameterAccessor dbp = createDbParameterAccessor( columnName, direction, typeMapper.getJDBCSQLTypeForDBType(dataType), getJavaClass(dataType), position++ - 1); allParams.put(NameNormaliser.normaliseName(columnName), dbp); } rs.close(); return allParams; } }

Target:
private Map<String, DbParameterAccessor> readIntoParams(String objName, String query) throws SQLException { String[] nameParts = objName.toUpperCase().split("\\."); String schemaName = nameParts.length == 2 ? nameParts[0] : getConnection().getSchema(); String objectName = nameParts.length == 2 ? nameParts[1] : nameParts[0]; try (PreparedStatement dc = getConnection().prepareStatement(query)) { if (objectName.trim().startsWith("\"") && objectName.trim().endsWith("\"")) { objectName = objectName.replaceFirst("\"", ""); int i = objectName.lastIndexOf("\""); objectName = objName.substring(0, i) + objName.substring(i + 1); } dc.setString(1, objectName); dc.setString(2, schemaName); ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; while (rs.next()) { String columnName = rs.getString("PARAMETER_NAME"); String dataType = rs.getString("TYPE_NAME"); DbParameterAccessor dbp = createDbParameterAccessor( columnName, Direction.valueOf(rs.getString("STATEMENT_PARAMETER_MODE")), typeMapper.getJDBCSQLTypeForDBType(dataType), getJavaClass(dataType), position++ - 1); allParams.put(NameNormaliser.normaliseName(columnName), dbp); } rs.close(); return allParams; } }
Source:
public boolean isEngineRunning() { LOGGER.info("isEngineRunning Called"); try { if (restClient == null || !restClient.ping(RequestOptions.DEFAULT)) { LOGGER.info("isEngineRunning: false"); return false; } ClusterHealthStatus healthStatus = restClient.cluster() .health(new ClusterHealthRequest(), RequestOptions.DEFAULT) .getStatus(); LOGGER.info("isEngineRunning Status: " + healthStatus); return ClusterHealthStatus.GREEN.equals(healthStatus); } catch (Exception e) { LOGGER.info("isEngineRunning: false"); return false; } }

Target:
public boolean isEngineRunning() { try { if (restClient == null || !restClient.ping(RequestOptions.DEFAULT)) { return false; } ClusterHealthStatus healthStatus = restClient.cluster() .health(new ClusterHealthRequest(), RequestOptions.DEFAULT) .getStatus(); return ClusterHealthStatus.GREEN.equals(healthStatus); } catch (Exception e) { return false; } }
Source:
public Dataset execConstructDataset(){ DatasetGraph graph = DatasetGraphFactory.createMem(); checkNotClosed() ; try { Iterator<Quad> it = execConstructQuads(); while (it.hasNext()) { Quad q = it.next(); graph.add(q); } } finally { this.close(); } return DatasetFactory.create(graph); }

Target:
public Dataset execConstructDataset(){ DatasetGraph graph = DatasetGraphFactory.createMem(); checkNotClosed() ; try { execConstructQuads().forEachRemaining(graph::add); } finally { this.close(); } return DatasetFactory.create(graph); }
Source:
public List<EmailInfo> apply(AccountResource rsrc) throws AuthException, OrmException { IdentifiedUser s = (IdentifiedUser) self.get(); if (s.getAccountId().get() != rsrc.getUser().getAccountId().get() && !self.get().getCapabilities().canAdministrateServer()) { throw new AuthException("not allowed to list email addresses"); } List<EmailInfo> emails = Lists.newArrayList(); ResultSet<AccountExternalId> ids = dbProvider.get().accountExternalIds() .byAccount(rsrc.getUser().getAccountId()); for (AccountExternalId extId : ids) { String email = extId.getEmailAddress(); if (email != null) { EmailInfo e = new EmailInfo(); e.email = email; e.setPreferred(email.equals(rsrc.getUser().getAccount() .getPreferredEmail())); emails.add(e); } } return emails; }

Target:
public List<EmailInfo> apply(AccountResource rsrc) throws AuthException, OrmException { if (!(self.get() instanceof IdentifiedUser)) { throw new AuthException("Authentication required"); } IdentifiedUser s = (IdentifiedUser) self.get(); if (s.getAccountId().get() != rsrc.getUser().getAccountId().get() && !s.getCapabilities().canAdministrateServer()) { throw new AuthException("not allowed to list email addresses"); } List<EmailInfo> emails = Lists.newArrayList(); ResultSet<AccountExternalId> ids = dbProvider.get().accountExternalIds() .byAccount(rsrc.getUser().getAccountId()); for (AccountExternalId extId : ids) { String email = extId.getEmailAddress(); if (email != null) { EmailInfo e = new EmailInfo(); e.email = email; e.setPreferred(email.equals(rsrc.getUser().getAccount() .getPreferredEmail())); emails.add(e); } } return emails; }
Source:
public Optional<String> scope() { return Optional.of("query-log"); }

Target:
public Optional<String> scope() { return Optional.of("query-logging"); }
Source:
public void processCacheEntryDestroyed(CacheEntryRemovedEvent event) { if (!event.isPre()) { emitSessionDestroyedEvent((String) event.getKey()); } }

Target:
public void processCacheEntryDestroyed(CacheEntryRemovedEvent event) { emitSessionDestroyedEvent((String) event.getKey()); }
Source:
private void updateNetworkInterfacesByTemplate(VmTemplate template) { AsyncQuery query = new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { if (returnValue == null) { return; } List<VmNetworkInterface> nics = (List<VmNetworkInterface>) ((VdcQueryReturnValue) returnValue).getReturnValue(); if (nics.size() == 0) { return; } initNetworkInterfaces(networkBehavior, nics); } }); Frontend.RunQuery(VdcQueryType.GetTemplateInterfacesByTemplateId, new IdQueryParameters(template.getId()), query); }

Target:
private void updateNetworkInterfacesByTemplate(VmTemplate template) { AsyncQuery query = new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { if (returnValue == null) { return; } List<VmNetworkInterface> nics = (List<VmNetworkInterface>) ((VdcQueryReturnValue) returnValue).getReturnValue(); initNetworkInterfaces(networkBehavior, nics); } }); Frontend.RunQuery(VdcQueryType.GetTemplateInterfacesByTemplateId, new IdQueryParameters(template.getId()), query); }
Source:
private static void update(final ProjectEvent event, final Path projectMirrorPath, final String projectApiBaseUrl, ExecutorService executor) { if (event.getType() == ProjectEvent.EventType.DELETED) { IoUtil.deleteRecursive(projectMirrorPath.resolve(event.getPath()).toFile()); } else if (event.getType() == ProjectEvent.EventType.UPDATED || event.getType() == ProjectEvent.EventType.CREATED) { executor.execute(new Runnable() { @Override public void run() { int index = projectApiBaseUrl.indexOf(event.getProject()); try { HttpURLConnection conn = (HttpURLConnection)new URL(projectApiBaseUrl.substring(0, index) .concat("/file") .concat(event.getProject()) .concat("/") .concat(event.getPath())).openConnection(); conn.setConnectTimeout(30 * 1000); conn.setRequestMethod("GET"); conn.addRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); final int responseCode = conn.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { java.io.File updatedFile = new java.io.File(projectMirrorPath.toString(), event.getPath()); byte[] buffer = new byte[8192]; try (InputStream input = conn.getInputStream(); OutputStream output = new FileOutputStream(updatedFile)) { int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } } } catch (IOException e) { LOG.error("Unable to update mirror of project for GWT code server.", event.getProject()); } } }); } }

Target:
private void update(final ProjectEvent event, final Path projectMirrorPath, final String projectApiBaseUrl, ExecutorService executor) { if (event.getType() == ProjectEvent.EventType.DELETED) { IoUtil.deleteRecursive(projectMirrorPath.resolve(event.getPath()).toFile()); } else if (event.getType() == ProjectEvent.EventType.UPDATED || event.getType() == ProjectEvent.EventType.CREATED) { executor.execute(new Runnable() { @Override public void run() { int index = projectApiBaseUrl.indexOf(event.getProject()); try { HttpURLConnection conn = (HttpURLConnection)new URL(projectApiBaseUrl.substring(0, index) .concat("/file") .concat(event.getProject()) .concat("/") .concat(event.getPath())).openConnection(); conn.setConnectTimeout(30 * 1000); conn.setRequestMethod("GET"); conn.addRequestProperty(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); final int responseCode = conn.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { java.io.File updatedFile = new java.io.File(projectMirrorPath.toString(), event.getPath()); byte[] buffer = new byte[8192]; try (InputStream input = conn.getInputStream(); OutputStream output = new FileOutputStream(updatedFile)) { int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } } } catch (IOException e) { LOG.error("Unable to update mirror of project for GWT code server.", event.getProject()); } } }); } }
Source:
public static NumberValue subtract( long a, long b ) { try { return Values.longValue( Math.subtractExact( a, b ) ); } catch ( ArithmeticException e ) { return Values.doubleValue( (double) a - (double) b ); } }

Target:
public static LongValue subtract( long a, long b ) { return longValue( Math.subtractExact( a, b ) ); }
Source:
public void execute() { final List<QuotaTariffVO> result = _responseBuilder.listQuotaTariffPlans(this); final List<QuotaTariffResponse> responses = new ArrayList<QuotaTariffResponse>(); for (final QuotaTariffVO resource : result) { s_logger.info("Result desc=" + resource.getDescription() + " date=" + resource.getEffectiveOn() + " val=" + resource.getCurrencyValue()); responses.add(_responseBuilder.createQuotaTariffResponse(resource)); } final ListResponse<QuotaTariffResponse> response = new ListResponse<QuotaTariffResponse>(); response.setResponses(responses); response.setResponseName(getCommandName()); setResponseObject(response); }

Target:
public void execute() { final List<QuotaTariffVO> result = _responseBuilder.listQuotaTariffPlans(this); final List<QuotaTariffResponse> responses = new ArrayList<QuotaTariffResponse>(); for (final QuotaTariffVO resource : result) { if (s_logger.isDebugEnabled()){ s_logger.debug("Result desc=" + resource.getDescription() + " date=" + resource.getEffectiveOn() + " val=" + resource.getCurrencyValue()); } responses.add(_responseBuilder.createQuotaTariffResponse(resource)); } final ListResponse<QuotaTariffResponse> response = new ListResponse<QuotaTariffResponse>(); response.setResponses(responses); response.setResponseName(getCommandName()); setResponseObject(response); }
Source:
public LiveData<List<Allergy>> getAllergies(RestApi restApi, String uuid) { MutableLiveData<List<Allergy>> allergyLiveData = new MutableLiveData<>(); allergyEntitiesOffline = allergyRoomDAO.getAllAllergiesByPatientID(patientID); if (NetworkUtils.isOnline()) { restApi.getAllergies(uuid).enqueue(new Callback<Results<Allergy>>() { @Override public void onResponse(@NotNull Call<Results<Allergy>> call, @NotNull Response<Results<Allergy>> response) { if (response.isSuccessful()) { allergyRoomDAO.deleteAllPatientAllergy(patientID); allergyList = response.body().getResults(); for (Allergy allergy : allergyList) { allergyRoomDAO.saveAllergy(AppDatabaseHelper.allergyToEntity(allergy, patientID)); } allergyLiveData.setValue(allergyList); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_allergies)); allergyLiveData.setValue(entityListToAllergy(allergyEntitiesOffline)); } } @Override public void onFailure(@NotNull Call<Results<Allergy>> call, @NotNull Throwable t) { ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_allergies)); allergyLiveData.setValue(entityListToAllergy(allergyEntitiesOffline)); } }); } else { allergyLiveData.setValue(entityListToAllergy(allergyEntitiesOffline)); } return allergyLiveData; }

Target:
public LiveData<List<Allergy>> getAllergies(RestApi restApi, String uuid) { MutableLiveData<List<Allergy>> allergyLiveData = new MutableLiveData<>(); allergyEntitiesOffline = allergyRoomDAO.getAllAllergiesByPatientID(patientID); allergyLiveData.setValue(allergyEntityListToAllergyList(allergyEntitiesOffline)); if (NetworkUtils.isOnline()) { restApi.getAllergies(uuid).enqueue(new Callback<Results<Allergy>>() { @Override public void onResponse(@NotNull Call<Results<Allergy>> call, @NotNull Response<Results<Allergy>> response) { if (response.isSuccessful()) { allergyRoomDAO.deleteAllPatientAllergy(patientID); allergyList = response.body().getResults(); for (Allergy allergy : allergyList) { allergyRoomDAO.saveAllergy(AppDatabaseHelper.allergyToEntity(allergy, patientID)); } allergyLiveData.setValue(allergyList); } else { ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_allergies)); } } @Override public void onFailure(@NotNull Call<Results<Allergy>> call, @NotNull Throwable t) { ToastUtil.error(OpenMRS.getInstance().getString(R.string.unable_to_fetch_allergies)); } }); } return allergyLiveData; }
Source:
private static void cacheUser(User user) { if (!map.containsKey(user.getUsername())) map.put(user.getUsername(), user); }

Target:
private static void cacheUser(User user) { map.putIfAbsent(user.getUsername(), user); }
Source:
public ImageUploadTinyMCEPage() { TinyMCESettings settings = new TinyMCESettings(TinyMCESettings.Theme.modern); settings.addToolbar(new Toolbar( "toolbar", "insertfile undo redo | styleselect | bold italic | image | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | imageupload")); settings.addPlugins("imageupload"); settings.addPlugins("image"); TextArea<String> textArea = new TextArea("ta", new Model<String>(TEXT)); textArea.add(new TinyMceBehavior(settings)); add(textArea); add(new ImageUploadPanel("uploadPanel")); }

Target:
public ImageUploadTinyMCEPage() { TinyMCESettings settings = new TinyMCESettings(TinyMCESettings.Theme.modern); settings.addToolbar(new Toolbar( "toolbar", "insertfile undo redo | styleselect | bold italic | image | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | imageupload")); settings.addPlugins("imageupload"); settings.addPlugins("image"); TextArea<String> textArea = new TextArea<>("ta", new Model<String>(TEXT)); textArea.add(new TinyMceBehavior(settings)); add(textArea); add(new ImageUploadPanel("uploadPanel")); }
Source:
protected List<MessageDescriptor> getWarnings(final ResponseEntity<?> authenticationResponse) { List<MessageDescriptor> messageDescriptors = new ArrayList<>(); var passwordExpirationDate = authenticationResponse.getHeaders().getFirstZonedDateTime("X-Cas-PasswordExpirationDate"); if (passwordExpirationDate != null) { var days = Duration.between(Instant.now(), passwordExpirationDate).toDays(); messageDescriptors.add(new PasswordExpiringWarningMessageDescriptor(null, days)); } List<String> warnings = authenticationResponse.getHeaders().get("X-Cas-Warning"); if (warnings != null) { warnings.stream() .map(warning -> new DefaultMessageDescriptor(warning, warning, null)) .forEach(messageDescriptors::add); } return messageDescriptors; }

Target:
protected List<MessageDescriptor> getWarnings(final ResponseEntity<?> authenticationResponse) { val messageDescriptors = new ArrayList<MessageDescriptor>(); val passwordExpirationDate = authenticationResponse.getHeaders().getFirstZonedDateTime("X-CAS-PasswordExpirationDate"); if (passwordExpirationDate != null) { val days = Duration.between(Instant.now(), passwordExpirationDate).toDays(); messageDescriptors.add(new PasswordExpiringWarningMessageDescriptor(null, days)); } val warnings = authenticationResponse.getHeaders().get("X-CAS-Warning"); if (warnings != null) { warnings.stream() .map(warning -> new DefaultMessageDescriptor(warning, warning, null)) .forEach(messageDescriptors::add); } return messageDescriptors; }
Source:
private void analyse(SensorContext sensorContext, InputFile inputFile, ProductDependentExecutor executor, List<TreeVisitor> visitors) { ActionParser<Tree> currentParser = this.parser; if (inputFile.filename().endsWith(".vue")) { currentParser = this.vueParser; } ScriptTree scriptTree; try { scriptTree = (ScriptTree) currentParser.parse(inputFile.contents()); scanFile(sensorContext, inputFile, executor, visitors, scriptTree); } catch (RecognitionException e) { checkInterrupted(e); LOG.error("Unable to parse file: " + inputFile.toString()); LOG.error(e.getMessage()); processRecognitionException(e, sensorContext, inputFile); } catch (Exception e) { checkInterrupted(e); processException(e, sensorContext, inputFile); LOG.error("Unable to analyse file: " + inputFile.toString(), e); } }

Target:
private void analyse(SensorContext sensorContext, InputFile inputFile, ProductDependentExecutor executor, List<TreeVisitor> visitors) { ActionParser<Tree> currentParser = this.parser; if (inputFile.filename().endsWith(".vue")) { currentParser = this.vueParser; } ScriptTree scriptTree; try { scriptTree = (ScriptTree) currentParser.parse(inputFile.contents()); scanFile(sensorContext, inputFile, executor, visitors, scriptTree); } catch (RecognitionException e) { checkInterrupted(e); LOG.error("Unable to parse file: " + inputFile.uri()); LOG.error(e.getMessage()); processRecognitionException(e, sensorContext, inputFile); } catch (Exception e) { checkInterrupted(e); processException(e, sensorContext, inputFile); LOG.error("Unable to analyse file: " + inputFile.uri(), e); } }
Source:
public static void openProductEditor(IProductModel productModel) { IResource resource = productModel.getUnderlyingResource(); try { IEditorInput input = null; if (resource != null) { input = new FileEditorInput((IFile) resource); } else { File file = new File(productModel.getInstallLocation(), ICoreConstants.FEATURE_FILENAME_DESCRIPTOR); IFileStore store = EFS.getStore(file.toURI()); input = new FileStoreEditorInput(store); } IDE.openEditor(PDEPlugin.getActivePage(), input, IPDEUIConstants.PRODUCT_EDITOR_ID, true); } catch (PartInitException e) { PDEPlugin.logException(e); } catch (CoreException e) { PDEPlugin.logException(e); } }

Target:
public static void openProductEditor(IProductModel productModel) { IResource resource = productModel.getUnderlyingResource(); try { IEditorInput input = null; if (resource != null) { input = new FileEditorInput((IFile) resource); IDE.openEditor(PDEPlugin.getActivePage(), input, IPDEUIConstants.PRODUCT_EDITOR_ID, true); } } catch (PartInitException e) { PDEPlugin.logException(e); } }
Source:
public boolean remove(K key) { if (service.isRunning()) { String target = buildUrl(service.cacheName, key); Invocation delete = service.getHttpClient().target(target).request().accept(service.getContentType()) .buildDelete(); Response response = delete.invoke(); int status = response.getStatus(); response.close(); if (status != Status.OK.getStatusCode()) { if (status == Status.NOT_FOUND.getStatusCode()) { log.warn("RESTEasyHTTPOperations.remove::Key: " + key + " does not exist in cache: " + service.cacheName); } else { throw new RuntimeException("RESTEasyHTTPOperations.remove::Unexpected HttpStatus: " + status + " " + response.getStatusInfo().getReasonPhrase() + " for request " + target); } } return true; } return false; }

Target:
public boolean remove(K key) { return doDelete(buildUrl(service.cacheName, key), null); }
Source:
private ParseResult parseFlex20Position(DeviceSession deviceSession, ByteBuf buf) { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); long index = 0; int length = buf.readUnsignedShort(); if (length <= buf.readableBytes() && buf.readUnsignedByte() == 0x0A) { buf.skipBytes(1); index = buf.readUnsignedIntLE(); position.set(Position.KEY_INDEX, index); position.set(Position.KEY_EVENT, buf.readUnsignedShortLE()); buf.skipBytes(4); int navSensorState = buf.readUnsignedByte(); position.setValid(BitUtil.check(navSensorState, 1)); position.set(Position.KEY_SATELLITES, navSensorState >> 2); position.setTime(new DateBuilder(new Date(buf.readUnsignedIntLE() * 1000)).getDate()); position.setLatitude(buf.readIntLE() / 600000.0); position.setLongitude(buf.readIntLE() / 600000.0); position.setAltitude(buf.readIntLE() * 0.1); position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE())); position.setCourse(buf.readUnsignedShortLE()); position.set(Position.KEY_ODOMETER, buf.readFloatLE() * 1000); buf.skipBytes(length - buf.readerIndex() - 1); } return new ParseResult(index, position); }

Target:
private ParseResult parseFlex20Position(DeviceSession deviceSession, ByteBuf buf) { Position position = new Position(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); long index = 0; int length = buf.readUnsignedShort(); if (length <= buf.readableBytes() && buf.readUnsignedByte() == 0x0A) { buf.readUnsignedByte(); index = buf.readUnsignedIntLE(); position.set(Position.KEY_INDEX, index); position.set(Position.KEY_EVENT, buf.readUnsignedShortLE()); buf.readUnsignedInt(); int navSensorState = buf.readUnsignedByte(); position.setValid(BitUtil.check(navSensorState, 1)); position.set(Position.KEY_SATELLITES, BitUtil.from(navSensorState, 2)); position.setTime(new DateBuilder(new Date(buf.readUnsignedIntLE() * 1000)).getDate()); position.setLatitude(buf.readIntLE() / 600000.0); position.setLongitude(buf.readIntLE() / 600000.0); position.setAltitude(buf.readIntLE() * 0.1); position.setSpeed(UnitsConverter.knotsFromKph(buf.readFloatLE())); position.setCourse(buf.readUnsignedShortLE()); position.set(Position.KEY_ODOMETER, buf.readFloatLE() * 1000); buf.skipBytes(length - buf.readerIndex() - 1); } return new ParseResult(index, position); }
Source:
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { Array array = null; if (parameter instanceof Array) { array = (Array)parameter; } else { if (!parameter.getClass().isArray()) { throw new TypeException("ArrayType Handler requires SQL array or java array parameter and does not support type " + parameter.getClass()); } Object[] values = (Object[])parameter; array = ps.getConnection().createArrayOf(jdbcType.name(), values); } ps.setArray(i, array); }

Target:
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { if (parameter instanceof Array) { ps.setArray(i, (Array) parameter); } else { if (!parameter.getClass().isArray()) { throw new TypeException( "ArrayType Handler requires SQL array or java array parameter and does not support type " + parameter.getClass()); } Class<?> componentType = parameter.getClass().getComponentType(); String arrayTypeName = resolveTypeName(componentType); Array array = ps.getConnection().createArrayOf(arrayTypeName, (Object[]) parameter); ps.setArray(i, array); array.free(); } }
Source:
T getNextHandle() { try { while (jsonParser.nextToken() != null) { JsonToken currentToken = jsonParser.currentToken(); switch (currentToken) { case FIELD_NAME: key.pop(); key.push(jsonParser.getCurrentName()); break; case START_OBJECT: NodeOperation operation = visitor.startObject(key.peek()); switch (operation) { case DESCEND: key.push(currentToken.asString()); break; case PROCESS: T handle = visitor.makeBufferedHandle(new JSONSplitter.JsonContainerParser(jsonParser)); if (handle != null) { return handle; } break; case SKIP: jsonParser.skipChildren(); break; default: throw new IllegalStateException("Unknown state"); } break; case END_OBJECT: visitor.endObject(key.peek()); key.pop(); break; case START_ARRAY: NodeOperation operation_array = visitor.startArray(key.peek()); switch (operation_array) { case DESCEND: break; case PROCESS: T handle = visitor.makeBufferedHandle(new JSONSplitter.JsonContainerParser(jsonParser)); if (handle != null) { return handle; } break; case SKIP: jsonParser.skipChildren(); break; default: throw new IllegalStateException("Unknown state"); } break; case END_ARRAY: visitor.endArray(key.peek()); break; } } return null; } catch (IOException e) { throw new RuntimeException("Failed to traverse document", e); } }

Target:
T getNextHandle() { try { while (jsonParser.nextToken() != null) { JsonToken currentToken = jsonParser.currentToken(); switch (currentToken) { case FIELD_NAME: key.pop(); key.push(jsonParser.getCurrentName()); break; case START_OBJECT: NodeOperation operation = visitor.startObject(key.peek()); switch (operation) { case DESCEND: END case only as the parser won't hit END_OBJECT in case PROCESS and case SKIP. key.push(currentToken.asString()); break; case PROCESS: T handle = visitor.makeBufferedHandle(new JSONSplitter.JsonContainerParser(jsonParser)); if (handle != null) { return handle; } break; case SKIP: jsonParser.skipChildren(); break; default: throw new IllegalStateException("Unknown state"); } break; case END_OBJECT: visitor.endObject(key.peek()); key.pop(); break; case START_ARRAY: NodeOperation operation_array = visitor.startArray(key.peek()); switch (operation_array) { case DESCEND: break; case PROCESS: T handle = visitor.makeBufferedHandle(new JSONSplitter.JsonContainerParser(jsonParser)); if (handle != null) { return handle; } break; case SKIP: jsonParser.skipChildren(); break; default: throw new IllegalStateException("Unknown state"); } break; case END_ARRAY: visitor.endArray(key.peek()); break; } } return null; } catch (IOException e) { throw new RuntimeException("Failed to traverse document", e); } }
Source:
public GlowItem dropItemNaturally(Location location, ItemStack item) { ThreadLocalRandom tlr = ThreadLocalRandom.current(); double radius = 0.1; double offsetX = tlr.nextDouble(radius * 2) - radius; double offsetY = 0.15; double offsetZ = Math.sqrt(Math.pow(radius, 2) - Math.pow(offsetX, 2)); if (tlr.nextInt(2) == 0) { offsetZ *= -1; } location.add(0.5, 0.5, 0.5); GlowItem dropItem = dropItem(location, item); dropItem.setVelocity(new Vector(offsetX, offsetY, offsetZ)); return dropItem; }

Target:
public GlowItem dropItemNaturally(Location location, ItemStack item) { ThreadLocalRandom tlr = ThreadLocalRandom.current(); double radius = 0.1; double offsetX = tlr.nextDouble(radius * 2) - radius; double offsetY = 0.15; double offsetZ = Math.sqrt(Math.pow(radius, 2) - Math.pow(offsetX, 2)); if (tlr.nextBoolean()) { offsetZ *= -1; } location.add(0.5, 0.5, 0.5); GlowItem dropItem = dropItem(location, item); dropItem.setVelocity(new Vector(offsetX, offsetY, offsetZ)); return dropItem; }
Source:
protected void executeCommand() { try { VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getParameters().getImageGroupID(), getParameters() .getWipeAfterDelete(), false, getStoragePool().getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveVmTemplate, VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { log.errorFormat("Image {0} does not exists in domain {1}. Removing disk from DB only.", getDiskImage().getId(), getParameters().getStorageDomainId()); } else { throw e; } } }

Target:
protected void executeCommand() { try { VDSReturnValue vdsReturnValue = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.DeleteImageGroup, new DeleteImageGroupVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getParameters().getImageGroupID(), getParameters() .getWipeAfterDelete(), false, getStoragePool().getcompatibility_version().toString())); if (vdsReturnValue.getSucceeded()) { getReturnValue().getInternalTaskIdList().add( createTask(vdsReturnValue.getCreationInfo(), VdcActionType.RemoveVmTemplate, VdcObjectType.Storage, getParameters().getStorageDomainId())); setSucceeded(true); } } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { getReturnValue().setFault(new VdcFault(e, e.getErrorCode())); log.errorFormat("Image {0} does not exist in domain {1}.", getDiskImage().getId(), getParameters().getStorageDomainId()); setSucceeded(true); } else { throw e; } } }
Source:
public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { final int targetStep = trace.getCacheSize(); int step = (startRank < targetStep ? (int) startRank : targetStep); long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); EventMatchingRequest req = new EventMatchingRequest(currentRank, step, predicate, true); trace.sendRequest(req); req.waitForCompletion(); ITmfEvent event = req.getFoundEvent(); if (event != null) { return event; } step *= 2; } } catch (InterruptedException e) { return null; } return null; }

Target:
public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { int step = trace.getCacheSize(); if (startRank < step) { step = (int) startRank; } long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); List<ITmfEvent> list = new ArrayList<>(step); ArrayFillingRequest req = new ArrayFillingRequest(currentRank, step, list); trace.sendRequest(req); req.waitForCompletion(); Optional<ITmfEvent> matchingEvent = Lists.reverse(list).stream() .filter(predicate) .findFirst(); if (matchingEvent.isPresent()) { return matchingEvent.get(); } } } catch (InterruptedException e) { return null; } return null; }
Source:
public void testJsonToMapWithList() { Map<String, String> map = JsonUtils.jsonToStringMapWithList(new StringReader(JSON_STRING_WITH_ARRAYS)); assertEquals("string value", "string", map.get("string")); assertEquals("long value", "123", map.get("long")); assertEquals("double value", "123.45", map.get("double")); assertEquals("null value", null, map.get("null")); assertEquals("true value", "true", map.get("true")); assertEquals("false value", "false", map.get("false")); assertEquals("encoding", "Chloë", map.get("encoding")); assertEquals("array of simple types only reads string values", "[\"string\",\"123\",\"123.45\",null,\"true\",\"false\"]", map.get("array")); assertEquals("array of objects with only strings as keys and values is supported", "[{\"key1\":\"string1\"},{\"key2\":\"string2\"}]", map.get("array2")); assertEquals("array of objects with values other than strings is not supported", "[{\"key1\":\"123.45\"},{\"key2\":\"false\"}]", map.get("array3")); assertEquals("nested primitive arrays are not supported", "[\"string\",\"123\",\"123.45\",null,\"true\"]", map.get("array4")); assertEquals("nested object arrays are not supported", "[{\"key1\":\"string1\"},{},{\"key3\":\"string3\"}]", map.get("array5")); assertEquals("nested arrays are not supported", "[]", map.get("array6")); assertEquals("empty array read", "[]", map.get("array7")); assertEquals("array with only null read correctly", "[null]", map.get("array8")); assertEquals("nested arrays are not supported", "[\"A\",{},\"C\",\"D\",null]", map.get("array9")); assertNull("object is ignored", map.get("object")); }

Target:
public void testJsonToMapWithList() { Map<String, String> map = JsonUtils.jsonToStringMapWithList(new StringReader(JSON_STRING_WITH_ARRAYS)); Map<String, String> actualMap = new HashMap<>(); actualMap.put("string", "string"); actualMap.put("long", "123"); actualMap.put("double", "123.45"); actualMap.put("null", null); actualMap.put("true", "true"); actualMap.put("false", "false"); actualMap.put("encoding", "Chloë"); actualMap.put("array", "[\"string\",\"123\",\"123.45\",null,\"true\",\"false\"]"); actualMap.put("array2", "[{\"key1\":\"string1\"},{\"key2\":\"string2\"}]"); actualMap.put("array3", "[{\"key1\":\"123.45\"},{\"key2\":\"false\"}]"); actualMap.put("array4", "[\"string\",\"123\",\"123.45\",null,\"true\"]"); actualMap.put("array5", "[{\"key1\":\"string1\"},{},{\"key3\":\"string3\"}]"); actualMap.put("array6", "[]"); actualMap.put("array7", "[]"); actualMap.put("array8", "[null]"); actualMap.put("array9", "[\"A\",{},\"C\",\"D\",null]"); assertEquals(actualMap, map); }
Source:
public CommittedTransactionException() { super("Transaction must not be committed"); }

Target:
public CommittedTransactionException() { super("Transaction must be uncommitted"); }
Source:
public String getInstanceURL() { if (this.getCustomer() != null) { return String.format("%s/%s/cards/%s", classURL(Customer.class), this.getCustomer(), this.getId()); } else { return String.format("%s/%s/cards/%s", classURL(Recipient.class), this.getRecipient(), this.getId()); } }

Target:
public String getInstanceURL() { if (this.getCustomer() != null) { return String.format("%s/%s/cards/%s", classURL(Customer.class), this.getCustomer(), this.getId()); } else if (this.getRecipient() != null) { return String.format("%s/%s/cards/%s", classURL(Recipient.class), this.getRecipient(), this.getId()); } else { return null; } }
Source:
public ASTNode visit(Term trm, Void _) throws ParseFailedException { if (!context.isSubsortedEq(expectedSort, trm.getSort()) && !(trm.getSort().equals(KSorts.K) && context.isSubsortedEq(KSorts.K, expectedSort))) { String msg = "Wrong type in cell '" + cellLabel + "'. Expected sort: " + expectedSort + " but found " + trm.getSort(); throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, getName(), trm.getFilename(), trm.getLocation())); } return trm; }

Target:
public ASTNode visit(Term trm, Void _) throws ParseFailedException { if (!context.isSubsortedEq(expectedSort, trm.getSort()) && !(context.isSubsortedEq(Sort.KLIST, expectedSort) && (trm.getSort().equals(Sort.KLIST) || trm.getSort().equals(Sort.K) || trm.getSort().equals(Sort.KITEM)))) { String msg = "Wrong type in cell '" + cellLabel + "'. Expected sort: " + expectedSort + " but found " + trm.getSort(); throw new ParseFailedException(new KException(ExceptionType.ERROR, KExceptionGroup.CRITICAL, msg, getName(), trm.getFilename(), trm.getLocation())); } return trm; }
Source:
public KApp(Term label, Term child) { super(label.getLocation(), label.getFilename(), KSorts.KITEM); setLabel(label); setChild(child); }

Target:
public KApp(Term label, Term child) { super(label.getLocation(), label.getFilename(), Sort.KITEM); setLabel(label); setChild(child); }
Source:
public Response restart(Action action) { validateParameters(action); return performServiceAction(action, GlusterServiceActionType.restart); }

Target:
public Response restart(Action action) { validateParameters(action); return performServiceAction(action, GlusterServiceActionType.RESTART); }
Source:
protected void readBytes(final byte[] bytes) { mIndexBuffer.readBytes(bytes); }

Target:
protected final void readBytes(final byte[] bytes) { mIndexBuffer.readBytes(bytes); }
Source:
public void delete(Scene sceneToDelete) throws IOException { StorageOperations.deleteDir(sceneToDelete.getDirectory()); File projectDirectory = ProjectManager.getInstance().getCurrentProject().getDirectory(); DeviceVariableAccessor accessor = new DeviceVariableAccessor(projectDirectory); for (Sprite sprite: sceneToDelete.getSpriteList()) { try { accessor.deleteAllLocalVariables(sprite); } catch (IOException e) { Log.i(TAG, e.getMessage()); } } }

Target:
public void delete(Scene sceneToDelete) throws IOException { StorageOperations.deleteDir(sceneToDelete.getDirectory()); }
Source:
boolean equalsArray(List<ConfigurationSetting> settings1, List<ConfigurationSetting> settings2) { if (settings1 == settings2) { return true; } if (settings1 == null || settings2 == null) { return false; } if (settings1.size() != settings2.size()) { return false; } final int size = settings1.size(); for (int i = 0; i < size; i++) { if (!equals(settings1.get(i), settings2.get(i))) { return false; } } return true; }

Target:
static boolean equalsArray(List<ConfigurationSetting> settings1, List<ConfigurationSetting> settings2) { if (settings1 == settings2) { return true; } if (settings1 == null || settings2 == null) { return false; } if (settings1.size() != settings2.size()) { return false; } final int size = settings1.size(); for (int i = 0; i < size; i++) { if (!equals(settings1.get(i), settings2.get(i))) { return false; } } return true; }
Source:
public ValidationResult validate(Object value) { assert value == null || value instanceof String : "This validation must be run on a String!"; String mask = (String) value; if (!MaskValidator.getInstance().isMaskFormatValid(mask, isPrefixSupported)) { return failWith(getSubnetBadFormatMessage()); } else if (!MaskValidator.getInstance().isMaskValid(mask, isPrefixSupported)) { return failWith(getInvalidMask()); } return new ValidationResult(); }

Target:
public ValidationResult validate(Object value) { assert value == null || value instanceof String : "This validation must be run on a String!"; String mask = (String) value; if (isPrefixAllowed ? !MaskValidator.getInstance().isValidPrefixFormat(mask) : !MaskValidator.getInstance().isValidNetmaskFormat(mask)){ return failWith(getSubnetBadFormatMessage()); } else if (isPrefixAllowed ? !MaskValidator.getInstance().isPrefixValid(mask) : !MaskValidator.getInstance().isNetmaskValid(mask)) { return failWith(getInvalidMask()); } return new ValidationResult(); }