auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public long saveRun(Run run) throws IOException { if (runStore != null) { if (run.getId() == AbstractRun.UNSAVED_ID) { run.setName(generateTemporaryName()); run.setId(runStore.save(run)); try { String name = namingScheme.generateNameFor(run); run.setName(name); validateNameOrThrow(run, namingScheme); return runStore.save(run); } catch (MisoNamingException e) { throw new IOException("Cannot save Run - issue with generating name"); } } else { Run managed = getRunById(run.getId()); log.info("update run: " + managed); managed.setAlias(run.getAlias()); managed.setDescription(run.getDescription()); managed.setPairedEnd(run.getPairedEnd()); managed.setCycles(run.getCycles()); managed.setFilePath(run.getFilePath()); Status targetStatus = getStatusById(run.getStatus().getId()); targetStatus.setHealth(run.getStatus().getHealth()); targetStatus.setStartDate(run.getStatus().getStartDate()); targetStatus.setCompletionDate(run.getStatus().getCompletionDate()); targetStatus.setRunName(run.getAlias()); managed.setStatus(targetStatus); for (RunQC runQc : run.getRunQCs()) { if (!managed.getRunQCs().contains(runQc)) { try { managed.addQc(runQc); } catch (MalformedRunQcException e) { log.error("malformed runQC: ", e); } } } managed.setNotes(run.getNotes()); managed.setSequencingParameters(run.getSequencingParameters()); runStore.save(managed); return run.getId(); } } else { throw new IOException("No runStore available. Check that it has been declared in the Spring config."); } }

Target:
public long saveRun(Run run) throws IOException { if (runStore != null) { if (run.getId() == AbstractRun.UNSAVED_ID) { run.setName(generateTemporaryName()); run.setId(runStore.save(run)); try { String name = namingScheme.generateNameFor(run); run.setName(name); validateNameOrThrow(run, namingScheme); return runStore.save(run); } catch (MisoNamingException e) { throw new IOException("Cannot save Run - issue with generating name"); } } else { Run managed = getRunById(run.getId()); log.info("update run: " + managed); managed.setAlias(run.getAlias()); managed.setDescription(run.getDescription()); managed.setPairedEnd(run.getPairedEnd()); managed.setCycles(run.getCycles()); managed.setFilePath(run.getFilePath()); managed.getStatus().setHealth(run.getStatus().getHealth()); managed.getStatus().setStartDate(run.getStatus().getStartDate()); managed.getStatus().setCompletionDate(run.getStatus().getCompletionDate()); managed.getStatus().setInstrumentName(run.getStatus().getInstrumentName()); managed.getStatus().setRunName(run.getStatus().getRunName()); managed.getStatus().setXml(run.getStatus().getXml()); for (RunQC runQc : run.getRunQCs()) { if (!managed.getRunQCs().contains(runQc)) { try { managed.addQc(runQc); } catch (MalformedRunQcException e) { log.error("malformed runQC: ", e); } } } managed.setNotes(run.getNotes()); managed.setSequencingParameters(run.getSequencingParameters()); runStore.save(managed); return run.getId(); } } else { throw new IOException("No runStore available. Check that it has been declared in the Spring config."); } }
Source:
public QueryRunner<T> getRunner(QuerySegmentWalker walker) { return getQuerySegmentSpecForLookUp().lookup(this, walker); }

Target:
public QueryRunner<T> getRunner(QuerySegmentWalker walker) { return getQuerySegmentSpecForLookUp(this).lookup(this, walker); }
Source:
private static void validateEmail(String value) throws WSSecurityException { final EmailValidator validator = EmailValidator.getInstance(); if (!validator.isValid(value)) { throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid email address."); } }

Target:
private static void validateEmail(String value) throws WSSecurityException { if (!EmailValidator.getInstance().isValid(value)) { throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid email address."); } }
Source:
public SimpleFeatureCollection getFeatureCollection(String typeName, Filter filter) throws IOException { SimpleFeatureCollection collection; String filterXml = null; InputStream is = null; OutputStream os = null; DefaultHttpClient httpClient = new DefaultHttpClient(); if (filter != null) { try { FilterTransformer transformer = new FilterTransformer(); transformer.setOmitXMLDeclaration(true); transformer.setNamespaceDeclarationEnabled(false); filterXml = "<ogc:Filter>" + transformer.transform(filter) + "</ogc:Filter>"; } catch (TransformerException ex) { throw new RuntimeException("Specified filter cannot be transformed", ex); } } else { filterXml = ""; } try { HttpPost post = new HttpPost(wfsEndpoint); StringEntity stringEntity = new StringEntity(fillInTemplate(typeName, filterXml), ContentType.APPLICATION_XML); post.setEntity(stringEntity); HttpContext localContext = new BasicHttpContext(); httpClient.setReuseStrategy(new NoConnectionReuseStrategy()); HttpResponse methodResponse = httpClient.execute(post, localContext); if (methodResponse.getStatusLine().getStatusCode() != 200) { throw new IOException(methodResponse.getStatusLine().getReasonPhrase()); } is = methodResponse.getEntity().getContent(); os = new FileOutputStream(tmpWfsFile); IOUtils.copy(is, os); } finally { if (httpClient.getConnectionManager() != null) { httpClient.getConnectionManager().closeExpiredConnections(); } IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } collection = new GMLStreamingFeatureCollection(tmpWfsFile); return collection; }

Target:
public SimpleFeatureCollection getFeatureCollection(String typeName, Filter filter) throws IOException { SimpleFeatureCollection collection = null; String filterXml = null; InputStream is = null; OutputStream os = null; DefaultHttpClient httpClient = new DefaultHttpClient(); if (filter != null) { try { FilterTransformer transformer = new FilterTransformer(); transformer.setOmitXMLDeclaration(true); transformer.setNamespaceDeclarationEnabled(false); filterXml = "<ogc:Filter>" + transformer.transform(filter) + "</ogc:Filter>"; } catch (TransformerException ex) { throw new RuntimeException("Specified filter cannot be transformed", ex); } } else { filterXml = ""; } try { HttpPost post = new HttpPost(wfsEndpoint); StringEntity stringEntity = new StringEntity(fillInTemplate(typeName, filterXml), ContentType.APPLICATION_XML); post.setEntity(stringEntity); HttpContext localContext = new BasicHttpContext(); httpClient.setReuseStrategy(new NoConnectionReuseStrategy()); HttpResponse methodResponse = httpClient.execute(post, localContext); if (methodResponse.getStatusLine().getStatusCode() != 200) { throw new IOException(methodResponse.getStatusLine().getReasonPhrase()); } is = methodResponse.getEntity().getContent(); os = new FileOutputStream(tmpWfsFile); IOUtils.copy(is, os); } finally { if (httpClient.getConnectionManager() != null) { httpClient.getConnectionManager().closeExpiredConnections(); } IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } collection = new GMLStreamingFeatureCollection(tmpWfsFile); return collection; }
Source:
public void calculateFromDerivedFields() { numHomVar = Math.round(TOTAL_SNPS / (HET_HOMVAR_RATIO + 1.0)); numHets = TOTAL_SNPS - numHomVar; calculateFromDerivedFields(TOTAL_HET_DEPTH); }

Target:
public void calculateFromDerivedFields() { numHomVar = invertFromRatio(TOTAL_SNPS, HET_HOMVAR_RATIO); numHets = TOTAL_SNPS - numHomVar; calculateFromDerivedFields(TOTAL_HET_DEPTH); }
Source:
private String envName(Secret secret, String key) throws InfrastructureException { String mountEnvName; if (secret.getData().size() == 1) { try { mountEnvName = firstNonNull( secret.getMetadata().getAnnotations().get("envName"), secret.getMetadata().getAnnotations().get(key + ".envName")); } catch (NullPointerException e) { throw new InfrastructureException( format( "Unable to mount secret '%s': it has to be mounted as Env, but env name is not specified." + "Please make sure you specified 'envName' annotation of secret.'", secret.getMetadata().getName())); } } else { mountEnvName = secret.getMetadata().getAnnotations().get(key + ".envName"); if (mountEnvName == null) { throw new InfrastructureException( format( "Unable to mount key '%s' of secret '%s': it has to be mounted as Env, but env name is not specified." + "Please make sure you specified '%s.envName' annotation of secret.'", key, secret.getMetadata().getName(), key)); } } return mountEnvName; }

Target:
private String envName(Secret secret, String key) throws InfrastructureException { String mountEnvName; if (secret.getData().size() == 1) { try { mountEnvName = firstNonNull( secret.getMetadata().getAnnotations().get(ANNOTATION_ENV_NAME), secret .getMetadata() .getAnnotations() .get(format(ANNOTATION_ENV_NAME_TEMPLATE, key))); } catch (NullPointerException e) { throw new InfrastructureException( format( "Unable to mount secret '%s': It is configured to be mount as a environment variable, but its was not specified. Please define the '%s' annotation on the secret to specify it.", secret.getMetadata().getName(), ANNOTATION_ENV_NAME)); } } else { mountEnvName = secret.getMetadata().getAnnotations().get(format(ANNOTATION_ENV_NAME_TEMPLATE, key)); if (mountEnvName == null) { throw new InfrastructureException( format( "Unable to mount key '%s' of secret '%s': It is configured to be mount as a environment variable, but its was not specified. Please define the '%s' annotation on the secret to specify it.", key, secret.getMetadata().getName(), format(ANNOTATION_ENV_NAME_TEMPLATE, key))); } } return mountEnvName; }
Source:
public void editTitle(AgentPrincipals agent, PID pid, String title) throws Exception { try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit titles", pid, agent.getPrincipals(), Permission.editDescription); ContentObject obj = (ContentObject) repoObjLoader.getRepositoryObject(pid); BinaryObject mods = obj.getDescription(); String username = agent.getUsername(); String newMods; InputStream modsStream; try { modsStream = mods.getBinaryStream(); } catch (NullPointerException e) { modsStream = null; } if (modsStream != null) { String modsString = IOUtils.toString(modsStream, StandardCharsets.UTF_8); ByteArrayInputStream modsByteArray = new ByteArrayInputStream(modsString.getBytes()); SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false)); Document document = sb.build(modsByteArray); Element rootEl = document.getRootElement(); String oldTitle = getOldTitle(rootEl); if (oldTitle != "no mods:title") { newMods = updateTitle(document, title); } else { newMods = addTitleToMODS(document, title); } } else { Document document = new Document(); document.addContent(new Element("mods", MODS_V3_NS)); newMods = addTitleToMODS(document, title); } InputStream newModsStream = new ByteArrayInputStream(newMods.getBytes()); modsValidator.validate(newModsStream); obj.setDescription(newModsStream); } operationsMessageSender.sendUpdateDescriptionOperation(agent.getUsername(), Arrays.asList(pid)); }

Target:
public void editTitle(AgentPrincipals agent, PID pid, String title) { try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit titles", pid, agent.getPrincipals(), Permission.editDescription); ContentObject obj = (ContentObject) repoObjLoader.getRepositoryObject(pid); BinaryObject mods = obj.getDescription(); Document newMods; InputStream modsStream; if (mods != null) { modsStream = mods.getBinaryStream(); } else { modsStream = null; } if (modsStream != null) { SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false)); Document document; try { document = sb.build(modsStream); } catch (IOException | JDOMException e) { throw new ServiceException("Unable to build mods document for " + pid, e); } Element rootEl = document.getRootElement(); if (hasExistingTitle(rootEl)) { newMods = updateTitle(document, title); } else { newMods = addTitleToMODS(document, title); } } else { Document document = new Document(); document.addContent(new Element("mods", MODS_V3_NS)); newMods = addTitleToMODS(document, title); } InputStream newModsStream; try { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); new XMLOutputter().output(newMods, outStream); newModsStream = new ByteArrayInputStream(outStream.toByteArray()); } catch (IOException e) { throw new ServiceException("Unable to build new mods stream for " + pid, e); } modsValidator.validate(newModsStream); obj.setDescription(newModsStream); } operationsMessageSender.sendUpdateDescriptionOperation(agent.getUsername(), Arrays.asList(pid)); }
Source:
public void testGetRawRoutingData() throws IOException { Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); _testRawRoutingData .forEach((realm, keys) -> Assert.assertEquals(rawRoutingData.get(realm), keys)); }

Target:
public void testGetRawRoutingData() throws IOException { Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); _testRawRoutingData.forEach((realm, keys) -> Assert .assertEquals(new HashSet(rawRoutingData.get(realm)), new HashSet(keys))); }
Source:
public int hashCode() { return root.hashCode(); }

Target:
public int hashCode() { return root.hashCode() ^ refs.hashCode(); }
Source:
public static String getJarVersionNumber() { Class clazz = SelendroidStandaloneDriver.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); String version = ""; if (!classPath.startsWith("jar")) { String dev_path = ""; if(classPath.startsWith("file") && classPath.contains("target")) dev_path = classPath.substring(5, classPath.lastIndexOf("target")); try { version = getVersionFromPom(dev_path); } catch (Exception e) { e.printStackTrace(); return "pom file path may not exist"; } } else { try { version = getVersionFromManifest(classPath); } catch (IOException e){ return ""; } } return version; }

Target:
public static String getJarVersionNumber() { Class clazz = SelendroidStandaloneDriver.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); if (!classPath.startsWith("jar")) { return "dev"; } String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF"; Manifest manifest; try { manifest = new Manifest(new URL(manifestPath).openStream()); } catch (Exception e) { return ""; } Attributes attr = manifest.getMainAttributes(); return attr.getValue("version"); }
Source:
public MockResponse dispatch(RecordedRequest request) { String path = request.getPath(); String method = request.getMethod(); switch (method.toUpperCase()) { case POST: case PUT: return handleCreate(path, request.getBody().readUtf8()); case PATCH: return handlePatch(path, request.getBody().readUtf8()); case GET: return detectWatchMode(path)? handleWatch(request): handleGet(path); case DELETE: return handleDelete(path); default: return null; } }

Target:
public MockResponse dispatch(RecordedRequest request) { String path = request.getPath(); String method = request.getMethod(); switch (method.toUpperCase()) { case POST: return handleCreate(path, request.getBody().readUtf8()); case PUT: return handleReplace(path, request.getBody().readUtf8()); case PATCH: return handlePatch(path, request.getBody().readUtf8()); case GET: return detectWatchMode(path)? handleWatch(path): handleGet(path); case DELETE: return handleDelete(path); default: return null; } }
Source:
public void run(SourceContext sourceContext) { Random random = new Random(); for (int i = 0; i < recordCount; i++) { Row row = Row.of(random.nextInt(1000), NAMES[random.nextInt(NAMES.length)], random.nextDouble()); sourceContext.collect(row); } }

Target:
public void run(SourceContext sourceContext) { Random random = new Random(); for (int i = 0; i < NAMES.length; i++) { Row row = Row.of(i, NAMES[i]); sourceContext.collect(row); } }
Source:
public void testGetDocContent_markAllDocsPublic() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.<String, String>of ( "adaptor.markAllDocsAsPublic", "true")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); mockDocument(os, id, DOCUMENT_TIMESTAMP, true, 1000d, "text/plain"); DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); traverser.getDocContent(new Id(id), request, response); assertEquals( ImmutableSet.of(PropertyNames.ID, PropertyNames.DATE_LAST_MODIFIED, PropertyNames.CONTENT_SIZE, PropertyNames.MIME_TYPE), response.getMetadata().getKeys()); assertEquals("text/plain", response.getContentType()); byte[] actualContent = baos.toByteArray(); assertEquals("sample content", new String(actualContent, UTF_8)); assertFalse(response.isSecure()); assertNull(response.getAcl()); assertTrue(response.getNamedResources().isEmpty()); }

Target:
public void testGetDocContent_markAllDocsPublic() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.<String, String>of ( "adaptor.markAllDocsAsPublic", "true")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); mockDocument(os, id, DOCUMENT_TIMESTAMP, true, TestObjectFactory.getPermissions( PermissionSource.SOURCE_DIRECT, PermissionSource.SOURCE_TEMPLATE, PermissionSource.SOURCE_PARENT)); DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); traverser.getDocContent(new Id(id), request, response); assertEquals( ImmutableSet.of(PropertyNames.ID, PropertyNames.DATE_LAST_MODIFIED), response.getMetadata().getKeys()); byte[] actualContent = baos.toByteArray(); assertEquals("sample content", new String(actualContent, UTF_8)); assertFalse(response.isSecure()); assertNull(response.getAcl()); assertTrue(response.getNamedResources().isEmpty()); }
Source:
public boolean isFinished() { double distanceSum = 0; for (int i = 0; i < encoders.length; i++) { try { distanceSum += encoders[i].getDistanceSafely() - initialDistances[i]; LogKitten.d("Encoder " + i + " reads " + encoders[i].getDistanceSafely() + " out of " + distance); } catch (InvalidSensorException e) { cancel(); if (fallbackCommand != null) { fallbackCommand.initialize(); } return true; } } double distanceAvg = distanceSum / encoders.length; return distanceAvg >= distance; }

Target:
public boolean isFinished() { double distanceSum = 0; for (int i = 0; i < encoders.length; i++) { try { distanceSum += encoders[i].getDistanceSafely() - initialDistances[i]; LogKitten.d("Encoder " + i + " reads " + encoders[i].getDistanceSafely() + " out of " + distance); } catch (InvalidSensorException e) { cancel(); if (fallbackCommand != null) { fallbackCommand.schedule(); } return true; } } return distanceSum / (double) encoders.length >= distance; }
Source:
private boolean matches(final PairedReadSequence lhs, final PairedReadSequence rhs, final double maxDiffRate, final boolean useBarcodes) { final int read1Length = Math.min(lhs.read1.length, rhs.read1.length); final int read2Length = Math.min(lhs.read2.length, rhs.read2.length); final int maxErrors = (int) Math.floor((read1Length + read2Length) * maxDiffRate); int errors = 0; if (useBarcodes) { if (((PairedReadSequenceWithBarcodes) lhs).barcode != ((PairedReadSequenceWithBarcodes) rhs).barcode) return false; if (((PairedReadSequenceWithBarcodes) lhs).readOneBarcode != ((PairedReadSequenceWithBarcodes) rhs).readOneBarcode) return false; if (((PairedReadSequenceWithBarcodes) lhs).readTwoBarcode != ((PairedReadSequenceWithBarcodes) rhs).readTwoBarcode) return false; } for (int i = MIN_IDENTICAL_BASES; i < read1Length; ++i) { if (lhs.read1[i] != rhs.read1[i]) { if (++errors > maxErrors) return false; } } for (int i = MIN_IDENTICAL_BASES; i < read2Length; ++i) { if (lhs.read2[i] != rhs.read2[i]) { if (++errors > maxErrors) return false; } } return true; }

Target:
private boolean matches(final PairedReadSequence lhs, final PairedReadSequence rhs, final double maxDiffRate, final boolean useBarcodes) { final int read1Length = Math.min(lhs.read1.length, rhs.read1.length); final int read2Length = Math.min(lhs.read2.length, rhs.read2.length); final int maxErrors = (int) Math.floor((read1Length + read2Length) * maxDiffRate); int errors = 0; if (useBarcodes) { final PairedReadSequenceWithBarcodes lhsWithBarcodes = (PairedReadSequenceWithBarcodes) lhs; final PairedReadSequenceWithBarcodes rhsWithBarcodes = (PairedReadSequenceWithBarcodes) rhs; if (lhsWithBarcodes.barcode != rhsWithBarcodes.barcode || lhsWithBarcodes.readOneBarcode != rhsWithBarcodes.readOneBarcode || lhsWithBarcodes.readTwoBarcode != rhsWithBarcodes.readTwoBarcode) { return false; } } for (int i = MIN_IDENTICAL_BASES; i < read1Length; ++i) { if (lhs.read1[i] != rhs.read1[i]) { if (++errors > maxErrors) return false; } } for (int i = MIN_IDENTICAL_BASES; i < read2Length; ++i) { if (lhs.read2[i] != rhs.read2[i]) { if (++errors > maxErrors) return false; } } return true; }
Source:
public AccessControlPolicyIterator getApplicablePolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } JcrAccessControlList acl = getApplicableACL(absPath); if (!acl.isEmpty() && !acl.hasPrivileges(securityContext(), new Privilege[] { privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL) })) { throw new AccessDeniedException(); } CachedNode node = session.cachedNode(session.pathFactory().create(absPath), false); if (node.hasACL(session.cache())) { return AccessControlPolicyIteratorImpl.EMPTY; } return new AccessControlPolicyIteratorImpl(new JcrAccessControlList(this, absPath)); }

Target:
public AccessControlPolicyIterator getApplicablePolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } JcrAccessControlList acl = getApplicableACL(absPath); if (!acl.isEmpty() && !acl.hasPrivileges(securityContext(), new Privilege[] { privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL) })) { throw new AccessDeniedException(); } CachedNode node = session.cachedNode(session.pathFactory().create(absPath), false); if (node.hasACL(session.cache())) { return AccessControlPolicyIteratorImpl.EMPTY; } else { return new AccessControlPolicyIteratorImpl(new JcrAccessControlList(this, absPath)); } }
Source:
public ActionEventRequest deserialize(JsonElement element, Type type, JsonDeserializationContext context) { LOGGER.debug("Deserializing the json into ActionEventRequest object"); ActionEventRequest actionEvent = null; if (element.isJsonObject()) { JsonObject jsonObject = element.getAsJsonObject(); actionEvent = new ActionEventRequestBuilder().setDisplayName(getValue(jsonObject, DISPLAY_NAME_FIELD)) .setSubject(getValue(jsonObject, SUBJECT_FIELD)).setDescription(getValue(jsonObject, DESCRIPTION_FIELD)) .setServiceInterface(getValue(jsonObject, SERVICE_INTERFACE_FIELD)) .setServiceMethod(getValue(jsonObject, SERVICE_METHOD_FIELD)) .setServiceMethodCallManner(getValue(jsonObject, SERVICE_METHOD_CALL_MANNER_FIELD)) .setName(getValue(jsonObject, NAME_FIELD)).createActionEventRequest(); if (jsonObject.has(ACTION_PARAMETERS_FIELD)) { JsonArray jsonArray = jsonObject.getAsJsonArray(ACTION_PARAMETERS_FIELD); for (int i = 0; i < jsonArray.size(); ++i) { ActionParameterRequest parameter = context.deserialize(jsonArray.get(i), ActionParameterRequest.class); boolean changeOrder = parameter.getOrder() == null; actionEvent.addParameter(parameter, changeOrder); } } if (!actionEvent.isValid()) { throw new JsonParseException("Channel action must contains subject and/or serviceInterface and serviceMethod"); } } return actionEvent; }

Target:
public ActionEventRequest deserialize(JsonElement element, Type type, JsonDeserializationContext context) { ActionEventRequest actionEvent = null; if (element.isJsonObject()) { JsonObject jsonObject = element.getAsJsonObject(); actionEvent = new ActionEventRequestBuilder().setDisplayName(getValue(jsonObject, DISPLAY_NAME_FIELD)) .setSubject(getValue(jsonObject, SUBJECT_FIELD)).setDescription(getValue(jsonObject, DESCRIPTION_FIELD)) .setServiceInterface(getValue(jsonObject, SERVICE_INTERFACE_FIELD)) .setServiceMethod(getValue(jsonObject, SERVICE_METHOD_FIELD)) .setServiceMethodCallManner(getValue(jsonObject, SERVICE_METHOD_CALL_MANNER_FIELD)) .setName(getValue(jsonObject, NAME_FIELD)).createActionEventRequest(); if (jsonObject.has(ACTION_PARAMETERS_FIELD)) { JsonArray jsonArray = jsonObject.getAsJsonArray(ACTION_PARAMETERS_FIELD); for (int i = 0; i < jsonArray.size(); ++i) { ActionParameterRequest parameter = context.deserialize(jsonArray.get(i), ActionParameterRequest.class); boolean changeOrder = parameter.getOrder() == null; actionEvent.addParameter(parameter, changeOrder); } } if (!actionEvent.isValid()) { throw new JsonParseException("Channel action must contains subject and/or serviceInterface and serviceMethod"); } } return actionEvent; }
Source:
public void testWriteAttributeWithCredentialReferenceWithClearTextOnly() throws Exception { try { String newPassword = "newPassword"; getNonEmptyCredentialStore(); addKeyStoreWithCredentialReference(KS_NAME, NON_EMPTY_CS_NAME, EXISTING_ALIAS, null, true); testWriteCredentialReferenceAttribute("key-store", KS_NAME, null, null, newPassword, false); assertEquals(newPassword, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertEquals(null, readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); assertEquals(null, readAttribute(KS_NAME, STORE_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }

Target:
public void testWriteAttributeWithCredentialReferenceWithClearTextOnly() throws Exception { try { String newPassword = "newPassword"; getNonEmptyCredentialStore(); addKeyStoreWithCredentialReference(KS_NAME, NON_EMPTY_CS_NAME, EXISTING_ALIAS, null, true); testWriteCredentialReferenceAttribute("key-store", KS_NAME, null, null, newPassword, false); assertEquals(newPassword, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertNull(readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); assertNull(readAttribute(KS_NAME, STORE_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }
Source:
protected void updateStorageDomainFromIrs() { final StorageDomainDynamic sdDynamicFromIrs = executeGetStorageDomainStats(); final StorageDomainStatic sdStaticFromIrs = executeHSMGetStorageDomainInfo(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntity(getStorageDomain().getStorageDynamicData()); storageDomainDynamicDao.update(sdDynamicFromIrs); StorageDomainStatic sdStatic = storageDomainStaticDao.get(getStorageDomain().getId()); sdStatic.setBlockSize(sdStaticFromIrs.getBlockSize()); storageDomainStaticDao.update(sdStatic); getCompensationContext().stateChanged(); return null; }); }

Target:
protected void updateStorageDomainFromIrs() { final StorageDomainDynamic sdDynamicFromIrs = getStorageDomainDynamic(); final StorageDomainStatic sdStaticFromIrs = getStorageDomainStatic(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntity(getStorageDomain().getStorageDynamicData()); storageDomainDynamicDao.update(sdDynamicFromIrs); StorageDomainStatic sdStatic = storageDomainStaticDao.get(getStorageDomain().getId()); sdStatic.setBlockSize(sdStaticFromIrs.getBlockSize()); storageDomainStaticDao.update(sdStatic); getCompensationContext().stateChanged(); return null; }); }
Source:
protected void onBind() { Brand brand = Brand.getDefaultValue(); ProductDto shirt = new ProductDto(); shirt.setBrand(brand); shirt.setPrice(55); shirt.setProduct(Product.SHIRT); ProductDto bag = new ProductDto(); bag.setBrand(brand); bag.setPrice(55); bag.setProduct(Product.BAG); addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(Side.LEFT, shirt)); addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(Side.RIGHT, bag)); ProductDto cup = new ProductDto(); cup.setBrand(brand); cup.setPrice(55); cup.setProduct(Product.THERMOS); ProductDto phoneCase = new ProductDto(); phoneCase.setBrand(brand); phoneCase.setPrice(55); phoneCase.setProduct(Product.PHONE_CASE); ProductDto key = new ProductDto(); key.setBrand(brand); key.setPrice(55); key.setProduct(Product.USB_KEY); ProductDto mug = new ProductDto(); mug.setBrand(brand); mug.setPrice(55); mug.setProduct(Product.MUG); SecondaryProductPresenter cupPresenter = productFactory.create(cup); SecondaryProductPresenter keyPresenter = productFactory.create(key); SecondaryProductPresenter mugPresenter = productFactory.create(mug); SecondaryProductPresenter phoneCasePresenter = productFactory.create(phoneCase); addToSlot(SLOT_SECONDARY_PRODUCTS, cupPresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, phoneCasePresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, keyPresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, mugPresenter); }

Target:
protected void onBind() { Brand brand = currentBrand.get(); ProductDto shirt = new ProductDto(); shirt.setBrand(brand); shirt.setProduct(Product.SHIRT); ProductDto bag = new ProductDto(); bag.setBrand(brand); bag.setProduct(Product.BAG); addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(Side.LEFT, shirt)); addToSlot(SLOT_MAIN_PRODUCTS, productFactory.create(Side.RIGHT, bag)); ProductDto cup = new ProductDto(); cup.setBrand(brand); cup.setProduct(Product.THERMOS); ProductDto phoneCase = new ProductDto(); phoneCase.setBrand(brand); phoneCase.setProduct(Product.PHONE_CASE); ProductDto key = new ProductDto(); key.setBrand(brand); key.setProduct(Product.USB_KEY); ProductDto mug = new ProductDto(); mug.setBrand(brand); mug.setProduct(Product.MUG); SecondaryProductPresenter cupPresenter = productFactory.create(cup); SecondaryProductPresenter keyPresenter = productFactory.create(key); SecondaryProductPresenter mugPresenter = productFactory.create(mug); SecondaryProductPresenter phoneCasePresenter = productFactory.create(phoneCase); addToSlot(SLOT_SECONDARY_PRODUCTS, cupPresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, phoneCasePresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, keyPresenter); addToSlot(SLOT_SECONDARY_PRODUCTS, mugPresenter); }
Source:
public Method getOnPongMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(PongMessage.class)) { return method; } } } return null; }

Target:
public Method getOnPongMessageMethod(Object webSocketEndpoint) { Method[] methods = webSocketEndpoint.getClass().getMethods(); if (methods == null) { return null; } for (Method method : methods) { if (method.isAnnotationPresent(OnMessage.class)) { Class<?>[] paraTypes = method.getParameterTypes(); List<Class<?>> paraList = Arrays.asList(paraTypes); if (paraList.contains(PongMessage.class)) { return method; } } } return null; }
Source:
public ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType) { this.actualTypeArguments = actualTypeArguments.clone(); this.rawType = rawType; this.ownerType = ownerType; }

Target:
public ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType) { this.actualTypeArguments = actualTypeArguments; this.rawType = rawType; this.ownerType = ownerType; }
Source:
public void testRequiredOnlySetWhenVisible() throws JSONException { NestedProperties props = new NestedProperties("foo"); props.init(); JsonSchemaGenerator generator = new JsonSchemaGenerator(); ObjectNode genSchema = generator.genSchema(props, Form.MAIN); String expectedComplete = "{\"title\":\"\",\"type\":\"object\",\"properties\":{\"myNestedStr\":{\"title\":\"property.myNestedStr.displayName\",\"type\":\"string\"},\"myNestedMultiValueStr\":{\"title\":\"property.myNestedMultiValueStr.displayName\",\"type\":\"string\",\"enum\":[\"a\",\"b\"],\"enumNames\":[\"Ai18n\",\"Bi18n\"]}}}"; System.out.println(genSchema.toString()); assertEquals(expectedComplete, genSchema.toString(), true); }

Target:
public void testRequiredOnlySetWhenVisible() throws JSONException { NestedProperties props = new NestedProperties("foo"); props.init(); JsonSchemaGenerator generator = new JsonSchemaGenerator(); ObjectNode genSchema = generator.generateJsonSchema(props, Form.MAIN); String expectedComplete = "{\"title\":\"\",\"type\":\"object\",\"properties\":{\"myNestedStr\":{\"title\":\"property.myNestedStr.displayName\",\"type\":\"string\"},\"myNestedMultiValueStr\":{\"title\":\"property.myNestedMultiValueStr.displayName\",\"type\":\"string\",\"enum\":[\"a\",\"b\"],\"enumNames\":[\"Ai18n\",\"Bi18n\"]}}}"; assertEquals(expectedComplete, genSchema.toString(), true); }
Source:
private Function<PollingContext<KeyVaultCertificateWithPolicy>, Mono<PollResponse<KeyVaultCertificateWithPolicy>>> createRecoverPollOperation(String keyName) { return pollingContext -> withContext(context -> service.getCertificatePoller(vaultUrl, keyName, "", API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(certificateResponse -> { if (certificateResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } if (certificateResponse.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.fromString("FORBIDDEN", true), pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, certificateResponse.getValue()))); })) .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); }

Target:
private Function<PollingContext<KeyVaultCertificateWithPolicy>, Mono<PollResponse<KeyVaultCertificateWithPolicy>>> createRecoverPollOperation(String keyName) { return pollingContext -> withContext(context -> service.getCertificatePoller(vaultUrl, keyName, "", API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(certificateResponse -> { if (certificateResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } if (certificateResponse.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, certificateResponse.getValue()))); })) .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); }
Source:
public void showHealthForProbes(HttpServletResponse response) throws IOException { Result result = health.status(Health.FailurePolicy.ANY); response.setStatus(result.getStatus() == Status.HEALTHY ? SC_OK : SC_INTERNAL_SERVER_ERROR ); PrintWriter writer = response.getWriter(); result.getProbeResults().forEach(probeResult -> { writer.println( String.format( "%s: %s", probeResult.getIdentifier(), probeResult.getStatus().toString() ) ); probeResult.getMsg().ifPresent(writer::println); probeResult.getReason().ifPresent(writer::println); writer.println(); }); }

Target:
public void showHealthForProbes(HttpServletResponse response) throws IOException { Result result = health.status(Health.FailurePolicy.ALL); response.setContentType("application/json"); response.setStatus(result.getStatus() == Status.HEALTHY ? SC_OK : SC_INTERNAL_SERVER_ERROR ); mapper.writeValue(response.getWriter(), result.getProbeResults()); }
Source:
private boolean stopmodule(DashboardModule module) { IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ActiveModuleBrowserView.ID); ActiveModuleBrowserView ambv = (ActiveModuleBrowserView)ivp; GraphTreeNode graphNode; DashboardGraphData graphData; boolean stop = false; if(ambv.isActive(module)) { ActiveModuleTreeNode node = ambv.remove(module); ActiveModuleData amd = (ActiveModuleData)node.getData(); ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(DashboardView.ID); DashboardView dv = (DashboardView)ivp; for(int i=0; i<node.getChildCount(); i++) { graphNode = (GraphTreeNode)node.getChildAt(i); graphData = (DashboardGraphData)graphNode.getData(); if(null != graphData.adapter) { dv.removeGraph(graphData.adapter, module.getcategory()); graphData.adapter = null; } } if(!amd.paused) { if (amd.cmd.isRunning()) amd.cmd.stop(); amd.data = null; } dv.closeComposite(amd.module.category); amd = null; fireActionEvent(); } setEnablement(false); buildEnablementChecks(); return stop; }

Target:
private void stopmodule(DashboardModule module) { IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ActiveModuleBrowserView.ID); ActiveModuleBrowserView ambv = (ActiveModuleBrowserView)ivp; GraphTreeNode graphNode; DashboardGraphData graphData; if(ambv.isActive(module)) { ActiveModuleTreeNode node = ambv.remove(module); ActiveModuleData amd = (ActiveModuleData)node.getData(); ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(DashboardView.ID); DashboardView dv = (DashboardView)ivp; for(int i=0; i<node.getChildCount(); i++) { graphNode = (GraphTreeNode)node.getChildAt(i); graphData = (DashboardGraphData)graphNode.getData(); if(null != graphData.adapter) { dv.removeGraph(graphData.adapter, module.getcategory()); graphData.adapter = null; } } if(!amd.paused) { if (amd.cmd.isRunning()) amd.cmd.stop(); amd.data = null; } dv.closeComposite(amd.module.category); amd = null; fireActionEvent(); } setEnablement(false); buildEnablementChecks(); }
Source:
private String toDenonValue(BigDecimal percent) { BigDecimal round = new BigDecimal("0.5"); percent = percent.divide(round).setScale(0, RoundingMode.UP).multiply(round).min(connection.getMainVolumeMax()).max(BigDecimal.ZERO); String dbString = String.valueOf(percent.intValue()); if (percent.compareTo(new BigDecimal("10")) == -1) { dbString = "0" + dbString; } if (percent.remainder(BigDecimal.ONE).equals(new BigDecimal("0.5"))) { dbString = dbString + "5"; } return dbString; }

Target:
private String toDenonValue(BigDecimal percent) { percent = percent.divide(POINTFIVE).setScale(0, RoundingMode.UP) .multiply(POINTFIVE) .min(connection.getMainVolumeMax()) .max(BigDecimal.ZERO); String dbString = String.valueOf(percent.intValue()); if (percent.compareTo(BigDecimal.TEN) == -1) { dbString = "0" + dbString; } if (percent.remainder(BigDecimal.ONE).equals(POINTFIVE)) { dbString = dbString + "5"; } return dbString; }
Source:
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.EMPI_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType) { if (theTargetType == null) { myEmpiExpungeSvc.expungeEmpiLinks(); } else { myEmpiExpungeSvc.expungeEmpiLinks(theTargetType.getValueNotNull()); } return new Parameters(); }

Target:
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.EMPI_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType) { long resetCount; if (theTargetType == null || StringUtils.isBlank(theTargetType.getValue())) { resetCount = myEmpiExpungeSvc.removeAllEmpiLinks(); } else { resetCount = myEmpiExpungeSvc.expungeAllEmpiLinksOfTargetType(theTargetType.getValueNotNull()); } Parameters parameters = new Parameters(); parameters.addParameter().setName(ProviderConstants.OPERATION_EMPI_CLEAR_OUT_PARAM_DELETED_COUNT) .setValue(new DecimalType(resetCount)); return parameters; }
Source:
public void checkBubbles() { Iterator<Bubble> i = bubbles.iterator(); while (i.hasNext()) { Bubble bubble = i.next(); if (bubble.checkPop() && !bubble.getIsPrisonBubble()) { i.remove(); levelController.getScreenController().removeSprite(bubble); Logger.log(String.format("Bubble is popped")); } } }

Target:
public void checkBubbles() { Iterator<Bubble> i = bubbles.iterator(); while (i.hasNext()) { Bubble bubble = i.next(); if (bubble.checkPop() && !bubble.getIsPrisonBubble()) { i.remove(); levelController.getScreenController().removeSprite(bubble); Logger.log("Bubble is popped"); } } }
Source:
public boolean equals(Object o) { if (o instanceof CaseManagementSet) { CaseManagementSet other = (CaseManagementSet) o; return caseRoles.equals(other.caseRoles) && caseFileVariables.equals(other.caseFileVariables); } return false; }

Target:
public boolean equals(Object o) { if (o instanceof CaseManagementSet) { CaseManagementSet other = (CaseManagementSet) o; return Objects.equals(caseRoles, other.caseRoles) && Objects.equals(caseFileVariables, other.caseFileVariables); } return false; }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.sf__fingerprint_dialog, container, false); final Button cancelButton = v.findViewById(R.id.sf__use_password_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dismiss(); mContext.biometricDeclined(); } }); mStatusText = v.findViewById(R.id.sf__fingerprint_status); ApplicationInfo applicationInfo = mContext.getApplicationInfo(); int resId = applicationInfo.labelRes; String appName = resId == 0 ? "" : getString(resId); TextView textView = v.findViewById(R.id.sf__fingerprint_description); textView.setText(getString(R.string.sf__fingerprint_description, appName)); getDialog().setCanceledOnTouchOutside(false); return v; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View v = inflater.inflate(R.layout.sf__fingerprint_dialog, container, false); final Button cancelButton = v.findViewById(R.id.sf__use_password_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dismiss(); mContext.biometricDeclined(); } }); mStatusText = v.findViewById(R.id.sf__fingerprint_status); TextView textView = v.findViewById(R.id.sf__fingerprint_description); textView.setText(getString(R.string.sf__fingerprint_description, SalesforceSDKManager.getInstance().provideAppName())); getDialog().setCanceledOnTouchOutside(false); return v; }
Source:
public void testEventProgress() { EventApi eventApi = EasyMock.createMock(EventApi.class); DigitalOceanApi api = EasyMock.createMock(DigitalOceanApi.class); expect(eventApi.get(1)).andReturn(event(Status.DONE)); expect(eventApi.get(2)).andReturn(event(Status.PENDING)); expect(api.getEventApi()).andReturn(eventApi).times(2); replay(eventApi); replay(api); EventDonePredicate predicate = new EventDonePredicate(api); assertTrue(predicate.apply(1)); assertFalse(predicate.apply(2)); verify(eventApi); verify(api); }

Target:
public void testEventProgress() { EventApi eventApi = EasyMock.createMock(EventApi.class); DigitalOceanApi api = EasyMock.createMock(DigitalOceanApi.class); expect(eventApi.get(1)).andReturn(event(Status.DONE)); expect(eventApi.get(2)).andReturn(event(Status.PENDING)); expect(api.getEventApi()).andReturn(eventApi).times(2); replay(eventApi, api); EventDonePredicate predicate = new EventDonePredicate(api); assertTrue(predicate.apply(1)); assertFalse(predicate.apply(2)); }
Source:
private ResourcePageSource createPageSource(String poolName, ServerSideConfiguration.Pool pool) throws ResourceConfigurationException { ResourcePageSource pageSource; OffHeapResource source = services.getService(OffHeapResourceIdentifier.identifier(pool.getServerResource())); if (source == null) { throw new ResourceConfigurationException("Non-existent server side resource '" + pool.getServerResource() + "'. Available resources are: " + offHeapResourceIdentifiers); } else if (source.reserve(pool.getSize())) { try { pageSource = new ResourcePageSource(pool); registerStatistic(pageSource, poolName, "allocatedMemory" ,new Callable<Number>() { @Override public Number call() throws Exception { return pageSource.delegatePageSource.getAllocatedSize(); } }); } catch (RuntimeException t) { source.release(pool.getSize()); throw new ResourceConfigurationException("Failure allocating pool " + pool, t); } LOGGER.info("Reserved bytes from resource '{}' for pool '{}'", pool.getSize(), pool.getServerResource(), poolName); } else { throw new ResourceConfigurationException("Insufficient defined resources to allocate pool " + poolName + "=" + pool); } return pageSource; }

Target:
private ResourcePageSource createPageSource(String poolName, ServerSideConfiguration.Pool pool) throws ResourceConfigurationException { ResourcePageSource pageSource; OffHeapResource source = services.getService(OffHeapResourceIdentifier.identifier(pool.getServerResource())); if (source == null) { throw new ResourceConfigurationException("Non-existent server side resource '" + pool.getServerResource() + "'. Available resources are: " + offHeapResourceIdentifiers); } else if (source.reserve(pool.getSize())) { try { pageSource = new ResourcePageSource(pool); registerPoolStatistics(poolName, pageSource); } catch (RuntimeException t) { source.release(pool.getSize()); throw new ResourceConfigurationException("Failure allocating pool " + pool, t); } LOGGER.info("Reserved bytes from resource '{}' for pool '{}'", pool.getSize(), pool.getServerResource(), poolName); } else { throw new ResourceConfigurationException("Insufficient defined resources to allocate pool " + poolName + "=" + pool); } return pageSource; }
Source:
public void newTerminal() { workspaceAgent.setActivePart(this); final ProcessTreeNode selectedTreeNode = view.getSelectedTreeNode(); final MachineEntity devMachine = appContext.getDevMachine(); if (selectedTreeNode == null && devMachine != null) { onAddTerminal(devMachine); return; } if (selectedTreeNode == null) { notificationManager.notify(localizationConstant.failedToConnectTheTerminal(), localizationConstant.machineNotFound(""), FAIL, FLOAT_MODE); return; } if (selectedTreeNode.getType() == MACHINE_NODE) { MachineEntity machine = (MachineEntity)selectedTreeNode.getData(); onAddTerminal(machine); return; } ProcessTreeNode parent = selectedTreeNode.getParent(); if (parent != null && parent.getType() == MACHINE_NODE) { MachineEntity machine = (MachineEntity)selectedTreeNode.getData(); onAddTerminal(machine); } }

Target:
public void newTerminal() { workspaceAgent.setActivePart(this); final ProcessTreeNode selectedTreeNode = view.getSelectedTreeNode(); final MachineEntity devMachine = appContext.getDevMachine(); if (selectedTreeNode == null && devMachine != null) { onAddTerminal(devMachine.getId()); return; } if (selectedTreeNode == null) { String notificationTitle = localizationConstant.failedToConnectTheTerminal(); String notificationContent = localizationConstant.machineNotFound(""); notificationManager.notify(notificationTitle, notificationContent, FAIL, FLOAT_MODE); return; } if (selectedTreeNode.getType() == MACHINE_NODE) { MachineEntity machine = (MachineEntity)selectedTreeNode.getData(); onAddTerminal(machine.getId()); return; } ProcessTreeNode parent = selectedTreeNode.getParent(); if (parent != null && parent.getType() == MACHINE_NODE) { MachineEntity machine = (MachineEntity)selectedTreeNode.getData(); onAddTerminal(machine.getId()); } }