auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<DFUDataColumnInfo> getFileDataColumns(String logicalname, String clustername) throws Exception { WsDfuServiceSoapProxy proxy = getSoapProxy(); DFUGetDataColumnsRequest req = new DFUGetDataColumnsRequest(); List<DFUDataColumnInfo> cols = new ArrayList<DFUDataColumnInfo>(); req.setOpenLogicalName(logicalname); if (clustername != null) { req.setCluster(clustername); } try { DFUGetDataColumnsResponse resp = proxy.DFUGetDataColumns(req); if (resp == null) { return cols; } this.handleException(resp.getExceptions()); for (Method m : resp.getClass().getMethods()) { if (m.getName().startsWith("getDFUDataKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); DFUDataColumn[] thesecols = (DFUDataColumn[]) r; if (r != null) { for (DFUDataColumn col:Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } if (m.getName().startsWith("getDFUDataNonKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); DFUDataColumn[] thesecols = (DFUDataColumn[]) r; if (r != null) { for (DFUDataColumn col:Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } } } catch (ArrayOfEspException e) { if (e != null && verbose) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving field names for file: " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } return cols; }

Target:
public List<DFUDataColumnInfo> getFileDataColumns(String logicalname, String clustername) throws Exception { WsDfuServiceSoapProxy proxy = getSoapProxy(); DFUGetDataColumnsRequest req = new DFUGetDataColumnsRequest(); List<DFUDataColumnInfo> cols = new ArrayList<DFUDataColumnInfo>(); req.setOpenLogicalName(logicalname); if (clustername != null) { req.setCluster(clustername); } try { DFUGetDataColumnsResponse resp = proxy.DFUGetDataColumns(req); if (resp == null) { return cols; } this.handleException(resp.getExceptions()); for (Method m : resp.getClass().getMethods()) { if (m.getName().startsWith("getDFUDataKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); if (r != null) { DFUDataColumn[] thesecols = (DFUDataColumn[]) r; for (DFUDataColumn col : Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } if (m.getName().startsWith("getDFUDataNonKeyedColumns") && m.getParameterTypes().length == 0) { final Object r = m.invoke(resp); if (r != null) { DFUDataColumn[] thesecols = (DFUDataColumn[]) r; for (DFUDataColumn col : Arrays.asList(thesecols)) { cols.add(new DFUDataColumnInfo(col)); } } } } } catch (ArrayOfEspException e) { if (e != null && verbose) { for (EspException espexception : e.getException()) { Utils.println(System.out, "Error retrieving field names for file: " + espexception.getSource() + espexception.getMessage(), false, true); } } throw e; } return cols; }
Source:
private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, Date keepDate) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); if (SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) { logger.warn("Received invalid snapshot version {}", snapshotVersion); return; } snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepDate != null) { snapshots.forEach((k, v) -> { try { DateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT); Calendar calendar = Calendar.getInstance(); String currentDate = formatter.format(calendar.getTime()); if (keepDate.compareTo(formatter.parse(currentDate)) < 0) { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }

Target:
private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, Date keepDate) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); if (SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) { logger.warn("Received invalid snapshot version {}", snapshotVersion); return; } snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepDate != null) { snapshots.forEach((k, v) -> { try { DateFormat formatter = new SimpleDateFormat(TIMESTAMP_FORMAT); Date snapshotVersionDate = formatter.parse(v.getTimestamp()); if (keepDate.after(snapshotVersionDate)) { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }
Source:
protected void doStop() throws Exception { if (zendesk != null) { zendesk.close(); zendesk = null; } }

Target:
protected void doStop() throws Exception { IOHelper.close(zendesk); super.doStop(); }
Source:
public DownloadMigrator build() { ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder binder) { if (!(binder instanceof LiteDownloadMigrationService.MigrationDownloadServiceBinder)) { return; } DownloadMigrationService migrationService = ((LiteDownloadMigrationService.MigrationDownloadServiceBinder) binder).getService(); downloadMigrator.initialise(migrationService); } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent serviceIntent = new Intent(applicationContext, LiteDownloadMigrationService.class); applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationChannelProvider.registerNotificationChannel(applicationContext); } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(applicationContext); ServiceNotificationDispatcher<MigrationStatus> notificationDispatcher = new ServiceNotificationDispatcher<>( LOCK, notificationCreator, notificationManager ); downloadMigrator = new LiteDownloadMigrator(applicationContext, LOCK, EXECUTOR, handler, migrationCallback, notificationDispatcher); return downloadMigrator; }

Target:
public DownloadMigrator build() { ServiceConnection serviceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder binder) { if (binder instanceof LiteDownloadMigrationService.MigrationDownloadServiceBinder) { DownloadMigrationService migrationService = ((LiteDownloadMigrationService.MigrationDownloadServiceBinder) binder).getService(); downloadMigrator.initialise(migrationService); } } @Override public void onServiceDisconnected(ComponentName name) { } }; Intent serviceIntent = new Intent(applicationContext, LiteDownloadMigrationService.class); applicationContext.bindService(serviceIntent, serviceConnection, Context.BIND_AUTO_CREATE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { notificationChannelProvider.registerNotificationChannel(applicationContext); } NotificationManagerCompat notificationManager = NotificationManagerCompat.from(applicationContext); ServiceNotificationDispatcher<MigrationStatus> notificationDispatcher = new ServiceNotificationDispatcher<>( LOCK, notificationCreator, notificationManager ); downloadMigrator = new LiteDownloadMigrator(applicationContext, LOCK, EXECUTOR, handler, migrationCallback, notificationDispatcher); return downloadMigrator; }
Source:
private void initialiseRegistry() { IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (IConfigurationElement configuration : extensions) { try { Object classAttribute = configuration.createExecutableExtension("class"); if (classAttribute instanceof IRefactorParticipant) { IRefactorParticipant refactorParticipant = (IRefactorParticipant) classAttribute; String nameParticitpant = configuration.getAttribute("name"); String participantId = configuration.getAttribute("id"); refactorParticipantsList.add(refactorParticipant); } } catch (CoreException e) { Activator.log.error("Failed to retrieve Refactor Participant extension point", e); } } }

Target:
private void initialiseRegistry() { IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); for (IConfigurationElement configuration : extensions) { try { Object classAttribute = configuration.createExecutableExtension("class"); if (classAttribute instanceof IRefactorParticipant) { IRefactorParticipant refactorParticipant = (IRefactorParticipant) classAttribute; String nameParticitpant = configuration.getAttribute("name"); String participantId = configuration.getAttribute("id"); refactorParticipantsList.add(refactorParticipant); } else { Activator.log.warn("The class " + classAttribute.getClass().getName() + " is not an instance of IRefactorParticipant"); } } catch (CoreException e) { Activator.log.error("Failed to retrieve Refactor Participant extension point", e); } } }
Source:
private static SrlBankProblem extractBankProblem(final DBObject dbObject, final String problemBankId, final boolean isAdmin) { final SrlBankProblem.Builder exactProblem = SrlBankProblem.newBuilder(); exactProblem.setId(problemBankId); exactProblem.setQuestionText((String) dbObject.get(QUESTION_TEXT)); exactProblem.setImage((String) dbObject.get(IMAGE)); if (isAdmin) { exactProblem.setSolutionId((String) dbObject.get(SOLUTION_ID)); } exactProblem.setCourseTopic((String) dbObject.get(COURSE_TOPIC)); exactProblem.setSubTopic((String) dbObject.get(SUB_TOPIC)); exactProblem.setSource((String) dbObject.get(SOURCE)); exactProblem.setQuestionType(Util.QuestionType.valueOf((Integer) dbObject.get(QUESTION_TYPE))); try { exactProblem.setBaseSketch(Commands.SrlUpdateList.parseFrom((byte[]) dbObject.get(BASESKETCH))); } catch (InvalidProtocolBufferException e) { e.printStackTrace(); } exactProblem.addAllOtherKeywords((ArrayList) dbObject.get(KEYWORDS)); final SrlPermission.Builder permissions = SrlPermission.newBuilder(); if (isAdmin) { permissions.addAllAdminPermission((ArrayList) dbObject.get(ADMIN)); permissions.addAllUserPermission((ArrayList) dbObject.get(USERS)); exactProblem.setAccessPermission(permissions.build()); } if (dbObject.get(SCRIPT) != null) { exactProblem.setScript((String) dbObject.get(SCRIPT)); } return exactProblem.build(); }

Target:
private static SrlBankProblem extractBankProblem(final DBObject dbObject, final String problemBankId, final boolean isAdmin) { final SrlBankProblem.Builder exactProblem = SrlBankProblem.newBuilder(); exactProblem.setId(problemBankId); exactProblem.setQuestionText((String) dbObject.get(QUESTION_TEXT)); exactProblem.setImage((String) dbObject.get(IMAGE)); if (isAdmin) { exactProblem.setSolutionId((String) dbObject.get(SOLUTION_ID)); } exactProblem.setCourseTopic((String) dbObject.get(COURSE_TOPIC)); exactProblem.setSubTopic((String) dbObject.get(SUB_TOPIC)); exactProblem.setSource((String) dbObject.get(SOURCE)); exactProblem.setQuestionType(Util.QuestionType.valueOf((Integer) dbObject.get(QUESTION_TYPE))); try { if (dbObject.get(BASE_SKETCH) != null) { exactProblem.setBaseSketch(Commands.SrlUpdateList.parseFrom((byte[]) dbObject.get(BASE_SKETCH))); } } catch (InvalidProtocolBufferException e) { e.printStackTrace(); } exactProblem.addAllOtherKeywords((ArrayList) dbObject.get(KEYWORDS)); final SrlPermission.Builder permissions = SrlPermission.newBuilder(); if (isAdmin) { permissions.addAllAdminPermission((ArrayList) dbObject.get(ADMIN)); permissions.addAllUserPermission((ArrayList) dbObject.get(USERS)); exactProblem.setAccessPermission(permissions.build()); } if (dbObject.get(SCRIPT) != null) { exactProblem.setScript((String) dbObject.get(SCRIPT)); } return exactProblem.build(); }
Source:
private String getGeneratedSetResponseForCodes(int minResponseCode, String minResponseType, String responseSectionString) { return "\nvar response501json = {\n" + "\"code\" : 501," + "\n\"description\" : " + "\"Not Implemented\"\n" + "}\n\n" + "var responseCode = mc.getProperty('query.param.responseCode');\n\n" + responseSectionString + " if (responseCode == null) {\n\n" + " mc.setProperty('HTTP_SC', \"" + minResponseCode + "\");\n" + " mc.setProperty('CONTENT_TYPE', 'application/" + minResponseType + "');\n" + " mc.setPayload" + minResponseType.toUpperCase() + "(response" + minResponseCode + minResponseType + ");\n\n" + "} else " + "{\n\n" + " mc.setProperty('CONTENT_TYPE', 'application/json');\n" + " mc.setPayloadJSON(response501json);\n\n" + "}"; }

Target:
private String getGeneratedSetResponseForCodes(int minResponseCode, String minResponseType, String responseSectionString) { return "\nvar response501json = {\n" + "\"code\" : 501," + "\n\"description\" : " + "\"Not Implemented\"\n" + "}\n\n" + "var responseCode = mc.getProperty('query.param.responseCode');\n\n" + responseSectionString + " if (responseCode == null) {\n\n" + " mc.setProperty('HTTP_SC', \"" + minResponseCode + "\");\n" + " mc.setProperty('CONTENT_TYPE', 'application/" + minResponseType + "');\n" + " mc.setPayload" + minResponseType.toUpperCase() + "(response" + minResponseCode + minResponseType + ");\n\n" + "} else {\n\n" + " mc.setProperty('CONTENT_TYPE', 'application/json');\n" + " mc.setPayloadJSON(response501json);\n\n" + "}"; }
Source:
private void applyRecoveredUpdates() throws IOException, IndexEntryConflictException { if ( log.isDebugEnabled() ) { log.debug( "Applying recovered updates: " + recoveredNodeIds ); } monitor.applyingRecoveredData( recoveredNodeIds ); if ( !recoveredNodeIds.isEmpty() ) { try ( IndexUpdaterMap updaterMap = indexMapRef.createIndexUpdaterMap( IndexUpdateMode.RECOVERY ) ) { for ( IndexUpdater updater : updaterMap ) { updater.remove( recoveredNodeIds ); } Iterator<NodeUpdates> updates = recoveredNodeUpdatesIterator(); Iterator<IndexEntryUpdate<LabelSchemaDescriptor>> indexEntryUpdates = Iterators.flatMap( nodeUpdates -> convertToIndexUpdates( nodeUpdates ).iterator(), updates ); while ( indexEntryUpdates.hasNext() ) { IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate = indexEntryUpdates.next(); monitor.applyingRecoveredUpdate( indexUpdate ); IndexUpdater updater = updaterMap.getUpdater( indexUpdate.indexKey().schema() ); if ( updater != null ) { updater.process( indexUpdate ); } } monitor.recoveredUpdatesApplied(); } } recoveredNodeIds.clear(); }

Target:
private void applyRecoveredUpdates() throws IOException, IndexEntryConflictException { if ( log.isDebugEnabled() ) { log.debug( "Applying recovered updates: " + recoveredNodeIds ); } monitor.applyingRecoveredData( recoveredNodeIds ); if ( !recoveredNodeIds.isEmpty() ) { try ( IndexUpdaterMap updaterMap = indexMapRef.createIndexUpdaterMap( IndexUpdateMode.RECOVERY ) ) { for ( IndexUpdater updater : updaterMap ) { updater.remove( recoveredNodeIds ); } Iterator<NodeUpdates> updates = recoveredNodeUpdatesIterator(); Iterator<IndexEntryUpdate<LabelSchemaDescriptor>> indexEntryUpdates = Iterators.flatMap( nodeUpdates -> convertToIndexUpdates( nodeUpdates ).iterator(), updates ); while ( indexEntryUpdates.hasNext() ) { IndexEntryUpdate<LabelSchemaDescriptor> indexUpdate = indexEntryUpdates.next(); monitor.applyingRecoveredUpdate( indexUpdate ); processUpdate( updaterMap, indexUpdate ); } monitor.recoveredUpdatesApplied(); } } recoveredNodeIds.clear(); }
Source:
public Order saveRevisedOrder(Order revisedOrder) throws APIException { Order previousOrder = revisedOrder.getPreviousOrder(); if (previousOrder == null) { throw new APIException("Previous order cannot be null"); } if (OrderUtil.isOrderActive(previousOrder, null)) { markAsRevised(previousOrder, new Date()); } else { throw new APIException("Cannot revise an inactive order."); } return saveOrderInternal(revisedOrder); }

Target:
public Order saveRevisedOrder(Order revisedOrder) throws APIException { if (!Order.Action.REVISE.equals(revisedOrder.getAction())) { throw new APIException("Action has to be 'REVISE'"); } Order previousOrder = revisedOrder.getPreviousOrder(); if (previousOrder == null) { throw new APIException("Previous order cannot be null"); } if (Order.Action.DISCONTINUE.equals(previousOrder.getAction())) { throw new APIException("Cannot revise a discontinued order"); } if (OrderUtil.isOrderActive(previousOrder, null)) { markAsDiscontinued(previousOrder, new Date()); } else { throw new APIException("Cannot revise an inactive order."); } return saveOrderInternal(revisedOrder); }
Source:
private void showMultiSelectOfflineStateChangeSnackbar(List<ReadingListPage> pages, boolean offline) { String message = pages.size() == 1 ? String.format(singularOfflineStateChangeString(offline), pages.get(0).title()) : String.format(pluralOfflineStateChangeString(offline), pages.size()); }

Target:
private void showMultiSelectOfflineStateChangeSnackbar(List<ReadingListPage> pages, boolean offline) { String message = offline ? getQuantityString(R.plurals.reading_list_article_offline_message, pages.size()) : getQuantityString(R.plurals.reading_list_article_not_offline_message, pages.size()); FeedbackUtil.showMessage(getActivity(), message); }
Source:
private boolean isInPowerSaveMode() { PowerManager powerManager = (PowerManager) requireActivity().getSystemService(Context.POWER_SERVICE); if (powerManager != null) { return powerManager.isPowerSaveMode(); } else { return false; } }

Target:
private boolean isInPowerSaveMode() { PowerManager powerManager = (PowerManager) requireActivity().getSystemService(Context.POWER_SERVICE); return (powerManager != null) && powerManager.isPowerSaveMode(); }
Source:
public void setEnableSmallFileFeatures(final boolean on) { enableSmallFileFeatures = on; if (enableSmallFileFeatures) { syntaxHighlighting.setValue(getValue().isSyntaxHighlighting()); } else { syntaxHighlighting.setValue(false); } NodeList<OptionElement> options = context.getElement().<SelectElement>cast().getOptions(); for (int i = 0; i < options.getLength(); i++) { OptionElement currOption = options.getItem(i); if (Short.valueOf(currOption.getValue()) == AccountDiffPreference.WHOLE_FILE_CONTEXT) { if (enableSmallFileFeatures) { currOption.setDisabled(false); } else { currOption.setDisabled(true); if (AccountDiffPreference.CONTEXT_CHOICES[context.getSelectedIndex()] == AccountDiffPreference.WHOLE_FILE_CONTEXT) { for (int j = 0; i < AccountDiffPreference.CONTEXT_CHOICES.length; j++) { if (AccountDiffPreference.CONTEXT_CHOICES[j] == PatchScreen.LARGE_FILE_CONTEXT) { context.setSelectedIndex(j); break; } } } } } } toggleEnabledStatus(save.isEnabled()); }

Target:
public void setEnableSmallFileFeatures(final boolean on) { enableSmallFileFeatures = on; if (enableSmallFileFeatures) { syntaxHighlighting.setValue(getValue().isSyntaxHighlighting()); } else { syntaxHighlighting.setValue(false); } NodeList<OptionElement> options = context.getElement().<SelectElement>cast().getOptions(); for (int i = 0; i < options.getLength(); i++) { OptionElement currOption = options.getItem(i); if (Short.parseShort(currOption.getValue()) == AccountDiffPreference.WHOLE_FILE_CONTEXT) { if (enableSmallFileFeatures) { currOption.setDisabled(false); } else { currOption.setDisabled(true); if (context.getSelectedIndex() > -1 && AccountDiffPreference.CONTEXT_CHOICES[context.getSelectedIndex()] == AccountDiffPreference.WHOLE_FILE_CONTEXT) { for (int j = 0; i < AccountDiffPreference.CONTEXT_CHOICES.length; j++) { if (AccountDiffPreference.CONTEXT_CHOICES[j] == PatchScreen.LARGE_FILE_CONTEXT) { context.setSelectedIndex(j); break; } } } } break; } } toggleEnabledStatus(save.isEnabled()); }
Source:
public void cancel(Handler<AsyncResult<Void>> cancelResult) { AsyncResult<Void> operationResult; try { log.info("Cancelling " + consumerTag()); cancelled = true; consumerHandler.getChannel().basicCancel(consumerTag()); operationResult = Future.succeededFuture(); } catch (IOException e) { operationResult = Future.failedFuture(e); } if (cancelResult != null) { cancelResult.handle(operationResult); } handleEnd(); }

Target:
public void cancel(Handler<AsyncResult<Void>> cancelResult) { AsyncResult<Void> operationResult; try { log.debug("Cancelling " + consumerTag()); cancelled = true; consumerHandler.getChannel().basicCancel(consumerTag()); operationResult = Future.succeededFuture(); } catch (IOException e) { operationResult = Future.failedFuture(e); } if (cancelResult != null) { cancelResult.handle(operationResult); } handleEnd(); }
Source:
List getNetworkInterfaces(VM vm){ List<Map> net = new ArrayList(); Map<String, Object> resultMap = new HashMap(); List Inet6List = new ArrayList(); List Inet4List = new ArrayList(); resultMap.put("name", "eth0"); Inet6List.add("fe80::21a:4aff:fe16:2016"); Inet6List.add("2620:52:0:2380:21a:4aff:fe16:2016"); resultMap.put("inet6", Inet6List); Inet4List.add(vm.getIp()); resultMap.put("inet", Inet4List); resultMap.put("hw", vm.getMacAddress()); net.add(resultMap); log.debug("network list is {}", net.toString()); return net; }

Target:
List<Map<String, Object>> getNetworkInterfaces(VM vm){ Map<String, Object> resultMap = new HashMap(); List<String> inet6Adsreess = new ArrayList<>(); List<String> inet4Adsress = new ArrayList<>(); List<Map<String, Object>> nets = new ArrayList<>(); resultMap.put("name", "eth0"); inet6Adsreess.add("fe80::21a:4aff:fe16:2016"); inet6Adsreess.add("2620:52:0:2380:21a:4aff:fe16:2016"); resultMap.put("inet6", inet6Adsreess); inet4Adsress.add(vm.getIp()); resultMap.put("inet", inet4Adsress); resultMap.put("hw", vm.getMacAddress()); nets.add(resultMap); log.debug("network list is {}", nets.toString()); return nets; }
Source:
public DeleteResult executeAsBlocking() { try { return deleteResolver.performDelete(storIOContentResolver, deleteQuery); } catch (Throwable throwable) { throw new StorIOException(throwable); } }

Target:
public DeleteResult executeAsBlocking() { try { return deleteResolver.performDelete(storIOContentResolver, deleteQuery); } catch (Exception exception) { throw new StorIOException(exception); } }
Source:
public void checkTransform( int protocol, String localAddress, IpSecAlgorithm crypt, IpSecAlgorithm auth, boolean doUdpEncap, int sendCount, boolean useJavaSockets) throws Exception { StatsChecker.initStatsChecker(); InetAddress local = InetAddress.getByName(localAddress); try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket(); IpSecManager.SecurityParameterIndex spi = mISM.allocateSecurityParameterIndex(local)) { IpSecTransform.Builder transformBuilder = new IpSecTransform.Builder(mContext) .setSpi(spi) .setEncryption(crypt) .setAuthentication(auth); if (doUdpEncap) { transformBuilder = transformBuilder.setIpv4Encapsulation(encapSocket, encapSocket.getPort()); } int ipHdrLen = local instanceof Inet6Address ? IP6_HDRLEN : IP4_HDRLEN; int transportHdrLen = 0; int udpEncapLen = doUdpEncap ? UDP_HDRLEN : 0; try (IpSecTransform transform = transformBuilder.buildTransportModeTransform( InetAddress.getByName(localAddress))) { if (protocol == IPPROTO_TCP) { transportHdrLen = TCP_HDRLEN_WITH_OPTIONS; checkTcp(transform, local, sendCount, useJavaSockets); } else if (protocol == IPPROTO_UDP) { transportHdrLen = UDP_HDRLEN; checkUnconnectedUdp(transform, local, sendCount, useJavaSockets); } else { throw new IllegalArgumentException("Invalid protocol"); } } checkStatsChecker( protocol, ipHdrLen, transportHdrLen, udpEncapLen, sendCount, auth.getTruncationLengthBits()); } }

Target:
public void checkTransform( int protocol, String localAddress, IpSecAlgorithm crypt, IpSecAlgorithm auth, boolean doUdpEncap, int sendCount, boolean useJavaSockets) throws Exception { StatsChecker.initStatsChecker(); InetAddress local = InetAddress.getByName(localAddress); try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket(); IpSecManager.SecurityParameterIndex spi = mISM.allocateSecurityParameterIndex(local)) { IpSecTransform.Builder transformBuilder = new IpSecTransform.Builder(mContext) .setEncryption(crypt) .setAuthentication(auth); if (doUdpEncap) { transformBuilder = transformBuilder.setIpv4Encapsulation(encapSocket, encapSocket.getPort()); } int ipHdrLen = local instanceof Inet6Address ? IP6_HDRLEN : IP4_HDRLEN; int transportHdrLen = 0; int udpEncapLen = doUdpEncap ? UDP_HDRLEN : 0; try (IpSecTransform transform = transformBuilder.buildTransportModeTransform(local, spi)) { if (protocol == IPPROTO_TCP) { transportHdrLen = TCP_HDRLEN_WITH_OPTIONS; checkTcp(transform, local, sendCount, useJavaSockets); } else if (protocol == IPPROTO_UDP) { transportHdrLen = UDP_HDRLEN; checkUnconnectedUdp(transform, local, sendCount, useJavaSockets); } else { throw new IllegalArgumentException("Invalid protocol"); } } checkStatsChecker( protocol, ipHdrLen, transportHdrLen, udpEncapLen, sendCount, auth.getTruncationLengthBits()); } }
Source:
public EurekaArchaius2InstanceConfig(Config config, String namespace) { this(config, "eureka", new DataCenterInfo() { @Override public Name getName() { return Name.MyOwn; } }); }

Target:
public EurekaArchaius2InstanceConfig(Config config, String namespace) { this(config, namespace, new DataCenterInfo() { @Override public Name getName() { return Name.MyOwn; } }); }
Source:
private String createTempPropFile() throws ManageDomainsResult { File propFile = null; try { propFile = File.createTempFile("engine-config", "properties"); propFile.deleteOnExit(); } catch (IOException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.ERROR_CREATING_PROPERTIES_FILE, ex.getMessage()); } try (BufferedWriter fw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propFile), Charset.defaultCharset().displayName()))) { fw.write(new StringBuilder() .append(ConfigValues.AdUserName.name()) .append("=\n") .append(ConfigValues.AdUserPassword.name()) .append(".type=CompositePassword\n") .append(ConfigValues.LDAPSecurityAuthentication.name()) .append("=\n") .append(ConfigValues.DomainName.name()) .append("=\n") .append(ConfigValues.AdUserId.name()) .append("=\n") .append(ConfigValues.LdapServers.name()) .append("=\n") .append(ConfigValues.LDAPProviderTypes.name()) .append("=\n") .append(ConfigValues.LDAPServerPort.name()) .append("=\n") .append(ConfigValues.ChangePasswordMsg.name()) .append("=\n") .toString()); fw.flush(); } catch (IOException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.ERROR_CREATING_PROPERTIES_FILE, ex.getMessage()); } return propFile.getAbsolutePath(); }

Target:
private String createTempPropFile() throws ManageDomainsResult { File propFile = null; try { propFile = File.createTempFile("engine-config", "properties"); propFile.deleteOnExit(); } catch (IOException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.ERROR_CREATING_PROPERTIES_FILE, ex.getMessage()); } try (FileWriter fw = new FileWriter(propFile)) { fw.write(new StringBuilder() .append(ConfigValues.AdUserName.name()) .append("=\n") .append(ConfigValues.AdUserPassword.name()) .append(".type=CompositePassword\n") .append(ConfigValues.LDAPSecurityAuthentication.name()) .append("=\n") .append(ConfigValues.DomainName.name()) .append("=\n") .append(ConfigValues.AdUserId.name()) .append("=\n") .append(ConfigValues.LdapServers.name()) .append("=\n") .append(ConfigValues.LDAPProviderTypes.name()) .append("=\n") .append(ConfigValues.LDAPServerPort.name()) .append("=\n") .append(ConfigValues.ChangePasswordMsg.name()) .append("=\n") .toString()); fw.flush(); } catch (IOException ex) { throw new ManageDomainsResult(ManageDomainsResultEnum.ERROR_CREATING_PROPERTIES_FILE, ex.getMessage()); } return propFile.getAbsolutePath(); }
Source:
protected void initChannel(Channel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new PassportStateOriginHandler()); pipeline.addLast(HTTP_CODEC_HANDLER_NAME, new HttpClientCodec( BaseZuulChannelInitializer.MAX_INITIAL_LINE_LENGTH.get(), BaseZuulChannelInitializer.MAX_HEADER_SIZE.get(), BaseZuulChannelInitializer.MAX_CHUNK_SIZE.get(), false, false )); pipeline.addLast(PassportStateHttpClientHandler.PASSPORT_STATE_HTTP_CLIENT_HANDLER_NAME, new PassportStateHttpClientHandler()); pipeline.addLast("originNettyLogger", nettyLogger); pipeline.addLast(httpMetricsHandler); addMethodBindingHandler(pipeline); pipeline.addLast("httpLifecycle", new HttpClientLifecycleChannelHandler()); pipeline.addLast("connectionPoolHandler", connectionPoolHandler); if(connectionPoolConfig.isSecure()) { pipeline.addFirst("ssl", getClientSslContext().newHandler(ch.alloc())); } }

Target:
protected void initChannel(Channel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new PassportStateOriginHandler()); if(connectionPoolConfig.isSecure()) { pipeline.addLast("ssl", getClientSslContext().newHandler(ch.alloc())); } pipeline.addLast(HTTP_CODEC_HANDLER_NAME, new HttpClientCodec( BaseZuulChannelInitializer.MAX_INITIAL_LINE_LENGTH.get(), BaseZuulChannelInitializer.MAX_HEADER_SIZE.get(), BaseZuulChannelInitializer.MAX_CHUNK_SIZE.get(), false, false )); pipeline.addLast(PassportStateHttpClientHandler.PASSPORT_STATE_HTTP_CLIENT_HANDLER_NAME, new PassportStateHttpClientHandler()); pipeline.addLast("originNettyLogger", nettyLogger); pipeline.addLast(httpMetricsHandler); addMethodBindingHandler(pipeline); pipeline.addLast("httpLifecycle", new HttpClientLifecycleChannelHandler()); pipeline.addLast("connectionPoolHandler", connectionPoolHandler); }
Source:
public static boolean hasStatus(byte[] receivedApdu, byte[] statusCode) throws IOException { byte[] receivedStatus = statusBytes(receivedApdu); return receivedStatus[0] == statusCode[0] && receivedStatus[0] == statusCode[0]; }

Target:
public static boolean hasStatus(byte[] receivedApdu, byte[] statusCode) throws IOException { byte[] receivedStatus = statusBytes(receivedApdu); return receivedStatus[0] == statusCode[0] && receivedStatus[1] == statusCode[1]; }
Source:
void handleData(Buffer data) { synchronized (conn) { bytesRead += data.getByteBuf().readableBytes(); if (decoder != null) { try { decoder.offer(new DefaultHttpContent(data.getByteBuf())); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e) { handleException(e); } } if (dataHandler != null) { dataHandler.handle(data); } } }

Target:
void handleData(Buffer data) { synchronized (conn) { bytesRead += data.length(); if (decoder != null) { try { decoder.offer(new DefaultHttpContent(data.getByteBuf())); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e) { handleException(e); } } if (dataHandler != null) { dataHandler.handle(data); } } }
Source:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { int lineCount = 0; int matches = 0; String line = readNextEventString(() -> (char) rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventEvent.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> (char) rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a traceevevent trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }

Target:
public IStatus validate(IProject project, String path) { File file = new File(path); if (!file.exists()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "File not found: " + path); } if (!file.isFile()) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Not a file. It's a directory: " + path); } int confidence = 0; try { if (!TmfTraceUtils.isText(file)) { return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } try (BufferedRandomAccessFile rafile = new BufferedRandomAccessFile(path, "r")) { int lineCount = 0; int matches = 0; String line = readNextEventString(() -> (char) rafile.read()); while ((line != null) && (lineCount++ < MAX_LINES)) { try { TraceEventField field = TraceEventEvent.parseJson(line); if (field != null) { matches++; } } catch (RuntimeException e) { confidence = Integer.MIN_VALUE; } confidence = MAX_CONFIDENCE * matches / lineCount; line = readNextEventString(() -> (char) rafile.read()); } if (matches == 0) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Most assuredly NOT a traceevent trace"); } } catch (IOException e) { Activator.getInstance().logError("Error validating file: " + path, e); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "IOException validating file: " + path, e); } return new TraceValidationStatus(confidence, Activator.PLUGIN_ID); }
Source:
public boolean moveCellsUp() { boolean dirty = false; if (moveCellsUpLoop()) { dirty = true; } for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; dirty = combineCells(i, nextJ, i, j, dirty); } } if (moveCellsUpLoop()) { dirty = true; } return dirty; }

Target:
public boolean moveCellsUp() { boolean actionSuccess = false; if (moveCellsUpLoop()) { actionSuccess = true; } for (int i = 0; i < GRID_WIDTH; i++) { for (int j = 0; j < (GRID_WIDTH - 1); j++) { int nextJ = j + 1; actionSuccess = combineCells(i, nextJ, i, j, actionSuccess); } } if (moveCellsUpLoop()) { actionSuccess = true; } return actionSuccess; }
Source:
public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) { System.out.println("Warning : " + message); }

Target:
public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) { log.warn("Warning : " + message); }
Source:
private static void waitForStreamState(AmazonKinesisClient kinesisClient, String streamName, @Nullable StreamStatus expectedStatus) { long waitTime = System.currentTimeMillis() + TIMEOUT; while (System.currentTimeMillis() < waitTime) { try { TimeUnit.MILLISECONDS.sleep(SLEEP_INTERVAL); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } StreamStatus streamState = streamExists(kinesisClient, streamName) ? getStreamState(kinesisClient, streamName) : null; if (expectedStatus == streamState) { return; } } throw new IllegalStateException(String.format("Timed out waiting for stream to be in %s state", expectedStatus)); }

Target:
private static void waitForStreamState(AmazonKinesisClient kinesisClient, String streamName, @Nullable StreamStatus expectedStatus) { StreamStatus streamStatus = getStreamState(kinesisClient, streamName); long waitTime = System.currentTimeMillis() + TIMEOUT; while (streamStatus != expectedStatus && waitTime > System.currentTimeMillis()) { Uninterruptibles.sleepUninterruptibly(SLEEP_INTERVAL, TimeUnit.MILLISECONDS); streamStatus = getStreamState(kinesisClient, streamName); } if (!(streamStatus == expectedStatus)) { throw new IllegalStateException(String.format("Timed out waiting for stream to be in %s state", expectedStatus)); } }
Source:
protected Object execute(Object[] data) { if (data[0]!=null & data[0].equals(Boolean.TRUE)) return data[1]; else return data[2]; }

Target:
protected Object execute(Object[] data) { if (data[0]!=null && data[0].equals(Boolean.TRUE)) return data[1]; else return data[2]; }
Source:
private void flush() throws IOException { if(curBufferPos == 0) { return; } try { Collection<ResultSetFeature> features = Arrays.asList(Arrays.copyOfRange(buffer, 0, curBufferPos)); dataStore.insert(features, featureType, st.getConnection()); for (ResultSetFeature cur : features) { final String fid = (String) cur.getUserData().get("fid"); cur.setID(fid); final SimpleFeature orig = (SimpleFeature)cur.getUserData().get("_original_"); if (orig != null) { ((FeatureIdImpl)orig.getIdentifier()).setID(fid); orig.getUserData().putAll(cur.getUserData()); orig.getUserData().remove("_original_"); } final ContentEntry entry = featureSource.getEntry(); final ContentState state = entry.getState(this.tx); state.fireFeatureAdded(featureSource, cur); } } catch (SQLException e) { throw new IOException(e); } finally { curBufferPos = 0; } }

Target:
private void flush() throws IOException { if(curBufferPos == 0) { return; } try { Collection<ResultSetFeature> features = Arrays.asList(Arrays.copyOfRange(buffer, 0, curBufferPos)); dataStore.insert(features, featureType, st.getConnection()); for (ResultSetFeature cur : features) { final String fid = (String) cur.getUserData().get("fid"); cur.setID(fid); final SimpleFeature orig =(SimpleFeature)cur.getUserData(). get(ContentFeatureStore.ORIGINAL_FEATURE_KEY); if (orig != null) { ((FeatureIdImpl)orig.getIdentifier()).setID(fid); orig.getUserData().putAll(cur.getUserData()); orig.getUserData().remove(ContentFeatureStore.ORIGINAL_FEATURE_KEY); } final ContentEntry entry = featureSource.getEntry(); final ContentState state = entry.getState(this.tx); state.fireFeatureAdded(featureSource, cur); } } catch (SQLException e) { throw new IOException(e); } finally { curBufferPos = 0; } }
Source:
private boolean hasPersistentPower() { final PackageManager pm = this.getPackageManager(); return (pm != null && (pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK) || pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE))); }

Target:
private boolean hasPersistentPower() { final PackageManager pm = getPackageManager(); return (pm != null && (pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK) || pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE))); }
Source:
public StarlarkList<E> repeat(StarlarkInt n, Mutability mutability) throws EvalException { if (n.signum() <= 0) { return wrap(mutability, EMPTY_ARRAY); } int ni = n.toInt("repeat"); Object[] res = new Object[StarlarkInt.multiplyExact(ni, size, "repeat")]; for (int i = 0; i < ni; i++) { System.arraycopy(elems, 0, res, i * size, size); } return wrap(mutability, res); }

Target:
public StarlarkList<E> repeat(StarlarkInt n, Mutability mutability) throws EvalException { if (n.signum() <= 0) { return wrap(mutability, EMPTY_ARRAY); } int ni = n.toInt("repeat"); long sz = (long) ni * size; if (sz > MAX_ALLOC) { throw Starlark.errorf("excessive repeat (%d * %d elements)", size, ni); } Object[] res = new Object[(int) sz]; for (int i = 0; i < ni; i++) { System.arraycopy(elems, 0, res, i * size, size); } return wrap(mutability, res); }
Source:
public static String getFacetFileType(DataFile dataFile) { String fileType = dataFile.getContentType(); if (!StringUtil.isEmpty(fileType)) { if (fileType.contains(";")) { fileType = fileType.substring(0, fileType.indexOf(";")); } try { return ResourceBundle.getBundle("MimeTypeFacets").getString(fileType); } catch (MissingResourceException e) { String typeClass = fileType.split("/")[0]; return Character.toUpperCase(typeClass.charAt(0)) + typeClass.substring(1); } } return "Unknown"; }

Target:
public static String getFacetFileType(DataFile dataFile) { String fileType = dataFile.getContentType(); if (!StringUtil.isEmpty(fileType)) { if (fileType.contains(";")) { fileType = fileType.substring(0, fileType.indexOf(";")); } try { return ResourceBundle.getBundle("MimeTypeFacets").getString(fileType); } catch (MissingResourceException e) { String typeClass = fileType.split("/")[0]; return Character.toUpperCase(typeClass.charAt(0)) + typeClass.substring(1); } } return ResourceBundle.getBundle("MimeTypeFacets").getString("application/octet-stream"); }
Source:
public void testObjectDefinePropertiesQuoted() { String js = LINE_JOINER.join( " var Bar = function(){};", "Bar.prototype.bar = 0;", " var Foo = function() {", " this.bar_ = 'bar';", "};", " Foo.prototype['bar'];", "Object.defineProperties(Foo.prototype, {", " 'bar': {", " configurable: true,", " enumerable: true,", " get: function() { return this.bar_;},", " set: function(value) { this.bar_ = value; }", " }", "});"); String result = LINE_JOINER.join( " var Bar = function(){};", "Bar.prototype.a = 0;", " var Foo = function() {", " this.a = 'bar';", "};", " Foo.prototype['bar'];", "Object.defineProperties(Foo.prototype, {", " 'bar': {", " configurable: true,", " enumerable: true,", " get: function() { return this.a;},", " set: function(value) { this.a = value; }", " }", "});"); test (js, result); }

Target:
public void testObjectDefinePropertiesQuoted() { String js = LINE_JOINER.join( " var Bar = function(){};", "Bar.prototype.bar = 0;", " var Foo = function() {", " this.bar_ = 'bar';", "};", " Foo.prototype['bar'];", "Object.defineProperties(Foo.prototype, {", " 'a': {", " configurable: true,", " enumerable: true,", " get: function() { return this.bar_;},", " set: function(value) { this.bar_ = value; }", " }", "});"); String result = LINE_JOINER.join( " var Bar = function(){};", "Bar.prototype.b = 0;", " var Foo = function() {", " this.b = 'bar';", "};", " Foo.prototype['bar'];", "Object.defineProperties(Foo.prototype, {", " 'a': {", " configurable: true,", " enumerable: true,", " get: function() { return this.b;},", " set: function(value) { this.b = value; }", " }", "});"); test (js, result); }
Source:
public void testGetResponseInvalidKey() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); try { resources.client().target(String.format("/foxtrot/v1/async/%s/dummy", dataToken.getAction())).request().get(GroupResponse.class); } catch (WebApplicationException ex) { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), ex.getResponse().getStatus()); } }

Target:
public void testGetResponseInvalidKey() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME); groupRequest.setNesting(Arrays.asList("os", "device", "version")); AsyncDataToken dataToken = getQueryExecutor().executeAsync(groupRequest); Thread.sleep(1000); GroupResponse response = resources.client().target(String.format("/foxtrot/v1/async/%s/dummy", dataToken.getAction())).request().get(GroupResponse.class); assertNull(response); }
Source:
protected ValidationResult validateConnectionProperties() { if (StringUtils.isEmpty(hostPort) || StringUtils.isBlank(hostPort)) { return new ValidationResult(Result.ERROR, messages.getMessage("error.hostUrl.shouldNotBeEmpty")); } else { try { new URL(hostPort); } catch (MalformedURLException e) { return new ValidationResult(Result.ERROR, messages.getMessage("error.hostUrl.notValid", hostPort)); } } if (StringUtils.isEmpty(userId) || StringUtils.isBlank(userId)) { return new ValidationResult(Result.ERROR, messages.getMessage("error.userId.shouldNotBeEmpty")); } if (StringUtils.isEmpty(userPassword) || StringUtils.isBlank(userPassword)) { return new ValidationResult(Result.ERROR, messages.getMessage("error.password.shouldNotBeEmpty")); } return ValidationResult.OK; }

Target:
protected ValidationResult validateConnectionProperties() { if (StringUtils.isEmpty(hostPort) || StringUtils.isBlank(hostPort)) { return new ValidationResult(Result.ERROR, messages.getMessage("error.hostUrl.shouldNotBeEmpty")); } else { try { new URL(hostPort); } catch (MalformedURLException e) { return new ValidationResult(Result.ERROR, messages.getMessage("error.hostUrl.notValid", hostPort)); } } if (userId == null || (!userId.isEmpty() && StringUtils.isBlank(userId))) { return new ValidationResult(Result.ERROR, messages.getMessage("error.userId.shouldNotBeNullOrBlank")); } if (userPassword == null || (!userPassword.isEmpty() && StringUtils.isBlank(userPassword))) { return new ValidationResult(Result.ERROR, messages.getMessage("error.password.shouldNotBeNullOrBlank")); } return ValidationResult.OK; }
Source:
protected void execute(Context context) throws SQLException { if (0 == context.prepareSelect("select count(uuid) from quality_gates where is_built_in = ?") .setBoolean(1, true) .get(row -> row.getLong(1))) { context.prepareUpsert("insert into quality_gates (uuid, name, is_built_in, created_at) values (?,?,?,?)") .setString(1, uuidFactory.create()) .setString(2, SONAR_WAY_QUALITY_GATE) .setBoolean(3, true) .setDate(4, new Date(system2.now())) .execute() .commit(); } }

Target:
protected void execute(Context context) throws SQLException { Long nbOfBuiltInQualityGates = context.prepareSelect("select count(uuid) from quality_gates where is_built_in = ?") .setBoolean(1, true) .get(row -> row.getLong(1)); if (nbOfBuiltInQualityGates == 0) { final Date now = new Date(system2.now()); context.prepareUpsert("insert into quality_gates (uuid, name, is_built_in, created_at) values (?,?,?,?)") .setString(1, uuidFactory.create()) .setString(2, SONAR_WAY_QUALITY_GATE) .setBoolean(3, true) .setDate(4, now) .execute() .commit(); } }
Source:
private SchemaPlus getRootSchema(@Named(INCOMPLETE_SCHEMA) SchemaPlus rootSchema, InformationSchema informationSchema) { String name = "INFORMATION_SCHEMA"; rootSchema.add(name, informationSchema); return rootSchema; }

Target:
private SchemaPlus getRootSchema(@Named(INCOMPLETE_SCHEMA) SchemaPlus rootSchema, InformationSchema informationSchema) { rootSchema.add(INFORMATION_SCHEMA_NAME, informationSchema); return rootSchema; }
Source:
public void setDiskStorageMap(HashMap<Guid, ArrayList<Guid>> value) { diskStorageMap = value; raiseDiskEvent(); }

Target:
public void setDiskStorageMap(HashMap<Guid, ArrayList<Guid>> value) { diskStorageMap = value; }
Source:
public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return; } variantXWikiObjects.stream().filter(Objects::nonNull) .filter(variant -> !StringUtils.isBlank(variant.getStringValue(VARIANT_KEY))) .forEach(variant -> { String cdna = variant.getStringValue(VARIANT_KEY).trim().replaceFirst("^C\\.", "c\\."); variant.setStringValue(VARIANT_KEY, cdna); }); }

Target:
public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return; } variantXWikiObjects.stream().filter(Objects::nonNull) .filter(variant -> !StringUtils.isBlank(variant.getStringValue(VARIANT_KEY))) .forEach(variant -> { String cdna = variant.getStringValue(VARIANT_KEY).trim().replaceFirst("^C\\.", "c."); variant.setStringValue(VARIANT_KEY, cdna); }); }