auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Builder() { id("hpcloud-compute") .name("HP Cloud Compute Services") .apiMetadata(new NovaApiMetadata().toBuilder() .identityName("${tenantName}:${accessKey}") .credentialName("${secret}") .version("2") .endpointName("identity service url ending in /v2.0/") .defaultEndpoint("<LINK_2>") .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(MappedAuthenticationApiModule.class) .add(KeystoneAuthenticationModule.class) .add(ZoneModule.class) .add(NovaParserModule.class) .add(NovaRestClientModule.class) .add(HPCloudComputeServiceContextModule.class).build()) .build()) .homepage(URI.create("<LINK_0>")) .console(URI.create("<LINK_1>")) .linkedServices("hpcloud-compute", "hpcloud-objectstorage") .iso3166Codes("US-NV", "US-VA") .endpoint("<LINK_2>") .defaultProperties(HPCloudComputeProviderMetadata.defaultProperties()); }

Target:
protected Builder() { id("hpcloud-compute") .name("HP Cloud Compute Services") .apiMetadata(new NovaApiMetadata().toBuilder() .identityName("${tenantName}:${accessKey}") .credentialName("${secretKey}") .version("2") .endpointName("identity service url ending in /v2.0/") .defaultEndpoint("<LINK_2>") .defaultModules(ImmutableSet.<Class<? extends Module>>builder() .add(MappedAuthenticationApiModule.class) .add(KeystoneAuthenticationModule.class) .add(ZoneModule.class) .add(NovaParserModule.class) .add(NovaRestClientModule.class) .add(HPCloudComputeServiceContextModule.class).build()) .build()) .homepage(URI.create("<LINK_0>")) .console(URI.create("<LINK_1>")) .linkedServices("hpcloud-compute", "hpcloud-objectstorage") .iso3166Codes("US-NV", "US-VA") .endpoint("<LINK_2>") .defaultProperties(HPCloudComputeProviderMetadata.defaultProperties()); }
Source:
public void testAnyOrderedReading() throws Exception { ArrayDeque<Object> expectedOutput = new ArrayDeque<>(); expectedOutput.add(new StreamRecord<>("[1]: Hello-1")); expectedOutput.add(new StreamRecord<>("[2]: 1")); expectedOutput.add(new StreamRecord<>("[1]: Hello-2")); expectedOutput.add(new StreamRecord<>("[2]: 2")); expectedOutput.add(new StreamRecord<>("[1]: Hello-3")); expectedOutput.add(new StreamRecord<>("[2]: 3")); expectedOutput.add(new StreamRecord<>("[2]: 4")); testBase(new TestAnyModeMultipleInputStreamOperator.Factory(), false, expectedOutput, true); }

Target:
public void testAnyOrderedReading() throws Exception { ArrayDeque<Object> expectedOutput = new ArrayDeque<>(); expectedOutput.add(new StreamRecord<>("[1]: Hello-1")); expectedOutput.add(new StreamRecord<>("[2]: 1")); expectedOutput.add(new StreamRecord<>("[1]: Hello-2")); expectedOutput.add(new StreamRecord<>("[2]: 2")); expectedOutput.add(new StreamRecord<>("[1]: Hello-3")); expectedOutput.add(new StreamRecord<>("[2]: 3")); expectedOutput.add(new StreamRecord<>("[2]: 4")); testInputSelection(new TestAnyModeMultipleInputStreamOperator.Factory(), false, expectedOutput, true); }
Source:
public IIrsServer getIrsProxy() { if (getmIrsProxy() == null) { final StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().get(_storagePoolId); if (storagePool.getStatus() != StoragePoolStatus.Uninitialized) { String host = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<String>() { @Override public String runInTransaction() { return gethostFromVds(); } }); if (host != null) { int clientTimeOut = Config.<Integer> getValue(ConfigValues.vdsTimeout) * 1000; int connectionTimeOut = Config.<Integer> getValue(ConfigValues.vdsConnectionTimeout) * 1000; int clientRetries = Config.<Integer> getValue(ConfigValues.vdsRetries); privatemIrsProxy = TransportFactory.createIrsServer(getProtocol(), host, getmIrsPort(), clientTimeOut, connectionTimeOut, clientRetries); runStoragePoolUpEvent(storagePool); } } } return getmIrsProxy(); }

Target:
public IIrsServer getIrsProxy() { if (getmIrsProxy() == null) { final StoragePool storagePool = DbFacade.getInstance().getStoragePoolDao().get(_storagePoolId); if (storagePool.getStatus() != StoragePoolStatus.Uninitialized) { String host = TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<String>() { @Override public String runInTransaction() { return gethostFromVds(); } }); if (host != null) { int clientTimeOut = Config.<Integer> getValue(ConfigValues.vdsTimeout) * 1000; int connectionTimeOut = Config.<Integer> getValue(ConfigValues.vdsConnectionTimeout) * 1000; int clientRetries = Config.<Integer> getValue(ConfigValues.vdsRetries); irsProxy = TransportFactory.createIrsServer(getProtocol(), host, getmIrsPort(), clientTimeOut, connectionTimeOut, clientRetries); runStoragePoolUpEvent(storagePool); } } } return getmIrsProxy(); }
Source:
protected IConnectionWrapper createConnection(IServer server) { IConnection openshiftCon = OpenShiftServerUtils.getConnection(server); IResource resource = OpenShiftServerUtils.getResource(server); String token = ((Connection)openshiftCon).getToken(); String projName = resource.getNamespace(); List<IPod> pods = ResourceUtils.getPodsFor(resource, resource.getProject().getResources(ResourceKind.POD)); if( pods.size() == 0 ) { return null; } String pod = pods.get(0).getName(); String host = server.getHost(); String url = "https://" + host + ":8443/api/v1/namespaces/" + projName + "/pods/https:" + pod + ":8778/proxy/jolokia/"; String headerKey = "Authorization"; String headerVal = "Bearer " + token; JolokiaConnectionWrapper cw = new JolokiaConnectionWrapper() { public IConnectionProvider getProvider() { return ExtensionManager.getProvider(PROVIDER_ID); } protected void verifyServerReachable() throws IOException { super.verifyServerReachable(); } }; cw.setId(server.getName()); cw.setUrl(url); cw.setType("POST"); cw.setIgnoreSSLErrors(true); HashMap<String, String> headers = new HashMap<String, String>(); headers.put(headerKey, headerVal); cw.setHeaders(headers); return cw; }

Target:
protected IConnectionWrapper createConnection(IServer server) { IConnection openshiftCon = OpenShiftServerUtils.getConnection(server); IResource resource = OpenShiftServerUtils.getResource(server); if (resource == null) { return null; } String token = ((Connection)openshiftCon).getToken(); String projName = resource.getNamespace(); List<IPod> pods = ResourceUtils.getPodsFor(resource, resource.getProject().getResources(ResourceKind.POD)); if( pods.size() == 0 ) { return null; } String pod = pods.get(0).getName(); String host = server.getHost(); String url = "https://" + host + ":8443/api/v1/namespaces/" + projName + "/pods/https:" + pod + ":8778/proxy/jolokia/"; String headerKey = "Authorization"; String headerVal = "Bearer " + token; JolokiaConnectionWrapper cw = new JolokiaConnectionWrapper() { public IConnectionProvider getProvider() { return ExtensionManager.getProvider(PROVIDER_ID); } protected void verifyServerReachable() throws IOException { super.verifyServerReachable(); } }; cw.setId(server.getName()); cw.setUrl(url); cw.setType("POST"); cw.setIgnoreSSLErrors(true); HashMap<String, String> headers = new HashMap<String, String>(); headers.put(headerKey, headerVal); cw.setHeaders(headers); return cw; }
Source:
private Request request() { Map<String, Object> request = new ArrayMap<>(); request.put("kind", mKind.name); Map<String, Object> metadata = new ArrayMap<>(); metadata.put("sender", mSender.getId()); metadata.put("date-time", formatDate( new Date())); request.put("metadata", new JSONObject(metadata)); request.put("message", new JSONObject(mConstructingMap)); return new Request(new JSONObject(request)); }

Target:
private Request request() { Map<String, Object> request = new ArrayMap<>(); request.put("kind", mKind.name); Map<String, Object> metadata = new ArrayMap<>(); metadata.put("sender", mSender.getId()); metadata.put("datetime", formatDate( new Date())); request.put("metadata", new JSONObject(metadata)); request.put("message", new JSONObject(mConstructingMap)); return new Request(new JSONObject(request)); }
Source:
protected void writeViaTable(TableName tableName, int rowCount) throws IOException { List<Put> puts = new ArrayList<>(); for (int i = 0; i < rowCount; i++) { byte[] row = Bytes.toBytes("row_" + i); puts.add(new Put(row).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes(RandomStringUtils.randomAlphanumeric(8)))); } try (Table t = connection.getTable(tableName);) { t.put(puts); } }

Target:
private void writeViaTable(TableName tableName, int rowCount) throws IOException { List<Put> puts = new ArrayList<>(); for (int i = 0; i < rowCount; i++) { byte[] row = Bytes.toBytes("row_" + i); puts.add(new Put(row).addColumn(COLUMN_FAMILY, QUALIFIER1, Bytes.toBytes(RandomStringUtils.randomAlphanumeric(8)))); } try (Table t = connection.getTable(tableName);) { t.put(puts); } }
Source:
private final boolean acceptAsDataset(Oaf oafObj) { if (oafObj.getEntity() != null && oafObj.getEntity().getResult() != null && oafObj.getEntity().getResult().getMetadata() != null && oafObj.getEntity().getResult().getMetadata().getResulttype() != null) { if (approvedDatasetResultTypes.contains(oafObj.getEntity().getResult().getMetadata().getResulttype().getClassid())) { return true; } } return false; }

Target:
private boolean acceptAsDataset(Oaf oafObj) { return Optional.ofNullable(oafObj.getEntity()).map(OafProtos.OafEntity::getResult) .map(ResultProtos.Result::getMetadata).map(ResultProtos.Result.Metadata::getResulttype) .map(FieldTypeProtos.Qualifier::getClassid).map(classid -> approvedDatasetResultTypes.contains(classid)) .orElse(false); }
Source:
void onErrorResponse(ReplicaId replicaId, RouterException exception) { logger.info("Get exception: " + exception); operationTracker.onResponse(replicaId, TrackedRequestFinalState.fromRouterErrorCodeToFinalState(exception.getErrorCode())); setOperationException(exception); if (exception.getErrorCode() != RouterErrorCode.BlobDeleted && exception.getErrorCode() != RouterErrorCode.BlobExpired) { routerMetrics.routerRequestErrorCount.inc(); } routerMetrics.getDataNodeBasedMetrics(replicaId.getDataNodeId()).deleteRequestErrorCount.inc(); }

Target:
private void onErrorResponse(ReplicaId replicaId, RouterException exception) { operationTracker.onResponse(replicaId, TrackedRequestFinalState.fromRouterErrorCodeToFinalState(exception.getErrorCode())); setOperationException(exception); routerMetrics.routerRequestErrorCount.inc(); routerMetrics.getDataNodeBasedMetrics(replicaId.getDataNodeId()).deleteRequestErrorCount.inc(); }
Source:
public static ImmutableMap<String, AppleToolchain> discoverAppleToolchains( Optional<Path> developerDir, ImmutableList<Path> extraDirs) throws IOException { ImmutableMap.Builder<String, AppleToolchain> toolchainIdentifiersToToolchainsBuilder = ImmutableMap.builder(); HashSet<Path> toolchainPaths = new HashSet<Path>(extraDirs); if (developerDir.isPresent()) { Path toolchainsDir = developerDir.get().resolve("Toolchains"); LOG.debug("Searching for Xcode toolchains under %s", toolchainsDir); toolchainPaths.add(toolchainsDir); } for (Path toolchains : toolchainPaths) { if (!Files.exists(toolchains)) { LOG.debug("Skipping toolchain search path %s that does not exist", toolchains); continue; } LOG.debug("Searching for Xcode toolchains in %s", toolchains); try (DirectoryStream<Path> toolchainStream = Files.newDirectoryStream(toolchains, "*.xctoolchain")) { List<Path> sortedToolchainPaths = new ArrayList<>(); toolchainStream.forEach(sortedToolchainPaths::add); sortedToolchainPaths.sort(Comparator.comparing(Path::toString)); for (Path toolchainPath : sortedToolchainPaths) { LOG.debug("Getting identifier for for Xcode toolchain under %s", toolchainPath); addIdentifierForToolchain(toolchainPath, toolchainIdentifiersToToolchainsBuilder); } } } return toolchainIdentifiersToToolchainsBuilder.build(); }

Target:
public static ImmutableMap<String, AppleToolchain> discoverAppleToolchains( Optional<Path> developerDir, ImmutableList<Path> extraDirs) throws IOException { ImmutableMap.Builder<String, AppleToolchain> toolchainIdentifiersToToolchainsBuilder = ImmutableMap.builder(); HashSet<Path> toolchainPaths = new HashSet<Path>(extraDirs); if (developerDir.isPresent()) { Path toolchainsDir = developerDir.get().resolve("Toolchains"); LOG.debug("Searching for Xcode toolchains under %s", toolchainsDir); toolchainPaths.add(toolchainsDir); } for (Path toolchains : toolchainPaths) { if (!Files.exists(toolchains)) { LOG.debug("Skipping toolchain search path %s that does not exist", toolchains); continue; } LOG.debug("Searching for Xcode toolchains in %s", toolchains); try (DirectoryStream<Path> toolchainStream = Files.newDirectoryStream(toolchains, "*.xctoolchain")) { for (Path toolchainPath : ImmutableSortedSet.copyOf(toolchainStream)) { LOG.debug("Getting identifier for for Xcode toolchain under %s", toolchainPath); addIdentifierForToolchain(toolchainPath, toolchainIdentifiersToToolchainsBuilder); } } } return toolchainIdentifiersToToolchainsBuilder.build(); }
Source:
public Iterable<Repo> repos( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtSearchPagination<Repo>( this.entry, "/search/repositories", keywords, sort, order, new RtPagination.Mapping<Repo>() { @Override public Repo map(final JsonObject object) { return new RtRepo( RtSearch.this.ghub, RtSearch.this.entry, new Coordinates.Simple(object.getString("full_name")) ); } } ); }

Target:
public Iterable<Repo> repos( @NotNull(message = "Search keywords can't be NULL") final String keywords, @NotNull(message = "Sort field can't be NULL") final String sort, @NotNull(message = "Sort order can't be NULL") final String order) throws IOException { return new RtSearchPagination<Repo>( this.request, "repositories", keywords, sort, order, new RtPagination.Mapping<Repo, JsonObject>() { @Override public Repo map(final JsonObject object) { return RtSearch.this.github().repos().get( new Coordinates.Simple(object.getString("full_name")) ); } } ); }
Source:
protected Ref findBranch(String branchName) throws IOException { return repository.exactRef(R_HEADS + branchName); }

Target:
protected Ref findBranch(String branchName) throws IOException { return repository.getRef(R_HEADS + branchName); }
Source:
public void setUp() throws Exception { currentContextClassLoader = Thread.currentThread().getContextClassLoader(); }

Target:
static void setUp() { currentContextClassLoader = Thread.currentThread().getContextClassLoader(); }
Source:
public void process(Exchange exchange) throws FrameworkProducerException { try { LOGGER.debug("Entering process method"); final Object operationValueObj = exchange.getIn().getHeader(OPERATION_HEADER_KEY); String operation; if (operationValueObj == null) { exchange.getIn().setBody(new ArrayList<Metacard>()); throw new FrameworkProducerException( String.format("Missing expected [%s] header!", OPERATION_HEADER_KEY)); } operation = operationValueObj.toString(); if (operation.trim().equalsIgnoreCase(CREATE_OPERATION)) { create(exchange); } else if (operation.trim().equalsIgnoreCase(UPDATE_OPERATION)) { update(exchange); } else if (operation.trim().equalsIgnoreCase(DELETE_OPERATION)) { delete(exchange); } else { exchange.getIn().setBody(new ArrayList<Metacard>()); LOGGER.debug( "Missing expected header \"operation:<CREATE|UPDATE|DELETE>\" but received {}", operation); } LOGGER.debug("Exiting process method"); } catch (ClassCastException cce) { exchange.getIn().setBody(new ArrayList<Metacard>()); LOGGER.debug("Received a non-String as the operation type"); } catch (SourceUnavailableException | IngestException e) { exchange.getIn().setBody(new ArrayList<Metacard>()); LOGGER.debug("Exception cataloging metacards", e); throw new FrameworkProducerException(e); } }

Target:
public void process(Exchange exchange) throws FrameworkProducerException { try { LOGGER.debug("Entering process method"); final Object operationValueObj = exchange.getIn().getHeader(OPERATION_HEADER_KEY); String operation; if (operationValueObj == null) { exchange.getIn().setBody(new ArrayList<Metacard>()); throw new FrameworkProducerException( String.format("Missing expected [%s] header!", OPERATION_HEADER_KEY)); } operation = operationValueObj.toString(); if (operation.trim().equalsIgnoreCase(CREATE_OPERATION)) { create(exchange); } else if (operation.trim().equalsIgnoreCase(UPDATE_OPERATION)) { update(exchange); } else if (operation.trim().equalsIgnoreCase(DELETE_OPERATION)) { delete(exchange); } else { exchange.getIn().setBody(new ArrayList<Metacard>()); LOGGER.debug( "Missing expected header \"operation:<CREATE|UPDATE|DELETE>\" but received {}", operation); } LOGGER.debug("Exiting process method"); } catch (ClassCastException cce) { exchange.getIn().setBody(new ArrayList<Metacard>()); LOGGER.debug("Received a non-String as the operation type"); } catch (SourceUnavailableException | IngestException e) { LOGGER.debug("Exception cataloging metacards", e); throw new FrameworkProducerException(e); } }
Source:
public void startGame(boolean isHost,String ipAddress) { game = new SevenWondersGame(new Router(isHost)); }

Target:
public void startGame(boolean isHost,String ipAddress) { game = (new Router(isHost)).getLocalGame(); }
Source:
protected boolean postFileToImpl(String fileName, String serviceUrl) { boolean result; resetResponse(); String url = getUrl(serviceUrl); String fitnesseFilesDir; String filePath; try { fitnesseFilesDir = getEnvironment().getFitNesseFilesSectionDir(); filePath = String.format("%s/%s", fitnesseFilesDir, fileName); File file = new File(filePath); if(!isFile(file)) { filePath = getFilePathFromWikiUrl(fileName); file = new File(filePath); } if(!isFile(file)) { throw new Exception("File " + fileName + " not found."); } getEnvironment().doHttpFilePost(url, response, headerValues, file); } catch (Throwable t) { throw new StopTestException("Unable to get response from POST to: " + url, t); } result = postProcessResponse(); return result; }

Target:
protected boolean postFileToImpl(String fileName, String serviceUrl) { boolean result; resetResponse(); String url = getUrl(serviceUrl); try { String filePath = getFilePathFromWikiUrl(fileName); File file = new File(filePath); if(!isFile(file)) { throw new Exception("File " + fileName + " not found."); } getEnvironment().doHttpFilePost(url, response, headerValues, file); } catch (Throwable t) { throw new StopTestException("Unable to get response from POST to: " + url, t); } result = postProcessResponse(); return result; }
Source:
public static void retrieveThumbnail(final IndexedFile item, final IOnResult<Boolean> callback) { if (item.getThumbnail() != null) { callback.onResult(true); return; } final File thumbFile = item.getThumbFile(); if (!thumbFile.exists()) { callback.onResult(false); return; } new Thread(new Runnable() { @Override public void run() { try { File thumbFile = item.getThumbFile(); File cache = Utils.getRandomCacheFile(); Utils.getMainCrypto().decrypt(thumbFile, cache, item.getName()); Bitmap bm = BitmapFactory.decodeFile(cache.getPath()); Utils.delete(cache); item.seThumbnail(bm); if (callback != null) { callback.onResult(true); } } catch (Exception e) { Utils.d("Failed to read thumbnail of item '" + item.getName() + "'. " + e.getMessage()); e.printStackTrace(); if (callback != null) { callback.onResult(false); } } } }).start(); }

Target:
public static void retrieveThumbnail(final IndexedFile item, final IOnResult<Boolean> callback) { if (item.getThumbnail() != null) { callback.onResult(true); return; } if (mRetrievingThumbs.contains(item)) { callback.onResult(false); return; } final File thumbFile = item.getThumbFile(); if (!thumbFile.exists()) { callback.onResult(false); return; } mRetrievingThumbs.add(item); new Thread(new Runnable() { @Override public void run() { boolean result = false; while (mCreatingThumbs.contains(item)) { try { Thread.sleep(100); } catch (InterruptedException e) { } } try { File thumbFile = item.getThumbFile(); File cache = Utils.getRandomCacheFile(); Utils.getMainCrypto().decrypt(thumbFile, cache, item.getName()); Bitmap bm = BitmapFactory.decodeFile(cache.getPath()); Utils.delete(cache); item.setThumbnail(bm); result = true; } catch (Exception e) { Utils.d("Failed to read thumbnail of item '" + item.getName() + "'. " + e.getMessage()); e.printStackTrace(); } mRetrievingThumbs.remove(item); Utils.runCallbackOnMain(callback, result); } }).start(); }
Source:
public static Job createWorkingBranch_Create(final TeamWorkFlowArtifact teamArt, final TransactionRecord parentTransactionId, boolean pend) throws OseeCoreException { final String branchName = Strings.truncate(TeamWorkFlowManager.getBranchName(teamArt), 195, true); Conditions.checkNotNull(teamArt, "Parent Team Workflow"); Conditions.checkNotNull(parentTransactionId, "Parent Branch"); IExceptionableRunnable runnable = new IExceptionableRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws OseeCoreException { teamArt.setWorkingBranchCreationInProgress(true); BranchManager.createWorkingBranch(parentTransactionId, branchName, null, teamArt); teamArt.setWorkingBranchCreationInProgress(false); SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), "Create Reviews upon Transition"); createNecessaryBranchEventReviews(StateEventType.CreateBranch, teamArt, new Date(), AtsUsers.getSystemUser(), transaction); transaction.execute(); for (IAtsStateItemCore item : AtsStateItemCoreManager.getStateItems()) { item.workingBranchCreated(teamArt); } return Status.OK_STATUS; } }; Job job = Jobs.startJob(new CatchAndReleaseJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID), true); if (pend) { try { job.join(); } catch (InterruptedException ex) { throw new OseeWrappedException(ex); } } return job; }

Target:
public static Job createWorkingBranch_Create(final TeamWorkFlowArtifact teamArt, final TransactionRecord parentTransactionId, boolean pend) throws OseeCoreException { final String branchName = Strings.truncate(TeamWorkFlowManager.getBranchName(teamArt), 195, true); Conditions.checkNotNull(teamArt, "Parent Team Workflow"); Conditions.checkNotNull(parentTransactionId, "Parent Branch"); IExceptionableRunnable runnable = new IExceptionableRunnable() { @Override public IStatus run(IProgressMonitor monitor) throws OseeCoreException { teamArt.setWorkingBranchCreationInProgress(true); BranchManager.createWorkingBranch(parentTransactionId, branchName, null, teamArt); teamArt.setWorkingBranchCreationInProgress(false); performPostBranchCreationTasks(teamArt); return Status.OK_STATUS; } }; Job job = Jobs.startJob(new CatchAndReleaseJob("Create Branch", runnable, Activator.class, Activator.PLUGIN_ID), true); if (pend) { try { job.join(); } catch (InterruptedException ex) { throw new OseeWrappedException(ex); } } return job; }
Source:
private boolean isTxnRelatedEvent(final NotificationEvent event) { return ((event.getEventType().equals(MessageFactory.OPEN_TXN_EVENT)) || (event.getEventType().equals(MessageFactory.COMMIT_TXN_EVENT)) || (event.getEventType().equals(MessageFactory.ABORT_TXN_EVENT)) || (event.getEventType().equals(MessageFactory.ALLOC_WRITE_ID_EVENT)) ); }

Target:
private boolean isTxnRelatedEvent(final NotificationEvent event) { return ((event.getEventType().equals(MessageFactory.OPEN_TXN_EVENT)) || (event.getEventType().equals(MessageFactory.COMMIT_TXN_EVENT)) || (event.getEventType().equals(MessageFactory.ABORT_TXN_EVENT))); }
Source:
public void isNotAGitRepoTest() throws Exception { Path myTmpDir = Files.createTempDirectory(testTmpFolder, "NotARepo", new FileAttribute<?>[] {}); context.addArg(getCommandName()); setCmdLocation(myTmpDir.toString()); Object result = app.start(context); assertOutputs("fatal: Can't find git repository\n", ""); assertEquals(ReturnCode.ERROR, result); }

Target:
public void isNotAGitRepoTest() throws Exception { Path myTmpDir = Files.createTempDirectory(testTmpFolder, "NotARepo", new FileAttribute<?>[] {}); context.addArg(getCommandName()); setCmdLocation(myTmpDir.toString()); Object result = app.start(context); assertOutputs("fatal: Can't find git repository" + EOL, ""); assertEquals(ReturnCode.ERROR, result); }
Source:
Task<Void> linkWithAsync( String authType, Map<String, String> authData) { return linkWithAsync(authType, authData, getSessionToken()); }

Target:
Task<Void> linkWithAsync( String authType, Map<String, String> authData) { if (authType == null) { throw new IllegalArgumentException("Invalid authType: " + null); } return linkWithAsync(authType, authData, getSessionToken()); }
Source:
public void interrupt() { final boolean differentThread = Thread.currentThread() != this; if (differentThread) checkAccess(); if (isInterrupted()) return; final AtomicInteger stateRef = this.stateRef; int oldVal, newVal; for (;;) { oldVal = stateRef.get(); if (oldVal == STATE_INTERRUPT_PENDING) { Messages.msg.tracef("Interrupting thread \"%s\" (already interrupted)", this); return; } else if (oldVal == STATE_INTERRUPT_IN_PROGRESS) { JDKSpecific.onSpinWait(); continue; } else { if (oldVal == STATE_INTERRUPT_DEFERRED) { newVal = STATE_INTERRUPT_PENDING; } else { newVal = STATE_INTERRUPT_IN_PROGRESS; } } if (stateRef.compareAndSet(oldVal, newVal)) { break; } } if (newVal == STATE_INTERRUPT_IN_PROGRESS) try { doInterrupt(); } finally { stateRef.set(STATE_MAYBE_INTERRUPTED); if (differentThread) { LockSupport.unpark(this); } } else { Messages.intMsg.tracef("Interrupting thread \"%s\" (deferred)", this); } }

Target:
public void interrupt() { final boolean differentThread = Thread.currentThread() != this; if (differentThread) checkAccess(); if (isInterrupted()) return; final AtomicInteger stateRef = this.stateRef; int oldVal, newVal; int spins = 0; for (;;) { oldVal = stateRef.get(); if (oldVal == STATE_INTERRUPT_PENDING) { Messages.msg.tracef("Interrupting thread \"%s\" (already interrupted)", this); return; } else if (oldVal == STATE_INTERRUPT_IN_PROGRESS) { if (spins < MAX_INTERRUPT_SPINS) { JDKSpecific.onSpinWait(); spins++; } else { Thread.yield(); } continue; } else { if (oldVal == STATE_INTERRUPT_DEFERRED) { newVal = STATE_INTERRUPT_PENDING; } else { newVal = STATE_INTERRUPT_IN_PROGRESS; } } if (stateRef.compareAndSet(oldVal, newVal)) { break; } } if (newVal == STATE_INTERRUPT_IN_PROGRESS) try { doInterrupt(); } finally { stateRef.set(STATE_MAYBE_INTERRUPTED); if (differentThread) { LockSupport.unpark(this); } } else { Messages.intMsg.tracef("Interrupting thread \"%s\" (deferred)", this); } }
Source:
public SQLQueryEngine(MetaDataStore metaDataStore, com.yahoo.elide.contrib.dynamicconfighelpers.compile.ConnectionDetails defaultConnectionDetails) { this(metaDataStore, defaultConnectionDetails, null); }

Target:
public SQLQueryEngine(MetaDataStore metaDataStore, com.yahoo.elide.contrib.dynamicconfighelpers.compile.ConnectionDetails defaultConnectionDetails) { this(metaDataStore, defaultConnectionDetails, Collections.emptyMap()); }
Source:
public QuotaTariffVO updateQuotaTariffPlan(QuotaTariffUpdateCmd cmd) { final int quotaType = cmd.getUsageType(); final BigDecimal quotaCost = new BigDecimal(cmd.getValue()); final Date effectiveDate = _quotaService.computeAdjustedTime(cmd.getStartDate()); final Date now = _quotaService.computeAdjustedTime(new Date()); if (effectiveDate.compareTo(now) < 0) { throw new InvalidParameterValueException("Incorrect effective date for tariff " + effectiveDate + " is less than now " + now); } QuotaTypes quotaConstant = QuotaTypes.listQuotaTypes().get(quotaType); if (quotaConstant == null) { throw new InvalidParameterValueException("Quota type does not exists " + quotaType); } final short opendb = TransactionLegacy.currentTxn().getDatabaseId(); TransactionLegacy.open(TransactionLegacy.USAGE_DB).close(); QuotaTariffVO result = null; try { result = new QuotaTariffVO(); result.setUsageType(quotaType); result.setUsageName(quotaConstant.getQuotaName()); result.setUsageUnit(quotaConstant.getQuotaUnit()); result.setUsageDiscriminator(quotaConstant.getDiscriminator()); result.setCurrencyValue(quotaCost); result.setEffectiveOn(effectiveDate); result.setUpdatedOn(now); result.setUpdatedBy(cmd.getEntityOwnerId()); s_logger.debug(String.format("Updating Quota Tariff Plan: New value=%s for resource type=%d effective on date=%s", quotaCost, quotaType, effectiveDate)); _quotaTariffDao.addQuotaTariff(result); } catch (Exception pokemon) { s_logger.error("Error in update quota tariff plan: " + pokemon); } finally { TransactionLegacy.open(opendb).close(); } return result; }

Target:
public QuotaTariffVO updateQuotaTariffPlan(QuotaTariffUpdateCmd cmd) { final int quotaType = cmd.getUsageType(); final BigDecimal quotaCost = new BigDecimal(cmd.getValue()); final Date effectiveDate = _quotaService.computeAdjustedTime(cmd.getStartDate()); final Date now = _quotaService.computeAdjustedTime(new Date()); if (effectiveDate.compareTo(now) < 0) { throw new InvalidParameterValueException("Incorrect effective date for tariff " + effectiveDate + " is less than now " + now); } QuotaTypes quotaConstant = QuotaTypes.listQuotaTypes().get(quotaType); if (quotaConstant == null) { throw new InvalidParameterValueException("Quota type does not exists " + quotaType); } QuotaTariffVO result = null; result = new QuotaTariffVO(quotaType); result.setUsageName(quotaConstant.getQuotaName()); result.setUsageUnit(quotaConstant.getQuotaUnit()); result.setUsageDiscriminator(quotaConstant.getDiscriminator()); result.setCurrencyValue(quotaCost); result.setEffectiveOn(effectiveDate); result.setUpdatedOn(now); result.setUpdatedBy(cmd.getEntityOwnerId()); if (s_logger.isDebugEnabled()) { s_logger.debug(String.format("Updating Quota Tariff Plan: New value=%s for resource type=%d effective on date=%s", quotaCost, quotaType, effectiveDate)); } _quotaTariffDao.addQuotaTariff(result); return result; }
Source:
public int getBasicRailMetadata(EntityMinecart cart) { int meta = tileEntity.getBlockMetadata(); if (cart != null && (isSwitched() || springingCarts.contains(cart.getPersistentID()))) { if (meta == EnumTrackMeta.NORTH_SOUTH.ordinal()) { if (isMirrored()) { if (reversed) { meta = EnumTrackMeta.WEST_SOUTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.WEST_NORTH_CORNER.ordinal(); } } else { if (reversed) { meta = EnumTrackMeta.EAST_NORTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.EAST_SOUTH_CORNER.ordinal(); } } } else if (meta == EnumTrackMeta.EAST_WEST.ordinal()) { if (isMirrored()) { if (reversed) { meta = EnumTrackMeta.WEST_NORTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.EAST_NORTH_CORNER.ordinal(); } } else { if (reversed) { meta = EnumTrackMeta.EAST_SOUTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.WEST_SOUTH_CORNER.ordinal(); } } } } return meta; }

Target:
public int getBasicRailMetadata(EntityMinecart cart) { int meta = tileEntity.getBlockMetadata(); if (cart != null && isSwitched(cart)) { if (meta == EnumTrackMeta.NORTH_SOUTH.ordinal()) { if (isMirrored()) { if (reversed) { meta = EnumTrackMeta.WEST_SOUTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.WEST_NORTH_CORNER.ordinal(); } } else { if (reversed) { meta = EnumTrackMeta.EAST_NORTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.EAST_SOUTH_CORNER.ordinal(); } } } else if (meta == EnumTrackMeta.EAST_WEST.ordinal()) { if (isMirrored()) { if (reversed) { meta = EnumTrackMeta.WEST_NORTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.EAST_NORTH_CORNER.ordinal(); } } else { if (reversed) { meta = EnumTrackMeta.EAST_SOUTH_CORNER.ordinal(); } else { meta = EnumTrackMeta.WEST_SOUTH_CORNER.ordinal(); } } } } return meta; }
Source:
public BeanIdentifier getIdentifier(int idx) { checkIsBuilt(); return index[idx]; }

Target:
public BeanIdentifier getIdentifier(int idx) { checkIsBuilt(); if (idx < 0 || idx >= index.length) { throw SerializationLogger.LOG.unableToGetBeanIdentifier(idx, this); } return index[idx]; }
Source:
public void propertyChange(PropertyChangeEvent event) { if(event.getSource() == serverChoice && event.getProperty() == FieldEditor.VALUE) { String changedLSLocation = CPPStreamConnectionProvider.getDefaultLSLocation((String) event.getNewValue()).getAbsolutePath(); if(changedLSLocation != null) { serverPath.setStringValue(changedLSLocation); } } }

Target:
public void propertyChange(PropertyChangeEvent event) { if(event.getSource() == serverChoice && event.getProperty() == FieldEditor.VALUE) { File changedLSLocation = CPPStreamConnectionProvider.getDefaultLSLocation((String) event.getNewValue()); if(changedLSLocation != null) { serverPath.setStringValue(changedLSLocation.getAbsolutePath()); } } }
Source:
public void navigateForward() { try { driver.navigate().forward(); PageObjectLogging.log("navigateForward", "next page loaded", true); } catch (TimeoutException e) { PageObjectLogging.log("navigateForward", "page loaded for more then 30 seconds after navigating back", true); } }

Target:
public void navigateForward() { try { driver.navigate().forward(); PageObjectLogging.log("Navigate Forward", "next page loaded", true); } catch (TimeoutException e) { PageObjectLogging.log("Navigate Forward", "page loaded for more then 30 seconds after navigating forward", false); } }
Source:
public String getResultName(@Nonnull Query query, @Nonnull ObjectName objectName, @Nullable String key, @Nonnull String attribute) { String result; if (query.getResultAlias() == null) { result = escapeObjectName(objectName); if (attribute != null && !attribute.isEmpty()) { result += "." + attribute; } if (key != null && !key.isEmpty()) { result += "." + key; } } else { result = expressionLanguageEngine.resolveExpression(query.getResultAlias(), objectName); } return result; }

Target:
public String getResultName(@Nonnull Query query, @Nonnull ObjectName objectName, @Nullable String key, @Nonnull String attribute) { String result; if (query.getResultAlias() == null) { if (key == null) { result = escapeObjectName(objectName) + "." + attribute; } else { result = escapeObjectName(objectName) + "." + attribute + "." + key; } } else { result = expressionLanguageEngine.resolveExpression(query.getResultAlias(), objectName); } return result; }
Source:
protected void executeCommand() { Provider hostProvider = getProvider(); HostProviderProxy proxy = ((HostProviderProxy) ProviderProxyFactory.getInstance().create(hostProvider)); List<? extends Certificate> chain = proxy.getCertificateChain(); saveChainToTrustStore(chain); }

Target:
protected void executeCommand() { Provider provider = getProvider(); ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); saveChainToTrustStore(chain); }
Source:
public static synchronized IndexedUserContainer getInstance() { return container; }

Target:
public static IndexedUserContainer getInstance() { return container; }
Source:
private void removeCacheLoader(String storeType, Collection<CacheLoader> collection) { Iterator<CacheLoader> clIt = collection.iterator(); while (clIt.hasNext()) { CacheLoader w = clIt.next(); if (undelegate(w).getClass().getName().equals(storeType)) clIt.remove(); } }

Target:
private void removeCacheLoader(String storeType, Collection<CacheLoader> collection) { collection.removeIf(cacheLoader -> undelegate(cacheLoader).getClass().getName().equals(storeType)); }
Source:
public List<OskariLayer> findByIdList(final List<Integer> intList) { final List<String> strList = ConversionHelper.getStringListFromIntegers(intList); if(intList.size() < 1 && strList.size() < 1){ return new ArrayList<OskariLayer>(); } Map<String, Object> params = new HashMap<String, Object>(); params.put("strList", strList); params.put("intList", intList); List<Map<String,Object>> result = queryForList(getNameSpace() + ".findByIdList", params); final List<OskariLayer> layers = mapDataList(result); return OskariLayerWorker.reorderLayers(layers, strList); }

Target:
public List<OskariLayer> findByIdList(final List<Integer> intList) { if(intList.isEmpty()){ return new ArrayList<OskariLayer>(); } Map<String, Object> params = new HashMap<String, Object>(); params.put("intList", intList); params.put("parentIntList", intList); List<Map<String,Object>> result = queryForList(getNameSpace() + ".findByIdList", params); final List<OskariLayer> layers = mapDataList(result); List<OskariLayer> reLayers = new ArrayList<OskariLayer>(); for (Integer id : intList) { for (OskariLayer lay : layers) { if (lay.getId() == id) { reLayers.add(lay); break; } } } return reLayers; }
Source:
public void onProcessComplete(int exitValue) { LOGGER.warn("Process is exited with exit value " + exitValue); if (exitValue != 0) { state = State.EXITED; synchronized (this) { notify(); } } }

Target:
public void onProcessComplete(int exitValue) { LOGGER.warn("Process is exited with exit value " + exitValue); if (exitValue != 0) { transition(State.TERMINATED); synchronized (this) { notify(); } } else { transition(State.COMPLETED); } }
Source:
public CompletableFuture<MessageSendingResult> send(Message message) { try { final CompletableFuture<MessageSendingResult> resultFuture = new CompletableFuture<>(); sendMessage(message, resultFuture); return resultFuture; } catch (Exception e) { throw new InternalProcessingException("Failed to send message", e); } }

Target:
public CompletableFuture<MessageSendingResult> send(Message message) { try { CompletableFuture<MessageSendingResult> resultFuture = new CompletableFuture<>(); sendMessage(message, resultFuture); return resultFuture; } catch (Exception e) { throw new InternalProcessingException("Failed to send message", e); } }
Source:
public void sendPushMessage(Variant variant, Collection<String> clientIdentifiers, UnifiedPushMessage pushMessage, NotificationSenderCallback senderCallback) { AdmService admService = ADM.newService(); PayloadBuilder builder = ADM.newPayload(); builder.dataField("alert", pushMessage.getMessage().getAlert()); builder.dataField("sound", pushMessage.getMessage().getSound()); builder.dataField("badge", "" + pushMessage.getMessage().getBadge()); int ttl = pushMessage.getConfig().getTimeToLive(); if (ttl != -1) { builder.expiresAfter(ttl); } builder.dataField("message","useless payload"); builder.consolidationKey("my other app"); Set<String> keys = pushMessage.getMessage().getUserData().keySet(); for (String key : keys) { builder.dataField(key, pushMessage.getMessage().getUserData().get(key)); } System.out.println(builder.build()); final AdmVariant admVariant = (AdmVariant) variant; for(String token : clientIdentifiers) { try { admService.sendMessageToDevice(token, admVariant.getClientId(), admVariant.getClientSecret(), builder.build()); senderCallback.onSuccess(); } catch (Exception e) { logger.severe("Error sending payload to ADM server", e); senderCallback.onError(e.getMessage()); } } }

Target:
public void sendPushMessage(Variant variant, Collection<String> clientIdentifiers, UnifiedPushMessage pushMessage, NotificationSenderCallback senderCallback) { final AdmService admService = ADM.newService(); final PayloadBuilder builder = ADM.newPayload(); builder.dataField("alert", pushMessage.getMessage().getAlert()); int ttl = pushMessage.getConfig().getTimeToLive(); if (ttl != -1) { builder.expiresAfter(ttl); } builder.dataField("message","useless payload"); builder.consolidationKey(pushMessage.getMessage().getConsolidationKey()); Set<String> keys = pushMessage.getMessage().getUserData().keySet(); for (String key : keys) { builder.dataField(key, pushMessage.getMessage().getUserData().get(key)); } final AdmVariant admVariant = (AdmVariant) variant; for(String token : clientIdentifiers) { try { admService.sendMessageToDevice(token, admVariant.getClientId(), admVariant.getClientSecret(), builder.build()); senderCallback.onSuccess(); } catch (Exception e) { logger.severe("Error sending payload to ADM server", e); senderCallback.onError(e.getMessage()); } } }
Source:
public CompletableFuture<Boolean> replaceIssueLabels(TurboIssue issue, List<String> newLabels) { boolean isLabelsChanged = updateIssueLabels(issue, newLabels); if (isLabelsChanged) { logger.info("Changing labels for " + issue + " on UI"); refreshUI(); } return updateIssueLabelsOnRepo(issue, newLabels); }

Target:
public CompletableFuture<Boolean> replaceIssueLabels(TurboIssue issue, List<String> newLabels) { logger.info("Changing labels for " + issue + " on UI"); issue.setLabels(newLabels); refreshUI(); return updateIssueLabelsOnRepo(issue, newLabels); }
Source:
public void start(BundleContext bc) throws Exception { this.processRuntimeReg = bc.registerService( new String[]{ ProcessRuntimeFactoryService.class.getName(), Service.class.getName()}, new ProcessRuntimeFactoryServiceImpl(), new Hashtable() ); this.processRuntimeReg2 = bc.registerService( new String[]{ ProcessMarshallerFactoryService.class.getName(), Service.class.getName()}, new ProcessMarshallerFactoryServiceImpl(), new Hashtable() ); RuntimeManagerFactory.Factory.reset(); ProcessBuilderFactory.resetInitialization(); }

Target:
public void start(BundleContext bc) throws Exception { this.processRuntimeReg = bc.registerService( new String[]{ ProcessRuntimeFactoryService.class.getName(), Service.class.getName()}, new ProcessRuntimeFactoryServiceImpl(), new Hashtable() ); this.processRuntimeReg2 = bc.registerService( new String[]{ ProcessMarshallerFactoryService.class.getName(), Service.class.getName()}, new ProcessMarshallerFactoryServiceImpl(), new Hashtable() ); RuntimeManagerFactory.Factory.reset(); ProcessRuntimeFactory.resetInitialization(); }
Source:
public String toString() { return String.format("%s, storagePoolId = %s, storagePoolName = %s, masterDomainId = %s, masterVersion = %s, domainsList = [%s]", super.toString(), getStoragePoolId(), getStoragePoolName(), getMasterDomainId(), getMasterVersion(), getPrintableDomainsList()); }

Target:
public String toString() { return String.format("%s, vdsSpmId = %i, storagePoolId = %s, " + "storagePoolName = %s, masterDomainId = %s, masterVersion = %s, " + "domainsList = [%s]", super.toString(), getVdsSpmId(), getStoragePoolId(), getStoragePoolName(), getMasterDomainId(), getMasterVersion(), getPrintableDomainsList()); }
Source:
public void testPendingMutationsOnDDL() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, "true"); try (Connection conn = DriverManager.getConnection(getUrl(), props); PhoenixConnection spy = spy((PhoenixConnection) conn)) { MutationState mutationState = mock(MutationState.class); when(mutationState.getNumRows()).thenReturn(1); doReturn(mutationState).when(spy).getMutationState(); exceptionRule.expect(SQLException.class); exceptionRule.expectMessage( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS.getMessage()); spy.createStatement().execute("create table MUTATION_TEST1" + "( id1 UNSIGNED_INT not null primary key," + "appId1 VARCHAR)"); } }

Target:
public void testPendingMutationsOnDDL() throws Exception { Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, "true"); try (Connection conn = DriverManager.getConnection(getUrl(), props); PhoenixConnection pConnSpy = spy((PhoenixConnection) conn)) { MutationState mutationState = mock(MutationState.class); when(mutationState.getNumRows()).thenReturn(1); doReturn(mutationState).when(pConnSpy).getMutationState(); exceptionRule.expect(SQLException.class); exceptionRule.expectMessage( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS.getMessage()); pConnSpy.createStatement().execute("create table MUTATION_TEST1" + "( id1 UNSIGNED_INT not null primary key," + "appId1 VARCHAR)"); } }
Source:
public static void prepareCommandForMonitoring(CommandBase<?> command, VdcActionType actionType, boolean runAsInternal) { ExecutionContext context = new ExecutionContext(); try { boolean isMonitored = shouldMonitorCommand(actionType, runAsInternal); context.setMonitored(isMonitored); if (isMonitored) { Job job = createJob(actionType, command); JobRepositoryFactory.getJobRepository().saveJob(job); context.setExecutionMethod(ExecutionMethod.AsJob); context.setJob(job); command.setExecutionContext(context); } } catch (Exception e) { log.errorFormat("Failed to prepare command of type {0} for monitoring due to error {1}", actionType.name(), ExceptionUtils.getMessage(e), e); } }

Target:
public static void prepareCommandForMonitoring(CommandBase<?> command, VdcActionType actionType, boolean runAsInternal) { ExecutionContext context = command.getExecutionContext(); if (context == null) { context = new ExecutionContext(); } try { boolean isMonitored = shouldMonitorCommand(actionType, runAsInternal); context.setMonitored(isMonitored); if (isMonitored) { Job job = createJob(actionType, command); JobRepositoryFactory.getJobRepository().saveJob(job); context.setExecutionMethod(ExecutionMethod.AsJob); context.setJob(job); command.setExecutionContext(context); } } catch (Exception e) { log.errorFormat("Failed to prepare command of type {0} for monitoring due to error {1}", actionType.name(), ExceptionUtils.getMessage(e), e); } }
Source:
public void clearMemory() { final Iterator<Map.Entry<String,Bitmap>> iterator = cache.entrySet().iterator(); while (iterator.hasNext()) { iterator.next(); iterator.remove(); } currentSize = 0; }

Target:
public void clearMemory() { final Iterator<Map.Entry<String,Bitmap>> iterator = cache.entrySet().iterator(); while (iterator.hasNext()) { final Bitmap bitmap = iterator.next().getValue(); bitmap.recycle(); iterator.remove(); } currentSize = 0; }
Source:
private NotifierInfo populateNotifierInfo (Map notificationSinkConfig) { NotifierInfo notifierInfo = new NotifierInfo(); Map notifierInfoConfig = (Map) notificationSinkConfig.get(TopologyLayoutConstants.JSON_KEY_CONFIG); notifierInfo.setNotifierName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_NAME)); notifierInfo.setClassName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_CLASSNAME)); notifierInfo.setJarFileName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_JAR_FILENAME)); String[] fieldNames = { TopologyLayoutConstants.JSON_KEY_NOTIFIER_FROM, TopologyLayoutConstants.JSON_KEY_NOTIFIER_TO, TopologyLayoutConstants.JSON_KEY_NOTIFIER_SUBJECT, TopologyLayoutConstants.JSON_KEY_NOTIFIER_CONTENT_TYPE, TopologyLayoutConstants.JSON_KEY_NOTIFIER_BODY }; notifierInfo.setFieldValues(this.getFieldValues(notifierInfoConfig, fieldNames)); String[] propertyNames = { TopologyLayoutConstants.JSON_KEY_NOTIFIER_HOST, TopologyLayoutConstants.JSON_KEY_NOTIFIER_PORT, TopologyLayoutConstants.JSON_KEY_NOTIFIER_SSL, TopologyLayoutConstants.JSON_KEY_NOTIFIER_STARTTLS, TopologyLayoutConstants.JSON_KEY_NOTIFIER_PROTOCOL, TopologyLayoutConstants.JSON_KEY_NOTIFIER_USERNAME, TopologyLayoutConstants.JSON_KEY_NOTIFIER_PASSWORD, TopologyLayoutConstants.JSON_KEY_NOTIFIER_AUTH, TopologyLayoutConstants.JSON_KEY_NOTIFIER_DEBUG }; notifierInfo.setProperties(this.getProperties(notifierInfoConfig, propertyNames)); return notifierInfo; }

Target:
private NotifierInfo populateNotifierInfo (Map notificationSinkConfig) { NotifierInfo notifierInfo = new NotifierInfo(); Map notifierInfoConfig = (Map) notificationSinkConfig.get(TopologyLayoutConstants.JSON_KEY_CONFIG); notifierInfo.setName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_NAME)); notifierInfo.setClassName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_CLASSNAME)); notifierInfo.setJarFileName((String) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_JAR_FILENAME)); Map properties = (Map) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_PROPERTIES); notifierInfo.setProperties(convertMapValuesToString(properties)); Map fieldValues = (Map) notifierInfoConfig.get(TopologyLayoutConstants.JSON_KEY_NOTIFIER_FIELD_VALUES); notifierInfo.setFieldValues(convertMapValuesToString(fieldValues)); return notifierInfo; }
Source:
public void recount() { count = 0; for(char type : types) { if (type != 0) count++; } }

Target:
public void recount() { count = 0; for(char type : types) { if (type != 0) { count++; } } }