auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testDecisionExpressionLiteral() throws Exception { final String expected = loadResource("decision-expression-literal.xml"); setContent(expected); final String actual = getContent(); assertThat(actual).isNotBlank(); XmlAssert.assertThat(actual) .and(expected) .ignoreComments() .ignoreWhitespace() .areIdentical(); final Map<String, String> prefix2Uri = new Maps.Builder<String, String>() .put(DMN.getPrefix(), DMN.getUri()) .build(); XmlAssert.assertThat(actual) .withNamespaceContext(prefix2Uri) .hasXPath("/dmn:definitions" + "/dmn:decision[@id='_4FEA7589-823B-4880-BCFA-AF2F9B145785']" + "/dmn:literalExpression[@id='_35DB53A6-97E7-4D48-9E5A-59CE0015CEF8']" + "/dmn:text[text()='123']"); }

Target:
public void testDecisionExpressionLiteral() throws Exception { final String expected = loadResource("decision-expression-literal.xml"); setContent(expected); final String actual = getContent(); assertThat(actual).isNotBlank(); XmlAssert.assertThat(actual) .and(expected) .ignoreComments() .ignoreWhitespace() .areIdentical(); XmlAssert.assertThat(actual) .withNamespaceContext(NAMESPACES) .hasXPath("/dmn:definitions" + "/dmn:decision[@id='_4FEA7589-823B-4880-BCFA-AF2F9B145785']" + "/dmn:literalExpression[@id='_35DB53A6-97E7-4D48-9E5A-59CE0015CEF8']" + "/dmn:text[text()='123']"); }
Source:
private static void assertLinesMatchWithFastForward(List<String> expectedLines, List<String> actualLines) { Deque<String> expectedDeque = new LinkedList<>(expectedLines); Deque<String> actualDeque = new LinkedList<>(actualLines); while (!expectedDeque.isEmpty()) { String expectedLine = expectedDeque.pop(); String actualLine = actualDeque.peek(); if (matches(expectedLine, actualLine)) { actualDeque.pop(); continue; } if (isFastForwardLine(expectedLine)) { int fastForwardLimit = parseFastForwardLimit(expectedLine); if (expectedDeque.isEmpty()) { int actualRemaining = actualDeque.size(); if (fastForwardLimit == Integer.MAX_VALUE || fastForwardLimit == actualRemaining) { return; } fail(format("terminal fast-forward(%d) error: fast-forward(%d) expected", fastForwardLimit, actualRemaining)); } expectedLine = expectedDeque.peek(); if (fastForwardLimit != Integer.MAX_VALUE) { for (int i = 0; i < fastForwardLimit; i++) { actualDeque.pop(); } if (actualDeque.isEmpty()) { fail(format("%d more lines expected, actual lines is empty", expectedDeque.size())); } continue; } while (true) { if (actualDeque.isEmpty()) { fail(format("no match for `%s` line fast-forwarding: %n%s", expectedLine, actualLines)); } if (matches(expectedLine, actualDeque.pop())) { break; } } } } if (!actualDeque.isEmpty()) { fail("more actual lines than expected: " + actualDeque.size()); } }

Target:
private static void assertLinesMatchWithFastForward(List<String> expectedLines, List<String> actualLines) { Deque<String> expectedDeque = new ArrayDeque<>(expectedLines); Deque<String> actualDeque = new ArrayDeque<>(actualLines); main: while (!expectedDeque.isEmpty()) { String expectedLine = expectedDeque.pop(); String actualLine = actualDeque.peek(); if (matches(expectedLine, actualLine)) { actualDeque.pop(); continue; } if (isFastForwardLine(expectedLine)) { int fastForwardLimit = parseFastForwardLimit(expectedLine); if (expectedDeque.isEmpty()) { int actualRemaining = actualDeque.size(); if (fastForwardLimit == Integer.MAX_VALUE || fastForwardLimit == actualRemaining) { return; } fail(expectedLines, actualLines, "terminal fast-forward(%d) error: fast-forward(%d) expected", fastForwardLimit, actualRemaining); } if (fastForwardLimit != Integer.MAX_VALUE) { for (int i = 0; i < fastForwardLimit; i++) { actualDeque.pop(); } continue; } expectedLine = expectedDeque.peek(); while (true) { if (actualDeque.isEmpty()) { fail(expectedLines, actualLines, "fast-forward(∞) didn't find: `%s`", snippet(expectedLine)); } if (matches(expectedLine, actualDeque.peek())) { continue main; } actualDeque.pop(); } } int number = expectedLines.size() - expectedDeque.size(); fail(expectedLines, actualLines, "expected line #%d:`%s` doesn't match", number, snippet(expectedLine)); } if (!actualDeque.isEmpty()) { fail(expectedLines, actualLines, "more actual lines than expected: %d", actualDeque.size()); } }
Source:
public void createTable(String name) { }

Target:
public AzureTable createTable(String name) { return null; }
Source:
public void testFilteredNotPaged() { MessageColumnIO columnIO = new ColumnIOFactory(true).getColumnIO(schema); MemPageStore memPageStore = writeTestRecords(columnIO, 8); RecordMaterializer<Group> recordConverter = new GroupRecordConverter(schema); RecordReaderImplementation<Group> recordReader = (RecordReaderImplementation<Group>) columnIO.getRecordReader(memPageStore, recordConverter, Optional.of(Either.<UnboundRecordFilter, FilterPredicate>left(not(column("DocId", equalTo(10l)))))); List<Group> all = readAll(recordReader); assertEquals("expecting 8 records " + all, 8, all.size()); for (int i = 0; i < all.size(); i++) { assertEquals("expecting record2", r2.toString(), all.get(i).toString()); } }

Target:
public void testFilteredNotPaged() { MessageColumnIO columnIO = new ColumnIOFactory(true).getColumnIO(schema); MemPageStore memPageStore = writeTestRecords(columnIO, 8); RecordMaterializer<Group> recordConverter = new GroupRecordConverter(schema); RecordReaderImplementation<Group> recordReader = (RecordReaderImplementation<Group>) columnIO.getRecordReader(memPageStore, recordConverter, FilterCompat.get(not(column("DocId", equalTo(10l))))); List<Group> all = readAll(recordReader); assertEquals("expecting 8 records " + all, 8, all.size()); for (int i = 0; i < all.size(); i++) { assertEquals("expecting record2", r2.toString(), all.get(i).toString()); } }
Source:
protected LobParamsBuilder beginParams() { return super.beginParams().putMap("mergeVariables", this.mergeVariables); }

Target:
protected LobParamsBuilder beginParams() { return super.beginParams().putMap("merge_variables", this.mergeVariables); }
Source:
protected boolean validate() { if (!super.validate()) { return false; } if (!getGlusterVolume().getVolumeType().isReplicatedType()) { addValidationMessage(EngineMessage.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getGlusterVolume().getAsyncTask() != null && (getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED || (getGlusterVolume().getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.FINISHED))) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_RUNNING_TASKS); return false; } if (getParameters().getExistingBrick() == null) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } return true; }

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (!supportedInConfig(ConfigValues.ResetBrickSupported, getCluster().getCompatibilityVersion())) { return false; } if (!getGlusterVolume().getVolumeType().isReplicatedType()) { addValidationMessage(EngineMessage.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getGlusterVolume().getAsyncTask() != null && (getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED || (getGlusterVolume().getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.FINISHED))) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_RUNNING_TASKS); return false; } if (getParameters().getExistingBrick() == null) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } return true; }
Source:
private void addProcedureParameter(MetadataFactory mf, Procedure procedure, Operation operation) { for(Parameter parameter : operation.getParameters()) { String name = parameter.getName(); String dataType = TypeFacility.RUNTIME_NAMES.STRING; String isPathParam = TRUE_STRING; if(parameter instanceof PathParameter) { PathParameter p = (PathParameter) parameter; String type = p.getType(); dataType = DataTypeManager.getDataTypeName(TypeFacility.getDataTypeClass(type)); } else if(parameter instanceof QueryParameter) { QueryParameter p = (QueryParameter) parameter; String type = p.getType(); dataType = DataTypeManager.getDataTypeName(TypeFacility.getDataTypeClass(type)); isPathParam = FALSE_STRING; } ProcedureParameter param = mf.addProcedureParameter(name, dataType, Type.In, procedure); param.setProperty(IS_PATH_PARAMETER, isPathParam); param.setNullType(NullType.No_Nulls); param.setDefaultValue(FALSE_STRING); param.setAnnotation(parameter.getDescription()); } }

Target:
private void addProcedureParameter(MetadataFactory mf, Procedure procedure, Operation operation) { for(Parameter parameter : operation.getParameters()) { String name = parameter.getName(); String dataType = TypeFacility.RUNTIME_NAMES.STRING; String isPathParam = TRUE_STRING; if(parameter instanceof PathParameter) { PathParameter p = (PathParameter) parameter; String type = p.getType(); dataType = DataTypeManager.getDataTypeName(TypeFacility.getDataTypeClass(type)); } else if(parameter instanceof QueryParameter) { QueryParameter p = (QueryParameter) parameter; String type = p.getType(); dataType = DataTypeManager.getDataTypeName(TypeFacility.getDataTypeClass(type)); isPathParam = FALSE_STRING; } ProcedureParameter param = mf.addProcedureParameter(name, dataType, Type.In, procedure); param.setProperty(IS_PATH_PARAMETER, isPathParam); param.setNullType(NullType.No_Nulls); param.setAnnotation(parameter.getDescription()); } }
Source:
public void onGiveup(Exception firstException, Exception lastException) throws RetryExecutor.RetryGiveupException { LOGGER.info("Giving up execution on exception", lastException); }

Target:
public void onGiveup(Exception firstException, Exception lastException) throws RetryExecutor.RetryGiveupException { LOGGER.error("Giving up retry, first exception is [{}], last exception is [{}]", firstException.getMessage(), lastException.getMessage()); }
Source:
public void createDeployment() throws Exception { WebArchive testDeployment = ShrinkWrap.create(WebArchive.class, ARCHIVE_FILE_NAME); testDeployment.addClasses(TaskSchedulerServletContextListener.class); tmpDir = new File("target/deployments/" + this.getClass().getSimpleName()); new File(tmpDir, "archives").mkdirs(); testDeployment.as(ZipExporter.class).exportTo(new File(tmpDir, "archives/" + ARCHIVE_FILE_NAME), true); final WildFlyManagedConfiguration config = createConfiguration("domain.xml", "host.xml", getClass().getSimpleName()); config.setAdminOnly(true); config.setReadOnlyDomain(true); config.setReadOnlyHost(true); String hostProps = config.getHostCommandLineProperties(); hostProps = hostProps == null ? "" : hostProps; config.setHostCommandLineProperties(hostProps + "\n-Djboss.unsupported.fail-boot-on-runtime-failure=true"); this.addTestResources(); }

Target:
public void createDeployment() { WebArchive testDeployment = ShrinkWrap.create(WebArchive.class, ARCHIVE_FILE_NAME); testDeployment.addClasses(TaskSchedulerServletContextListener.class); tmpDir = new File("target/deployments/" + this.getClass().getSimpleName()); new File(tmpDir, "archives").mkdirs(); testDeployment.as(ZipExporter.class).exportTo(new File(tmpDir, "archives/" + ARCHIVE_FILE_NAME), true); }
Source:
public void sendPasswordResetLinkEmail(PerunSession sess, Member member, String namespace, String url, String mailAttributeUrn, String language) throws InternalErrorException, PrivilegeException, MemberNotExistsException { Utils.checkPerunSession(sess); getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, member)) { throw new PrivilegeException(sess, "sendPasswordResetLinkEmail"); } getMembersManagerBl().sendPasswordResetLinkEmail(sess, member, namespace, url, mailAttributeUrn, language); }

Target:
public void sendPasswordResetLinkEmail(PerunSession sess, Member member, String namespace, String url, String mailAttributeUrn, String language) throws InternalErrorException, PrivilegeException, MemberNotExistsException, UserNotExistsException, AttributeNotExistsException { Utils.checkPerunSession(sess); getMembersManagerBl().checkMemberExists(sess, member); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, member)) { throw new PrivilegeException(sess, "sendPasswordResetLinkEmail"); } Attribute mailAttribute = null; AttributeDefinition ad = getPerunBl().getAttributesManager().getAttributeDefinition(sess, mailAttributeUrn); try { if (ad.getEntity().equals("user")) { User user = perunBl.getUsersManagerBl().getUserByMember(sess, member); mailAttribute = getPerunBl().getAttributesManager().getAttribute(sess, user, mailAttributeUrn); } if (ad.getEntity().equals("member")) { mailAttribute = getPerunBl().getAttributesManager().getAttribute(sess, member, mailAttributeUrn); } } catch (WrongAttributeAssignmentException ex) { throw new InternalErrorException(ex); } String mailAddress = (String) mailAttribute.getValue(); getMembersManagerBl().sendPasswordResetLinkEmail(sess, member, namespace, url, mailAddress, language); }
Source:
private void sendMuteCommand(String itemName, String command, DataOutputStream outToServer, BufferedReader i) throws IOException { char[] cbuf = new char[50]; outToServer.write(hexStringToByteArray(command)); i.read(cbuf, 0, 50); String result = new String(cbuf); if (result.contains("Mute=on") || result.contains("MuteOn")) eventPublisher.postUpdate(itemName, OnOffType.OFF); else if (result.contains("Mute=off") || result.contains("MuteOff")) eventPublisher.postUpdate(itemName, OnOffType.ON); else logger.error("Error sending command, received this: " + new String(cbuf)); }

Target:
private void sendMuteCommand(String itemName, String command, DataOutputStream outToServer, BufferedReader i) throws IOException { char[] cbuf = new char[50]; logger.debug("Sending mute command {}", command); outToServer.write(hexStringToByteArray(command)); i.read(cbuf, 0, 50); String result = new String(cbuf); logger.trace("Received this result: {}", result); if (result.contains("Mute=on") || result.contains("MuteOn")) { eventPublisher.postUpdate(itemName, OnOffType.OFF); logger.debug("Setting mute item on OFF", itemName); } else if (result.contains("Mute=off") || result.contains("MuteOff")) { eventPublisher.postUpdate(itemName, OnOffType.ON); logger.debug("Setting mute item on ON", itemName); } else logger.error("Error sending mute command {}, received this: {}", command, result); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((SyncthingActivity) getActivity()).registerOnServiceConnectedListener(this); mIsCreate = ((SettingsActivity) getActivity()).getIsCreate(); setHasOptionsMenu(true); if (mIsCreate) { addPreferencesFromResource(R.xml.device_settings_create); } else { addPreferencesFromResource(R.xml.device_settings_edit); } mDeviceId = findPreference("device_id"); mDeviceId.setOnPreferenceChangeListener(this); mName = (EditTextPreference) findPreference("name"); mName.setOnPreferenceChangeListener(this); mAddresses = (EditTextPreference) findPreference("addresses"); mAddresses.setOnPreferenceChangeListener(this); mCompression = (ListPreference) findPreference("compression"); mCompression.setOnPreferenceChangeListener(this); mIntroducer = (CheckBoxPreference) findPreference("introducer"); mIntroducer.setOnPreferenceChangeListener(this); if (!mIsCreate) { mVersion = findPreference("version"); mVersion.setSummary("?"); mCurrentAddress = findPreference("current_address"); mCurrentAddress.setSummary("?"); } if (mIsCreate) { mDevice = null; if (savedInstanceState != null) { mDevice = (RestApi.Device) savedInstanceState.getSerializable("device"); } if (mDevice == null) { mDevice = new RestApi.Device(); mDevice.Name = ""; mDevice.DeviceID = ""; mDevice.Addresses = "dynamic"; mDevice.Compression = "always"; ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID); } } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ((SyncthingActivity) getActivity()).registerOnServiceConnectedListener(this); mIsCreate = ((SettingsActivity) getActivity()).getIsCreate(); setHasOptionsMenu(true); if (mIsCreate) { addPreferencesFromResource(R.xml.device_settings_create); } else { addPreferencesFromResource(R.xml.device_settings_edit); } mDeviceId = findPreference("device_id"); mDeviceId.setOnPreferenceChangeListener(this); mName = (EditTextPreference) findPreference("name"); mName.setOnPreferenceChangeListener(this); mAddresses = (EditTextPreference) findPreference("addresses"); mAddresses.setOnPreferenceChangeListener(this); mCompression = (ListPreference) findPreference("compression"); mCompression.setOnPreferenceChangeListener(this); mIntroducer = (CheckBoxPreference) findPreference("introducer"); mIntroducer.setOnPreferenceChangeListener(this); if (!mIsCreate) { mVersion = findPreference("version"); mVersion.setSummary("?"); mCurrentAddress = findPreference("current_address"); mCurrentAddress.setSummary("?"); } if (mIsCreate) { if (savedInstanceState != null) { mDevice = (RestApi.Device) savedInstanceState.getSerializable("device"); } if (mDevice == null) { mDevice = new RestApi.Device(); mDevice.Name = ""; mDevice.DeviceID = ""; mDevice.Addresses = "dynamic"; mDevice.Compression = "always"; ((EditTextPreference) mDeviceId).setText(mDevice.DeviceID); } } }
Source:
private RollingUpdateOp rollingUpdateTimedoutError(final RollingUpdateOpFactory opFactory, final String host, final JobId jobId, final TaskStatus taskStatus) { final List<TaskStatus.State> previousJobStates = getPreviousJobStates(jobId, host, 10); final String baseError = "timed out waiting for job to reach state RUNNING "; final String stateInfo = String.format( "(terminal job state %s, previous states: %s)", taskStatus.getState(), Joiner.on("->").join(previousJobStates)); final Map<String, Object> metadata = Maps.newHashMap(); metadata.put("jobState", taskStatus.getState()); metadata.put("previousJobStates", previousJobStates); metadata.put("throttleState", taskStatus.getThrottled()); if (taskStatus.getThrottled().equals(ThrottleState.IMAGE_MISSING)) { return opFactory.error( baseError + "due to missing Docker image " + stateInfo, host, RollingUpdateError.IMAGE_MISSING, metadata); } if (taskStatus.getThrottled().equals(ThrottleState.IMAGE_PULL_FAILED)) { return opFactory.error( baseError + "due to failure pulling Docker image " + stateInfo, host, RollingUpdateError.IMAGE_PULL_FAILED, metadata); } if (!taskStatus.getContainerError().equals("")) { return opFactory.error( baseError + stateInfo + " container error: " + taskStatus.getContainerError(), host, RollingUpdateError.TIMED_OUT_WAITING_FOR_JOB_TO_REACH_RUNNING, metadata); } return opFactory.error( baseError + stateInfo, host, RollingUpdateError.TIMED_OUT_WAITING_FOR_JOB_TO_REACH_RUNNING, metadata); }

Target:
private RollingUpdateOp rollingUpdateTimedoutError(final RollingUpdateOpFactory opFactory, final String host, final JobId jobId, final TaskStatus taskStatus) { final List<TaskStatus.State> previousJobStates = getPreviousJobStates(jobId, host, 10); final String baseError = "timed out waiting for job to reach state RUNNING "; final String stateInfo = String.format( "(terminal job state %s, previous states: %s)", taskStatus.getState(), Joiner.on("->").join(previousJobStates)); final Map<String, Object> metadata = Maps.newHashMap(); metadata.put("jobState", taskStatus.getState()); metadata.put("previousJobStates", previousJobStates); metadata.put("throttleState", taskStatus.getThrottled()); if (taskStatus.getThrottled().equals(ThrottleState.IMAGE_MISSING)) { return opFactory.error( baseError + "due to missing Docker image " + stateInfo, host, RollingUpdateError.IMAGE_MISSING, metadata); } if (taskStatus.getThrottled().equals(ThrottleState.IMAGE_PULL_FAILED)) { return opFactory.error( baseError + "due to failure pulling Docker image " + stateInfo, host, RollingUpdateError.IMAGE_PULL_FAILED, metadata); } if (!Strings.isNullOrEmpty(taskStatus.getContainerError())) { return opFactory.error( baseError + stateInfo + " container error: " + taskStatus.getContainerError(), host, RollingUpdateError.TIMED_OUT_WAITING_FOR_JOB_TO_REACH_RUNNING, metadata); } return opFactory.error( baseError + stateInfo, host, RollingUpdateError.TIMED_OUT_WAITING_FOR_JOB_TO_REACH_RUNNING, metadata); }
Source:
public void addArgumentsToInstallFeatures(String repositoryLocation, String installIUs, String destination, String profile) { launcher.addArguments( "-metadataRepository", repositoryLocation, "-artifactRepository", repositoryLocation, "-profileProperties", "org.eclipse.update.install.features=true", "-installIU", installIUs, "-bundlepool", destination + File.separator + "lib", "-shared", destination + File.separator + "lib" + File.separator + "p2", "-destination", destination + File.separator + profile, "-profile", profile, "-roaming"); }

Target:
public void addArgumentsToInstallFeatures(String repositoryLocation, String installIUs, String destination, String profile) { launcher.addArguments( "-metadataRepository", repositoryLocation, "-artifactRepository", repositoryLocation, "-profileProperties", "org.eclipse.update.install.features=true", "-installIU", installIUs, "-bundlepool", Paths.get(destination + File.separator + "lib").toString(), "-shared", Paths.get(destination + File.separator + "lib" + File.separator + "p2").toString(), "-destination", Paths.get(destination + File.separator + profile).toString(), "-profile", profile, "-roaming"); }
Source:
public JdbcClientBuilder fromType(JdbcDriverType type, String db, String host, int port) { dbDriver(type.getDriver()); String dbHost = host; if (System.getProperty("osee.application.server") == null) { dbHost = JDBC_SERVER__LOCAL_CONNECTIONS; } else { dbHost = System.getProperty("osee.application.server"); } dbUri(type.getUriFormat(), type.getPrefix(), dbHost, port, db); switch (type) { case hsql: dbParamsInUri(true); if (!Strings.isValid(getDbUsername())) { dbUsername("public"); } break; case oracle_thin: if (!getDbProps().containsKey("SetBigStringTryClob")) { dbParam("SetBigStringTryClob", "true"); } if (!getDbProps().containsKey("includeSynonyms")) { dbParam("includeSynonyms", "true"); } break; default: break; } return this; }

Target:
public JdbcClientBuilder fromType(JdbcDriverType type, String db, String host, int port) { dbDriver(type.getDriver()); String dbHost = host; if (System.getProperty(OseeClient.OSEE_APPLICATION_SERVER) == null) { dbHost = JDBC_SERVER__LOCAL_CONNECTIONS; } else { dbHost = System.getProperty(OseeClient.OSEE_APPLICATION_SERVER); } dbUri(type.getUriFormat(), type.getPrefix(), dbHost, port, db); switch (type) { case hsql: dbParamsInUri(true); if (!Strings.isValid(getDbUsername())) { dbUsername("public"); } break; case oracle_thin: if (!getDbProps().containsKey("SetBigStringTryClob")) { dbParam("SetBigStringTryClob", "true"); } if (!getDbProps().containsKey("includeSynonyms")) { dbParam("includeSynonyms", "true"); } break; default: break; } return this; }
Source:
public void testGoodSubjectAmqp() { Message message = new AMQPMessage(1); message.setAddress("test.address"); securityServerPlugin.handleMessage(mockServerSession, null, message, false, false); assertThat(message.getStringProperty("subject"), is("Hello World")); }

Target:
public void testGoodSubjectAmqp() { Message message = new AMQPMessage(1); message.setAddress("test.address"); securityServerPlugin.handleMessage(mockServerSession, null, message, false, false); assertThat(message.getStringProperty("subject"), is("Hello World")); assertThat( ((AMQPMessage) message) .getProtonMessage() .getApplicationProperties() .getValue() .get("subject"), is("Hello World")); }
Source:
public static Observation shallowClone(Observation observation) { if (null == observation) { return null; } final Request request = observation.getRequest(); if (null == request) { throw new IllegalArgumentException("missing request for observation!"); } Request clonedRequest = new Request(request.getCode()); clonedRequest.setDestinationContext(request.getDestinationContext()); clonedRequest.setType(request.getType()); clonedRequest.setMID(request.getMID()); clonedRequest.setToken(request.getToken()); clonedRequest.setOptions(request.getOptions()); clonedRequest.setPayload(request.getPayload()); clonedRequest.setUserContext(request.getUserContext()); clonedRequest.addMessageObserver(new MessageObserverAdapter() { @Override public void onResponse(Response response) { request.setResponse(response); } }); return new Observation(clonedRequest, observation.getContext()); }

Target:
public static Observation shallowClone(Observation observation) { if (null == observation) { return null; } Request request = observation.getRequest(); if (null == request) { throw new IllegalArgumentException("missing request for observation!"); } Request clonedRequest = new Request(request.getCode()); clonedRequest.setDestinationContext(request.getDestinationContext()); clonedRequest.setType(request.getType()); clonedRequest.setMID(request.getMID()); clonedRequest.setToken(request.getToken()); clonedRequest.setOptions(request.getOptions()); clonedRequest.setPayload(request.getPayload()); clonedRequest.setUserContext(request.getUserContext()); return new Observation(clonedRequest, observation.getContext()); }
Source:
public void validateChartData() { super.validateChartData(); if (getXDescriptorsInfo().areNumericals()) { throw new IllegalArgumentException("Bar chart X axis cannot be numerical."); } if (!getYDescriptorsInfo().areNumericals()) { throw new IllegalArgumentException("Bar chart Y axis must be numerical."); } if (countDiffDescriptors(getXDescriptors()) > 1) { throw new IllegalArgumentException("Bar chart can only have one X axis."); } }

Target:
public void validateChartData() { super.validateChartData(); if (getXDescriptorsInfo().areNumericals()) { throw new IllegalArgumentException("Bar chart X axis cannot be numerical."); } if (!getYDescriptorsInfo().areNumericals()) { throw new IllegalArgumentException("Bar chart Y axis must be numerical."); } if (countDistinctDescriptors(getXDescriptors()) > 1) { throw new IllegalArgumentException("Bar chart can only have one X axis."); } }
Source:
public void cleanUp() throws Exception { if (executor != null) { executor.shutdownNow(); } httpClient.close(); query(format("DROP TABLE IF EXISTS %s", TABLE_NAME)); }

Target:
public void cleanUp() throws Exception { if (executor != null) { executor.shutdownNow(); } if (queryCanceller != null) { queryCanceller.close(); } }
Source:
public void goalSelected(Goal goal) { if(application.getGoals().contains(goal)) { deleteGoal(goal); } else { addGoal(goal); if (goal.getBehaviorCount() > 0){ Intent intent = new Intent(getApplicationContext(), GoalTryActivity.class); intent.putExtra("goal", goal); intent.putExtra("category", mCategory); startActivity(intent); } } }

Target:
public void goalSelected(Goal goal) { if(application.getGoals().contains(goal)) { deleteGoal(goal); } else { addGoal(goal); if (goal.getBehaviorCount() > 0){ Intent intent = new Intent(getApplicationContext(), GoalTryActivity.class); intent.putExtra("goal", goal); intent.putExtra("category", mCategory); startActivity(intent); } else{ Toast.makeText(this, R.string.goal_selected, Toast.LENGTH_SHORT).show(); } } }
Source:
public void moveAliens() { Iterator iteralien = ConcreteAggregate.createIterator(aliens); while (iteralien.hasNext()) { Alien alien = (Alien) iteralien.next(); alien.hmovement(); } if (Alien.getupdateLogic()) { Iterator iteralien2 = ConcreteAggregate.createIterator(aliens); while (iteralien2.hasNext()) { Alien alien = (Alien) iteralien2.next(); alien.vmovement(); } Game.logfile.writeString("Aliens reached a border and moved down"); } }

Target:
public void moveAliens() { Iterator iterAliens = ConcreteAggregate.createIterator(aliens); while (iterAliens.hasNext()) { Alien alien = (Alien) iterAliens.next(); alien.hmovement(); } if (Alien.getupdateLogic()) { Iterator iterAliens2 = ConcreteAggregate.createIterator(aliens); while (iterAliens2.hasNext()) { Alien alien = (Alien) iterAliens2.next(); alien.vmovement(); } Game.logfile.writeString("Aliens reached a border and moved down"); } }
Source:
public void visitMethodInvocation(MethodInvocationTree mit) { if (isInvocationOnVariable(mit, variable) && SET_SSL_CHECK_SERVER_ID.matches(mit) && isNotFalse(mit.arguments().get(0))) { this.isSecured = true; } super.visitMethodInvocation(mit); }

Target:
public void visitMethodInvocation(MethodInvocationTree mit) { if (isInvocationOnVariable(mit, variable, true) && SET_SSL_CHECK_SERVER_ID.matches(mit) && isNotFalse(mit.arguments().get(0))) { this.isSecured = true; } super.visitMethodInvocation(mit); }
Source:
public Map<String, LocalMapStats> getStats() { LocalMapStatsProvider localMapStatsProvider = mapServiceContext.getLocalMapStatsProvider(); return localMapStatsProvider.createAllLocalMapStats(); }

Target:
public Map<String, LocalMapStats> getStats() { return statisticsAwareService.getStats(); }
Source:
void download() { if (downloadBatchStatus.status() == PAUSED) { return; } if (downloadBatchStatus.status() == DELETION) { return; } if (downloadBatchStatus.status() == DOWNLOADED) { return; } downloadBatchStatus.markAsDownloading(downloadsBatchPersistence); notifyCallback(downloadBatchStatus); totalBatchSizeBytes = getTotalSize(downloadFiles); if (totalBatchSizeBytes <= ZERO_BYTES) { DownloadError downloadError = new DownloadError(DownloadError.Error.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE); downloadBatchStatus.markAsError(downloadError, downloadsBatchPersistence); notifyCallback(downloadBatchStatus); return; } DownloadFile.Callback fileDownloadCallback = downloadFileStatus -> { fileBytesDownloadedMap.put(downloadFileStatus.downloadFileId(), downloadFileStatus.bytesDownloaded()); long currentBytesDownloaded = getBytesDownloadedFrom(fileBytesDownloadedMap); downloadBatchStatus.update(currentBytesDownloaded, totalBatchSizeBytes); if (downloadFileStatus.isMarkedAsError()) { downloadBatchStatus.markAsError(downloadFileStatus.error(), downloadsBatchPersistence); } callbackThrottle.update(downloadBatchStatus); }; for (DownloadFile downloadFile : downloadFiles) { downloadFile.download(fileDownloadCallback); if (batchCannotContinue()) { break; } } if (networkError()) { DownloadsNetworkRecoveryCreator.getInstance().scheduleRecovery(); } if (downloadBatchStatus.status() == DOWNLOADED) { downloadBatchStatus.markAsDownloaded(downloadsBatchPersistence); } callbackThrottle.stopUpdates(); }

Target:
void download() { DownloadBatchStatus.Status status = downloadBatchStatus.status(); if (status == PAUSED) { return; } if (status == DELETION) { return; } if (status == DOWNLOADED) { return; } downloadBatchStatus.markAsDownloading(downloadsBatchPersistence); notifyCallback(downloadBatchStatus); totalBatchSizeBytes = getTotalSize(downloadFiles); if (totalBatchSizeBytes <= ZERO_BYTES) { DownloadError downloadError = new DownloadError(DownloadError.Error.NETWORK_ERROR_CANNOT_DOWNLOAD_FILE); downloadBatchStatus.markAsError(downloadError, downloadsBatchPersistence); notifyCallback(downloadBatchStatus); return; } DownloadFile.Callback fileDownloadCallback = downloadFileStatus -> { fileBytesDownloadedMap.put(downloadFileStatus.downloadFileId(), downloadFileStatus.bytesDownloaded()); long currentBytesDownloaded = getBytesDownloadedFrom(fileBytesDownloadedMap); downloadBatchStatus.update(currentBytesDownloaded, totalBatchSizeBytes); if (downloadFileStatus.isMarkedAsError()) { downloadBatchStatus.markAsError(downloadFileStatus.error(), downloadsBatchPersistence); } callbackThrottle.update(downloadBatchStatus); }; for (DownloadFile downloadFile : downloadFiles) { downloadFile.download(fileDownloadCallback); if (batchCannotContinue()) { break; } } if (networkError()) { DownloadsNetworkRecoveryCreator.getInstance().scheduleRecovery(); } if (status == DOWNLOADED) { downloadBatchStatus.markAsDownloaded(downloadsBatchPersistence); } callbackThrottle.stopUpdates(); }
Source:
public void checkPaths() throws ConfigurationException { File badInstanceClid = new File(generator.getNuxeoHome(), getDefaultDataDir() + File.separator + "instance.clid"); if (badInstanceClid.exists() && !getDataDir().equals(badInstanceClid.getParentFile())) { log.warn("Moving to {}.", () -> badInstanceClid, this::getDataDir); try { FileUtils.moveFileToDirectory(badInstanceClid, getDataDir(), true); } catch (IOException e) { throw new ConfigurationException("NXP-6722 move failed: " + e.getMessage(), e); } } File oldPackagesPath = new File(getDataDir(), getDefaultPackagesDir()); if (oldPackagesPath.exists() && !oldPackagesPath.equals(getPackagesDir())) { log.warn("NXP-8014 Packages cache location changed. You can safely delete or move its content to {}", () -> oldPackagesPath, this::getPackagesDir); } File oldPath = new File(getRuntimeHome(), "data" + File.separator + "vcsh2repo"); String message = String.format("NXP-5370, NXP-5460. " + "Please rename 'vcsh2repo' directory from %s to %s", oldPath, new File(generator.getDataDir(), "h2" + File.separator + "nuxeo")); checkPath(oldPath, message); }

Target:
public void checkPaths() throws ConfigurationException { File badInstanceClid = new File(generator.getNuxeoHome(), getDefaultDataDir() + File.separator + "instance.clid"); if (badInstanceClid.exists() && !getDataDir().equals(badInstanceClid.getParentFile())) { log.warn("Moving to {}.", () -> badInstanceClid, this::getDataDir); try { FileUtils.moveFileToDirectory(badInstanceClid, getDataDir(), true); } catch (IOException e) { throw new ConfigurationException("NXP-6722 move failed: " + e.getMessage(), e); } } File oldPackagesPath = new File(getDataDir(), getDefaultPackagesDir()); if (oldPackagesPath.exists() && !oldPackagesPath.equals(getPackagesDir())) { log.warn("NXP-8014 Packages cache location changed. You can safely delete or move its content to {}", () -> oldPackagesPath, this::getPackagesDir); } }
Source:
protected boolean isConditionsDefaultValueEnabled() { try { final String ConditionsDefaultValueEnabled = PropertyAccessor.getInstance() .getProperty(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.ENABLE_CONDITIONS_DEFAULT_VALUE); if (ConditionsDefaultValueEnabled != null) { return !ConditionsDefaultValueEnabled.equals(Boolean.FALSE.toString()); } } catch (final PropertyAccessException pae) { LOG.warn("Property not found: {}", NhincConstants.ENABLE_CONDITIONS_DEFAULT_VALUE, pae.getLocalizedMessage()); LOG.trace("Property not found exception: {}", pae.getLocalizedMessage(), pae); } return Boolean.TRUE; }

Target:
protected boolean isConditionsDefaultValueEnabled() { try { final Boolean conditionsDefaultValueEnabled = PropertyAccessor.getInstance().getPropertyBoolean( NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.ENABLE_CONDITIONS_DEFAULT_VALUE); return !conditionsDefaultValueEnabled.equals(Boolean.FALSE); } catch (final PropertyAccessException pae) { LOG.trace("Property not found exception: {}", pae.getLocalizedMessage(), pae); } return Boolean.TRUE; }
Source:
public JWindowPreference(Window window) { super (window.getName()); try { this.width = window.getWidth(); this.height = window.getHeight(); this.screenX = window.getLocationOnScreen().x; this.screenY = window.getLocationOnScreen().y; if (window instanceof JFrame) { this.isMaximized = (((JFrame)window).getState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH; } else { this.isMaximized = false; } } catch (Exception ignored) { } this.weakRef = new WeakReference<>(window); window.addWindowStateListener(this); window.addComponentListener(this); }

Target:
public JWindowPreference(Window window) { super (window.getName()); try { this.width = window.getWidth(); this.height = window.getHeight(); this.screenX = window.getLocationOnScreen().x; this.screenY = window.getLocationOnScreen().y; if (window instanceof JFrame) { this.isMaximized = (((JFrame)window).getExtendedState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH; } else { this.isMaximized = false; } } catch (Exception ignored) { } this.weakRef = new WeakReference<>(window); window.addWindowStateListener(this); window.addComponentListener(this); }
Source:
public ImageWorker(final RenderedImage image) { inheritanceStopPoint = this.image = image; setnoData(extractNoDataProperty(image)); }

Target:
public ImageWorker(final RenderedImage image) { setImage(image); }
Source:
private void reComputeDiagnostics(String pomPath) { String pomUri = prefixURI(pomPath); Type type = new TypeToken<PublishDiagnosticsParams>() {}.getType(); PublishDiagnosticsParams result = doGetOne(Commands.RECOMPUTE_POM_DIAGNOSTICS, singletonList(pomUri), type); CheLanguageClient cheLanguageClient = clientFactory.create(findInitializedLanguageServer().get().getId()); cheLanguageClient.publishDiagnostics(result); }

Target:
private void reComputeDiagnostics(String pomPath) { String pomUri = prefixURI(pomPath); executeCommand(RECOMPUTE_POM_DIAGNOSTICS, singletonList(pomUri)); }
Source:
public static ICPPExecution getConstructorChainExecution(IASTNode def) { ICPPASTFunctionDefinition fnDef = getFunctionDefinition(def); if (fnDef != null) { final ICPPASTConstructorChainInitializer[] ccInitializers = fnDef.getMemberInitializers(); final List<Pair<IBinding, ICPPEvaluation>> resultPairs = new ArrayList<Pair<IBinding, ICPPEvaluation>>(); for(ICPPASTConstructorChainInitializer ccInitializer : ccInitializers) { final IBinding member = ccInitializer.getMemberInitializerId().resolveBinding(); if(member instanceof ICPPField) { final ICPPField fieldMember = (ICPPField)member; final ICPPEvaluation memberEval = getMemberEvaluation(fieldMember, ccInitializer, fnDef); final Pair<IBinding, ICPPEvaluation> resultPair = new Pair<IBinding, ICPPEvaluation>(fieldMember, memberEval); resultPairs.add(resultPair); } else if(member instanceof ICPPConstructor) { final ICPPConstructor ctorMember = (ICPPConstructor)member; final IASTInitializer initializer = ccInitializer.getInitializer(); if (initializer instanceof ICPPASTConstructorInitializer) { final ICPPClassType baseClassType = (ICPPClassType)ctorMember.getOwner(); EvalConstructor memberEval = new EvalConstructor(baseClassType, ctorMember, EvalConstructor.extractArguments(initializer), fnDef); final Pair<IBinding, ICPPEvaluation> resultPair = new Pair<IBinding, ICPPEvaluation>(ctorMember, memberEval); resultPairs.add(resultPair); } } } return new ExecConstructorChain(resultPairs); } return null; }

Target:
public static ICPPExecution getConstructorChainExecution(IASTNode def) { ICPPASTFunctionDefinition fnDef = getFunctionDefinition(def); if (fnDef != null) { final ICPPASTConstructorChainInitializer[] ccInitializers = fnDef.getMemberInitializers(); final List<Pair<IBinding, ICPPEvaluation>> resultPairs = new ArrayList<>(); for(ICPPASTConstructorChainInitializer ccInitializer : ccInitializers) { final IBinding member = ccInitializer.getMemberInitializerId().resolveBinding(); if(member instanceof ICPPField) { final ICPPField fieldMember = (ICPPField)member; final ICPPEvaluation memberEval = getMemberEvaluation(fieldMember, ccInitializer, fnDef); final Pair<IBinding, ICPPEvaluation> resultPair = new Pair<>(fieldMember, memberEval); resultPairs.add(resultPair); } else if(member instanceof ICPPConstructor) { final ICPPConstructor ctorMember = (ICPPConstructor)member; final IASTInitializer initializer = ccInitializer.getInitializer(); if (initializer instanceof ICPPASTConstructorInitializer) { final ICPPClassType baseClassType = (ICPPClassType)ctorMember.getOwner(); EvalConstructor memberEval = new EvalConstructor(baseClassType, ctorMember, EvalConstructor.extractArguments(initializer), fnDef); final Pair<IBinding, ICPPEvaluation> resultPair = new Pair<IBinding, ICPPEvaluation>(ctorMember, memberEval); resultPairs.add(resultPair); } } } return new ExecConstructorChain(resultPairs); } return null; }
Source:
public void setProduct(ProductDto productDto) { Brand brand = productDto.getBrand(); $(brandName).text(brand.getValue()); Product product = productDto.getProduct(); $(productName).text(product.getName()); $(productDescription).text(product.getDescription()); $(priceText).text(String.valueOf(product.getPrice() + " $")); productImage.setResource(productBrandUtil.getImage(product, brand)); if (product.equals(Product.SHIRT)) { $(productImageDiv).css("background-color", Colors.getBrandColor(brand)); $(productInfoDiv).css("background-color", Colors.getBrandColor(brand)); } else { $(productImageDiv).css("background-color", ""); $(productInfoDiv).css("background-color", ""); } setAnchorToProduct(previous, product.getPreviousProduct()); setAnchorToProduct(next, product.getNextProduct()); }

Target:
public void setProduct(ProductDto productDto) { Brand brand = productDto.getBrand(); Product product = productDto.getProduct(); $(brandName).text(brand.getValue()); $(productName).text(product.getName()); $(productDescription).text(product.getDescription()); $(priceText).text(String.valueOf(product.getPrice() + " $")); productImage.setResource(productBrandUtil.getImage(product, brand)); if (product.equals(Product.SHIRT)) { $(productImageDiv).css("background-color", Colors.getBrandColor(brand)); $(productInfoDiv).css("background-color", Colors.getBrandColor(brand)); $(sizeDiv).show(); } else { $(productImageDiv).css("background-color", ""); $(productInfoDiv).css("background-color", ""); $(sizeDiv).hide(); } setAnchorToProduct(previous, product.getPreviousProduct()); setAnchorToProduct(next, product.getNextProduct()); }
Source:
private void injectAccountAndContainerUsingServiceId(RestRequest restRequest) throws RestServiceException { String accountName = getServiceId(restRequest); Account targetAccount = accountService.getAccountByName(accountName); if (targetAccount == null) { frontendMetrics.unrecognizedServiceIdCount.inc(); if (frontendConfig.frontendAllowUnrecognizedAccountAndContainerForPreContainerizationRequest) { logger.debug( "Account cannot be found for accountName={} in put request with serviceId. Setting targetAccount to UNKNOWN_ACCOUNT", accountName); targetAccount = Account.UNKNOWN_ACCOUNT; } else { throw new RestServiceException( "Account cannot be found for accountName=" + accountName + " in put request with serviceId", RestServiceErrorCode.InvalidAccount); } } boolean isBlobPrivate = isPrivate(restRequest.getArgs()); Container targetContainer = targetAccount.getContainerById( isBlobPrivate ? Container.DEFAULT_PRIVATE_CONTAINER_ID : Container.DEFAULT_PUBLIC_CONTAINER_ID); if (targetContainer == null) { frontendMetrics.missingDefaultContainerCount.inc(); if (frontendConfig.frontendAllowUnrecognizedAccountAndContainerForPreContainerizationRequest) { logger.debug( "Container cannot be identified for accountName={} and isPrivate={} in put request with serviceId. " + "Setting targetAccount to UNKNOWN_ACCOUNT, targetContainer to UNKNOWN_CONTAINER", accountName, isBlobPrivate); targetAccount = Account.UNKNOWN_ACCOUNT; targetContainer = Container.UNKNOWN_CONTAINER; } else { throw new RestServiceException( "Container cannot be identified for accountName=" + accountName + " and isPrivate=" + isBlobPrivate + " in put request with serviceId.", RestServiceErrorCode.InvalidContainer); } } setTargetAccountAndContainerInRestRequest(restRequest, targetAccount, targetContainer); }

Target:
private void injectAccountAndContainerUsingServiceId(RestRequest restRequest) throws RestServiceException { String accountName = getHeader(restRequest.getArgs(), Headers.SERVICE_ID, false); Account targetAccount = accountService.getAccountByName(accountName); if (targetAccount == null) { frontendMetrics.unrecognizedServiceIdCount.inc(); logger.debug( "Account cannot be found for accountName={} in put request with serviceId. Setting targetAccount to UNKNOWN_ACCOUNT", accountName); targetAccount = Account.UNKNOWN_ACCOUNT; } boolean isBlobPrivate = isPrivate(restRequest.getArgs()); Container targetContainer = targetAccount.getContainerById( isBlobPrivate ? Container.DEFAULT_PRIVATE_CONTAINER_ID : Container.DEFAULT_PUBLIC_CONTAINER_ID); setTargetAccountAndContainerInRestRequest(restRequest, targetAccount, targetContainer); }
Source:
private void conditionallyAddHost(List<Host> agentBasedHosts, Host host) { if (host == null) { if (LOG.isTraceEnabled()) { LOG.trace("trying to add no host to a list"); } return; } if (host.getResourceState() == ResourceState.Creating) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("host is in creating state, not adding to the host list, (id = %s)", host.getUuid())); } return; } if (host.getResourceState() == ResourceState.Error) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("host is in error state, not adding to the host list, (id = %s)", host.getUuid())); } return; } if (host.getType() != Host.Type.Routing && host.getType() != Host.Type.ConsoleProxy && host.getType() != Host.Type.SecondaryStorage && host.getType() != Host.Type.SecondaryStorageVM) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("host is of wrong type, not adding to the host list, (id = %s, type = %s)", host.getUuid(), host.getType())); } return; } if (host.getHypervisorType() != null && ! (host.getHypervisorType() == Hypervisor.HypervisorType.KVM || host.getHypervisorType() == Hypervisor.HypervisorType.LXC)) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("hypervisor is not the right type, not adding to the host list, (id = %s, hypervisortype = %s)", host.getUuid(), host.getHypervisorType())); } return; } agentBasedHosts.add(host); }

Target:
private void conditionallyAddHost(List<Host> agentBasedHosts, Host host) { if (host == null) { if (LOG.isTraceEnabled()) { LOG.trace("trying to add no host to a list"); } return; } EnumSet<ResourceState> allowedStates = EnumSet.of( ResourceState.Enabled, ResourceState.Maintenance, ResourceState.Disabled, ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance); if (!allowedStates.contains(host.getResourceState())) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("host is in '%s' state, not adding to the host list, (id = %s)", host.getResourceState(), host.getUuid())); } return; } if (host.getType() != Host.Type.Routing && host.getType() != Host.Type.ConsoleProxy && host.getType() != Host.Type.SecondaryStorage && host.getType() != Host.Type.SecondaryStorageVM) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("host is of wrong type, not adding to the host list, (id = %s, type = %s)", host.getUuid(), host.getType())); } return; } if (host.getHypervisorType() != null && ! (host.getHypervisorType() == Hypervisor.HypervisorType.KVM || host.getHypervisorType() == Hypervisor.HypervisorType.LXC)) { if (LOG.isTraceEnabled()) { LOG.trace(String.format("hypervisor is not the right type, not adding to the host list, (id = %s, hypervisortype = %s)", host.getUuid(), host.getHypervisorType())); } return; } agentBasedHosts.add(host); }
Source:
public void shouldThrowExceptionIfTemplateIsMalformed() throws Exception { when(settingsFacade.getRawConfig(INCORRECT_TEMPLATE)).thenReturn(loadFile(INCORRECT_TEMPLATE)); try { parser.mergeTemplateIntoString(INCORRECT_TEMPLATE, params); } finally { verify(settingsFacade, times(1)).getRawConfig(INCORRECT_TEMPLATE); } }

Target:
public void shouldThrowExceptionIfTemplateIsMalformed() throws Exception { try (FileInputStream template = loadFile(INCORRECT_TEMPLATE)) { when(settingsFacade.getRawConfig(INCORRECT_TEMPLATE)).thenReturn(template); parser.mergeTemplateIntoString(INCORRECT_TEMPLATE, params); } finally { verify(settingsFacade).getRawConfig(INCORRECT_TEMPLATE); } }