auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void validatePendingStatus(final List<TransactionDto> transactionDtos) { errors = new MapBindingResult(new HashMap<String, String>(), TransactionDto.class.getName()); final long pendingTransactionCount = transactionDtos.stream() .filter(transactionDto -> TransactionStatus.PENDING.getValue().equalsIgnoreCase(transactionDto.getTransactionStatus())).count(); if (pendingTransactionCount != transactionDtos.size()) { this.errors.reject("transaction.wrong.transaction.status", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } }

Target:
public void validatePendingStatus(final List<TransactionDto> transactionDtos) { errors = new MapBindingResult(new HashMap<String, String>(), TransactionDto.class.getName()); final Predicate<TransactionDto> isPendingStatus = transactionDto -> transactionDto.getTransactionStatus().equals(TransactionStatus.PENDING.getValue()); if (transactionDtos.stream().filter(isPendingStatus.negate()).count() > 0) { this.errors.reject("transaction.wrong.transaction.status", ""); throw new ApiRequestValidationException(errors.getAllErrors()); } }
Source:
public void activate() { logger.debug("Plex binding actived"); }

Target:
public void activate() { logger.trace("Plex binding actived"); }
Source:
public <T extends IBuildSource> T getBuildSource() { switch (asString("spec.source.type")) { case BuildSourceType.GIT: return (T) new GitBuildSource(asString("spec.source.git.uri"), asString("spec.source.git.ref"), asString("spec.source.contextDir")); case BuildSourceType.BINARY: return (T) new BinaryBuildSource(asString("spec.source.binary.asFile"), asString("spec.source.contextDir")); default: } return null; }

Target:
public <T extends IBuildSource> T getBuildSource() { switch (asString("spec.source.type")) { case BuildSourceType.GIT: return (T) new GitBuildSource(asString(BUILDCONFIG_SOURCE_URI), asString(BUILDCONFIG_SOURCE_REF), asString(BUILDCONFIG_SOURCE_CONTEXTDIR)); case BuildSourceType.BINARY: return (T) new BinaryBuildSource(asString(BUILDCONFIG_SOURCE_BINARY_ASFILE), asString(BUILDCONFIG_SOURCE_CONTEXTDIR)); default: } return null; }
Source:
public void parse() { List<String> rawSetupDefinitions = new ArrayList<String>(); List<String> lSetupDefinitions = new ArrayList<String>(); String line = ""; long startPos; long endPos; try { RandomAccessFile raf = new RandomAccessFile(file.getRawLocation() .makeAbsolute().toFile(), "r"); startPos = findStart(raf); endPos = findEnd(raf, startPos); raf.seek(startPos); while ((line = raf.readLine()) != null && raf.getFilePointer() < endPos) { rawSetupDefinitions.add(line); } lSetupDefinitions = prepareOptions(rawSetupDefinitions); for (String str : lSetupDefinitions) { parseLine(str); } } catch (Exception e) { StubbyLog.logError(e); } }

Target:
public void parse() { List<String> rawSetupDefinitions = new ArrayList<String>(); List<String> lSetupDefinitions = new ArrayList<String>(); String line = ""; long startPos; long endPos; try { RandomAccessFile raf = new RandomAccessFile(file.getRawLocation() .makeAbsolute().toFile(), "r"); startPos = findStart(raf); endPos = findEnd(raf, startPos); raf.seek(startPos); while ((line = raf.readLine()) != null && raf.getFilePointer() < endPos) { rawSetupDefinitions.add(line); } lSetupDefinitions = prepareOptions(rawSetupDefinitions); for (String str : lSetupDefinitions) { parseLine(str); } raf.close(); } catch (FileNotFoundException e) { StubbyLog.logError(e); } catch (IOException e) { StubbyLog.logError(e); } }
Source:
public void testValidateKafkaTopicName() { Assert.fail("Should fail now"); KafkaMessageChannelBinder.validateTopicName("foo:bar"); }

Target:
public void testValidateKafkaTopicName() { KafkaMessageChannelBinder.validateTopicName("foo:bar"); }
Source:
public SAMRecordComparator getComparatorInstance() { if (comparatorSupplier != null) { return comparatorSupplier.get(); } return null; }

Target:
public SAMRecordComparator getComparatorInstance() { return comparatorSupplier.get(); }
Source:
private void addTaskContainers(AbstractTask oldTask, AbstractTask newTask) { for (AbstractTaskContainer container : oldTask.getParentContainers()) { addTask(newTask, container); } for (ITask subtask : oldTask.getChildren()) { addTask(subtask, newTask); } }

Target:
private void addTaskContainers(AbstractTask oldTask, AbstractTask newTask) { Set<AbstractTaskContainer> containers = oldTask.getParentContainers(); if (containers.isEmpty() || (containers.size() == 1 && containers.iterator().next() instanceof UnmatchedTaskContainer)) { addTask(newTask); } else { for (AbstractTaskContainer container : containers) { addTask(newTask, container); } } for (ITask subtask : oldTask.getChildren()) { addTask(subtask, newTask); } }
Source:
void initTable() { TextColumnWithTooltip<Provider> nameColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getName(); } }; getTable().addColumn(nameColumn, constants.nameProvider()); TextColumnWithTooltip<Provider> descriptionColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getDescription(); } }; getTable().addColumn(descriptionColumn, constants.descriptionProvider()); TextColumnWithTooltip<Provider> urlColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getUrl(); } }; getTable().addColumn(urlColumn, constants.urlProvider()); getTable().addActionButton(new WebAdminButtonDefinition<Provider>(constants.addProvider()) { @Override protected UICommand resolveCommand() { return getMainModel().getAddCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Provider>(constants.removeProvider()) { @Override protected UICommand resolveCommand() { return getMainModel().getRemoveCommand(); } }); }

Target:
void initTable() { getTable().enableColumnResizing(); TextColumnWithTooltip<Provider> nameColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getName(); } }; getTable().addColumn(nameColumn, constants.nameProvider(), "200px"); TextColumnWithTooltip<Provider> descriptionColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getDescription(); } }; getTable().addColumn(descriptionColumn, constants.descriptionProvider(), "300px"); TextColumnWithTooltip<Provider> urlColumn = new TextColumnWithTooltip<Provider>() { @Override public String getValue(Provider object) { return object.getUrl(); } }; getTable().addColumn(urlColumn, constants.urlProvider(), "200px"); getTable().addActionButton(new WebAdminButtonDefinition<Provider>(constants.addProvider()) { @Override protected UICommand resolveCommand() { return getMainModel().getAddCommand(); } }); getTable().addActionButton(new WebAdminButtonDefinition<Provider>(constants.removeProvider()) { @Override protected UICommand resolveCommand() { return getMainModel().getRemoveCommand(); } }); }
Source:
public boolean isVisible() { AccountGroup accountGroup = GroupDescriptions.toAccountGroup(group); if (accountGroup != null && accountGroup.isVisibleToAll()) { return true; } return user instanceof InternalUser || user.getEffectiveGroups().contains(group.getGroupUUID()) || isOwner(); }

Target:
public boolean isVisible() { AccountGroup accountGroup = GroupDescriptions.toAccountGroup(group); return (accountGroup != null && accountGroup.isVisibleToAll()) || user instanceof InternalUser || user.getEffectiveGroups().contains(group.getGroupUUID()) || isOwner(); }
Source:
public static void afterClass() throws CommandFailedException, IOException { client.apply(backup.restore()); client.close(); }

Target:
public static void afterClass() throws CommandFailedException, IOException { try { client.apply(backup.restore()); } finally { client.close(); } }
Source:
public void stop() { if (serverThread == null) { throw new IllegalStateException("Server is not running"); } serverThread.interrupt(); TrafficCounter.shutdown(); }

Target:
public void stop() { if (serverThread == null) { throw new IllegalStateException("Server is not running"); } serverThread.interrupt(); }
Source:
public void onConfigure(SQLiteDatabase db) { if (db.isReadOnly() || !shouldEnableForeignKeyConstraints()) return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) db.execSQL("PRAGMA foreign_keys=ON;"); else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) db.setForeignKeyConstraintsEnabled(true); }

Target:
public void onConfigure(SQLiteDatabase db) { if (db.isReadOnly() || !shouldEnableForeignKeyConstraints()) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) db.setForeignKeyConstraintsEnabled(true); else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) db.execSQL("PRAGMA foreign_keys=ON;"); }
Source:
public ShowInContext getShowInContext() { ITreeSelection selection = (ITreeSelection) tree.getSelection(); for (Iterator it = selection.iterator(); it.hasNext();) { if (!(it.next() instanceof IResource)) { return null; } } return new ShowInContext(null, selection); }

Target:
public ShowInContext getShowInContext() { IPath repoPath = getRepositoryPath(); ITreeSelection selection = (ITreeSelection) tree.getSelection(); List<IResource> resources = new ArrayList<IResource>(); for (Iterator it = selection.iterator(); it.hasNext();) { Object obj = it.next(); if (obj instanceof IResource) resources.add((IResource) obj); else if (obj instanceof PathNode && repoPath != null) { PathNode pathNode = (PathNode) obj; IResource resource = ResourceUtil .getResourceForLocation(repoPath.append(pathNode.path .toString())); if (resource != null) resources.add(resource); } } return new ShowInContext(null, new StructuredSelection(resources)); }
Source:
protected void onCreateSessionSafe(Bundle savedInstanceState) { super.onCreateSessionSafe(savedInstanceState); String menuId = getIntent().getStringExtra(SessionFrame.STATE_COMMAND_ID); if (menuId == null) { menuId = Menu.ROOT_MENU_ID; } if (menuId == Menu.ROOT_MENU_ID && DispatchActivity.useRootMenuHomeActivity()) { finish(); return; } MenuList.setupMenuViewInActivity(this, menuId, useGridMenu(menuId), false); }

Target:
protected void onCreateSessionSafe(Bundle savedInstanceState) { super.onCreateSessionSafe(savedInstanceState); String menuId = getIntent().getStringExtra(SessionFrame.STATE_COMMAND_ID); if (menuId == null) { menuId = Menu.ROOT_MENU_ID; } if (menuId.equals(Menu.ROOT_MENU_ID) && DispatchActivity.useRootMenuHomeActivity()) { finish(); return; } MenuList.setupMenuViewInActivity(this, menuId, useGridMenu(menuId), false); }
Source:
public void testObservableWithRetrySameServer() throws Exception { IClientConfig config = DefaultClientConfigImpl.getClientConfigWithDefaultValues().withProperty(CommonClientConfigKey.ConnectTimeout, "1000"); HttpClientRequest<ByteBuf> request = HttpClientRequest.createGet("/testAsync/person"); Server badServer = new Server("localhost:12345"); Server goodServer = new Server("localhost:" + port); List<Server> servers = Lists.newArrayList(badServer, badServer, goodServer); BaseLoadBalancer lb = LoadBalancerBuilder.<Server>newBuilder() .withRule(new AvailabilityFilteringRule()) .withPing(new DummyPing()) .buildFixedServerListLoadBalancer(servers); LoadBalancingHttpClient<ByteBuf, ByteBuf> lbObservables = RibbonTransport.newHttpClient(lb, config, new NettyHttpLoadBalancerErrorHandler(1, true)); Observable<Person> observableWithRetries = getPersonObservable(lbObservables.submit(request)); ObserverWithLatch<Person> observer = new ObserverWithLatch<Person>(); observableWithRetries.subscribe(observer); observer.await(); ServerStats stats = lbObservables.getServerStats(badServer); assertEquals(1, stats.getTotalRequestsCount()); assertEquals(0, stats.getActiveRequestsCount()); stats = lbObservables.getServerStats(goodServer); assertEquals(1, stats.getTotalRequestsCount()); }

Target:
public void testObservableWithRetrySameServer() throws Exception { IClientConfig config = DefaultClientConfigImpl.getClientConfigWithDefaultValues().withProperty(CommonClientConfigKey.ConnectTimeout, "1000"); HttpClientRequest<ByteBuf> request = HttpClientRequest.createGet("/testAsync/person"); Server badServer = new Server("localhost:12345"); Server goodServer = new Server("localhost:" + port); List<Server> servers = Lists.newArrayList(badServer, badServer, goodServer); BaseLoadBalancer lb = LoadBalancerBuilder.<Server>newBuilder() .withRule(new AvailabilityFilteringRule()) .withPing(new DummyPing()) .buildFixedServerListLoadBalancer(servers); LoadBalancingHttpClient<ByteBuf, ByteBuf> lbObservables = RibbonTransport.newHttpClient(lb, config, new NettyHttpLoadBalancerErrorHandler(1, 0, true)); Observable<Person> observableWithRetries = getPersonObservable(lbObservables.submit(request)); ObserverWithLatch<Person> observer = new ObserverWithLatch<Person>(); observableWithRetries.subscribe(observer); observer.await(); assertNull(observer.obj); assertTrue(observer.error instanceof ClientException); ServerStats stats = lbObservables.getServerStats(badServer); assertEquals(2, stats.getTotalRequestsCount()); assertEquals(0, stats.getActiveRequestsCount()); stats = lbObservables.getServerStats(goodServer); assertEquals(0, stats.getTotalRequestsCount()); }
Source:
public CreateGlusterVolumeCommand(CreateGlusterVolumeParameters params) { super(params); }

Target:
public CreateGlusterVolumeCommand(CreateGlusterVolumeParameters params) { super(params); volume = getParameters().getVolume(); }
Source:
protected void onBind() { super.onBind(); logger.info(this.getClass().toString() + " onBind"); updateModel(currentErrataModel); getView().getTotalSecurity().setCommand(currentErrataModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(currentErrataModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(currentErrataModel.getShowEnhancementsCommand()); }

Target:
protected void onBind() { super.onBind(); updateModel(currentErrataModel); getView().getTotalSecurity().setCommand(currentErrataModel.getShowSecurityCommand()); getView().getTotalBugFix().setCommand(currentErrataModel.getShowBugsCommand()); getView().getTotalEnhancement().setCommand(currentErrataModel.getShowEnhancementsCommand()); }
Source:
public List<MetricFamilySamples> collect() { String UNKNOWN_LABEL_VALUE = "unknown"; List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>(); GaugeMetricFamily jvmInfo = new GaugeMetricFamily( "jvm_info", "jvm version info", Arrays.asList("version", "vendor")); jvmInfo.addMetric(Arrays.asList(System.getProperty("java.runtime.version", UNKNOWN_LABEL_VALUE), System.getProperty("java.vm.vendor", UNKNOWN_LABEL_VALUE)), 1L); mfs.add(jvmInfo); GaugeMetricFamily osInfo = new GaugeMetricFamily( "os_info", "os version info", Arrays.asList("name", "version", "arch")); osInfo.addMetric(Arrays.asList(System.getProperty("os.name", UNKNOWN_LABEL_VALUE), System.getProperty("os.version"), System.getProperty("os.arch", UNKNOWN_LABEL_VALUE)), 1L); mfs.add(osInfo); return mfs; }

Target:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>(); GaugeMetricFamily jvmInfo = new GaugeMetricFamily( "jvm_info", "JVM version info", Arrays.asList("version", "vendor")); jvmInfo.addMetric(Arrays.asList(System.getProperty("java.runtime.version", "unknown"), System.getProperty("java.vm.vendor", "unknown")), 1L); mfs.add(jvmInfo); return mfs; }
Source:
public static X509KeyManager createKeyManager( String keyStoreLocation, String keyStorePassword, String keyStoreTypeProp) throws KeyManagerException { FileInputStream inputStream = null; if (keyStorePassword == null) { keyStorePassword = ""; } try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( keyStoreTypeProp, keyStoreLocation); KeyStore ks = FileKeyStoreLoader .getBuilderForKeyStoreFileType(storeFileType) .setKeyStorePath(keyStoreLocation) .setKeyStorePassword(keyStorePassword) .build() .loadKeyStore(); KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); kmf.init(ks, keyStorePassword.toCharArray()); for (KeyManager km : kmf.getKeyManagers()) { if (km instanceof X509KeyManager) { return (X509KeyManager) km; } } throw new KeyManagerException("Couldn't find X509KeyManager"); } catch (IOException | GeneralSecurityException keyManagerCreationException) { throw new KeyManagerException(keyManagerCreationException); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ioException) { LOG.info("Failed to close key store input stream", ioException); } } } }

Target:
public static X509KeyManager createKeyManager( String keyStoreLocation, String keyStorePassword, String keyStoreTypeProp) throws KeyManagerException { if (keyStorePassword == null) { keyStorePassword = ""; } try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( keyStoreTypeProp, keyStoreLocation); KeyStore ks = FileKeyStoreLoaderBuilderProvider .getBuilderForKeyStoreFileType(storeFileType) .setKeyStorePath(keyStoreLocation) .setKeyStorePassword(keyStorePassword) .build() .loadKeyStore(); KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); kmf.init(ks, keyStorePassword.toCharArray()); for (KeyManager km : kmf.getKeyManagers()) { if (km instanceof X509KeyManager) { return (X509KeyManager) km; } } throw new KeyManagerException("Couldn't find X509KeyManager"); } catch (IOException | GeneralSecurityException | IllegalArgumentException e) { throw new KeyManagerException(e); } }
Source:
public void start(Context c) { mContext = c; LocationManager lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); } if (mLastLocation != null) { lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mNetworkLocationListener); } }

Target:
public void start(Context c) { mContext = c; LocationManager lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } } lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mNetworkLocationListener); }
Source:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); for (String file : status.getUntracked()) { if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } if (directories) { for (String dir : status.getUntrackedFolders()) { if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }

Target:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); for (String file : filtered) { if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }
Source:
public ShardNodes(UUID shardUuid, Optional<UUID> deltaShardUuid, Set<String> nodeIdentifiers) { this.shardUuid = requireNonNull(shardUuid, "shardUuid is null"); this.deltaShardUuid = requireNonNull(deltaShardUuid, "shardUuid is null"); this.nodeIdentifiers = ImmutableSet.copyOf(requireNonNull(nodeIdentifiers, "nodeIdentifiers is null")); }

Target:
public ShardNodes(UUID shardUuid, Optional<UUID> deltaShardUuid, Set<String> nodeIdentifiers) { this.shardUuid = requireNonNull(shardUuid, "shardUuid is null"); this.deltaShardUuid = requireNonNull(deltaShardUuid, "deltaShardUuid is null"); this.nodeIdentifiers = ImmutableSet.copyOf(requireNonNull(nodeIdentifiers, "nodeIdentifiers is null")); }
Source:
private void setConflictsWith(GerritClient gerritClient, ChangeInfo element) { ChangeInfo[] conflictsWithChangeInfo = null; if (!("MERGED".equals(element.getStatus())) && !("ABANDONED".equals(element.getStatus()))) { try { conflictsWithChangeInfo = queryConflictsWith(gerritClient, element.getChange_id(), new NullProgressMonitor()); } catch (MalformedURLException e) { EGerritCorePlugin.logError(gerritClient.getRepository().formatGerritVersion() + e.getMessage()); } List<ChangeInfo> conflictsWithChangeInfolist = null; List<ChangeInfo> conflictsWithChangeInfolistNew = new ArrayList<ChangeInfo>(); if (conflictsWithChangeInfo != null) { conflictsWithChangeInfolist = Arrays.asList(conflictsWithChangeInfo); for (int i = 0; i < conflictsWithChangeInfolist.size(); i++) { if (conflictsWithChangeInfolist.get(i).getChange_id().compareTo(fChangeInfo.getChange_id()) != 0 && conflictsWithChangeInfolist.get(i).getStatus().compareTo("NEW") == 0 && conflictsWithChangeInfolist.get(i).isMergeable()) { conflictsWithChangeInfolistNew.add(conflictsWithChangeInfolist.remove(i)); } } } fChangeInfo.getConflictsWith().clear(); fChangeInfo.getConflictsWith().addAll(conflictsWithChangeInfolistNew); } }

Target:
private void setConflictsWith(GerritClient gerritClient, ChangeInfo element) { ChangeInfo[] conflictsWithChangeInfo = null; if (!("MERGED".equals(element.getStatus())) && !("ABANDONED".equals(element.getStatus()))) { try { conflictsWithChangeInfo = queryConflictsWith(gerritClient, element.getChange_id(), new NullProgressMonitor()); } catch (MalformedURLException e) { EGerritCorePlugin.logError(gerritClient.getRepository().formatGerritVersion() + e.getMessage()); } List<ChangeInfo> conflictsWithChangeInfolist = null; List<ChangeInfo> conflictsWithChangeInfolistNew = new ArrayList<ChangeInfo>(); if (conflictsWithChangeInfo != null) { conflictsWithChangeInfolist = Arrays.asList(conflictsWithChangeInfo); for (int i = 0; i < conflictsWithChangeInfolist.size(); i++) { if (conflictsWithChangeInfolist.get(i).getChange_id().compareTo(fChangeInfo.getChange_id()) != 0) { conflictsWithChangeInfolistNew.add(conflictsWithChangeInfolist.remove(i)); } } } fChangeInfo.getConflictsWith().clear(); fChangeInfo.getConflictsWith().addAll(conflictsWithChangeInfolistNew); } }
Source:
public void setUp() throws Exception { config = new OzoneConfiguration(); config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY, StringUtils.join(OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT, ":", String.valueOf(scmRpcSecurePort))); securityProtocolServer = new SCMSecurityProtocolServer(config, null); }

Target:
public void setUp() throws Exception { config = new OzoneConfiguration(); config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY, OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT + ":0"); securityProtocolServer = new SCMSecurityProtocolServer(config, null); }
Source:
protected boolean basicHandlePrimaryDestroy(final EventID eventId, boolean addToUnprocessedTokens) { if (this.sender.isPrimary()) { return false; } GatewaySenderStats statistics = this.sender.getStatistics(); synchronized (unprocessedEventsLock) { if (this.sender.isPrimary()) { return false; } if (this.unprocessedEvents == null) return false; EventWrapper ew = this.unprocessedEvents.remove(eventId); if (ew != null) { ew.event.release(); statistics.incUnprocessedEventsRemovedByPrimary(); return true; } else if (addToUnprocessedTokens) { Long mapValue = Long.valueOf(System.currentTimeMillis() + AbstractGatewaySender.TOKEN_TIMEOUT); Long oldv = this.unprocessedTokens.put(eventId, mapValue); if (oldv == null) { statistics.incUnprocessedTokensAddedByPrimary(); } else { } } } return false; }

Target:
protected boolean basicHandlePrimaryDestroy(final EventID eventId, boolean addToUnprocessedTokens) { if (this.sender.isPrimary()) { return false; } GatewaySenderStats statistics = this.sender.getStatistics(); synchronized (unprocessedEventsLock) { if (this.sender.isPrimary()) { return false; } if (this.unprocessedEvents == null) return false; EventWrapper ew = this.unprocessedEvents.remove(eventId); if (ew != null) { ew.event.release(); statistics.incUnprocessedEventsRemovedByPrimary(); return true; } else if (addToUnprocessedTokens) { if (logger.isTraceEnabled()) { logger.trace("{}: fromPrimary destroy event : added to unprocessed token map", sender.getId(), eventId); } Long mapValue = System.currentTimeMillis() + AbstractGatewaySender.TOKEN_TIMEOUT; Long oldv = this.unprocessedTokens.put(eventId, mapValue); if (oldv == null) { statistics.incUnprocessedTokensAddedByPrimary(); } } } return false; }
Source:
protected Collection<Declarable> processAmqpListener(RabbitListener rabbitListener, Method method, Object bean, String beanName) { final Collection<Declarable> declarables = super.processAmqpListener(rabbitListener, method, bean, beanName); final RabbitAdmin rabbitAdmin = resolveRabbitAdminBean(rabbitListener); declarables.stream() .filter(dec -> dec.getDeclaringAdmins().isEmpty()) .filter(dec -> dec instanceof AbstractDeclarable) .map(dec -> (AbstractDeclarable) dec) .forEach(dec -> dec.setAdminsThatShouldDeclare(rabbitAdmin)); return declarables; }

Target:
protected Collection<Declarable> processAmqpListener(RabbitListener rabbitListener, Method method, Object bean, String beanName) { final Collection<Declarable> declarables = super.processAmqpListener(rabbitListener, method, bean, beanName); final String rabbitAdmin = resolveMultiRabbitAdminName(rabbitListener); for (final Declarable declarable : declarables) { if (declarable.getDeclaringAdmins().isEmpty()) { declarable.setAdminsThatShouldDeclare(rabbitAdmin); } } return declarables; }
Source:
public void testListImagesReturns404() throws InterruptedException { server.enqueue(response404()); Iterable<Image> images = api.imageApi().list(Regions.EU_CENTRAL_1.getName()).concat(); assertTrue(isEmpty(images)); assertEquals(server.getRequestCount(), 1); }

Target:
public void testListImagesReturns404() { server.enqueue(response404()); Iterable<Image> images = api.imageApi().list(Regions.EU_CENTRAL_1.getName()).concat(); assertTrue(isEmpty(images)); assertEquals(server.getRequestCount(), 1); }
Source:
public boolean isAPIArtifactExists(String APIId, String gatewayLabel) throws APIManagementException { int count = 0; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.CHECK_ARTIFACT_EXISTS)) { statement.setString(1, APIId); statement.setString(2, gatewayLabel); ResultSet rs = statement.executeQuery(); while (rs.next()) { count = rs.getInt("COUNT"); } } catch (SQLException e) { handleException("Failed to check API artifact status of API with ID " + APIId + " for label " + gatewayLabel, e); } return count != 0; }

Target:
public boolean isAPIArtifactExists(String APIId, String gatewayLabel) throws APIManagementException { ResultSet rs = null; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.CHECK_ARTIFACT_EXISTS)) { connection.setAutoCommit(false); connection.commit(); statement.setString(1, APIId); statement.setString(2, gatewayLabel); rs = statement.executeQuery(); return rs.next(); } catch (SQLException e) { handleException("Failed to check API artifact status of API with ID " + APIId + " for label " + gatewayLabel, e); } finally { GatewayArtifactsMgtDBUtil.closeResultSet(rs); } return false; }
Source:
public PaletteItemDropCommand(IPaletteItem paletteItem, boolean doNotShowWizard){ super(); this.paletteItem = paletteItem; this.doNotShowWizard = doNotShowWizard; wizard = paletteItem.createWizard(); corrector = paletteItem.createPositionCorrector(); }

Target:
public PaletteItemDropCommand(IPaletteItem paletteItem, boolean doNotShowWizard){ super(); this.paletteItem = paletteItem; this.doNotShowWizard = doNotShowWizard; corrector = paletteItem.createPositionCorrector(); }
Source:
private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { long time = timeGraphControl.getTimeAtX(pt.x); List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; if (duration == 0) { int height = Math.max(timeGraphControl.getItemHeight(), 10) / 2; startTime = timeGraphControl.getTimeAtX(pt.x - height); endTime = timeGraphControl.getTimeAtX(pt.x + height); } if ((startTime <= time) && (endTime >= time)) { retVal.add(marker); } } } return retVal; }

Target:
private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); if (markers != null) { int height = Math.max(timeGraphControl.getItemHeight(), 10) / 2; long fuzzStart = timeGraphControl.getTimeAtX(pt.x - height); long fuzzEnd = timeGraphControl.getTimeAtX(pt.x + height); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; if ((startTime < fuzzEnd) && (endTime > fuzzStart)) { retVal.add(marker); } } } } return retVal; }
Source:
protected boolean handlePreloadPackage(String packagePath, String libsPath) { Log.d(TAG, "Preload package ********************************************************"); Log.d(TAG, "WebView package = " + packagePath); return false; }

Target:
protected boolean handlePreloadPackage(String packagePath, String libsPath) { return false; }
Source:
public void tearDown() throws Exception { loggerContext.stop(); }

Target:
public void tearDown() throws Exception { factory.stop(); }
Source:
public void shouldGetMaterialByFolder() { Materials materials = new Materials(); HgMaterial material1 = MaterialsMother.hgMaterial(); material1.setFolder("folder1"); HgMaterial material2 = MaterialsMother.hgMaterial(); material2.setFolder("folder2"); materials.add(material1); materials.add(material2); assertThat((HgMaterial) materials.byFolder("folder1"), Is.is(material1)); }

Target:
public void shouldGetMaterialByFolder() { Materials materials = new Materials(); HgMaterial material1 = MaterialsMother.hgMaterial(); material1.setFolder("folder1"); HgMaterial material2 = MaterialsMother.hgMaterial(); material2.setFolder("folder2"); materials.add(material1); materials.add(material2); assertThat((HgMaterial) materials.byFolder("folder1"), is(material1)); }
Source:
private void remove(final List<Field> newFields, final Field field) { final Iterator<Field> fieldsIterator = newFields.iterator(); while (fieldsIterator.hasNext()) { final Field next = fieldsIterator.next(); if (next.id() != null && next.id().equals(field.id())) { fieldsIterator.remove(); break; } } }

Target:
private void remove(final List<Field> newFields, final Field field) { newFields.removeIf(next -> next.id() != null && next.id().equals(field.id())); }
Source:
public DenseLocalDateDoubleTimeSeries subSeries(LocalDate startInclusive, LocalDate endExclusive) { ArgChecker.notNull(startInclusive, "startInclusive"); ArgChecker.notNull(endExclusive, "endExclusive"); if (endExclusive.isBefore(startInclusive)) { throw new IllegalArgumentException( "Invalid sub series, end before start: " + startInclusive + " to " + endExclusive); } if (isEmpty() || startInclusive.equals(endExclusive) || !startDate.isBefore(endExclusive) || startInclusive.isAfter(getLatestDate())) { return EMPTY_SERIES; } int startIndex = dateCalculation.calculatePosition(startDate, startInclusive); int endIndex = dateCalculation.calculatePosition(startDate, endExclusive); return new DenseLocalDateDoubleTimeSeries( startInclusive, Arrays.copyOfRange(points, startIndex, endIndex), dateCalculation); }

Target:
public LocalDateDoubleTimeSeries subSeries(LocalDate startInclusive, LocalDate endExclusive) { ArgChecker.notNull(startInclusive, "startInclusive"); ArgChecker.notNull(endExclusive, "endExclusive"); if (endExclusive.isBefore(startInclusive)) { throw new IllegalArgumentException( "Invalid sub series, end before start: " + startInclusive + " to " + endExclusive); } if (isEmpty() || startInclusive.equals(endExclusive) || !startDate.isBefore(endExclusive) || startInclusive.isAfter(getLatestDate())) { return LocalDateDoubleTimeSeries.empty(); } LocalDate resolvedStart = dateCalculation.adjustDate(Ordering.natural().max(startInclusive, startDate)); int startIndex = dateCalculation.calculatePosition(startDate, resolvedStart); int endIndex = dateCalculation.calculatePosition(startDate, endExclusive); return new DenseLocalDateDoubleTimeSeries( resolvedStart, Arrays.copyOfRange(points, Math.max(0, startIndex), Math.min(points.length, endIndex)), dateCalculation, true); }
Source:
public static RntbdRequest decode(final ByteBuf in) { final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); if (resourceOperationCode == 0) { final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); throw new IllegalStateException(reason); } final int start = in.writerIndex(); final int expectedLength = in.readIntLE(); final RntbdRequestFrame header = RntbdRequestFrame.decode(in); final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } final byte[] payload = new byte[payloadBuf.readableBytes()]; payloadBuf.readBytes(payload); in.discardReadBytes(); return new RntbdRequest(header, metadata, payload); }

Target:
public static RntbdRequest decode(final ByteBuf in) { final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); if (resourceOperationCode == 0) { final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); throw new IllegalStateException(reason); } final int start = in.readerIndex(); final int expectedLength = in.readIntLE(); final RntbdRequestFrame header = RntbdRequestFrame.decode(in); final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } final byte[] payload = new byte[payloadBuf.readableBytes()]; payloadBuf.readBytes(payload); in.discardReadBytes(); return new RntbdRequest(header, metadata, payload); }
Source:
public LookupsState getAllLookupsState() { assertStarted(); startStopLock.readLock().lock(); try { Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>(); Set<String> lookupsToDrop = new HashSet<>(); Iterator<Notice> iter = queue.iterator(); while (iter.hasNext()) { Notice notice = iter.next(); if (notice instanceof LoadNotice) { LoadNotice loadNotice = (LoadNotice) notice; lookupsToLoad.put(loadNotice.lookupName, loadNotice.lookupExtractorFactoryContainer); lookupsToDrop.remove(loadNotice.lookupName); } else if (notice instanceof DropNotice) { DropNotice dropNotice = (DropNotice) notice; lookupsToDrop.add(dropNotice.lookupName); lookupsToLoad.remove(dropNotice.lookupName); } else { throw new ISE("Unknown Notice type [%s].", notice.getClass().getName()); } } return new LookupsState(Maps.newHashMap(lookupMap), lookupsToLoad, lookupsToDrop); } finally { startStopLock.readLock().unlock(); } }

Target:
public LookupsState<LookupExtractorFactoryContainer> getAllLookupsState() { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); LookupUpdateState lookupUpdateState = stateRef.get(); Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>(); Set<String> lookupsToDrop = new HashSet<>(); updateToLoadAndDrop(lookupUpdateState.noticesBeingHandled, lookupsToLoad, lookupsToDrop); updateToLoadAndDrop(lookupUpdateState.pendingNotices, lookupsToLoad, lookupsToDrop); return new LookupsState<>(lookupUpdateState.lookupMap, lookupsToLoad, lookupsToDrop); }
Source:
public String extractChildNode(String fullChildPath, String prefixPath) { return fullChildPath.substring(prefixPath.length() + URL_SEPARATOR.length()); }

Target:
public String extractChildNode(String fullChildPath, String prefixPath) { return StringUtils.removeStart(fullChildPath, prefixPath + URL_SEPARATOR); }
Source:
private ZapXmlConfiguration getRemoteConfigurationUrl(String url) throws IOException, ConfigurationException, InvalidCfuUrlException { HttpMessage msg = new HttpMessage(new URI(url, true), Model.getSingleton().getOptionsParam().getConnectionParam()); getHttpSender().sendAndReceive(msg,true); if (msg.getResponseHeader().getStatusCode() != HttpStatusCode.OK) { throw new IOException( "Expected '200 OK' but got '" + msg.getResponseHeader().getStatusCode() + " " + msg.getResponseHeader().getReasonPhrase() + "'"); } if (! msg.getRequestHeader().isSecure()) { throw new InvalidCfuUrlException(msg.getRequestHeader().getURI().toString()); } ZapXmlConfiguration config = new ZapXmlConfiguration(); config.setDelimiterParsingDisabled(true); config.load(new StringReader(msg.getResponseBody().toString())); File f = new File(Constant.FOLDER_LOCAL_PLUGIN, VERSION_FILE_NAME); try (Writer out = new OutputStreamWriter(new FileOutputStream(f), StandardCharsets.UTF_8)){ out.write(msg.getResponseBody().toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } return config; }

Target:
private ZapXmlConfiguration getRemoteConfigurationUrl(String url) throws IOException, ConfigurationException, InvalidCfuUrlException { HttpMessage msg = new HttpMessage(new URI(url, true), Model.getSingleton().getOptionsParam().getConnectionParam()); getHttpSender().sendAndReceive(msg,true); if (msg.getResponseHeader().getStatusCode() != HttpStatusCode.OK) { throw new IOException( "Expected '200 OK' but got '" + msg.getResponseHeader().getStatusCode() + " " + msg.getResponseHeader().getReasonPhrase() + "'"); } if (! msg.getRequestHeader().isSecure()) { throw new InvalidCfuUrlException(msg.getRequestHeader().getURI().toString()); } ZapXmlConfiguration config = new ZapXmlConfiguration(); config.setDelimiterParsingDisabled(true); config.load(new StringReader(msg.getResponseBody().toString())); File f = new File(Constant.FOLDER_LOCAL_PLUGIN, VERSION_FILE_NAME); try{ Files.write(f.toPath(), msg.getResponseBody().getBytes()); }catch(IOException ioe){ logger.error(ioe.getMessage(), ioe); } return config; }
Source:
protected List<Integer> getSlotsEligibleForRollup(long now, long maxAgeMillis, long delayedMetricsMaxAgeMillis) { List<Integer> outputKeys = new ArrayList<Integer>(); long nowMillis = new DateTime().getMillis(); for (Map.Entry<Integer, UpdateStamp> entry : slotToUpdateStampMap.entrySet()) { final UpdateStamp update = entry.getValue(); final long timeElapsed = now - update.getTimestamp(); timeSinceUpdate.update(timeElapsed); if (update.getState() == UpdateStamp.State.Rolled) { continue; } if (timeElapsed <= maxAgeMillis) { continue; } if (update.getLastRollupTimestamp() > 0) { final long timeElapsedSinceLastRollup = now - update.getLastRollupTimestamp(); if (timeElapsedSinceLastRollup < DELAYED_METRICS_MAX_ALLOWED_DELAY) { if (timeElapsed <= delayedMetricsMaxAgeMillis) { SlotKey slotKey = SlotKey.of(granularity, entry.getKey(), shard); log.debug(String.format("Delaying re-roll of slotKey [%s] as [%d] millis haven't elapsed " + "since collection time:[%d] now: [%d], last rollup time: [%d]", slotKey, delayedMetricsMaxAgeMillis, update.getTimestamp(), now, update.getLastRollupTimestamp())); continue; } else { granToReRollMeters.get(granularity).mark(); if (nowMillis - update.getTimestamp() >= millisInADay) { granToDelayedMetricsMeter.get(granularity).mark(); } } } } outputKeys.add(entry.getKey()); } return outputKeys; }

Target:
protected List<Integer> getSlotsEligibleForRollup(long now, long maxAgeMillis, long delayedMetricsMaxAgeMillis) { List<Integer> outputKeys = new ArrayList<Integer>(); long nowMillis = new DateTime().getMillis(); for (Map.Entry<Integer, UpdateStamp> entry : slotToUpdateStampMap.entrySet()) { final UpdateStamp update = entry.getValue(); final long timeElapsed = now - update.getTimestamp(); timeSinceUpdate.update(timeElapsed); if (update.getState() == UpdateStamp.State.Rolled) { continue; } if (timeElapsed <= maxAgeMillis) { continue; } if (update.getLastRollupTimestamp() > 0) { final long timeElapsedSinceLastRollup = now - update.getLastRollupTimestamp(); if (timeElapsedSinceLastRollup < REROLL_TIME_SPAN_ASSUMED_VALUE) { if (timeElapsed <= delayedMetricsMaxAgeMillis) { SlotKey slotKey = SlotKey.of(granularity, entry.getKey(), shard); log.debug(String.format("Delaying re-roll of slotKey [%s] as [%d] millis haven't elapsed " + "since collection time:[%d] now: [%d], last rollup time: [%d]", slotKey, delayedMetricsMaxAgeMillis, update.getTimestamp(), now, update.getLastRollupTimestamp())); continue; } else { granToReRollMeters.get(granularity).mark(); if (nowMillis - update.getTimestamp() >= millisInADay) { granToDelayedMetricsMeter.get(granularity).mark(); } } } } outputKeys.add(entry.getKey()); } return outputKeys; }
Source:
private void transferCommittedTail(CorfuRuntime runtime, Layout layout, long committedTail) { final int maxRetry = 3; LogUnitClient logUnitClient = runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(currentNode); for (int i = 0; i < maxRetry; i++) { try { CFUtils.getUninterruptibly(logUnitClient.updateCommittedTail(committedTail), TimeoutException.class, NetworkException.class); return; } catch (TimeoutException | NetworkException e) { log.error("Encountered network issue when transferring new committed tail."); } } }

Target:
private void transferCommittedTail(CorfuRuntime runtime, Layout layout, long committedTail) { LogUnitClient logUnitClient = runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(currentNode); for (int i = 0; i < retryBase; i++) { try { CFUtils.getUninterruptibly(logUnitClient.updateCommittedTail(committedTail), TimeoutException.class, NetworkException.class); log.debug("transferCommittedTail: transferred committed tail {}", committedTail); return; } catch (TimeoutException | NetworkException e) { log.error("transferCommittedTail: encountered network issue " + "when transferring a new committed tail."); } } log.warn("transferCommittedTail: failed to transfer the latest committed tail of {}.", committedTail); }
Source:
public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } if (isDnsResolverConfigurationSupported()) { addDnsConfiguration(result); } result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork ); return result; }

Target:
public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } addDnsConfiguration(result); result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork ); return result; }
Source:
public String transform(String jsonPathExpression, String source) throws TransformationException { if (jsonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("about to transform '{}' by the function '{}'", source, jsonPathExpression); try { Object transformationResult = JsonPath.read(source, jsonPathExpression); logger.debug("transformation resulted in '{}'", transformationResult); if (transformationResult == null) { return UnDefType.NULL.toFullString(); } else if (transformationResult instanceof List) { return flattenList((List<?>) transformationResult); } else { return transformationResult.toString(); } } catch (PathNotFoundException e) { return null; } catch (InvalidPathException | InvalidJsonException e) { throw new TransformationException("An error occurred while transforming JSON expression.", e); } }

Target:
public String transform(String jsonPathExpression, String source) throws TransformationException { if (jsonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("About to transform '{}' by the function '{}'", source, jsonPathExpression); try { Object transformationResult = JsonPath.read(source, jsonPathExpression); logger.debug("Transformation resulted in '{}'", transformationResult); if (transformationResult == null) { return UnDefType.NULL.toFullString(); } else if (transformationResult instanceof List) { return flattenList((List<?>) transformationResult); } else { return transformationResult.toString(); } } catch (PathNotFoundException e) { logger.debug("Given JSONPath selector expression '" + jsonPathExpression + "' does not match the input string '" + source + "'"); return UnDefType.NULL.toFullString(); } catch (InvalidPathException | InvalidJsonException e) { throw new TransformationException("An error occurred while transforming JSON expression.", e); } }
Source:
public byte[] getBytes(String plainText) { if (!isBase64) { return plainText.getBytes(charset); } else { try { return codec.decode(plainText.getBytes("US-ASCII")); } catch (Exception e) { throw new CompatException(e); } } }

Target:
public byte[] getBytes(String plainText) { if (this != Base64) { return plainText.getBytes(charset); } else { try { return codec.decode(plainText.getBytes("US-ASCII")); } catch (Exception e) { throw new CompatException(e); } } }