auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void applySupportedClasses(SpannableStringBuilder text, String[] classes, int start, int end) { for (String className : classes) { if (ColorParser.isNamedColor(className)) { int color = ColorParser.parseCssColor(className); text.setSpan(new ForegroundColorSpan(color), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } }

Target:
private static void applySupportedClasses(SpannableStringBuilder text, String[] classes, int start, int end) { for (String className : classes) { if (DEFAULT_COLORS.containsKey(className)) { int color = DEFAULT_COLORS.get(className); text.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } if (DEFAULT_BACKGROUND_COLORS.containsKey(className)) { int color = DEFAULT_BACKGROUND_COLORS.get(className); text.setSpan(new BackgroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } }
Source:
private ResolvedChannelGroup resolveAnnotationData( QueryContext ctxt, ChannelGroup<?> channelGroup ) { ResolvedChannelGroup.Builder resolvedChannelGroupBuilder = ResolvedChannelGroup.builder(channelGroup); resolvedChannelGroupBuilder.withRegionChannelGroups( contextHasAnnotation(ctxt, Annotation.REGIONS) ? resolveRegionChannelGroups(channelGroup) : Optional.absent() ); resolvedChannelGroupBuilder.withPlatformChannelGroup( contextHasAnnotation(ctxt, Annotation.PLATFORM) ? resolvePlatformChannelGroup(channelGroup) : Optional.absent() ); if (contextHasAnnotation(ctxt, Annotation.CHANNEL_GROUPS_SUMMARY)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannelsWithAllChannelGroups(channelGroup) ); } else if (contextHasAnnotation(ctxt, Annotation.GENERIC_CHANNEL_GROUPS_SUMMARY)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannelsWithWhitelistedChannelGroups(channelGroup) ); } else if (contextHasAnnotation(ctxt, Annotation.ADVERTISED_CHANNELS) || contextHasAnnotation(ctxt, Annotation.CHANNELS)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannels(channelGroup) ); } else { resolvedChannelGroupBuilder.withAdvertisedChannels(Optional.absent()); } return resolvedChannelGroupBuilder.build(); }

Target:
private ResolvedChannelGroup resolveAnnotationData( QueryContext ctxt, ChannelGroup<?> channelGroup ) { ResolvedChannelGroup.Builder resolvedChannelGroupBuilder = ResolvedChannelGroup.builder(channelGroup); resolvedChannelGroupBuilder.withRegionChannelGroups( contextHasAnnotation(ctxt, Annotation.REGIONS) ? resolveRegionChannelGroups(channelGroup) : Optional.absent() ); resolvedChannelGroupBuilder.withPlatformChannelGroup( contextHasAnnotation(ctxt, Annotation.PLATFORM) ? resolvePlatformChannelGroup(channelGroup) : Optional.absent() ); if (contextHasAnnotation(ctxt, Annotation.CHANNEL_GROUPS_SUMMARY)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveChannelsWithChannelGroups( channelGroup, contextHasAnnotation( ctxt, Annotation.GENERIC_CHANNEL_GROUPS_SUMMARY ) ? this::idIsWhitelisted : id -> true ) ); } else if (contextHasAnnotation(ctxt, Annotation.ADVERTISED_CHANNELS) || contextHasAnnotation(ctxt, Annotation.CHANNELS)) { resolvedChannelGroupBuilder.withAdvertisedChannels( resolveAdvertisedChannels(channelGroup) ); } else { resolvedChannelGroupBuilder.withAdvertisedChannels(Optional.absent()); } return resolvedChannelGroupBuilder.build(); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_circle_layer_clustering); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; map.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 12.099, -79.045), 3)); addClusteredGeoJsonSource(); mapboxMap.getStyle().addImage("cross-icon-id", BitmapUtils.getBitmapFromDrawable( getResources().getDrawable(R.drawable.ic_cross))); Toast.makeText(CircleLayerClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_circle_layer_clustering); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap map) { mapboxMap = map; map.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng( 12.099, -79.045), 3)); addClusteredGeoJsonSource(style); style.addImage("cross-icon-id", BitmapUtils.getBitmapFromDrawable( getResources().getDrawable(R.drawable.ic_cross))); Toast.makeText(CircleLayerClusteringActivity.this, R.string.zoom_map_in_and_out_instruction, Toast.LENGTH_SHORT).show(); } }); } }); }
Source:
private void uploadFiles(String container, List<BlobDetail> blobDetails) throws InterruptedException, ExecutionException { ListeningExecutorService executor = null; try { executor = MoreExecutors.listeningDecorator(newFixedThreadPool(THREADS)); List<ListenableFuture<BlobDetail>> blobUploaderFutures = Lists.newArrayList(); BlobUploaderCallback blobUploaderCallback = new BlobUploaderCallback(); for (BlobDetail blobDetail: blobDetails) { BlobUploader blobUploader = new BlobUploader(container, blobDetail); ListenableFuture<BlobDetail> blobDetailFuture = executor.submit(blobUploader); blobUploaderFutures.add(blobDetailFuture); Futures.addCallback(blobDetailFuture, blobUploaderCallback); } ListenableFuture<List<BlobDetail>> future = Futures.successfulAsList(blobUploaderFutures); List<BlobDetail> uploadedBlobDetails = future.get(); System.out.println(); for (int i = 0; i < uploadedBlobDetails.size(); i++) { if (uploadedBlobDetails.get(i) != null) { BlobDetail blobDetail = uploadedBlobDetails.get(i); System.out.format(" %s (eTag: %s)\n", blobDetail.getRemoteBlobName(), blobDetail.getETag()); } else { System.out.format(" %s (ERROR)\n", blobDetails.get(i).getLocalFile().getAbsolutePath()); } } } finally { if (executor != null) { executor.shutdown(); } } }

Target:
private void uploadFiles(String container, List<BlobDetail> blobDetails) throws InterruptedException, ExecutionException { ListeningExecutorService executor = MoreExecutors.listeningDecorator(newFixedThreadPool(THREADS)); List<ListenableFuture<BlobDetail>> blobUploaderFutures = Lists.newArrayList(); BlobUploaderCallback blobUploaderCallback = new BlobUploaderCallback(); try { for (BlobDetail blobDetail: blobDetails) { BlobUploader blobUploader = new BlobUploader(container, blobDetail); ListenableFuture<BlobDetail> blobDetailFuture = executor.submit(blobUploader); blobUploaderFutures.add(blobDetailFuture); Futures.addCallback(blobDetailFuture, blobUploaderCallback); } ListenableFuture<List<BlobDetail>> future = Futures.successfulAsList(blobUploaderFutures); List<BlobDetail> uploadedBlobDetails = future.get(); System.out.println(); for (int i = 0; i < uploadedBlobDetails.size(); i++) { if (uploadedBlobDetails.get(i) != null) { BlobDetail blobDetail = uploadedBlobDetails.get(i); System.out.format(" %s (eTag: %s)\n", blobDetail.getRemoteBlobName(), blobDetail.getETag()); } else { System.out.format(" %s (ERROR)\n", blobDetails.get(i).getLocalFile().getAbsolutePath()); } } } finally { executor.shutdown(); } }
Source:
public boolean matches(NameKey name) { boolean isMatch; if (projectPatterns.isEmpty()) { isMatch = true; } else { isMatch = false; String projectName = name.get(); for (String pattern : projectPatterns) { isMatch = matchesPattern(projectName, pattern); if (isMatch) { break; } } } return isMatch; }

Target:
public boolean matches(NameKey name) { if (projectPatterns.isEmpty()) { return true; } else { String projectName = name.get(); for (String pattern : projectPatterns) { if (matchesPattern(projectName, pattern)) { return true; } } } return false; }
Source:
public static EventSubscriberMethod forMessage(Class<?> cls, Message eventMessage) { final Class<? extends Message> eventClass = eventMessage.getClass(); final MethodRegistry registry = MethodRegistry.getInstance(); final EventSubscriberMethod method = registry.get(cls, eventClass, factory()); if (method == null) { throw missingEventHandler(cls, eventClass); } return method; }

Target:
public static EventSubscriberMethod forMessage(Class<?> cls, Message eventMessage) { checkNotNull(cls); checkNotNull(eventMessage); final Class<? extends Message> eventClass = eventMessage.getClass(); final MethodRegistry registry = MethodRegistry.getInstance(); final EventSubscriberMethod method = registry.get(cls, eventClass, factory()); if (method == null) { throw missingEventHandler(cls, eventClass); } return method; }
Source:
public static <C extends Comparable<?>> Renderer<Range<C>> range(String rangeResourceKeyPrefix, Renderer<C> renderer) { return range(rangeResourceKeyPrefix, renderer, renderer).nullsAsNull(); }

Target:
public static <C extends Comparable<?>> Renderer<Range<C>> range(String rangeResourceKeyPrefix, Renderer<C> renderer) { return range(rangeResourceKeyPrefix, renderer, renderer); }
Source:
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException { LOG.info(target.getPresentableName()); final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY); holder.processDirtyFiles(new FileProcessor<ElixirSourceRootDescriptor, ElixirTarget>() { @Override public boolean apply(ElixirTarget target, File file, ElixirSourceRootDescriptor root) throws IOException { boolean isAcceptFile = target.isTests() ? ELIXIR_TEST_SOURCE_FILTER.accept(file) : ELIXIR_SOURCE_FILTER.accept(file); if(isAcceptFile && ourCompilableModuleTypes.contains(target.getModule().getModuleType())){ filesToCompile.add(file); } return true; } }); if(filesToCompile.isEmpty() && !holder.hasRemovedFiles()) return; JpsModule module = target.getModule(); JpsProject project = module.getProject(); ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions(); if(compilerOptions.myUseMixCompiler){ doBuildWithMix(target, context, module, compilerOptions); } else { if(!target.isTests()){ doBuildWithElixic(target, context, module, compilerOptions, filesToCompile); } } }

Target:
public void build(@NotNull ElixirTarget target, @NotNull DirtyFilesHolder<ElixirSourceRootDescriptor, ElixirTarget> holder, @NotNull BuildOutputConsumer outputConsumer, @NotNull CompileContext context) throws ProjectBuildException, IOException { LOG.info(target.getPresentableName()); final Set<File> filesToCompile = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY); holder.processDirtyFiles(new FileProcessor<ElixirSourceRootDescriptor, ElixirTarget>() { @Override public boolean apply(ElixirTarget target, File file, ElixirSourceRootDescriptor root) throws IOException { boolean isAcceptFile = target.isTests() ? ELIXIR_TEST_SOURCE_FILTER.accept(file) : ELIXIR_SOURCE_FILTER.accept(file); if(isAcceptFile && ourCompilableModuleTypes.contains(target.getModule().getModuleType())){ filesToCompile.add(file); } return true; } }); if(filesToCompile.isEmpty() && !holder.hasRemovedFiles()) return; JpsModule module = target.getModule(); JpsProject project = module.getProject(); ElixirCompilerOptions compilerOptions = JpsElixirCompilerOptionsExtension.getOrCreateExtension(project).getOptions(); if(compilerOptions.myUseMixCompiler){ doBuildWithMix(target, context, module, compilerOptions); } else { if(!target.isTests()){ doBuildWithElixirc(target, context, module, compilerOptions, filesToCompile); } } }
Source:
public ResourceReference parse(String rawReference) { ResourceReference resourceReference = parseURILinks(rawReference); if (resourceReference != null) { return resourceReference; } StringBuilder content = new StringBuilder(rawReference); resourceReference = parseInterWikiLinks(content); if (resourceReference != null) { return resourceReference; } else{ resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); return resourceReference; } }

Target:
public ResourceReference parse(String rawReference) { ResourceReference resourceReference = parseURILinks(rawReference); if (resourceReference == null) { StringBuilder content = new StringBuilder(rawReference); resourceReference = parseInterWikiLinks(content); } if(resourceRefernece != null) { return resourceReference; } if (!isInWikiMode()) { resourceReference = new ResourceReference(rawReference, ResourceType.URL); resourceReference.setTyped(false); return resourceReference; } return parseDocumentLink(content); }
Source:
public TrainingConfig build(){ if(!skipValidation) { Preconditions.checkState(updater != null, "Updater (optimizer) must not be null. Use updater(IUpdater) to set an updater"); Preconditions.checkState(dataSetFeatureMapping != null, "No DataSet feature mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetFeatureMapping(...) to set this"); Preconditions.checkState(markLabelsUnused || dataSetLabelMapping != null, "No DataSet label mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetLabelMapping(...) to set this," + " or markLabelsUnused() to mark labels as unused (for example, for unsupervised learning)"); } return new TrainingConfig(updater, regularization, minimize, dataSetFeatureMapping, dataSetLabelMapping, dataSetFeatureMaskMapping, dataSetLabelMaskMapping, trainableParams, lossVariables); }

Target:
public TrainingConfig build(){ if(!skipValidation) { Preconditions.checkState(updater != null, "Updater (optimizer) must not be null. Use updater(IUpdater) to set an updater"); Preconditions.checkState(dataSetFeatureMapping != null, "No DataSet feature mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dateSetFeatureMapping(...) to set this"); Preconditions.checkState(markLabelsUnused || dataSetLabelMapping != null, "No DataSet label mapping has been provided. A " + "mapping between DataSet array positions and variables/placeholders must be provided - use dataSetLabelMapping(...) to set this," + " or use markLabelsUnused() to mark labels as unused (for example, for unsupervised learning)"); } return new TrainingConfig(updater, regularization, minimize, dataSetFeatureMapping, dataSetLabelMapping, dataSetFeatureMaskMapping, dataSetLabelMaskMapping, trainableParams, lossVariables); }
Source:
public void stop(Throwable cause) throws Exception { if (body != null) body.cancel(cause); Run<?, ?> r = getContext().get(Run.class); TaskListener listener = getContext().get(TaskListener.class); ThrottleJobProperty.DescriptorImpl descriptor = Jenkins.getActiveInstance().getDescriptorByType(ThrottleJobProperty.DescriptorImpl.class); descriptor.removeThrottledPipelineForCategory(r.getExternalizableId(), getCategory(), listener); }

Target:
public void stop(Throwable cause) throws Exception { }
Source:
public ProcessStatusPage() { ProcessStatusProvider provider = new ProcessStatusProvider(); table = new GeoServerTablePanel<ExecutionStatus>("table", provider, true) { @Override protected Component getComponentForProperty( String id, IModel<ExecutionStatus> itemModel, Property<ExecutionStatus> property) { Object value = property.getPropertyValue(itemModel.getObject()); if (value instanceof Date) { SimpleDateFormat gmtFrmt = new SimpleDateFormat( "E, d MMM yyyy HH:mm:ss.SSS 'GMT'", Session.get().getLocale()); return DateLabel.forDatePattern( id, Model.of((Date) value), gmtFrmt.toPattern()); } return null; } @Override protected void onSelectionUpdate(AjaxRequestTarget target) { dismissSelected.setEnabled(table.getSelection().size() > 0); target.add(dismissSelected); } }; table.setOutputMarkupId(true); table.setSelectable(true); add(table); add(dialog = new GeoServerDialog("dialog")); setHeaderPanel(headerPanel()); }

Target:
public ProcessStatusPage() { ProcessStatusProvider provider = new ProcessStatusProvider(); table = new GeoServerTablePanel<ExecutionStatus>("table", provider, true) { @Override protected Component getComponentForProperty( String id, IModel<ExecutionStatus> itemModel, Property<ExecutionStatus> property) { Object value = property.getPropertyValue(itemModel.getObject()); if (value instanceof Date) { SimpleDateFormat gmtFrmt = new SimpleDateFormat( "E, d MMM yyyy HH:mm:ss.SSS 'GMT'", Session.get().getLocale()); gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT")); return new Label(id, gmtFrmt.format((Date) value)); } return null; } @Override protected void onSelectionUpdate(AjaxRequestTarget target) { dismissSelected.setEnabled(table.getSelection().size() > 0); target.add(dismissSelected); } }; table.setOutputMarkupId(true); table.setSelectable(true); add(table); add(dialog = new GeoServerDialog("dialog")); setHeaderPanel(headerPanel()); }
Source:
public WebSocketClientHandshaker08(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }

Target:
WebSocketClientHandshaker08(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_remove_all_history: new MaterialDialog.Builder(this) .title(R.string.title_clear_history_dialog) .content(R.string.text_clear_history_dialog) .onPositive((dialog, which) -> { mHistoryProductDao.deleteAll(); ; productItems.clear(); recyclerHistoryScanView.getAdapter().notifyDataSetChanged(); }) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .show(); return true; case R.id.action_export_all_history: if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { new MaterialDialog.Builder(this) .title(R.string.action_about) .content(R.string.permision_write_external_storage) .neutralText(R.string.txtOk) .show(); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Utils.MY_PERMISSIONS_REQUEST_STORAGE); } } else { exportCSV(); } return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_remove_all_history: new MaterialDialog.Builder(this) .title(R.string.title_clear_history_dialog) .content(R.string.text_clear_history_dialog) .onPositive((dialog, which) -> { mHistoryProductDao.deleteAll(); productItems.clear(); recyclerHistoryScanView.getAdapter().notifyDataSetChanged(); }) .positiveText(R.string.txtYes) .negativeText(R.string.txtNo) .show(); return true; case R.id.action_export_all_history: if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { new MaterialDialog.Builder(this) .title(R.string.action_about) .content(R.string.permision_write_external_storage) .neutralText(R.string.txtOk) .show(); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, Utils.MY_PERMISSIONS_REQUEST_STORAGE); } } else { exportCSV(); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
public static void fail( @SqlType(StandardTypes.INTEGER) long errorCode, @SqlType(StandardTypes.VARCHAR) Slice message) { for (StandardErrorCode standardErrorCode : StandardErrorCode.values()) { if (standardErrorCode.toErrorCode().getCode() == errorCode) { throw new PrestoException(standardErrorCode, message.toStringUtf8()); } } throw new PrestoException(StandardErrorCode.GENERIC_USER_ERROR, "Unable to find error for code: " + errorCode); }

Target:
public static void fail( @SqlType(StandardTypes.INTEGER) long errorCode, @SqlType(StandardTypes.VARCHAR) Slice message) { for (StandardErrorCode standardErrorCode : StandardErrorCode.values()) { if (standardErrorCode.toErrorCode().getCode() == errorCode) { throw new PrestoException(standardErrorCode, message.toStringUtf8()); } } throw new PrestoException(StandardErrorCode.GENERIC_INTERNAL_ERROR, "Unable to find error for code: " + errorCode); }
Source:
public void statusUpdateReceived(EventObject event, String iporSerialPort, String data) { DeviceConfig deviceConfig = findDevice(iporSerialPort); if (deviceConfig != null) { logger.debug("Received status update '{}' from device {}", data, (deviceConfig.serialPortName != null) ? deviceConfig.serialPortName : deviceConfig.host); for (OnkyoBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { HashMap<String, String> values = provider.getDeviceCommands(itemName); for (String cmd : values.keySet()) { String[] commandParts = values.get(cmd).split(":"); String deviceName = commandParts[0]; String deviceCmd = commandParts[1]; boolean match = false; if (!deviceConfig.deviceId.equals(deviceName)) { continue; } if (deviceCmd.startsWith(ADVANCED_COMMAND_KEY)) { if (data.startsWith(deviceCmd.substring(1, 4))) { match = true; } } else { try { String eiscpCmd = EiscpCommand.valueOf(deviceCmd).getCommand(); if (data.startsWith(eiscpCmd.substring(0, 3))) { match = true; } } catch (Exception e) { logger.error("Unregonized command '" + deviceCmd + "'", e); } } if (match) { Class<? extends Item> itemType = provider.getItemType(itemName); State v = convertDeviceValueToOpenHabState(itemType, data); eventPublisher.postUpdate(itemName, v); break; } } } } } }

Target:
public void statusUpdateReceived(EventObject event, String iporSerialPort, String data) { DeviceConfig deviceConfig = findDevice(iporSerialPort); if (deviceConfig != null) { logger.debug("Received status update '{}' from device {}", data, (deviceConfig.serialPortName != null) ? deviceConfig.serialPortName : deviceConfig.host); for (OnkyoBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { HashMap<String, String> values = provider.getDeviceCommands(itemName); for (String cmd : values.keySet()) { String[] commandParts = values.get(cmd).split(":"); String deviceId = commandParts[0]; String deviceCmd = commandParts[1]; if (!deviceConfig.deviceId.equals(deviceId)) { continue; } boolean match = false; if (deviceCmd.startsWith(ADVANCED_COMMAND_KEY)) { if (data.startsWith(deviceCmd.substring(1))) { match = true; } } else { try { String eiscpCmd = EiscpCommand.valueOf(deviceCmd).getCommand(); if (data.startsWith(eiscpCmd.substring(0, 3))) { match = true; } } catch (Exception e) { logger.error("Unrecognized command ", e); } } if (match) { Class<? extends Item> itemType = provider.getItemType(itemName); State v = convertDeviceValueToOpenHabState(itemType, data); eventPublisher.postUpdate(itemName, v); break; } } } } } }
Source:
public void tearDown(){ account.deleteDB("lightcouch-db-test"; account.shutdown(); }

Target:
public void tearDown(){ account.deleteDB("lightcouch-db-test"); account.shutdown(); }
Source:
private String getTaskFormByTypeAsUser(String containerId, Long taskId, String language, String formType, boolean marshallContent, String userId) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.TASK_INSTANCE_ID, taskId); String userQuery = StringUtils.isEmpty(userId) ? "" : getUserQueryStr(userId); StringBuilder params = new StringBuilder(userQuery); if (params.length() == 0) { params.append("?"); } else { params.append("&"); } params.append( "type=" ).append( formType ); params.append( "&marshallContent=" ).append( marshallContent ); boolean filter = false; if ( !StringUtils.isEmpty( language ) ) { params.append( "&lang=" ).append( language ); filter = true; } params.append( "&filter=" ).append( filter ); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + TASK_FORM_GET_URI, valuesMap) + params.toString()); } else { CommandScript script = new CommandScript(Collections.singletonList( (KieServerCommand) new DescriptorCommand("FormService", "getFormDisplayTask", containerId, taskId, userId, StringUtils.defaultString(language), !StringUtils.isEmpty(language), formType))); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM-UI", containerId).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } return response.getResult(); } }

Target:
private String getTaskFormByTypeAsUser(String containerId, Long taskId, String language, String formType, boolean marshallContent, String userId) { if( config.isRest() ) { Map<String, Object> valuesMap = new HashMap<>(); valuesMap.put(RestURI.CONTAINER_ID, containerId); valuesMap.put(RestURI.TASK_INSTANCE_ID, taskId); String userQuery = StringUtils.isEmpty(userId) ? "" : getUserQueryStr(userId); StringBuilder params = new StringBuilder(userQuery); if (params.length() == 0) { params.append("?"); } else { params.append("&"); } params.append( "type=" ).append( formType ); params.append( "&marshallContent=" ).append( marshallContent ); boolean filter = false; if ( !StringUtils.isEmpty( language ) ) { params.append( "&lang=" ).append( language ); filter = true; } params.append( "&filter=" ).append( filter ); return makeHttpGetRequestAndCreateRawResponse( build(loadBalancer.getUrl(), FORM_URI + "/" + TASK_FORM_GET_URI, valuesMap) + params.toString()); } else { CommandScript script = new CommandScript(Collections.singletonList( (KieServerCommand) new DescriptorCommand("FormService", "getFormDisplayTask", new Object[]{containerId, taskId, StringUtils.defaultString(userId), StringUtils.defaultString(language), !StringUtils.isEmpty(language), formType}))); ServiceResponse<String> response = (ServiceResponse<String>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM-UI", containerId).getResponses().get(0); throwExceptionOnFailure(response); if (shouldReturnWithNullResponse(response)) { return null; } return response.getResult(); } }
Source:
private void createContextMenu() { final MenuManager contextMenu = new MenuManager(); contextMenu.add(new GroupMarker(GROUP_REORGANIZE)); contextMenu.add(getSortByNameAction()); contextMenu.add(getSortByIdAction()); contextMenu.add(getSortByTimeAction()); contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); TreeViewer treeViewer = getTimeGraphCombo().getTreeViewer(); Tree tree = treeViewer.getTree(); Menu menu = contextMenu.createContextMenu(tree); tree.setMenu(menu); getSite().registerContextMenu(ID_CONTEXT_TREE, contextMenu, treeViewer); }

Target:
private void createContextMenu() { final MenuManager contextMenu = new MenuManager(); contextMenu.add(new GroupMarker(IWorkbenchActionConstants.GROUP_REORGANIZE)); contextMenu.add(getSortByNameAction()); contextMenu.add(getSortByIdAction()); contextMenu.add(getSortByTimeAction()); contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); TreeViewer treeViewer = getTimeGraphCombo().getTreeViewer(); Tree tree = treeViewer.getTree(); Menu menu = contextMenu.createContextMenu(tree); tree.setMenu(menu); getSite().registerContextMenu(contextMenu, treeViewer); }
Source:
public void shutdown() { try { myScheduler.shutdown(true); } catch (SchedulerException e) { ourLog.error("Failed to shut down scheduler"); throw new ConfigurationException("Failed to shut down scheduler", e); } }

Target:
public void shutdown() { if (myScheduler == null) { return; } try { myScheduler.shutdown(true); } catch (SchedulerException e) { ourLog.error("Failed to shut down scheduler", e); throw new ConfigurationException("Failed to shut down scheduler", e); } }
Source:
public Response settingsScopesScopeGet(String username, String scopeName, MessageContext messageContext) { String[] userRoles; ScopeSettingsDTO scopeSettingsDTO = new ScopeSettingsDTO(); ErrorDTO errorDTO = new ErrorDTO(); try { if (APIUtil.isUserExist(username) && APIUtil.getRESTAPIScopesForTenant(MultitenantUtils .getTenantDomain(username)).containsKey(scopeName)) { userRoles = APIUtil.getListOfRoles(username); SettingsMappingUtil settingsMappingUtil = new SettingsMappingUtil(); if (settingsMappingUtil.GetRoleScopeList(userRoles, username).contains(scopeName)) { scopeSettingsDTO.setName(scopeName); } } else { errorDTO.setCode(404l); errorDTO.description("Username or Scope does not exist"); errorDTO.setMessage("Not Found"); return Response.ok().entity(errorDTO).build(); } } catch (APIManagementException e) { String errorMessage = "Error when getting the list of scopes"; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return Response.ok().entity(scopeSettingsDTO).build(); }

Target:
public Response settingsScopesScopeGet(String username, String scopeName, MessageContext messageContext) { String[] userRoles; ScopeSettingsDTO scopeSettingsDTO = new ScopeSettingsDTO(); ErrorDTO errorDTO = new ErrorDTO(); Map<String, String> scopeRoleMapping = APIUtil.getRESTAPIScopesForTenant(MultitenantUtils .getTenantDomain(username)); try { if (APIUtil.isUserExist(username) && scopeRoleMapping.containsKey(scopeName)) { userRoles = APIUtil.getListOfRoles(username); SettingsMappingUtil settingsMappingUtil = new SettingsMappingUtil(); if (settingsMappingUtil.GetRoleScopeList(userRoles, scopeRoleMapping).contains(scopeName)) { scopeSettingsDTO.setName(scopeName); } } else { errorDTO.setCode(404l); errorDTO.description("Username or Scope does not exist. Username: " + username + ", " + "Scope: " + scopeName); errorDTO.setMessage("Not Found"); return Response.ok().entity(errorDTO).build(); } } catch (APIManagementException e) { String errorMessage = "Error when getting the list of scopes. Username: " + username + " , " + "Scope: " + scopeName; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return Response.ok().entity(scopeSettingsDTO).build(); }
Source:
public void setSystemProperty(CoreSession session, List<String> ids, boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(ECM_UUID)); try { session.setDocumentSystemProp(ref, "isTrashed", value); updatedRefs.add(ref); } catch (NuxeoException e) { log.warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { log.warn("Cannot save session", e); } }

Target:
public void setSystemProperty(CoreSession session, List<String> ids, boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { TrashService trashService = Framework.getService(TrashService.class); for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(ECM_UUID)); try { String docName = (String) map.get(ECM_NAME); if (value || !trashService.isMangledName(docName)) { session.setDocumentSystemProp(ref, "isTrashed", value); updatedRefs.add(ref); } } catch (NuxeoException e) { log.warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { log.warn("Cannot save session", e); } }
Source:
private boolean updateVms() { for (VmStatic vm : vmsLockedForUpdate) { VmManagementParametersBase updateParams = new VmManagementParametersBase(vm); updateParams.setLockProperties(LockProperties.create(LockProperties.Scope.None)); updateParams.setClusterLevelChangeFromVersion(oldCluster.getCompatibilityVersion()); upgradeGraphicsDevices(vm, updateParams); updateRngDeviceIfNecessary(vm.getId(), vm.getCustomCompatibilityVersion(), updateParams); VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVm, updateParams, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { addCustomValue("VmName", vm.getName()); addCustomValue("Message", "todo"); auditLogDirector.log(this, AuditLogType.CLUSTER_CANNOT_UPDATE_VM_COMPATIBILITY_VERSION); vm.setCustomCompatibilityVersion(oldCluster.getCompatibilityVersion()); vmStaticDao.update(vm); } } return true; }

Target:
private boolean updateVms() { for (VmStatic vm : vmsLockedForUpdate) { VmManagementParametersBase updateParams = new VmManagementParametersBase(vm); updateParams.setLockProperties(LockProperties.create(LockProperties.Scope.None)); updateParams.setClusterLevelChangeFromVersion(oldCluster.getCompatibilityVersion()); upgradeGraphicsDevices(vm, updateParams); updateRngDeviceIfNecessary(vm.getId(), vm.getCustomCompatibilityVersion(), updateParams); VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVm, updateParams, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { failedUpgradeNames.add(vm.getName()); addCustomValue("VmName", vm.getName()); addCustomValue("Message", parseErrorMessage(result.getValidationMessages())); auditLogDirector.log(this, AuditLogType.CLUSTER_CANNOT_UPDATE_VM_COMPATIBILITY_VERSION); vm.setCustomCompatibilityVersion(oldCluster.getCompatibilityVersion()); vmStaticDao.update(vm); } } return true; }
Source:
@Override public boolean addAll(Collection<? extends E> c) { if (c.isEmpty()) { return false; } lock.lock(); try { for (E e : c) { queue.add(e); } nonEmpty.signal(); return true; } catch (IOException e) { QueueFile.<Error>getSneakyThrowable(e); return false; } finally { lock.unlock(); } }

Target:
@Override public boolean addAll(Collection<? extends E> c) { if (c.isEmpty()) { return false; } lock.lock(); try { for (E e : c) { queue.add(e); } nonEmpty.signal(); return true; } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } finally { lock.unlock(); } }
Source:
public abstract void create() throws IOException; public abstract void close(); public abstract boolean hasVersioning(); public abstract boolean isNameConflicting(String name) throws IOException; @NonNull public Collection<String> getConflictingNames(String name) throws IOException { Map<String, Ref> allRefs = getRefs(ALL); int lastSlash = name.lastIndexOf('/'); while (0 < lastSlash) { String needle = name.substring(0, lastSlash); if (allRefs.containsKey(needle)) return Collections.singletonList(needle); lastSlash = name.lastIndexOf('/', lastSlash - 1); } List<String> conflicting = new ArrayList<>(); String prefix = name + '/'; for (String existing : allRefs.keySet()) if (existing.startsWith(prefix)) conflicting.add(existing); return conflicting; }

Target:
public abstract void create() throws IOException; public abstract void close(); public boolean hasVersioning() { return false; }
Source:
public WriteAttributesRequest(int objectId, AttributeSet attributes) { this(new LwM2mPath(objectId), attributes); }

Target:
public WriteAttributesRequest(int objectId, AttributeSet attributes) throws InvalidRequestException { this(new LwM2mPath(objectId), attributes); }
Source:
private Collection<FeedbackResponse> getFeedbackResponseEntitiesFromGiverForQuestionInSection( String feedbackQuestionId, String giverEmail, String section) { Map<String, FeedbackResponse> feedbackResponses = new HashMap<String, FeedbackResponse>(); for (FeedbackResponse response : load() .filter("feedbackQuestionId =", feedbackQuestionId) .filter("giverEmail =", giverEmail) .filter("giverSection =", section) .list()) { feedbackResponses.put(response.getId(), response); } for (FeedbackResponse response : load() .filter("feedbackQuestionId =", feedbackQuestionId) .filter("giverEmail =", giverEmail) .filter("receiverSection =", section) .list()) { feedbackResponses.put(response.getId(), response); } return feedbackResponses.values(); }

Target:
private Collection<FeedbackResponse> getFeedbackResponseEntitiesFromGiverForQuestionInSection( String feedbackQuestionId, String giverEmail, String section) { Map<String, FeedbackResponse> feedbackResponses = new HashMap<>(); List<FeedbackResponse> firstQueryResponses = load() .filter("feedbackQuestionId =", feedbackQuestionId) .filter("giverEmail =", giverEmail) .filter("giverSection =", section) .list(); for (FeedbackResponse response : firstQueryResponses) { feedbackResponses.put(response.getId(), response); } List<FeedbackResponse> secondQueryResponses = load() .filter("feedbackQuestionId =", feedbackQuestionId) .filter("giverEmail =", giverEmail) .filter("receiverSection =", section) .list(); for (FeedbackResponse response : secondQueryResponses) { feedbackResponses.put(response.getId(), response); } return feedbackResponses.values(); }
Source:
private static String[] splitInput(String input) { if (input.startsWith("{") && input.endsWith("}")) { List<String> result = new ArrayList<String>(); int openBracket = 0; Integer lastStartIdx = null; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c == '{') { openBracket++; if (lastStartIdx == null) { lastStartIdx = i; } } if (c == '}') { openBracket--; if (openBracket == 0 && lastStartIdx != null) { String substring = input.substring(lastStartIdx, i + 1); result.add(substring); lastStartIdx = null; } } } return result.toArray(new String[result.size()]); } return input.split(","); }

Target:
private static String[] splitInput(String input) { if (input.startsWith("{") && input.endsWith("}")) { List<String> result = new ArrayList<String>(); int openBracket = 0; Integer lastStartIdx = null; for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c == '{') { openBracket++; if (lastStartIdx == null) { lastStartIdx = i; } } if (c == '}') { openBracket--; if (openBracket == 0 && lastStartIdx != null) { String substring = input.substring(lastStartIdx, i + 1); result.add(substring); lastStartIdx = null; } } } return result.toArray(new String[result.size()]); } return Strings.split(input, ','); }
Source:
public boolean normalizeRegions() throws IOException { if (regionNormalizerTracker == null || !regionNormalizerTracker.isNormalizerOn()) { LOG.debug("Region normalization is disabled, don't run region normalizer."); return false; } if (skipRegionManagementAction("region normalizer")) { return false; } if (assignmentManager.hasRegionsInTransition()) { return false; } if (!normalizationInProgressLock.tryLock()) { LOG.info("Normalization already in progress. Skipping request."); } else { try { List<TableName> allEnabledTables = new ArrayList<>( tableStateManager.getTablesInStates(TableState.State.ENABLED)); Collections.shuffle(allEnabledTables); for (TableName table : allEnabledTables) { if (table.isSystemTable()) { continue; } final TableDescriptor tblDesc = getTableDescriptors().get(table); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug( "Skipping because normalization is disabled in its table properties.", table); continue; } if (skipRegionManagementAction("region normalizer")) { return false; } final List<NormalizationPlan> plans = normalizer.computePlansForTable(table); if (CollectionUtils.isEmpty(plans)) { return true; } try (final Admin admin = asyncClusterConnection.toConnection().getAdmin()) { for (NormalizationPlan plan : plans) { plan.execute(admin); if (plan.getType() == PlanType.SPLIT) { splitPlanCount++; } else if (plan.getType() == PlanType.MERGE) { mergePlanCount++; } } } } } finally { normalizationInProgressLock.unlock(); } } return true; }

Target:
public boolean normalizeRegions() throws IOException { if (regionNormalizerTracker == null || !regionNormalizerTracker.isNormalizerOn()) { LOG.debug("Region normalization is disabled, don't run region normalizer."); return false; } if (skipRegionManagementAction("region normalizer")) { return false; } if (assignmentManager.hasRegionsInTransition()) { return false; } if (!normalizationInProgressLock.tryLock()) { LOG.info("Normalization already in progress. Skipping request."); return true; } try { final List<TableName> allEnabledTables = new ArrayList<>( tableStateManager.getTablesInStates(TableState.State.ENABLED)); Collections.shuffle(allEnabledTables); try (final Admin admin = asyncClusterConnection.toConnection().getAdmin()) { for (TableName table : allEnabledTables) { if (table.isSystemTable()) { continue; } final TableDescriptor tblDesc = getTableDescriptors().get(table); if (tblDesc != null && !tblDesc.isNormalizationEnabled()) { LOG.debug("Skipping table because normalization is disabled in its" + " table properties.", table); continue; } if (skipRegionManagementAction("region normalizer")) { return false; } final List<NormalizationPlan> plans = normalizer.computePlansForTable(table); if (CollectionUtils.isEmpty(plans)) { LOG.debug("No normalization required for table {}.", table); continue; } for (NormalizationPlan plan : plans) { plan.execute(admin); if (plan.getType() == PlanType.SPLIT) { splitPlanCount++; } else if (plan.getType() == PlanType.MERGE) { mergePlanCount++; } } } } } finally { normalizationInProgressLock.unlock(); } return true; }
Source:
public String[] transform(InputRow inputRow) { final String value = inputRow.getValue(countryColumn); final Country country = Country.find(value, defaultCountry); final String countryName; if (country == null) { countryName = null; } else { switch (outputFormat) { case ISO2: countryName = country.getTwoLetterISOCode(); break; case ISO3: countryName = country.getThreeLetterISOCode(); break; case NAME: countryName = country.getCountryName(); break; default: throw new IllegalStateException("Unexpected output format: " + outputFormat); } } final String correctedCountryName; if(countryName != null){ correctedCountryName = countryName; } else { correctedCountryName = LabelUtils.UNEXPECTED_LABEL; } synchronized (this) { if (!countryCountMap.containsKey(countryName)) { countryCountMap.put(correctedCountryName, _rowAnnotationFactory.createAnnotation()); } _rowAnnotationFactory.annotate(inputRow, 1, countryCountMap.get(correctedCountryName)); } return new String[] { countryName }; }

Target:
public String[] transform(InputRow inputRow) { final String value = inputRow.getValue(countryColumn); final Country country = Country.find(value, defaultCountry); final String countryName; if (country == null) { countryName = null; } else { switch (outputFormat) { case ISO2: countryName = country.getTwoLetterISOCode(); break; case ISO3: countryName = country.getThreeLetterISOCode(); break; case NAME: countryName = country.getCountryName(); break; default: throw new IllegalStateException("Unexpected output format: " + outputFormat); } } final String correctedCountryName; if(countryName != null){ correctedCountryName = countryName; } else { correctedCountryName = LabelUtils.UNEXPECTED_LABEL; } final RowAnnotation annotation; synchronized (this) { if (!countryCountMap.containsKey(countryName)) { countryCountMap.put(correctedCountryName, _rowAnnotationFactory.createAnnotation()); } annotation = countryCountMap.get(correctedCountryName); } _rowAnnotationFactory.annotate(inputRow, 1, annotation); return new String[] { countryName }; }
Source:
public Tree create( @NotNull(message = "params can't be NULL") final JsonObject params ) throws IOException { final Directives dirs = new Directives().xpath(this.xpath()) .add("tree"); for (final Entry<String, JsonValue> entry : params.entrySet()) { dirs.add(entry.getKey()).set(entry.getValue().toString()).up(); } this.storage.apply(dirs); new MkReferences(this.storage, this.self, this.coords).create( new StringBuilder().append("refs/trees/").append( params.getString("name") ).toString(), params.getString("sha") ); return this.get(params.getString("sha")); }

Target:
public Tree create( @NotNull(message = "params can't be NULL") final JsonObject params ) throws IOException { final String sha = params.getString("sha"); final Directives dirs = new Directives().xpath(this.xpath()) .add("tree"); for (final Entry<String, JsonValue> entry : params.entrySet()) { dirs.add(entry.getKey()).set(entry.getValue().toString()).up(); } this.storage.apply(dirs); new MkReferences(this.storage, this.self, this.coords).create( new StringBuilder().append("refs/trees/").append( params.getString("name") ).toString(), sha ); return this.get(sha); }
Source:
private static List<FormRecognizerError> transformTrainingErrors(List<ErrorInformation> trainingErrorList) { if (CoreUtils.isNullOrEmpty(trainingErrorList)) { return new ArrayList<>(); } else { return trainingErrorList.stream().map(errorInformation -> new FormRecognizerError(errorInformation.getCode(), errorInformation.getMessage())).collect(Collectors.toList()); } }

Target:
private static List<FormRecognizerError> transformTrainingErrors( List<ErrorInformation> trainingErrorList) { if (CoreUtils.isNullOrEmpty(trainingErrorList)) { return Collections.emptyList(); } else { return trainingErrorList.stream() .map(errorInformation -> new FormRecognizerError(errorInformation.getCode(), errorInformation.getMessage())) .collect(Collectors.toList()); } }
Source:
public static Node parse(ResourceLoader resourceLoader, String resourcePath, Reader reader) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode rootNode = mapper.readValue(reader, JsonNode.class); return new JModelWrapper(resourceLoader, resourcePath).wrap(rootNode); } catch (JsonMappingException | JsonParseException e) { return ErrorNodeFactory.createInvalidJsonExampleNode(e.getOriginalMessage()); } catch (IOException e) { e.printStackTrace(); } return null; }

Target:
public static Node parse(ResourceLoader resourceLoader, String resourcePath, Reader reader) { try { ObjectMapper mapper = new ObjectMapper(); JsonNode rootNode = mapper.readValue(reader, JsonNode.class); return new JModelWrapper(resourceLoader, resourcePath).wrap(rootNode); } catch (JsonMappingException | JsonParseException e) { return ErrorNodeFactory.createInvalidJsonExampleNode(e.getOriginalMessage()); } catch (IOException e) { return new ErrorNode(e.getMessage()); } }