auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void validateInputSchema(@Nullable Schema inputSchema) { if (inputSchema != null) { Schema.Field inputSchemaField = inputSchema.getField(config.bodyField); if (inputSchemaField == null) { throw new IllegalArgumentException( "Field " + config.bodyField + " is not present in the input schema"); } Schema fieldSchema = inputSchemaField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!fieldType.isSimpleType()) { throw new IllegalArgumentException(String.format( "Type %s for field %s is not supported. Supported types are Int, long, float, string, Bytes", fieldType, config.bodyField)); } } }

Target:
private void validateInputSchema(@Nullable Schema inputSchema) { if (inputSchema == null) { return; } Schema.Field inputSchemaField = inputSchema.getField(config.bodyField); if (inputSchemaField == null) { throw new IllegalArgumentException( "Field " + config.bodyField + " is not present in the input schema"); } Schema fieldSchema = inputSchemaField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema.getType(); if (!fieldType.isSimpleType()) { throw new IllegalArgumentException(String.format( "Type %s for field %s is not supported. Supported types are %s, %s, %s, %s, %s, %s, %s", Schema.Type.BOOLEAN, Schema.Type.INT, Schema.Type.LONG, Schema.Type.FLOAT, Schema.Type.DOUBLE, Schema.Type.STRING, Schema.Type.BYTES, fieldType, config.bodyField)); } }
Source:
private String getProjectDefaultLicenseInfoHeaderText() { String defaultLicenseInfoHeader = ""; try { defaultLicenseInfoHeader = (new LicenseInfoHandler()).getDefaultLicenseInfoHeaderText(); } catch (IOException e) { log.error("Could not load default license info header text.", e); } return defaultLicenseInfoHeader; }

Target:
private String getProjectDefaultLicenseInfoHeaderText() { final LicenseInfoService.Iface licenseInfoClient = thriftClients.makeLicenseInfoClient(); try { String defaultLicenseInfoHeaderText = licenseInfoClient.getDefaultLicenseInfoHeaderText(); return defaultLicenseInfoHeaderText; } catch (TException e) { log.error("Could not load default license info header text from backend.", e); return ""; } }
Source:
private void validateEntrypointSelector(Tool tool, List<HasMetadata> filteredObjects) throws DevfileFormatException { if (tool.getEntrypoints() == null || tool.getEntrypoints().isEmpty()) { return; } for (Entrypoint ep : tool.getEntrypoints()) { ContainerSearch search = new ContainerSearch( ep.getDeployment(), ep.getPod(), ep.getContainer(), ep.getPodSelector(), ep.getDeploymentSelector()); List<Container> cs = search.search(filteredObjects); if (cs.isEmpty()) { throw new DevfileFormatException( format( "Tool %s contains an entry point that doesn't match any container: %s", tool.getName(), toYAML(ep))); } } }

Target:
private void validateEntrypointSelector(Tool tool, List<HasMetadata> filteredObjects) throws DevfileException { if (tool.getEntrypoints() == null || tool.getEntrypoints().isEmpty()) { return; } for (Entrypoint ep : tool.getEntrypoints()) { ContainerSearch search = new ContainerSearch(ep.getParentName(), ep.getParentSelector(), ep.getContainerName()); List<Container> cs = search.search(filteredObjects); if (cs.isEmpty()) { throw new DevfileFormatException( format( "Tool %s contains an entry point that doesn't match any container:\n%s", tool.getName(), toYAML(ep))); } } }
Source:
public boolean abort() { abort = true; this.test.setAborted(true); if (Thread.currentThread() == this.getThread()) { throw new TestException("", Level.SEVERE); } if(OtePropertiesCore.abortMultipleInterrupt.getBooleanValue()){ int count = 0; do{ this.interrupt(); try{ this.join(1000*60); } catch (InterruptedException ex){ } count++; } while (this.isAlive() && count < 200); } else { this.interrupt(); try{ this.join(1000*60); } catch (InterruptedException ex){ } } if (this.isAlive()) { OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "Waited 60s for test to abort but the thread did not die.")); return false; } return true; }

Target:
public boolean abort() { abort = true; this.test.setAborted(true); if (Thread.currentThread() == this.getThread()) { throw new TestException("", Level.SEVERE); } if(OtePropertiesCore.abortMultipleInterrupt.getBooleanValue()){ int count = 0; do{ this.interrupt(); try{ this.join(10); } catch (InterruptedException ex){ } count++; } while (this.isAlive() && count < 200); } else { this.interrupt(); try{ this.join(1000*60); } catch (InterruptedException ex){ } } if (this.isAlive()) { OseeLog.reportStatus(new BaseStatus(TestEnvironment.class.getName(), Level.SEVERE, "Waited 60s for test to abort but the thread did not die.")); return false; } return true; }
Source:
public WriteOptionsBuilder timestamp(Instant timestamp) { Assert.notNull(timestamp, "Timestamp must not be null"); this.timestamp = timestamp.toEpochMilli() * 1000; return this; }

Target:
public WriteOptionsBuilder timestamp(Instant timestamp) { Assert.notNull(timestamp, "Timestamp must not be null"); this.timestamp = TimeUnit.MILLISECONDS.toMicros(timestamp.toEpochMilli()); return this; }
Source:
private void create() throws Exception { File file = new File(directory, name); if (!file.exists()) { assertTrue("Failed to create file", file.createNewFile()); } long val = lastModified; if (val == Long.MAX_VALUE) { val = System.currentTimeMillis(); } assertTrue("Failed to set modification time", file.setLastModified(val)); try { int s = Integer.parseInt(size); if (s > 0) { FileOutputStream out = new FileOutputStream(file); byte[] buffer = new byte[s]; out.write(buffer); out.close(); } } catch (NumberFormatException e) { } }

Target:
private void create() throws Exception { File file = new File(directory, name); if (subdirs != null && subdirs.size() > 0) { assertTrue("Failed to create a directory", file.mkdirs()); for (FileEntry entry : subdirs) { entry.name = name + File.separator + entry.name; entry.create(); } } else { assertTrue("Failed to create file", file.createNewFile()); } long val = lastModified; if (val == Long.MAX_VALUE) { val = System.currentTimeMillis(); } assertTrue("Failed to set modification time", file.setLastModified(val)); if (subdirs == null && size > 0) { try (FileOutputStream out = new FileOutputStream(file)) { byte[] buffer = new byte[size]; out.write(buffer); } } }
Source:
private void processStylers(final Graphics2D graphics, final Layer layer, String layerId) throws Exception { final FeatureSource featureSource = layer.getFeatureSource(); if (featureSource == null) { throw new IllegalArgumentException("The layer does not contain a feature source"); } final FeatureType schema = featureSource.getSchema(); final ArrayList<LiteFeatureTypeStyle> lfts = createLiteFeatureTypeStyles(layer, graphics, isOptimizedFTSRenderingEnabled()); if (lfts.isEmpty()) { return; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Processing " + lfts.size() + " stylers for " + schema.getName()); } } List<List<LiteFeatureTypeStyle>> txClassified = classifyByFeatureProduction(lfts); for (List<LiteFeatureTypeStyle> uniform : txClassified) { FeatureCollection features = getFeatures(layer, schema, uniform); if (isOptimizedFTSRenderingEnabled() && lfts.size() > 1) { drawOptimized(graphics, layerId, features, uniform); } else { drawPlain(graphics, layerId, features, uniform); } } }

Target:
private void processStylers(final Graphics2D graphics, final Layer layer, String layerId) throws Exception { final FeatureSource featureSource = layer.getFeatureSource(); if (featureSource == null) { throw new IllegalArgumentException( "The layer does not contain a feature source: " + layer.getTitle()); } final FeatureType schema = featureSource.getSchema(); final ArrayList<LiteFeatureTypeStyle> lfts = createLiteFeatureTypeStyles(layer, graphics, isOptimizedFTSRenderingEnabled()); if (lfts.isEmpty()) { return; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Processing " + lfts.size() + " stylers for " + schema.getName()); } } List<List<LiteFeatureTypeStyle>> txClassified = classifyByFeatureProduction(lfts); for (List<LiteFeatureTypeStyle> uniform : txClassified) { FeatureCollection features = getFeatures(layer, schema, uniform); if (isOptimizedFTSRenderingEnabled() && lfts.size() > 1) { drawOptimized(graphics, layerId, features, uniform); } else { drawPlain(graphics, layerId, features, uniform); } } }
Source:
private Workflow manualRegisterAndPublish(WorkflowsApi workflowsApi, String workflowPath, String workflowName, String descriptorType, SourceControl sourceControl, String descriptorPath, boolean toPublish) { Workflow workflow = workflowsApi .manualRegister(sourceControl.getFriendlyName().toLowerCase(), workflowPath, descriptorPath, workflowName, descriptorType, "/test.json"); assertEquals(Workflow.ModeEnum.STUB, workflow.getMode()); workflow = workflowsApi.refresh(workflow.getId()); assertEquals(Workflow.ModeEnum.FULL, workflow.getMode()); if (toPublish) { workflow = workflowsApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); assertTrue(workflow.isIsPublished()); } return workflow; }

Target:
private Workflow manualRegisterAndPublish(WorkflowsApi workflowsApi, String workflowPath, String workflowName, String descriptorType, SourceControl sourceControl, String descriptorPath, boolean toPublish) { Workflow workflow = workflowsApi .manualRegister(sourceControl.getFriendlyName().toLowerCase(), workflowPath, descriptorPath, workflowName, descriptorType, "/test.json"); assertEquals(Workflow.ModeEnum.STUB, workflow.getMode()); workflow = workflowsApi.refresh(workflow.getId()); assertEquals(Workflow.ModeEnum.FULL, workflow.getMode()); if (toPublish) { workflow = workflowsApi.publish(workflow.getId(), SwaggerUtility.createPublishRequest(true)); } assertTrue(workflow.isIsPublished() == toPublish); return workflow; }
Source:
public void cancelScan(UUID originNodeId, String cacheName, long id) { boolean res; try { IgniteClusterImpl cluster = ctx.cluster().get(); ClusterNode srv = U.randomServerNode(ctx); IgniteCompute compute = cluster.compute(); res = compute.execute(new VisorScanQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorScanQueryCancelTaskArg(originNodeId, cacheName, id), false)); } catch (Exception e) { throw new RuntimeException(e); } if (!res) { throw new RuntimeException("Query not found[originNodeId=" + originNodeId + ",cacheName=" + cacheName + ",qryId=" + id + ']'); } }

Target:
public void cancelScan(UUID originNodeId, String cacheName, long id) { try { IgniteClusterImpl cluster = ctx.cluster().get(); ClusterNode srv = U.randomServerNode(ctx); IgniteCompute compute = cluster.compute(); boolean res = compute.execute(new VisorScanQueryCancelTask(), new VisorTaskArgument<>(srv.id(), new VisorScanQueryCancelTaskArg(originNodeId, cacheName, id), false)); if (!res) { throw new RuntimeException("Query not found[originNodeId=" + originNodeId + ",cacheName=" + cacheName + ",qryId=" + id + ']'); } } catch (IgniteException e) { throw new RuntimeException(e); } }
Source:
public ZKDatabase(FileTxnSnapLog snapLog) { dataTree = new DataTree(); sessionsWithTimeouts = new ConcurrentHashMap<Long, Integer>(); this.snapLog = snapLog; String value = System.getProperty(SNAPSHOT_SIZE_FACTOR, "0.33"); try { snapshotSizeFactor = Double.parseDouble(value); } catch (NumberFormatException e) { LOG.error("Error parsing " + SNAPSHOT_SIZE_FACTOR + " - use default value"); } LOG.info(SNAPSHOT_SIZE_FACTOR + "=" + snapshotSizeFactor); }

Target:
public ZKDatabase(FileTxnSnapLog snapLog) { dataTree = new DataTree(); sessionsWithTimeouts = new ConcurrentHashMap<Long, Integer>(); this.snapLog = snapLog; try { snapshotSizeFactor = Double.parseDouble( System.getProperty(SNAPSHOT_SIZE_FACTOR, Double.toString(DEFAULT_SNAPSHOT_SIZE_FACTOR))); if (snapshotSizeFactor > 1) { snapshotSizeFactor = DEFAULT_SNAPSHOT_SIZE_FACTOR; LOG.warn("The configured is invalid, going to use " + "the default {}", SNAPSHOT_SIZE_FACTOR, DEFAULT_SNAPSHOT_SIZE_FACTOR); } } catch (NumberFormatException e) { LOG.error("Error parsing {}, using default value {}", SNAPSHOT_SIZE_FACTOR, DEFAULT_SNAPSHOT_SIZE_FACTOR); snapshotSizeFactor = DEFAULT_SNAPSHOT_SIZE_FACTOR; } LOG.info("{} = {}", SNAPSHOT_SIZE_FACTOR, snapshotSizeFactor); }
Source:
protected void setOrganizationDocumentNumberToPostingDate(CorporateBilledCorporatePaidDocument cbcpDoc, Date transactionPostingDate) { if (transactionPostingDate != null) { cbcpDoc.getDocumentHeader().setOrganizationDocumentNumber(getDateFormat().format(transactionPostingDate)); } else { LOG.error("setDocumentOrgDocumentNumber, unable to set the org document number, the posting date is null."); } }

Target:
protected void setOrganizationDocumentNumberToPostingDate(CorporateBilledCorporatePaidDocument cbcpDoc, Date transactionPostingDate) { if (transactionPostingDate != null) { cbcpDoc.getDocumentHeader().setOrganizationDocumentNumber(getDateFormat().format(transactionPostingDate)); } else { LOG.error("setOrganizationDocumentNumberToPostingDate, unable to set the org document number, the posting date is null."); } }
Source:
public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters); loadSafeParameters(); parametersAction.safeParameters = this.safeParameters; return parametersAction; } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null) { safe.addAll(this.safeParameters); } overrides.loadSafeParameters(); if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }

Target:
public ParametersAction merge(@CheckForNull ParametersAction overrides) { if (overrides == null) { ParametersAction parametersAction = new ParametersAction(parameters, this.safeParameters); return parametersAction; } ParametersAction parametersAction = createUpdated(overrides.parameters); Set<String> safe = new TreeSet<>(); if (parametersAction.safeParameters != null && this.safeParameters != null) { safe.addAll(this.safeParameters); } if (overrides.safeParameters != null) { safe.addAll(overrides.safeParameters); } parametersAction.safeParameters = safe; return parametersAction; }
Source:
public ThriftServerDef build() { checkState(niftyProcessorFactory != null || thriftProcessorFactory != null, "Processor not defined!"); checkState(niftyProcessorFactory == null || thriftProcessorFactory == null, "TProcessors will be automatically adapted to NiftyProcessors, don't specify both"); if (niftyProcessorFactory == null) { niftyProcessorFactory = factoryFromTProcessorFactory(thriftProcessorFactory); } return new ThriftServerDef( name, serverPort, maxFrameSize, queuedResponseLimit, maxConnections, niftyProcessorFactory, duplexProtocolFactory, clientIdleTimeout, thriftFrameCodecFactory, executor); }

Target:
public ThriftServerDef build() { checkState(niftyProcessorFactory != null || thriftProcessorFactory != null, "Processor not defined!"); checkState(niftyProcessorFactory == null || thriftProcessorFactory == null, "TProcessors will be automatically adapted to NiftyProcessors, don't specify both"); checkState(maxConnections >= 0, "maxConnections should be 0 (for unlimited) or positive"); if (niftyProcessorFactory == null) { niftyProcessorFactory = factoryFromTProcessorFactory(thriftProcessorFactory); } return new ThriftServerDef( name, serverPort, maxFrameSize, queuedResponseLimit, maxConnections, niftyProcessorFactory, duplexProtocolFactory, clientIdleTimeout, thriftFrameCodecFactory, executor); }
Source:
private void onGetUserNameFinish(RemoteOperationResult result) { mWaitingForOpId = Long.MAX_VALUE; if (result.isSuccess()) { boolean success = false; String username = ((UserInfo) result.getData().get(0)).mDisplayName; if ( mAction == ACTION_CREATE) { mUsernameInput.setText(username); success = createAccount(result); } else { if (!mUsernameInput.getText().toString().trim().equals(username)) { result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); mAuthToken = ""; updateAuthStatusIconAndText(result); showAuthStatus(); Log_OC.d(TAG, result.getLogMessage()); } else { try { updateAccountAuthentication(); success = true; } catch (AccountNotFoundException e) { Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); finish(); } } } if (success) finish(); } else { int statusText = result.getCode() == ResultCode.MAINTENANCE_MODE ? R.string.maintenance_mode : R.string.auth_fail_get_user_name; updateStatusIconFailUserName(statusText); showAuthStatus(); Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage()); } }

Target:
private void onGetUserNameFinish(RemoteOperationResult result) { mWaitingForOpId = Long.MAX_VALUE; if (result.isSuccess()) { boolean success = false; String username = ((UserInfo) result.getData().get(0)).mDisplayName; if ( mAction == ACTION_CREATE) { mUsernameInput.setText(username); success = createAccount(result); } else { if (!mUsernameInput.getText().toString().trim().equals(username)) { result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_THE_SAME); mAuthToken = ""; updateAuthStatusIconAndText(result); showAuthStatus(); Log_OC.d(TAG, result.getLogMessage()); } else { try { updateAccountAuthentication(); success = true; } catch (AccountNotFoundException e) { Log_OC.e(TAG, "Account " + mAccount + " was removed!", e); Toast.makeText(this, R.string.auth_account_does_not_exist, Toast.LENGTH_SHORT).show(); finish(); } } } if (success) finish(); } else { int failedStatusText = result.getCode() == ResultCode.MAINTENANCE_MODE ? R.string.maintenance_mode : R.string.auth_fail_get_user_name; updateFailedAuthStatusIconAndText(failedStatusText); showAuthStatus(); Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage()); } }
Source:
public static void main(String[] args) { NavigatorPlugin plugin = NavigatorPlugin.fromConfigFile(args[0]); NavApiCient client = plugin.getClient(); Source fs = client.getSourcesForType(SourceType.HDFS).iterator().next(); HdfsEntity dir = new HdfsEntity("/user/hdfs", EntityType .DIRECTORY, fs.getIdentity()); dir.setTags(Sets.newHashSet("TAG_1", "TAG_2")); ResultSet results = plugin.write(dir); if (results.hasErrors()) { throw new RuntimeException(results.toString()); } }

Target:
public static void main(String[] args) { NavigatorPlugin plugin = NavigatorPlugin.fromConfigFile(args[0]); NavApiCient client = plugin.getClient(); Source fs = client.getSourcesForType(SourceType.HDFS).iterator().next(); HdfsEntity dir = new HdfsEntity("/user/hdfs", EntityType .DIRECTORY, fs.getIdentity()); dir.setTags(Sets.newHashSet("HAS_SENSITIVE_FILES", "CONTAINS_SOME_SUPER_SECRET_STUFF")); ResultSet results = plugin.write(dir); if (results.hasErrors()) { throw new RuntimeException(results.toString()); } }
Source:
public void shutdown() { GerritServer server = PluginImpl.getInstance().getServer(serverName); if (server != null) { server.removeListener((GerritEventListener)this); } else { logger.error("Could not find server {}", serverName); } }

Target:
public void shutdown() { GerritServer server = PluginImpl.getServer_(serverName); if (server != null) { server.removeListener((GerritEventListener)this); } else { logger.error("Could not find server {}", serverName); } }
Source:
public String getToolTipText() { if (tooltip == null) { if (base == null) { tooltip = MessageFormat.format(UIText.DiffEditorInput_Tooltip1, tip.getObjectId().abbreviate(7).name(), GitLabels.getPlainShortLabel(tip.getRepository())); } else { tooltip = MessageFormat.format( UIText.DiffEditorInput_Tooltip2, base.getObjectId().abbreviate(7).name(), tip.getObjectId().abbreviate(7).name(), GitLabels.getPlainShortLabel(tip.getRepository())); } } return tooltip; }

Target:
public String getToolTipText() { if (tooltip == null) { if (base == null) { tooltip = MessageFormat.format(UIText.DiffEditorInput_Tooltip1, Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } else { tooltip = MessageFormat.format( UIText.DiffEditorInput_Tooltip2, Utils.getShortObjectId(base.getObjectId()), Utils.getShortObjectId(tip.getObjectId()), GitLabels.getPlainShortLabel(tip.getRepository())); } } return tooltip; }
Source:
public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); if (workingUser != null) { scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(enabled); workingUser.setAllLabelValues(labelValues); workingUser.setAttributes(attributes); workingUser.setGroups(groups); scoreDirector.afterProblemPropertyChanged(workingUser); releaseNonPinnedTasks(workingUser, scoreDirector); scoreDirector.triggerVariableListeners(); } }

Target:
public void doChange(ScoreDirector<TaskAssigningSolution> scoreDirector) { final User workingUser = scoreDirector.lookUpWorkingObjectOrReturnNull(user); if (workingUser == null) { return; } scoreDirector.beforeProblemPropertyChanged(workingUser); workingUser.setEnabled(enabled); workingUser.setAllLabelValues(labelValues); workingUser.setAttributes(attributes); workingUser.setGroups(groups); scoreDirector.afterProblemPropertyChanged(workingUser); releaseNonPinnedTasks(workingUser, scoreDirector); scoreDirector.triggerVariableListeners(); }
Source:
public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = new ArrayList<>(); List<TypeTree> interfacesList = tree.superInterfaces(); if (!interfacesList.isEmpty()) { IntStream.range(0, interfacesList.size()) .forEach(i -> { JavaType jt = (JavaType) tree.symbol().interfaces().get(i); if (jt.isParameterized()) { Optional<String> reportString = matchFunctionalInterface(jt); reportString.ifPresent(rs -> reportTreeAndStringInterfaces.add(new InterfaceTreeAndStringPairReport(rs, interfacesList.get(i)))); } }); } if (!reportTreeAndStringInterfaces.isEmpty()) { List<JavaFileScannerContext.Location> flow = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), flow, null); } }

Target:
public void checkClassInterfaces(ClassTree tree) { List<InterfaceTreeAndStringPairReport> reportTreeAndStringInterfaces = tree.superInterfaces().stream() .map(typeTree -> matchFunctionalInterface(typeTree.symbolType()).map(rs -> new InterfaceTreeAndStringPairReport(rs, typeTree)).orElse(null)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (reportTreeAndStringInterfaces.isEmpty()) { return; } List<JavaFileScannerContext.Location> secondaryLocations = reportTreeAndStringInterfaces.stream() .map(interf -> new JavaFileScannerContext.Location("", interf.classInterface)) .collect(Collectors.toList()); reportIssue(tree.simpleName(), reportMessage(reportTreeAndStringInterfaces), secondaryLocations, null); }
Source:
public List<Command> handle(final List<Command> commands) { active = true; try { final List<Command> results = new LinkedList<>(); for (Command command : commands) { results.addAll(serverConnector.receive(command)); hasResponseCommands = !results.isEmpty(); } return results; } finally { active = false; } }

Target:
public List<Command> handle(final List<Command> commands) { active = true; try { final List<Command> results = new LinkedList<>(); for (final Command command : commands) { results.addAll(serverConnector.receive(command)); hasResponseCommands = !results.isEmpty(); } return results; } finally { active = false; } }
Source:
static Integer runCli( List<String> args, Map<String, String> params, String workingDir ) { ArrayList<String> arguments = new ArrayList<>( args ); if (params.size() > 0 ) { Collections.addAll( arguments, toJavaParams( params ).split( "\\s+" ) ); } boolean argsContainsFile = false; for ( String s : args) { if ( s.startsWith( "--file" ) ) { argsContainsFile = true; break; } } if ( ! argsContainsFile ) { arguments.add( "--log=" + workingDir + File.separator + "build.log" ); arguments.add( "--file=" + workingDir + File.separator + "pom.xml" ); } logger.info( "Invoking CLI with ", arguments ); Cli cli = new Cli(); int result = cli.run( arguments.toArray( new String[0] ) ); final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( org.slf4j.Logger.ROOT_LOGGER_NAME ); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); PatternLayoutEncoder ple = new PatternLayoutEncoder(); ple.setPattern( "[%t] %level %logger{32} - %msg%n" ); ple.setContext( loggerContext ); ple.start(); ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>(); consoleAppender.setEncoder( ple ); consoleAppender.setContext( loggerContext ); consoleAppender.start(); root.addAppender( consoleAppender ); root.setLevel( Level.DEBUG ); return result; }

Target:
static Integer runCli( List<String> args, Map<String, String> params, String workingDir ) { ArrayList<String> arguments = new ArrayList<>( args ); if (!params.isEmpty() ) { Collections.addAll( arguments, toJavaParams( params ).split( "\\s+" ) ); } boolean argsContainsFile = false; for ( String s : args) { if ( s.startsWith( "--file" ) ) { argsContainsFile = true; break; } } if ( ! argsContainsFile ) { arguments.add( "--log=" + workingDir + File.separator + "build.log" ); arguments.add( "--file=" + workingDir + File.separator + "pom.xml" ); } logger.info( "Invoking CLI with ", arguments ); Cli cli = new Cli(); int result = cli.run( arguments.toArray( new String[0] ) ); final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( org.slf4j.Logger.ROOT_LOGGER_NAME ); LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); loggerContext.reset(); PatternLayoutEncoder ple = new PatternLayoutEncoder(); ple.setPattern( "[%t] %level %logger{32} - %msg%n" ); ple.setContext( loggerContext ); ple.start(); ConsoleAppender<ILoggingEvent> consoleAppender = new ConsoleAppender<>(); consoleAppender.setEncoder( ple ); consoleAppender.setContext( loggerContext ); consoleAppender.start(); root.addAppender( consoleAppender ); root.setLevel( Level.DEBUG ); return result; }
Source:
private Review processAdditionalReviewFields( ReviewType reviewType, Review.Builder builder, Element filmElement ) { Element author = filmElement.getFirstChildElement(reviewType.authorTag()); Element authorInitials = filmElement.getFirstChildElement(reviewType.authorInitialsTag()); Element rating = filmElement.getFirstChildElement("rating"); if (hasValue(author)) { builder.withAuthor(author.getValue()); } if (hasValue(authorInitials)) { builder.withAuthorInitials(authorInitials.getValue()); } if (hasValue(rating)) { builder.withRating(rating.getValue()); } if (reviewType.equals(ReviewType.FOTD_REVIEW)) { Element reviewDate = filmElement.getFirstChildElement(reviewType.dateTag()); if (hasValue(reviewDate)) { builder.withDate(Date.from(Instant.parse(reviewDate.getValue()))); } } return builder.build(); }

Target:
private Review processAdditionalReviewFields( ReviewType reviewType, Review.Builder builder, Element filmElement ) { Element author = filmElement.getFirstChildElement(reviewType.authorTag()); Element authorInitials = filmElement.getFirstChildElement(reviewType.authorInitialsTag()); Element rating = filmElement.getFirstChildElement("rating"); if (hasValue(author)) { builder.withAuthor(author.getValue()); } if (hasValue(authorInitials)) { builder.withAuthorInitials(authorInitials.getValue()); } if (hasValue(rating)) { builder.withRating(rating.getValue()); } if (reviewType.equals(ReviewType.FOTD_REVIEW)) { Element reviewDate = filmElement.getFirstChildElement(reviewType.dateTag()); if (hasValue(reviewDate)) { DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy"); try { builder.withDate(dateFormat.parse(reviewDate.getValue())); } catch (ParseException e) { } } } return builder.build(); }
Source:
private static InternalLoggerFactory newDefaultFactory(String name) { return JdkLoggerFactory.INSTANCE; }

Target:
private static InternalLoggerFactory newDefaultFactory(String name) { InternalLoggerFactory f = JdkLoggerFactory.INSTANCE; f.newInstance(name).debug("Using java.util.logging as the default logging framework"); return f; }
Source:
public String formatValue(String key, Object value) { if (key.equals(Command.KEY_ENABLE)) { return (Boolean) value ? "1" : "0"; } else if (key.equals(Command.KEY_TIMEZONE)) { return String.format("%+03d", TimeZone.getTimeZone(value.toString()).getRawOffset() / 3600000); } else if (key.equals(Command.KEY_INDEX)) { switch (((Number) value).intValue()) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: return null; } } return null; }

Target:
public String formatValue(String key, Object value) { if (key.equals(Command.KEY_ENABLE)) { return (Boolean) value ? "1" : "0"; } else if (key.equals(Command.KEY_TIMEZONE)) { return String.format("%+03d", TimeZone.getTimeZone((String) value).getRawOffset() / 3600000); } else if (key.equals(Command.KEY_INDEX)) { switch (((Number) value).intValue()) { case 0: return "A"; case 1: return "B"; case 2: return "C"; default: return null; } } return null; }
Source:
public void testReturnContainerRamLimitAndRequest() { long limit = Containers.getRamLimit(container); long request = (Containers.getRamRequest(container)); assertEquals(limit, RAM_LIMIT); assertEquals(request, RAM_REQUEST); }

Target:
public void testReturnContainerRamLimitAndRequest() { long limit = Containers.getRamLimit(container); long request = Containers.getRamRequest(container); assertEquals(limit, RAM_LIMIT); assertEquals(request, RAM_REQUEST); }
Source:
public BowShootHandler onShoot() { return (e, n) -> { Collection<Entity> entites = n.getWorld().getNearbyEntities(n.getLocation(), range.getValue(), range.getValue(), range.getValue(), entity -> entity instanceof LivingEntity); for (Entity entity : entites) { if (entity.isValid() && entity instanceof LivingEntity) { LivingEntity entityL = (LivingEntity) entity; double distance = entityL.getLocation().distance(n.getLocation()); double damage = calculateDamage(distance, e.getDamage()); Vector distanceVector = entityL.getLocation().toVector().subtract(n.getLocation().toVector()); distanceVector.setY(distanceVector.getY() + 0.6D); Vector entityVelocity = entityL.getVelocity(); Vector knockback = entityVelocity.add(distanceVector.normalize().multiply((int) (e.getDamage() / Math.round(damage)))); entityL.setVelocity(knockback); entityL.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, entityL.getLocation(), 1); entityL.getWorld().playSound(entityL.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); if (!entityL.getUniqueId().equals(n.getUniqueId())) { entityL.damage(damage); EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(e.getDamager(), entityL, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage); Bukkit.getPluginManager().callEvent(damageEvent); } } } }; }

Target:
public BowShootHandler onShoot() { return (e, target) -> { target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation(), 1); target.getWorld().playSound(target.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F); Collection<Entity> entites = target.getWorld().getNearbyEntities(target.getLocation(), range.getValue(), range.getValue(), range.getValue(), entity -> entity instanceof LivingEntity && entity.isValid()); for (Entity entity : entites) { LivingEntity entityL = (LivingEntity) entity; Vector distanceVector = entityL.getLocation().toVector().subtract(target.getLocation().toVector()); distanceVector.setY(distanceVector.getY() + 0.6D); Vector entityVelocity = entityL.getVelocity(); double distanceSquared = distanceVector.lengthSquared(); double damage = calculateDamage(distanceSquared, e.getDamage()); Vector knockback = entityVelocity.add(distanceVector.normalize().multiply((int) (e.getDamage() / damage))); entityL.setVelocity(knockback); if (!entityL.getUniqueId().equals(target.getUniqueId())) { EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(e.getDamager(), entityL, EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, damage); Bukkit.getPluginManager().callEvent(damageEvent); if (!damageEvent.isCancelled()) { entityL.damage(damageEvent.getDamage()); } } } }; }
Source:
private String getOutput(Process process, String correlationId) throws IOException { final String ERROR_PREFIX = "error"; String output; BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((output = br.readLine()) != null) { if (output.startsWith(ERROR_PREFIX)) { output = output.substring(ERROR_PREFIX.length() + 1); break; } else if (output.startsWith(correlationId)) { output = output.substring(correlationId.length() + 1); break; } } return output; }

Target:
private String getOutput(Process process, String correlationId) throws IOException { final String ERROR_PREFIX = "error"; String output; BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); while ((output = br.readLine()) != null) { if (output.startsWith(ERROR_PREFIX)) { return output.substring(ERROR_PREFIX.length() + 1); } else if (output.startsWith(correlationId)) { return output.substring(correlationId.length() + 1); } log.debug("ignored cinderlib output: {}", output); } return ""; }
Source:
public Consent createConsentForDataset(DataSetDTO dataset) { String consentId = UUID.randomUUID().toString(); Optional<DataSetPropertyDTO> nameProp = dataset.getProperties() .stream() .filter(p -> p.getPropertyName().equalsIgnoreCase(DATASET_NAME_KEY)) .findFirst(); String groupName = nameProp.isPresent() ? nameProp.get().getPropertyValue() : dataset.getAlias(); String name = CONSENT_NAME_PREFIX + dataset.getDataSetId(); Date createDate = new Date(); if (Objects.nonNull(dataset.getDataUse())) { boolean manualReview = isConsentDataUseManualReview(dataset.getDataUse()); consentDAO.insertConsent(consentId, manualReview, null, dataset.getDataUse().toString(), null, name, null, createDate, createDate, null, true, groupName, dataset.getDacId()); String associationType = AssociationType.SAMPLESET.getValue(); consentDAO.insertConsentAssociation(consentId, associationType, dataset.getDacId()); return consentDAO.findConsentById(consentId); } else { throw new NullPointerException("Dataset is missing Data Use information. Consent could not be created."); } }

Target:
public Consent createConsentForDataset(DataSetDTO dataset) { String consentId = UUID.randomUUID().toString(); Optional<DataSetPropertyDTO> nameProp = dataset.getProperties() .stream() .filter(p -> p.getPropertyName().equalsIgnoreCase(DATASET_NAME_KEY)) .findFirst(); String groupName = nameProp.isPresent() ? nameProp.get().getPropertyValue() : dataset.getAlias(); String name = CONSENT_NAME_PREFIX + dataset.getDataSetId(); Date createDate = new Date(); if (Objects.nonNull(dataset.getDataUse())) { boolean manualReview = isConsentDataUseManualReview(dataset.getDataUse()); consentDAO.insertConsent(consentId, manualReview, null, dataset.getDataUse().toString(), null, name, null, createDate, createDate, null, true, groupName, dataset.getDacId()); String associationType = AssociationType.SAMPLESET.getValue(); consentDAO.insertConsentAssociation(consentId, associationType, dataset.getDacId()); return consentDAO.findConsentById(consentId); } else { throw new IllegalArgumentException("Dataset is missing Data Use information. Consent could not be created."); } }
Source:
public Void execute(final TransactionContext context) { final CodeSystem codeSystem = context.lookup(uniqueId, CodeSystem.class); if (codeSystem == null) { throw new BadRequestException("Code System with unique ID %s was not found.", uniqueId); } updateOid(codeSystem, context); updateName(codeSystem); updateShortName(codeSystem, context); updateLink(codeSystem); updateLanguage(codeSystem); updateCitation(codeSystem); updateBranchPath(codeSystem); updateIconPath(codeSystem); updateTerminologyId(codeSystem); return null; }

Target:
public Void execute(final TransactionContext context) { final CodeSystem codeSystem = context.lookup(uniqueId, CodeSystem.class); updateName(codeSystem); updateLink(codeSystem); updateLanguage(codeSystem); updateCitation(codeSystem); updateBranchPath(codeSystem); updateIconPath(codeSystem); return null; }
Source:
public void addChildren(AlluxioURI path, Collection<UfsStatus> children) { UfsStatus status = mStatuses.get(path); if (status != null) { mChildren.computeIfAbsent(path, ufsStatus -> new ConcurrentHashSet<>()).addAll(children); } children.forEach(child -> { AlluxioURI childPath = path.joinUnsafe(child.getName()); addStatus(childPath, child); }); }

Target:
public Collection<UfsStatus> addChildren(AlluxioURI path, Collection<UfsStatus> children) { ConcurrentHashSet<UfsStatus> set = new ConcurrentHashSet<>(); children.forEach(child -> { AlluxioURI childPath = path.joinUnsafe(child.getName()); addStatus(childPath, child); set.add(child); }); return mChildren.put(path, set); }
Source:
public void checkMaskValidValue() { if (!isMaskValidFormat) { return; } assertEquals("Failed to validate mask value" + mask, isMaskValid, MaskValidator.getInstance().isMaskValid(mask)); }

Target:
public void checkMaskValidValue() { if (!MaskValidator.getInstance().isMaskFormatValid(mask, isPrefixAllowed)) { return; } assertEquals("Failed to validate mask value" + mask, isMaskValid, MaskValidator.getInstance().isMaskValid(mask, isPrefixAllowed)); }
Source:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { gravArray = event.values; } if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magneticArray = event.values; } if (gravArray != null && magneticArray != null) { float[] num1 = new float[9]; float[] num2 = new float[9]; boolean success = SensorManager.getRotationMatrix(num1, num2, gravArray, magneticArray); if (success) { float[] orientation = new float[3]; SensorManager.getOrientation(num1, orientation); azimut = orientation[0]; pitch = orientation[1]; roll = orientation[2]; CameraPosition position = new CameraPosition.Builder() .tilt(pitch * -90) .bearing(roll * 90) .build(); if (mapboxMap != null) { mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(position), 100 ); } } } }

Target:
public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { gravityArray = event.values; } if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { magneticArray = event.values; } if (gravityArray != null && magneticArray != null) { boolean success = SensorManager.getRotationMatrix(rotationMatrix, inclinationMatrix, gravityArray, magneticArray); if (success) { if (mapboxMap != null) { int mapCameraAnimationMillisecondsSpeed = 100; mapboxMap.animateCamera(CameraUpdateFactory .newCameraPosition(createNewCameraPosition()), mapCameraAnimationMillisecondsSpeed ); } } } }
Source:
protected void serviceStop() throws Exception { if (mbeanObjectName != null) { MBeans.unregister(mbeanObjectName); } if (null != materializeDir) { FileUtils.deleteQuietly(materializeDir.toFile()); } if (localizationEventsHandler != null) { localizationEventsHandler.interrupt(); } LOG.debug("Stopped CertificateLocalization service"); super.serviceStop(); }

Target:
protected void serviceStop() throws Exception { if (mbeanObjectName != null) { MBeans.unregister(mbeanObjectName); } if (localizationEventsHandler != null) { localizationEventsHandler.interrupt(); } if (null != materializeDir) { FileUtils.deleteQuietly(materializeDir.toFile()); } LOG.debug("Stopped CertificateLocalization service"); super.serviceStop(); }
Source:
public void setUpFluo() throws Exception { config = new FluoConfiguration(); config.setMiniStartAccumulo(false); config.setApplicationName("lit"); config.setAccumuloInstance(cluster.getInstanceName()); config.setAccumuloUser("root"); config.setAccumuloPassword("secret"); config.setInstanceZookeepers(cluster.getZooKeepers() + "/fluo"); config.setAccumuloZookeepers(cluster.getZooKeepers()); config.setAccumuloTable("data" + tableCounter.getAndIncrement()); config.setWorkerThreads(5); exportTable = "export" + tableCounter.getAndIncrement(); cluster.getConnector("root", "secret").tableOperations().create(exportTable); config.addObserver(new ObserverConfiguration(PageObserver.class.getName())); FluoApp.configureApplication(config, new TableInfo(cluster.getInstanceName(), cluster.getZooKeepers(), "root", "secret", exportTable), 5); FluoFactory.newAdmin(config).initialize( new FluoAdmin.InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(config); }

Target:
public void setUpFluo() throws Exception { config = new FluoConfiguration(); config.setMiniStartAccumulo(false); config.setApplicationName("lit"); config.setAccumuloInstance(cluster.getInstanceName()); config.setAccumuloUser("root"); config.setAccumuloPassword("secret"); config.setInstanceZookeepers(cluster.getZooKeepers() + "/fluo"); config.setAccumuloZookeepers(cluster.getZooKeepers()); config.setAccumuloTable("data" + tableCounter.getAndIncrement()); config.setWorkerThreads(5); exportTable = "export" + tableCounter.getAndIncrement(); cluster.getConnector("root", "secret").tableOperations().create(exportTable); config.addObserver(new ObserverConfiguration(PageObserver.class.getName())); FluoApp.configureApplication(config, new TableInfo(cluster.getInstanceName(), cluster.getZooKeepers(), "root", "secret", exportTable), FluoApp.NUM_BUCKETS); FluoFactory.newAdmin(config).initialize( new FluoAdmin.InitOpts().setClearTable(true).setClearZookeeper(true)); miniFluo = FluoFactory.newMiniFluo(config); }
Source:
public void onReceive(Context context, Intent intent) { mContext = context; if (MESSAGE_STATUS_RECEIVED_ACTION.equals(intent.getAction())) { Uri messageUri = intent.getData(); byte[] pdu = (byte[]) intent.getExtra("pdu"); boolean isStatusMessage = updateMessageStatus(context, messageUri, pdu); SmsMessage message = SmsMessage.createFromPdu(pdu); if (message.getStatus() < Sms.STATUS_PENDING) MessagingNotification.nonBlockingUpdateNewMessageIndicator(context, true, isStatusMessage); } }

Target:
public void onReceive(Context context, Intent intent) { mContext = context; if (MESSAGE_STATUS_RECEIVED_ACTION.equals(intent.getAction())) { Uri messageUri = intent.getData(); byte[] pdu = (byte[]) intent.getExtra("pdu"); SmsMessage message = updateMessageStatus(context, messageUri, pdu); if (message.getStatus() < Sms.STATUS_PENDING) MessagingNotification.nonBlockingUpdateNewMessageIndicator(context, true, message.isStatusReportMessage); } }
Source:
public final Object internalLoad( String entityName, Serializable id, boolean eager, boolean nullable, Boolean unwrapProxy) { final EffectiveEntityGraph effectiveEntityGraph = getLoadQueryInfluencers().getEffectiveEntityGraph(); final GraphSemantic semantic = effectiveEntityGraph.getSemantic(); final RootGraphImplementor<?> graph = effectiveEntityGraph.getGraph(); boolean clearedEffectiveGraph = false; if ( semantic != null ) { if ( ! graph.appliesTo( entityName ) ) { log.debugf( "Clearing effective entity graph for subsequent-select" ); clearedEffectiveGraph = true; effectiveEntityGraph.clear(); } } try { final LoadEventListener.LoadType type; if ( nullable ) { type = LoadEventListener.INTERNAL_LOAD_NULLABLE; } else { type = eager ? LoadEventListener.INTERNAL_LOAD_EAGER : LoadEventListener.INTERNAL_LOAD_LAZY; } LoadEvent event = loadEvent; loadEvent = null; event = recycleEventInstance( event, id, entityName ); fireLoad( event, type ); Object result = event.getResult(); if ( !nullable ) { UnresolvableObjectException.throwIfNull( result, id, entityName ); } if ( loadEvent == null ) { event.setEntityClassName( null ); event.setEntityId( null ); event.setInstanceToLoad( null ); event.setResult( null ); event.setShouldUnwrapProxy( unwrapProxy ); loadEvent = event; } return result; } finally { if ( clearedEffectiveGraph ) { effectiveEntityGraph.applyGraph( graph, semantic ); } } }

Target:
public final Object internalLoad( String entityName, Serializable id, boolean eager, boolean nullable, Boolean unwrapProxy) { final EffectiveEntityGraph effectiveEntityGraph = getLoadQueryInfluencers().getEffectiveEntityGraph(); final GraphSemantic semantic = effectiveEntityGraph.getSemantic(); final RootGraphImplementor<?> graph = effectiveEntityGraph.getGraph(); boolean clearedEffectiveGraph = false; if ( semantic != null ) { if ( ! graph.appliesTo( entityName ) ) { log.debugf( "Clearing effective entity graph for subsequent-select" ); clearedEffectiveGraph = true; effectiveEntityGraph.clear(); } } try { final LoadEventListener.LoadType type; if ( nullable ) { type = LoadEventListener.INTERNAL_LOAD_NULLABLE; } else { type = eager ? LoadEventListener.INTERNAL_LOAD_EAGER : LoadEventListener.INTERNAL_LOAD_LAZY; } LoadEvent event = loadEvent; loadEvent = null; event = recycleEventInstance( event, id, entityName ); event.setShouldUnwrapProxy( unwrapProxy ); fireLoad( event, type ); Object result = event.getResult(); if ( !nullable ) { UnresolvableObjectException.throwIfNull( result, id, entityName ); } if ( loadEvent == null ) { event.setEntityClassName( null ); event.setEntityId( null ); event.setInstanceToLoad( null ); event.setResult( null ); loadEvent = event; } return result; } finally { if ( clearedEffectiveGraph ) { effectiveEntityGraph.applyGraph( graph, semantic ); } } }
Source:
private void onResult() { if (script != null && comments != null) { if (comments.getHistory().size() > 1) { historyTable.display(comments.getHistory()); historyPanel.setVisible(true); } else { historyPanel.setVisible(false); } boolean hasDifferences = !script.getEdits().isEmpty() && !script.getPatchHeader().isEmpty(); boolean modeChange = script.getEdits().isEmpty() && !script.getPatchHeader().isEmpty(); if (contentTable instanceof SideBySideTable && modeChange) { contentTable.removeFromParent(); contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; contentPanel.add(contentTable); History.newItem(Link.toPatchUnified(patchKey), false); } if (hasDifferences) { contentTable.display(patchKey, idSideA, idSideB, script); contentTable.display(comments); contentTable.finishDisplay(); } showPatch(hasDifferences); script = null; comments = null; if (!isCurrentView()) { display(); } } }

Target:
private void onResult() { if (script != null && comments != null) { if (comments.getHistory().size() > 1) { historyTable.display(comments.getHistory()); historyPanel.setVisible(true); } else { historyPanel.setVisible(false); } boolean hasEdits = !script.getEdits().isEmpty(); boolean hasMeta = !script.getPatchHeader().isEmpty(); boolean hasDifferences = hasEdits || hasMeta; boolean pureMetaChange = !hasEdits && hasMeta; if (contentTable instanceof SideBySideTable && pureMetaChange) { contentTable.removeFromParent(); contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; contentPanel.add(contentTable); History.newItem(Link.toPatchUnified(patchKey), false); } if (hasDifferences) { contentTable.display(patchKey, idSideA, idSideB, script); contentTable.display(comments); contentTable.finishDisplay(); } showPatch(hasDifferences); script = null; comments = null; if (!isCurrentView()) { display(); } } }