auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void organisation_should_not_have_notice_for_language() { final Entity result = (Entity) map(RpslObject.parse("" + "organisation: ORG-AC1-TEST\n" + "org-name: Acme Carpets\n" + "org-type: OTHER\n" + "address: Singel 258\n" + "e-mail: bitbucket@ripe.net\n" + "descr: Acme Carpet Organisation\n" + "remark: some remark\n" + "phone: +31 1234567\n" + "fax-no: +31 98765432\n" + "geoloc: 52.375599 4.899902\n" + "language: DK\n" + "admin-c: TP1-TEST\n" + "abuse-c: ABU-TEST\n" + "mnt-by: FRED-MNT\n" + "source: TEST")); assertThat(result.getLang(), is("DK")); final List<Notice> notices = result.getNotices(); assertThat(notices, hasSize(1)); assertNull(notices.get(0)); }

Target:
public void organisation_should_not_have_notice_for_language() { final Entity result = (Entity) map(RpslObject.parse("" + "organisation: ORG-AC1-TEST\n" + "org-name: Acme Carpets\n" + "org-type: OTHER\n" + "address: Singel 258\n" + "e-mail: bitbucket@ripe.net\n" + "descr: Acme Carpet Organisation\n" + "remark: some remark\n" + "phone: +31 1234567\n" + "fax-no: +31 98765432\n" + "geoloc: 52.375599 4.899902\n" + "language: DK\n" + "admin-c: TP1-TEST\n" + "abuse-c: ABU-TEST\n" + "mnt-by: FRED-MNT\n" + "source: TEST")); assertThat(result.getLang(), is("DK")); final List<Notice> notices = result.getNotices(); assertThat(notices, hasSize(1)); assertThat(notices.get(0).getTitle(), is("Terms And Condition")); }
Source:
private boolean matchesFilter(StackTraceElement[] stackTraces) { for (StackTraceElement element : stackTraces) { String fullyQualifiedMethodName = element.getClassName() + '.' + element.getMethodName(); for (String filter : filters) { if (fullyQualifiedMethodName.equals(filter)) { return true; } } } return false; }

Target:
private boolean matchesFilter(StackTraceElement[] stackTraces) { for (StackTraceElement element : stackTraces) { for (Filter filter : filters ) { if (element.getMethodName().equals(filter.methodName) && element.getClassName().equals(filter.className)) { return true; } } } return false; }
Source:
public void reject(@PathVariable(value = "proposalId") Long proposalId) { Proposal proposal = proposalRepository.findOne(proposalId); proposal.setStatus(ProposalStatus.REJECTED); }

Target:
public void reject(@PathVariable(value = "proposalId") Long proposalId) { changeProposalStatus(proposalId, ProposalStatus.REJECTED); }
Source:
private void handleSuccess(List<Media> collection) { if (collection == null || collection.isEmpty()) { initErrorView(); hasMoreImages = false; return; } if (gridAdapter == null) { setAdapter(collection); } else { if (gridAdapter.containsAll(collection)) { hasMoreImages = false; return; } gridAdapter.addItems(collection); try { ((CategoryImagesActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } try { ((CategoryDetailsActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } try { ((ExploreActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } } progressBar.setVisibility(GONE); isLoading = false; statusTextView.setVisibility(GONE); for (Media m : collection) { replaceTitlesWithCaptions(m.getDisplayTitle(), mediaSize++); } }

Target:
private void handleSuccess(List<Media> collection) { if (collection == null || collection.isEmpty()) { initErrorView(); hasMoreImages = false; return; } if (gridAdapter == null) { setAdapter(collection); } else { if (gridAdapter.containsAll(collection)) { hasMoreImages = false; return; } gridAdapter.addItems(collection); try { ((CategoryImagesActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } try { ((CategoryDetailsActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } try { ((ExploreActivity) getContext()).viewPagerNotifyDataSetChanged(); }catch (Exception e){ e.printStackTrace(); } } progressBar.setVisibility(GONE); isLoading = false; statusTextView.setVisibility(GONE); for (Media m : collection) { replaceTitlesWithCaptions("M"+m.getPageId(), mediaSize++); } }
Source:
public DynamicTableSource createDynamicTableSource(Context context) { createTableFactoryHelper(this, context).validateExcept(FIELDS); Configuration options = new Configuration(); context.getCatalogTable().getOptions().forEach(options::setString); TableSchema schema = TableSchemaUtils.getPhysicalSchema(context.getCatalogTable().getSchema()); DataGenerator[] fieldGenerators = new DataGenerator[schema.getFieldCount()]; Set<ConfigOption<?>> optionalOptions = new HashSet<>(); for (int i = 0; i < fieldGenerators.length; i++) { String name = schema.getFieldNames()[i]; DataType type = schema.getFieldDataTypes()[i]; ConfigOption<String> kind = key(FIELDS + "." + name + "." + KIND) .stringType().defaultValue(RANDOM); DataGeneratorContainer container = createContainer(name, type, options.get(kind), options); fieldGenerators[i] = container.generator; optionalOptions.add(kind); optionalOptions.addAll(container.options); } FactoryUtil.validateFactoryOptions(new HashSet<>(), optionalOptions, options); Set<String> consumedOptionKeys = new HashSet<>(); consumedOptionKeys.add(CONNECTOR.key()); consumedOptionKeys.add(ROWS_PER_SECOND.key()); optionalOptions.stream().map(ConfigOption::key).forEach(consumedOptionKeys::add); FactoryUtil.validateUnconsumedKeys(factoryIdentifier(), options.keySet(), consumedOptionKeys); return new DataGenTableSource(fieldGenerators, schema, options.get(ROWS_PER_SECOND)); }

Target:
public DynamicTableSource createDynamicTableSource(Context context) { Configuration options = new Configuration(); context.getCatalogTable().getOptions().forEach(options::setString); TableSchema schema = TableSchemaUtils.getPhysicalSchema(context.getCatalogTable().getSchema()); DataGenerator[] fieldGenerators = new DataGenerator[schema.getFieldCount()]; Set<ConfigOption<?>> optionalOptions = new HashSet<>(); for (int i = 0; i < fieldGenerators.length; i++) { String name = schema.getFieldNames()[i]; DataType type = schema.getFieldDataTypes()[i]; ConfigOption<String> kind = key(FIELDS + "." + name + "." + KIND) .stringType().defaultValue(RANDOM); DataGeneratorContainer container = createContainer(name, type, options.get(kind), options); fieldGenerators[i] = container.generator; optionalOptions.add(kind); optionalOptions.addAll(container.options); } FactoryUtil.validateFactoryOptions(requiredOptions(), optionalOptions, options); Set<String> consumedOptionKeys = new HashSet<>(); consumedOptionKeys.add(CONNECTOR.key()); consumedOptionKeys.add(ROWS_PER_SECOND.key()); optionalOptions.stream().map(ConfigOption::key).forEach(consumedOptionKeys::add); FactoryUtil.validateUnconsumedKeys(factoryIdentifier(), options.keySet(), consumedOptionKeys); return new DataGenTableSource(fieldGenerators, schema, options.get(ROWS_PER_SECOND)); }
Source:
private ChannelFuture setupServerBootstrap( SocketAddress listenAddress, ChannelInitializer<?> channelInitializer) throws InterruptedException { ServerBootstrap serverBootstrap = new ServerBootstrap().group(serverGroup.clientToProxyBossPool, serverGroup.clientToProxyWorkerPool); Map<ChannelOption, Object> channelOptions = new HashMap<>(); channelOptions.put(ChannelOption.SO_BACKLOG, 128); channelOptions.put(ChannelOption.SO_LINGER, -1); channelOptions.put(ChannelOption.TCP_NODELAY, true); channelOptions.put(ChannelOption.SO_KEEPALIVE, true); LOG.debug("Proxy listening with " + serverGroup.channelType); serverBootstrap.channel(serverGroup.channelType); for (Map.Entry<ChannelOption, Object> optionEntry : channelOptions.entrySet()) { serverBootstrap = serverBootstrap.option(optionEntry.getKey(), optionEntry.getValue()); } for (Map.Entry<ChannelOption, ?> optionEntry : serverGroup.transportChannelOptions.entrySet()) { serverBootstrap = serverBootstrap.option(optionEntry.getKey(), optionEntry.getValue()); } serverBootstrap.childHandler(channelInitializer); serverBootstrap.validate(); LOG.debug("Binding to : " + listenAddress); serverStatusManager.localStatus(InstanceInfo.InstanceStatus.UP); return serverBootstrap.bind(listenAddress).sync(); }

Target:
private ChannelFuture setupServerBootstrap( SocketAddress listenAddress, ChannelInitializer<?> channelInitializer) throws InterruptedException { ServerBootstrap serverBootstrap = new ServerBootstrap().group(serverGroup.clientToProxyBossPool, serverGroup.clientToProxyWorkerPool); Map<ChannelOption, Object> channelOptions = new HashMap<>(); channelOptions.put(ChannelOption.SO_BACKLOG, 128); channelOptions.put(ChannelOption.SO_LINGER, -1); channelOptions.put(ChannelOption.TCP_NODELAY, true); channelOptions.put(ChannelOption.SO_KEEPALIVE, true); LOG.info("Proxy listening with " + serverGroup.channelType); serverBootstrap.channel(serverGroup.channelType); for (Map.Entry<ChannelOption, Object> optionEntry : channelOptions.entrySet()) { serverBootstrap = serverBootstrap.option(optionEntry.getKey(), optionEntry.getValue()); } for (Map.Entry<ChannelOption, ?> optionEntry : serverGroup.transportChannelOptions.entrySet()) { serverBootstrap = serverBootstrap.option(optionEntry.getKey(), optionEntry.getValue()); } serverBootstrap.childHandler(channelInitializer); serverBootstrap.validate(); LOG.info("Binding to : " + listenAddress); serverStatusManager.localStatus(InstanceInfo.InstanceStatus.UP); return serverBootstrap.bind(listenAddress).sync(); }
Source:
public void setKeywords(List<KeywordInfo> keywords) { if (keywords == null) { this.keywords = new ArrayList<>(); } this.keywords = keywords; }

Target:
public void setKeywords(List<KeywordInfo> keywords) { this.keywords = keywords == null ? new ArrayList<>() : keywords; }
Source:
public MimeMessage sendErrorReport(HttpServletRequest req, Throwable error) { MimeMessage email = null; try { String requestMethod = req.getMethod(); String requestUserAgent = req.getHeader("User-Agent"); String requestPath = req.getServletPath(); String requestUrl = req.getRequestURL().toString(); String requestParam = HttpRequestHelper.printRequestParameters(req); email = generateSystemErrorEmail(error, requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, Config.inst().getAppVersion()); forceSendEmailThroughGaeWithoutLogging(email); log.severe("Sent crash report: " + Emails.getEmailInfo(email)); } catch (Exception e) { log.severe("Crash report failed to send. Detailed error stack trace: " + TeammatesException.toStringWithStackTrace(error).replace("\\n","<br>")); logSevereForErrorInSendingItem("crash report", email, e); } return email; }

Target:
public MimeMessage sendErrorReport(HttpServletRequest req, Throwable error) { MimeMessage email = null; try { String requestMethod = req.getMethod(); String requestUserAgent = req.getHeader("User-Agent"); String requestPath = req.getServletPath(); String requestUrl = req.getRequestURL().toString(); String requestParam = HttpRequestHelper.printRequestParameters(req); email = generateSystemErrorEmail(error, requestMethod, requestUserAgent, requestPath, requestUrl, requestParam, Config.inst().getAppVersion()); forceSendEmailThroughGaeWithoutLogging(email); log.severe("Sent crash report: " + Emails.getEmailInfo(email)); } catch (Exception e) { log.severe("Crash report failed to send. Detailed error stack trace: " + TeammatesException.toStringWithStackTrace(error)); logSevereForErrorInSendingItem("crash report", email, e); } return email; }
Source:
public final void run() { if (forcedRepairAction == RepairAction.RESET) { resetAndStop(node); } else if (forcedRepairAction == RepairAction.UNLOCK_CONFIG) { forceUnlock(); } else { nomadRepair(); } logger.info("Command successful!" + lineSeparator()); }

Target:
public final void run() { if (forcedRepairAction == RepairAction.RESET) { resetAndStop(node); } else if (forcedRepairAction == RepairAction.UNLOCK) { forceUnlock(); } else { nomadRepair(); } logger.info("Command successful!" + lineSeparator()); }
Source:
public HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException { return AuthorizationUtils.getHivePrincipal(principal); }

Target:
public HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException { if (principal == null) { return null; } return AuthorizationUtils.getHivePrincipal(principal.getName(), principal.getType()); }
Source:
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { final ClientHttpResponse response = execution.execute(request, body); if (logger.isWarnEnabled()) { final List<String> deprecated = response.getHeaders().get(Header.GDC_DEPRECATED); if (deprecated != null && !deprecated.isEmpty()) { logger.warn("Resource path={} deprecated {}", request.getURI().getPath(), deprecated.get(0)); } } return response; }

Target:
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException { final ClientHttpResponse response = execution.execute(request, body); if (logger.isWarnEnabled()) { final List<String> deprecated = response.getHeaders().get(Header.GDC_DEPRECATED); if (deprecated != null && !deprecated.isEmpty()) { final List<String> versionHeaders = request.getHeaders().get(Header.GDC_VERSION); final String version = versionHeaders != null && !versionHeaders.isEmpty() ? versionHeaders.get(0) : "UNKNOWN"; logger.warn("Resource path={} version={} deprecated {}", request.getURI().getPath(), version, deprecated.get(0)); } } return response; }
Source:
public static <T> T createModel(Class<T> model, List<OpenEngSBModelEntry> entries) { checkIfClassIsModel(model); try { T instance = model.newInstance(); for (OpenEngSBModelEntry entry : entries) { try { String setterName = getSetterName(entry.getKey()); Method method = model.getMethod(setterName, entry.getType()); method.invoke(instance, entry.getValue()); } catch (NoSuchMethodException e) { ((OpenEngSBModel) instance).addOpenEngSBModelEntry(entry); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } return instance; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } return null; }

Target:
public static <T> T createModel(Class<T> model, List<OpenEngSBModelEntry> entries) { checkIfClassIsModel(model); try { T instance = model.newInstance(); for (OpenEngSBModelEntry entry : entries) { try { String setterName = getSetterName(entry.getKey()); Method method = model.getMethod(setterName, entry.getType()); method.invoke(instance, entry.getValue()); } catch (NoSuchMethodException e) { ((OpenEngSBModel) instance).addOpenEngSBModelEntry(entry); } catch (IllegalArgumentException e) { LOGGER.error("IllegalArgumentException while trying to set values for the new model.", e); } catch (InvocationTargetException e) { LOGGER.error("InvocationTargetException while trying to set values for the new model.", e); } } return instance; } catch (InstantiationException e) { LOGGER.error("InstantiationException while creating a new model instance.", e); } catch (IllegalAccessException e) { LOGGER.error("IllegalAccessException while creating a new model instance.", e); } catch (SecurityException e) { LOGGER.error("SecurityException while creating a new model instance.", e); } return null; }
Source:
public static Slice hmacMd5( @SqlType(StandardTypes.VARBINARY) Slice slice, @SqlType(StandardTypes.VARBINARY) Slice key) { return Slices.wrappedBuffer(Hashing.hmacMd5(key.getBytes()).hashBytes(slice.getBytes()).asBytes()); }

Target:
public static Slice hmacMd5( @SqlType(StandardTypes.VARBINARY) Slice slice, @SqlType(StandardTypes.VARBINARY) Slice key) { return wrappedBuffer(Hashing.hmacMd5(key.getBytes()).hashBytes(slice.getBytes()).asBytes()); }
Source:
public long getFilterBlobLimit() { return filterSpec.getBlobLimit(); }

Target:
public final long getFilterBlobLimit() { return filterSpec.getBlobLimit(); }
Source:
private void validateOriginalInstanceValues(InstanceAdapter instanceAdapter) { TaskAdapter taskAdapter = instanceAdapter.taskAdapter(); if (new First<>(new Sieved<>(taskAdapter::isUpdated, ORIGINAL_INSTANCE_FIELD_ADAPTERS)).isPresent()) { throw new IllegalArgumentException("Recurrence values can not be modified through the instances table."); } }

Target:
private void validateOriginalInstanceValues(InstanceAdapter instanceAdapter) { TaskAdapter taskAdapter = instanceAdapter.taskAdapter(); if (new First<>(new Sieved<>(taskAdapter::isUpdated, ORIGINAL_INSTANCE_FIELD_ADAPTERS)).isPresent()) { throw new IllegalArgumentException("ORIGINAL_INSTANCE_* fields can not be updated through the instances table."); } }
Source:
private static String findMode(String bondOptions){ char[] bondOptionsChars = bondOptions.toCharArray(); int length = bondOptions.length(); int index = 0; if (!bondOptions.startsWith(MODE_FOR_SEARCH)){ if ((index = bondOptions.indexOf(" " + MODE_FOR_SEARCH)) == -1){ return null; } index++; } index = index + MODE_FOR_SEARCH.length(); while(index < length && Character.isSpace(bondOptionsChars[index])){ index++; } if (index >= length || bondOptionsChars[index] != '='){ return null; } index++; while(index < length && Character.isSpace(bondOptionsChars[index])){ index++; } StringBuffer buffer = new StringBuffer(); while(index < length && Character.isDigit(bondOptionsChars[index])){ buffer.append(bondOptionsChars[index]); index++; } if (index < length && !Character.isSpace(bondOptionsChars[index])){ return null; } if (buffer.length() == 0){ return null; } return buffer.toString(); }

Target:
private static String findMode(String bondOptions){ char[] bondOptionsChars = bondOptions.toCharArray(); int length = bondOptions.length(); int index = 0; if (!bondOptions.startsWith(MODE_FOR_SEARCH)){ if ((index = bondOptions.indexOf(" " + MODE_FOR_SEARCH)) == -1){ return null; } index++; } index = index + MODE_FOR_SEARCH.length(); while(index < length && Character.isSpace(bondOptionsChars[index])){ index++; } if (index >= length || bondOptionsChars[index] != '='){ return null; } index++; while(index < length && Character.isSpace(bondOptionsChars[index])){ index++; } StringBuilder bondModeBuilder = new StringBuilder(); while(index < length && Character.isDigit(bondOptionsChars[index])){ bondModeBuilder.append(bondOptionsChars[index]); index++; } if (index < length && !Character.isSpace(bondOptionsChars[index])){ return null; } if (bondModeBuilder.length() == 0){ return null; } return bondModeBuilder.toString(); }
Source:
public void setProperties(Set<Property> properties) { this.properties = properties; }

Target:
public Node setProperties(Set<Property> properties) { if (details == null) { throw new IllegalArgumentException("Null value not permitted"); } this.properties = properties; return this; }
Source:
public TxnUnlockBackupOperation(String name, Data dataKey, String ownerUuid, long lockThreadId) { super(name, dataKey); this.ownerUuid = ownerUuid; this.lockThreadId = lockThreadId; }

Target:
public TxnUnlockBackupOperation(String name, Data dataKey, String ownerUuid, long lockThreadId) { super(name, dataKey); this.ownerUuid = ownerUuid; this.threadId = lockThreadId; }
Source:
private void writeExternalData(final FileOutputStream edfos) throws IOException { while (!externalData.isEmpty()) { Object[] ed = externalData.poll(); for (Object oo : ed) { if (oo == null) { continue; } if (oo instanceof StringWrapper) { StringWrapper sw = (StringWrapper) oo; byte[] bytes = sw.s.getBytes(); byte[] header = ActorExecutionTrace.getExtDataHeader(sw.actorId, sw.dataId, bytes.length); if (edfos != null) { edfos.getChannel().write(ByteBuffer.wrap(header)); edfos.getChannel().write(ByteBuffer.wrap(bytes)); edfos.flush(); } externalBytes += bytes.length + 12; } else if (oo instanceof TwoDArrayWrapper) { writeArray((TwoDArrayWrapper) oo, edfos); } else { byte[] data = (byte[]) oo; externalBytes += data.length; if (edfos != null) { edfos.getChannel().write(ByteBuffer.wrap(data)); edfos.flush(); } } } } }

Target:
private void writeExternalData(final FileOutputStream edfos) throws IOException { while (!externalData.isEmpty()) { Object[] external = externalData.poll(); for (Object oo : external) { if (oo == null) { continue; } if (oo instanceof StringWrapper) { StringWrapper sw = (StringWrapper) oo; byte[] bytes = sw.s.getBytes(); byte[] header = ActorExecutionTrace.getExtDataHeader(sw.actorId, sw.dataId, bytes.length); if (edfos != null) { edfos.getChannel().write(ByteBuffer.wrap(header)); edfos.getChannel().write(ByteBuffer.wrap(bytes)); edfos.flush(); } externalBytes += bytes.length + 12; } else if (oo instanceof TwoDArrayWrapper) { writeArray((TwoDArrayWrapper) oo, edfos); } else { byte[] data = (byte[]) oo; externalBytes += data.length; if (edfos != null) { edfos.getChannel().write(ByteBuffer.wrap(data)); edfos.flush(); } } } } }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { IWorkspaceRunnable action = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor actMonitor) throws CoreException { String taskName = NLS.bind( CoreText.CreateLocalBranchOperation_CreatingBranchMessage, name); SubMonitor progress = SubMonitor.convert(actMonitor, taskName, 1); try (Git git = new Git(repository)) { if (ref != null) { SetupUpstreamMode mode; if (upstreamConfig == null) mode = SetupUpstreamMode.NOTRACK; else mode = SetupUpstreamMode.SET_UPSTREAM; git.branchCreate().setName(name).setStartPoint( ref.getName()).setUpstreamMode(mode).call(); } else git.branchCreate().setName(name).setStartPoint(commit) .setUpstreamMode(SetupUpstreamMode.NOTRACK) .call(); } catch (Exception e) { throw new CoreException(Activator.error(e.getMessage(), e)); } if (upstreamConfig != null) { StoredConfig config = repository.getConfig(); config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, name, ConfigConstants.CONFIG_KEY_REBASE, upstreamConfig); try { config.save(); } catch (IOException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } } progress.worked(1); } }; ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor); }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { IWorkspaceRunnable action = new IWorkspaceRunnable() { @Override public void run(IProgressMonitor actMonitor) throws CoreException { String taskName = NLS.bind( CoreText.CreateLocalBranchOperation_CreatingBranchMessage, name); SubMonitor progress = SubMonitor.convert(actMonitor); progress.setTaskName(taskName); try (Git git = new Git(repository)) { if (ref != null) { SetupUpstreamMode mode; if (upstreamConfig == null) mode = SetupUpstreamMode.NOTRACK; else mode = SetupUpstreamMode.SET_UPSTREAM; git.branchCreate().setName(name).setStartPoint( ref.getName()).setUpstreamMode(mode).call(); } else git.branchCreate().setName(name).setStartPoint(commit) .setUpstreamMode(SetupUpstreamMode.NOTRACK) .call(); } catch (Exception e) { throw new CoreException(Activator.error(e.getMessage(), e)); } if (upstreamConfig != null) { StoredConfig config = repository.getConfig(); config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, name, ConfigConstants.CONFIG_KEY_REBASE, upstreamConfig); try { config.save(); } catch (IOException e) { throw new CoreException(Activator.error(e.getMessage(), e)); } } } }; ResourcesPlugin.getWorkspace().run(action, getSchedulingRule(), IWorkspace.AVOID_UPDATE, monitor); }
Source:
public FakeTestNGMethod(Class<?> clazz, String methodName, XmlTest xmlTest) { this(clazz, methodName); this.xmlTest = xmlTest; }

Target:
public FakeTestNGMethod(Class<?> clazz, String methodName, XmlTest xmlTest) { ConstructorOrMethod temp = null; Method[] methods = ReflectionHelper.getLocalMethods(clazz); for (Method method : methods) { if (method.getName().equalsIgnoreCase(methodName)) { temp = new ConstructorOrMethod(method); break; } } this.xmlTest = xmlTest; this.clazz = clazz; this.consMethod = temp; }
Source:
public void getGenericPasswordForOptions(String service, Promise promise) { try { service = getDefaultServiceIfNull(service); CipherStorage currentCipherStorage = getCipherStorageForCurrentAPILevel(); final DecryptionResult decryptionResult; ResultSet resultSet = prefsStorage.getEncryptedEntry(service); if (resultSet == null) { Log.e(KEYCHAIN_MODULE, "No entry found for service: " + service); promise.resolve(false); return; } if (resultSet.cipherStorageName.equals(currentCipherStorage.getCipherStorageName())) { decryptionResult = currentCipherStorage.decrypt(service, resultSet.usernameBytes, resultSet.passwordBytes); } else { CipherStorage oldCipherStorage = getCipherStorageByName(resultSet.cipherStorageName); decryptionResult = oldCipherStorage.decrypt(service, resultSet.usernameBytes, resultSet.passwordBytes); try { EncryptionResult encryptionResult = currentCipherStorage.encrypt(service, decryptionResult.username, decryptionResult.password, decryptionResult.getSecurityLevel()); prefsStorage.storeEncryptedEntry(service, encryptionResult); oldCipherStorage.removeKey(service); } catch (CryptoFailedException e) { Log.e(KEYCHAIN_MODULE, "Migrating to a less safe storage is not allowed. Keeping the old one"); } } WritableMap credentials = Arguments.createMap(); credentials.putString("service", service); credentials.putString("username", decryptionResult.username); credentials.putString("password", decryptionResult.password); promise.resolve(credentials); } catch (KeyStoreAccessException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_KEYSTORE_ACCESS_ERROR, e); } catch (CryptoFailedException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_CRYPTO_FAILED, e); } }

Target:
public void getGenericPasswordForOptions(String service, Promise promise) { try { service = getDefaultServiceIfNull(service); CipherStorage currentCipherStorage = getCipherStorageForCurrentAPILevel(); ResultSet resultSet = prefsStorage.getEncryptedEntry(service); if (resultSet == null) { Log.e(KEYCHAIN_MODULE, "No entry found for service: " + service); promise.resolve(false); return; } final DecryptionResult decryptionResult = decryptCredentials(service, currentCipherStorage, resultSet); WritableMap credentials = Arguments.createMap(); credentials.putString("service", service); credentials.putString("username", decryptionResult.username); credentials.putString("password", decryptionResult.password); promise.resolve(credentials); } catch (KeyStoreAccessException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_KEYSTORE_ACCESS_ERROR, e); } catch (CryptoFailedException e) { Log.e(KEYCHAIN_MODULE, e.getMessage()); promise.reject(E_CRYPTO_FAILED, e); } }
Source:
public void testGetPermittedStorageDomains() { List<StorageDomain> result = dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID, ActionGroup.CONFIGURE_VM_STORAGE, Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d")); assertNotNull(result); assertFalse(result.isEmpty()); assertEquals(result.get(0).getId(), existingDomain.getId()); }

Target:
public void testGetPermittedStorageDomains() { List<StorageDomain> result = dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID, ActionGroup.CONFIGURE_VM_STORAGE, new Guid("6d849ebf-755f-4552-ad09-9a090cda105d")); assertNotNull(result); assertFalse(result.isEmpty()); assertEquals(result.get(0).getId(), existingDomain.getId()); }