auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private <T, U extends T> Supplier<T> createSupplier(ClassLoader threadContextClassLoader, Consumer<Runnable> securityContextActionConsumer, U event, EventMetadata metadata, ObserverExceptionHandler exceptionHandler, boolean handleExceptions, Runnable notifyAction) { return () -> { ClassLoader originalCl = GetContextClassLoaderAction.INSTANCE.run(); final ThreadLocalStackReference<EventMetadata> stack = currentEventMetadata.pushIfNotNull(metadata); final RequestContext requestContext = requestContextHolder.get(); securityContextActionConsumer.accept(() -> { try { new SetContextClassLoaderAction(threadContextClassLoader).run(); requestContext.activate(); notifyAction.run(); } finally { stack.pop(); requestContext.invalidate(); requestContext.deactivate(); new SetContextClassLoaderAction(originalCl).run(); } }); if (handleExceptions) { handleExceptions(exceptionHandler); } return event; }; }

Target:
private <T, U extends T> Supplier<T> createSupplier(ClassLoader threadContextClassLoader, Consumer<Runnable> securityContextActionConsumer, U event, EventMetadata metadata, ObserverExceptionHandler exceptionHandler, boolean handleExceptions, Runnable notifyAction) { return () -> { ClassLoader originalCl = SecurityActions.getContextClassLoader(); final ThreadLocalStackReference<EventMetadata> stack = currentEventMetadata.pushIfNotNull(metadata); final RequestContext requestContext = requestContextHolder.get(); securityContextActionConsumer.accept(() -> { try { SecurityActions.setContextClassLoader(threadContextClassLoader); requestContext.activate(); notifyAction.run(); } finally { stack.pop(); requestContext.invalidate(); requestContext.deactivate(); SecurityActions.setContextClassLoader(originalCl); } }); if (handleExceptions) { handleExceptions(exceptionHandler); } return event; }; }
Source:
public void finish() { synchronized ( lock ) { if ( state == Worker.STATE_DEAD ) { return; } state = Worker.STATE_DEAD; try { final AbstractReportProcessor processor = ReportProcessorThreadHolder.getProcessor(); if ( processor != null ) { processor.cancel(); } } catch ( SecurityException se ) { } } }

Target:
public void finish() { synchronized ( lock ) { if ( state == Worker.STATE_DEAD ) { return; } state = Worker.STATE_DEAD; try { this.interrupt(); } catch ( SecurityException se ) { } } }
Source:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<Pattern> patterns = getPatterns(); int confidence = Alert.CONFIDENCE_MEDIUM; List<String> evidence = new ArrayList<String>(); if (msg.getResponseBody().length() > 0 && msg.getResponseHeader().isText()) { StringBuilder todoComments = new StringBuilder(); if (msg.getResponseHeader().isJavaScript()) { String[] lines = msg.getResponseBody().toString().split("\n"); for (String line : lines) { for (Pattern pattern : patterns) { if (pattern.matcher(line).find()) { todoComments.append( Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern, line)); todoComments.append("\n"); confidence = Alert.CONFIDENCE_LOW; evidence.add(line); break; } } } } else { List<Tag> tags = source.getAllTags(StartTagType.COMMENT); for (Tag tag : tags) { String tagStr = tag.toString(); for (Pattern pattern : patterns) { if (pattern.matcher(tagStr).find()) { todoComments.append( Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern, tagStr)); todoComments.append("\n"); evidence.add(tagStr); break; } } } Element el; int offset = 0; while ((el = source.getNextElement(offset, HTMLElementName.SCRIPT)) != null) { String elStr = el.toString(); for (Pattern pattern : patterns) { if (pattern.matcher(elStr).find()) { todoComments.append( Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern, elStr)); todoComments.append("\n"); confidence = Alert.CONFIDENCE_LOW; evidence.add(elStr); break; } } offset = el.getEnd(); } } for (String e : evidence) { this.raiseAlert(msg, id, todoComments.toString(), confidence, e); } } }

Target:
public void scanHttpResponseReceive(HttpMessage msg, int id, Source source) { List<Pattern> patterns = getPatterns(); int confidence = Alert.CONFIDENCE_MEDIUM; if (msg.getResponseBody().length() > 0 && msg.getResponseHeader().isText()) { if (msg.getResponseHeader().isJavaScript()) { String[] lines = msg.getResponseBody().toString().split("\n"); for (String line : lines) { for (Pattern pattern : patterns) { if (pattern.matcher(line).find()) { String other = Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern); confidence = Alert.CONFIDENCE_LOW; this.raiseAlert(msg, id, other, confidence, line); break; } } } } else { List<Tag> tags = source.getAllTags(StartTagType.COMMENT); for (Tag tag : tags) { String tagStr = tag.toString(); for (Pattern pattern : patterns) { if (pattern.matcher(tagStr).find()) { String other = Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern); this.raiseAlert(msg, id, other, confidence, tagStr); break; } } } Element el; int offset = 0; while ((el = source.getNextElement(offset, HTMLElementName.SCRIPT)) != null) { String elStr = el.toString(); for (Pattern pattern : patterns) { if (pattern.matcher(elStr).find()) { String other = Constant.messages.getString( MESSAGE_PREFIX + "otherinfo", pattern); confidence = Alert.CONFIDENCE_LOW; this.raiseAlert(msg, id, other, confidence, elStr); break; } } offset = el.getEnd(); } } } }
Source:
public static CreateFirewallPolicy create(final String name, final String description, List<Rule.CreatePayload> rules) { return new AutoValue_FirewallPolicy_CreateFirewallPolicy(name, description, rules == null ? ImmutableList.<Rule.CreatePayload>of() : rules); }

Target:
public static CreateFirewallPolicy create(final String name, final String description, List<Rule.CreatePayload> rules) { return new AutoValue_FirewallPolicy_CreateFirewallPolicy(name, description, rules == null ? ImmutableList.<Rule.CreatePayload>of() : ImmutableList.copyOf(rules)); }
Source:
public PipelinePagination(int currentPage, int totalCount, int pagingSize, String moveLink) { this.currentPage = currentPage; this.totalCount = totalCount; this.pageSize = pagingSize == 0 ? 10 : pagingSize; this.moveLink = moveLink; try { rootUrl = Hudson.getInstance().getRootUrlFromRequest(); } catch (Exception e) { } }

Target:
public PipelinePagination(int currentPage, int totalCount, int pagingSize, String moveLink) { this.currentPage = currentPage; this.totalCount = totalCount; this.pageSize = pagingSize == 0 ? 10 : pagingSize; this.moveLink = moveLink; this.rootUrl = Jenkins.getInstance() != null ? Jenkins.getInstance().getRootUrlFromRequest() : "/"; }
Source:
public void obtainsAuthor() throws Exception { final String alias = "charlie"; final Aliases aliases = new DyBase().user(new URN("urn:test:89636")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout bout = inbox.bout(inbox.start()); final Attachments attachments = bout.attachments(); final String name = "name"; attachments.create(name); final Attachment attachment = attachments.get(name); MatcherAssert.assertThat( attachment.author(), Matchers.equalTo(alias) ); attachments.delete(name); }

Target:
public void obtainsAuthor() throws Exception { final String alias = "charlie"; final Aliases aliases = new DyBase().user(new URN("urn:test:89636")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Attachments attachments = inbox.bout(inbox.start()) .attachments(); final String name = "name"; attachments.create(name); final Attachment attachment = attachments.get(name); MatcherAssert.assertThat( attachment.author(), Matchers.equalTo(alias) ); attachments.delete(name); }
Source:
void assertMutationMetrics(String tableName, int numRows, Map<String, Map<MetricType, Long>> mutationMetrics) { assertTrue("No mutation metrics present when there should have been", mutationMetrics.size() > 0); for (Map.Entry<String, Map<MetricType, Long>> entry : mutationMetrics.entrySet()) { String t = entry.getKey(); assertEquals("Table name didn't match for mutation metrics", tableName, t); Map<MetricType, Long> p = entry.getValue(); assertEquals("There should have been four metrics", 5, p.size()); for (Map.Entry<MetricType, Long> metric : p.entrySet()) { MetricType metricType = metric.getKey(); long metricValue = metric.getValue(); if (metricType.equals(MetricType.MUTATION_BATCH_SIZE)) { assertEquals("Mutation batch sizes didn't match!", numRows, metricValue); } else if (metricType.equals(MetricType.MUTATION_COMMIT_TIME)) { assertTrue("Mutation commit time should be greater than zero", metricValue > 0); } else if (metricType.equals(MetricType.MUTATION_BYTES)) { assertTrue("Mutation bytes size should be greater than zero", metricValue > 0); } else if (metricType.equals(MetricType.MUTATION_BATCH_FAILED_SIZE)) { assertEquals("Zero failed mutations expected", 0, metricValue); } else if (metricType.equals(MetricType.PHASE_THREE_FAILURE_SIZE)) { assertEquals("Zero failed phase 3 mutations expected", 0, metricValue); } } } }

Target:
void assertMutationMetrics(String tableName, int numRows, Map<String, Map<MetricType, Long>> mutationMetrics) { assertTrue("No mutation metrics present when there should have been", mutationMetrics.size() > 0); for (Map.Entry<String, Map<MetricType, Long>> entry : mutationMetrics.entrySet()) { String t = entry.getKey(); assertEquals("Table name didn't match for mutation metrics", tableName, t); Map<MetricType, Long> p = entry.getValue(); assertEquals("There should have been five metrics", 5, p.size()); for (Map.Entry<MetricType, Long> metric : p.entrySet()) { MetricType metricType = metric.getKey(); long metricValue = metric.getValue(); if (metricType.equals(MetricType.MUTATION_BATCH_SIZE)) { assertEquals("Mutation batch sizes didn't match!", numRows, metricValue); } else if (metricType.equals(MetricType.MUTATION_COMMIT_TIME)) { assertTrue("Mutation commit time should be greater than zero", metricValue > 0); } else if (metricType.equals(MetricType.MUTATION_BYTES)) { assertTrue("Mutation bytes size should be greater than zero", metricValue > 0); } else if (metricType.equals(MetricType.MUTATION_BATCH_FAILED_SIZE)) { assertEquals("Zero failed mutations expected", 0, metricValue); } else if (metricType.equals(MetricType.INDEX_COMMIT_FAILURE_SIZE)) { assertEquals("Zero failed phase 3 mutations expected", 0, metricValue); } } } }
Source:
private void setup() throws Exception { address = new ModelNode(); address.add(SUBSYSTEM, "resource-adapters"); address.add("resource-adapter", rarDeploymentName); address.protect(); ModelNode operation = new ModelNode(); operation.get(OP).set("add"); operation.get(OP_ADDR).set(address); operation.get("archive").set(rarDeploymentName); executeOperation(operation); ModelNode addr = address.clone(); addr.add("admin-objects", "ij_Pool3"); operation = new ModelNode(); operation.get(OP).set("add"); operation.get(OP_ADDR).set(addr); operation.get("jndi-name").set("java:jboss/Name3"); operation .get("class-name") .set("org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl"); executeOperation(operation); operation = new ModelNode(); operation.get(OP).set("activate"); operation.get(OP_ADDR).set(address); executeOperation(operation); }

Target:
private ModelNode setup() throws Exception { ModelNode address = new ModelNode(); address.add(SUBSYSTEM, "resource-adapters"); address.add("resource-adapter", rarDeploymentName); address.protect(); ModelNode operation = new ModelNode(); operation.get(OP).set("add"); operation.get(OP_ADDR).set(address); operation.get("archive").set(rarDeploymentName); executeOperation(operation); ModelNode addr = address.clone(); addr.add("admin-objects", "ij_Pool3"); operation = new ModelNode(); operation.get(OP).set("add"); operation.get(OP_ADDR).set(addr); operation.get("jndi-name").set("java:jboss/Name3"); operation .get("class-name") .set("org.jboss.as.test.integration.jca.rar.MultipleAdminObject1Impl"); executeOperation(operation); operation = new ModelNode(); operation.get(OP).set("activate"); operation.get(OP_ADDR).set(address); executeOperation(operation); return address; }
Source:
public Response findAll(@Auth AuthUser authUser, @QueryParam("withUsers") Optional<Boolean> withUsers) { List<Dac> dacs = new ArrayList<>(); final Boolean includeUsers = withUsers.isPresent() ? withUsers.get() : true; dacs.addAll(dacService.findDacsByUser(authUser, includeUsers)); return Response.ok().entity(dacs).build(); }

Target:
public Response findAll(@Auth AuthUser authUser, @QueryParam("withUsers") Optional<Boolean> withUsers) { final Boolean includeUsers = withUsers.isPresent() ? withUsers.get() : true; List<Dac> dacs = dacService.findDacsByUser(authUser, includeUsers); return Response.ok().entity(dacs).build(); }
Source:
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { pos = pos.offset(facing); ItemStack itemstack = player.getHeldItem(hand); if (!player.canPlayerEdit(pos, facing, itemstack)) return EnumActionResult.FAIL; else { if (worldIn.isAirBlock(pos) && NetworkHelper.getSoulNetwork(getBinding(player.getHeldItem(hand))).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess()) { worldIn.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState(), 11); } else return EnumActionResult.FAIL; if (player instanceof EntityPlayerMP) CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, itemstack); return EnumActionResult.SUCCESS; } }

Target:
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { pos = pos.offset(facing); ItemStack itemstack = player.getHeldItem(hand); if (!player.canPlayerEdit(pos, facing, itemstack)) return EnumActionResult.FAIL; if (worldIn.isAirBlock(pos) && NetworkHelper.getSoulNetwork(getBinding(player.getHeldItem(hand))).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess()) { worldIn.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState(), 11); } else return EnumActionResult.FAIL; if (player instanceof EntityPlayerMP) CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, itemstack); return EnumActionResult.SUCCESS; }
Source:
private void add(AddRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { checkPermissions(request); UserDto user = getUser(dbSession, request); Optional<ComponentDto> project = searchProject(dbSession, request); project.ifPresent(p -> userSession.checkComponentPermission(UserRole.USER, p)); notificationUpdater.add(dbSession, request.getChannel(), request.getType(), user, project.orElse(null)); dbSession.commit(); } }

Target:
private void add(AddRequest request) { try (DbSession dbSession = dbClient.openSession(false)) { checkPermissions(request); UserDto user = getUser(dbSession, request); Optional<ComponentDto> project = searchProject(dbSession, request); notificationUpdater.add(dbSession, request.getChannel(), request.getType(), user, project.orElse(null)); dbSession.commit(); } }
Source:
public Instantiator getInstantiator(MockCreationSettings<?> settings) { if (settings != null && settings.getConstructorArgs() != null) { return new ConstructorInstantiator(settings.getConstructorArgs()); } else { return INSTANCE; } }

Target:
public Instantiator getInstantiator(MockCreationSettings<?> settings) { if (settings != null && settings.getConstructorArgs() != null) { return new ConstructorInstantiator(settings.getOuterClassInstance() != null, settings.getConstructorArgs()); } else { return INSTANCE; } }
Source:
public List<InterpreterCompletion> completion(String buffer, int cursor) { String lines[] = buffer.split(System.getProperty("line.separator")); if (lines.length > 0 && (lines[0].startsWith("%") && cursor <= lines[0].trim().length())) { return getInterpreterCompletion(); } String replName = getRequiredReplName(buffer); if (replName != null && cursor > replName.length()) { cursor -= replName.length() + 1; } String body = getScriptBody(buffer); Interpreter repl = getRepl(replName); if (repl == null) { return null; } List completion = repl.completion(body, cursor); return completion; }

Target:
public List<InterpreterCompletion> completion(String buffer, int cursor) { String lines[] = buffer.split(System.getProperty("line.separator")); if (lines.length > 0 && lines[0].startsWith("%") && cursor <= lines[0].trim().length()) { int idx = lines[0].indexOf(' '); if (idx < 0 || (idx > 0 && cursor <= idx)) { return getInterpreterCompletion(); } } String replName = getRequiredReplName(buffer); if (replName != null && cursor > replName.length()) { cursor -= replName.length() + 1; } String body = getScriptBody(buffer); Interpreter repl = getRepl(replName); if (repl == null) { return null; } List completion = repl.completion(body, cursor); return completion; }
Source:
public void addLinkedAddress(final Address address) { if (linkedAddresses == null) { linkedAddresses = PlatformDependent.hasUnsafe() ? new NonBlockingHashSet<>() : new ConcurrentHashSet<>(); } assert !linkedAddresses.contains(address); linkedAddresses.add(address); }

Target:
public void addLinkedAddress(final Address address) { if (linkedAddresses == null) { linkedAddresses = PlatformDependent.hasUnsafe() ? new NonBlockingHashSet<>() : new ConcurrentHashSet<>(); } linkedAddresses.add(address); }
Source:
public void init( PrimaryIndex... indices ) { String indexCrsCode = null; for (PrimaryIndex primaryindx : indices) { if (indexCrsCode == null) { if (primaryindx.getIndexModel() instanceof CustomCrsIndexModel) { indexCrsCode = ((CustomCrsIndexModel) primaryindx.getIndexModel()).getCrsCode(); } else { indexCrsCode = GeometryUtils.DEFAULT_CRS_STR; } } else { if (primaryindx.getIndexModel() instanceof CustomCrsIndexModel) { if (!indexCrsCode.equals(((CustomCrsIndexModel) primaryindx.getIndexModel()).getCrsCode())) { LOGGER.error("Multiple indices with different CRS is not supported"); throw new RuntimeException( "Multiple indices with different CRS is not supported"); } else { if (!indexCrsCode.equals(GeometryUtils.DEFAULT_CRS_STR)) { LOGGER.error("Multiple indices with different CRS is not supported"); throw new RuntimeException( "Multiple indices with different CRS is not supported"); } } } } } }

Target:
public void init( PrimaryIndex... indices ) { }
Source:
public void testInvokeWithSpecifyService() throws RemotingException { mockChannel = mock(Channel.class); given(mockChannel.getAttribute("telnet.service")).willReturn(null); given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("127.0.0.1:5555")); given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("127.0.0.1:20886")); ProviderModel providerModel = new ProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", new DemoServiceImpl(), DemoService.class); ApplicationModel.initProviderModel("org.apache.dubbo.rpc.protocol.dubbo.support.DemoService", providerModel); String result = invoke.telnet(mockChannel, "echo(\"ok\")"); assertTrue(result.contains("result: \"ok\"")); }

Target:
public void testInvokeWithSpecifyService() throws RemotingException { mockChannel = mock(Channel.class); given(mockChannel.getAttribute("telnet.service")).willReturn(null); given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("127.0.0.1:5555")); given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("127.0.0.1:20886")); ProviderModel providerModel = new ProviderModel(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class); ApplicationModel.initProviderModel(DemoService.class.getName(), providerModel); String result = invoke.telnet(mockChannel, "DemoService.echo(\"ok\")"); assertTrue(result.contains("result: \"ok\"")); }
Source:
public void end(int responseCode, Throwable throwable, Context context) { Optional<Object> spanOptional = context.getData(OPENTELEMETRY_SPAN_KEY); if (!spanOptional.isPresent()) { logger.warning("Failed to find span to end it."); return; } Span span = (Span) spanOptional.get(); if (span.getOptions().contains(Options.RECORD_EVENTS)) { span.setStatus(HttpTraceUtil.parseResponseStatus(responseCode, throwable)); } span.end(); }

Target:
public void end(int responseCode, Throwable throwable, Context context) { final Span span = getSpan(context); if (span == null) { return; } if (span.getOptions().contains(Options.RECORD_EVENTS)) { span.setStatus(HttpTraceUtil.parseResponseStatus(responseCode, throwable)); } span.end(); }
Source:
public Downloadable createDownloadable() { if (getId().equals("hudson.tasks.Maven.MavenInstaller") || getId().equals("hudson.tasks.Ant.AntInstaller")) { return new Downloadable(getId()) { @Override public JSONObject reduce(List<JSONObject> jsonList) { List<ToolInstallerEntry> reducedToolEntries = new LinkedList<>(); for (JSONObject jsonToolList : jsonList) { ToolInstallerList toolInstallerList = (ToolInstallerList) JSONObject.toBean(jsonToolList, ToolInstallerList.class); reducedToolEntries.addAll(Arrays.asList(toolInstallerList.list)); } while (hasDuplicates(reducedToolEntries, "id")) { List<ToolInstallerEntry> tmpToolInstallerEntries = new LinkedList<>(); boolean processed[] = new boolean[reducedToolEntries.size()]; for (int i = 0; i < reducedToolEntries.size(); i++) { if (processed[i] == true) { continue; } ToolInstallerEntry data1 = reducedToolEntries.get(i); boolean hasDuplicate = false; for (int j = i + 1; j < reducedToolEntries.size(); j++) { ToolInstallerEntry data2 = reducedToolEntries.get(j); if (data1.id.equals(data2.id)) { hasDuplicate = true; processed[j] = true; tmpToolInstallerEntries.add(data1); break; } } if (!hasDuplicate) { tmpToolInstallerEntries.add(data1); } } reducedToolEntries = tmpToolInstallerEntries; } ToolInstallerList toolInstallerList = new ToolInstallerList(); toolInstallerList.list = new ToolInstallerEntry[reducedToolEntries.size()]; reducedToolEntries.toArray(toolInstallerList.list); JSONObject reducedToolEntriesJsonList = JSONObject.fromObject(toolInstallerList); return reducedToolEntriesJsonList; } }; } return new Downloadable(getId()); }

Target:
public Downloadable createDownloadable() { if (this instanceof DownloadFromUrlInstaller.DescriptorImpl) { final DownloadFromUrlInstaller.DescriptorImpl delegate = (DownloadFromUrlInstaller.DescriptorImpl)this; return new Downloadable(getId()) { public JSONObject reduce(List<JSONObject> jsonList) { if (isDefualtSchema(jsonList)) { return delegate.reduce(jsonList); } else { return super.reduce(jsonList); } } }; } return new Downloadable(getId()); }
Source:
public void getFileAsString_shouldReturnTheStringContainedInFile() { try { String separator = FileSystems.getDefault().getSeparator(); File file = new File(System.getProperty("user.dir") + separator + "file"); file.createNewFile(); PrintWriter writer = new PrintWriter(file); String output = "The first line" + "\n" + "The second line"; writer.println("The first line"); writer.print("The second line"); writer.close(); assertTrue(output.equals(OpenmrsUtil.getFileAsString(file))); file.delete(); } catch (Exception e) { } }

Target:
public void getFileAsString_shouldReturnTheStringContainedInFile() { try { File file = createFileInUserDirectory("file"); file.createNewFile(); PrintWriter writer = new PrintWriter(file); String output = "The first line" + "\n" + "The second line"; writer.println("The first line"); writer.print("The second line"); writer.close(); assertTrue(output.equals(OpenmrsUtil.getFileAsString(file))); file.delete(); } catch (IOException e) }
Source:
public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new DaoModule().configure(container); assertThat(container.size()).isEqualTo(2 + 50); }

Target:
public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new DaoModule().configure(container); assertThat(container.size()).isEqualTo(ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 50); }
Source:
public static void main(String[] args) throws Exception { PushGateway pg = new PushGateway(args[0], args[1]); g.set(42); pg.push(pushRegistry, "job"); }

Target:
public static void main(String[] args) throws Exception { PushGateway pg = new PushGateway(args[0]); g.set(42); pg.push(pushRegistry, "job"); }
Source:
void setManagedConnection(final BaseWrapperManagedConnection mc) { this.mc = mc; if (mc != null) { trackStatements = mc.getTrackStatements(); assert lockCount == 0; if (lockCount > 0) { throw new IllegalStateException("Connection is still in use by another thread"); } } else { closed = true; } }

Target:
void setManagedConnection(final BaseWrapperManagedConnection mc) { this.mc = mc; if (mc != null) { trackStatements = mc.getTrackStatements(); if (lockCount > 0) { throw new IllegalStateException(bundle.wrappedConnectionInUse()); } } else { closed = true; } }
Source:
private static ModulePropertyDetails createProperties(DetailNode nodeLi) { final ModulePropertyDetails modulePropertyDetails = new ModulePropertyDetails(); final DetailNode propertyNameTag = getFirstChildOfType(nodeLi, JavadocTokenTypes.JAVADOC_INLINE_TAG, 0); final DetailNode propertyType = getFirstChildOfMatchingText(nodeLi, TYPE_TAG); final String propertyDesc = DESC_CLEAN.matcher( constructSubTreeText(nodeLi, propertyNameTag.getIndex() + 1, propertyType.getIndex() - 1)) .replaceAll(Matcher.quoteReplacement("")); modulePropertyDetails.setDescription(propertyDesc.trim()); modulePropertyDetails.setName(getTextFromTag(propertyNameTag)); modulePropertyDetails.setType( getTagTextFromProperty(nodeLi, getFirstChildOfMatchingText(nodeLi, TYPE_TAG))); final DetailNode validationTypeNode = getFirstChildOfMatchingText(nodeLi, VALIDATION_TYPE_TAG); if (validationTypeNode != null) { modulePropertyDetails.setValidationType(getTagTextFromProperty(nodeLi, validationTypeNode)); } final String defaultValue = getPropertyDefaultText(nodeLi); if (!"null".equals(defaultValue) && !"the charset property of the parent".equals(defaultValue)) { modulePropertyDetails.setDefaultValue(defaultValue); } return modulePropertyDetails; }

Target:
private static ModulePropertyDetails createProperties(DetailNode nodeLi) { final ModulePropertyDetails modulePropertyDetails = new ModulePropertyDetails(); final Optional<DetailNode> propertyNameNode = getFirstChildOfType(nodeLi, JavadocTokenTypes.JAVADOC_INLINE_TAG, 0); DetailNode propertyNameTag = null; if (propertyNameNode.isPresent()) { propertyNameTag = propertyNameNode.get(); } final Optional<DetailNode> propertyTypeNode = getFirstChildOfMatchingText(nodeLi, TYPE_TAG); DetailNode propertyType = null; if (propertyTypeNode.isPresent()) { propertyType = propertyTypeNode.get(); } final String propertyDesc = DESC_CLEAN.matcher( constructSubTreeText(nodeLi, propertyNameTag.getIndex() + 1, propertyType.getIndex() - 1)) .replaceAll(Matcher.quoteReplacement("")); modulePropertyDetails.setDescription(propertyDesc.trim()); modulePropertyDetails.setName(getTextFromTag(propertyNameTag)); final Optional<DetailNode> typeNode = getFirstChildOfMatchingText(nodeLi, TYPE_TAG); if (typeNode.isPresent()) { modulePropertyDetails.setType(getTagTextFromProperty(nodeLi, typeNode.get())); } final Optional<DetailNode> validationTypeNodeOpt = getFirstChildOfMatchingText(nodeLi, VALIDATION_TYPE_TAG); DetailNode validationTypeNode = null; if (validationTypeNodeOpt.isPresent()) { validationTypeNode = validationTypeNodeOpt.get(); } if (validationTypeNode != null) { modulePropertyDetails.setValidationType(getTagTextFromProperty(nodeLi, validationTypeNode)); } final String defaultValue = getPropertyDefaultText(nodeLi); if (!PROPERTIES_TO_NOT_WRITE.contains(defaultValue)) { modulePropertyDetails.setDefaultValue(defaultValue); } return modulePropertyDetails; }
Source:
public void testResolveFragmentWithDistro() throws Exception { File f = IO.getFile("testdata/repo9/fragment.bndrun"); File index = IO.getFile("testdata/repo9/index.xml"); File distro = IO.getFile("testdata/release.dxp.distro-7.2.10.jar"); try (Run run = Run.createRun(null, f)) { run.setProperty("-distro", distro.getAbsolutePath() + ";version=file;x-whitelist=osgi.wiring.host"); BndrunResolveContext context = new BndrunResolveContext(run, run, run.getWorkspace(), log); context.setLevel(0); context.init(); RunResolution resolution = RunResolution.resolve(run, null); if (!resolution.isOK()) { fail("should NOT have failed because 'osgi.wiring.host' capablities are added to the system resource"); } Map<Resource, List<Wire>> runbundles = resolution.getRequired(); assertEquals(1, runbundles.size()); Resource resource = runbundles.entrySet() .iterator() .next() .getKey(); List<Capability> capabilities = resource.getCapabilities("osgi.identity"); assertEquals(1, capabilities.size()); assertEquals("com.liferay.osb.community.blogs.web.fragment", capabilities.get(0) .getAttributes() .get("osgi.identity")); } }

Target:
public void testResolveFragmentWithDistro() throws Exception { File f = IO.getFile("testdata/repo9/fragment.bndrun"); File distro = IO.getFile("testdata/release.dxp.distro-7.2.10.jar"); try (Run run = Run.createRun(null, f)) { run.setProperty("-distro", distro.getAbsolutePath() + ";version=file;x-whitelist=osgi.wiring.host"); BndrunResolveContext context = new BndrunResolveContext(run, run, run.getWorkspace(), log); context.setLevel(0); context.init(); RunResolution resolution = RunResolution.resolve(run, null); if (!resolution.isOK()) { fail("should NOT have failed because 'osgi.wiring.host' capablities are added to the system resource"); } Map<Resource, List<Wire>> runbundles = resolution.getRequired(); assertEquals(1, runbundles.size()); Resource resource = runbundles.entrySet() .iterator() .next() .getKey(); List<Capability> capabilities = resource.getCapabilities("osgi.identity"); assertEquals(1, capabilities.size()); assertEquals("com.liferay.osb.community.blogs.web.fragment", capabilities.get(0) .getAttributes() .get("osgi.identity")); } }
Source:
protected final void registerObserve(final Request request) { if (!request.getOptions().hasBlock2() || request.getOptions().getBlock2().getNum() == 0) { LOG.debug("registering observe request {}", request); Token token = request.getToken(); if (token == null) { do { token = tokenGenerator.createToken(request); request.setToken(token); } while (observationStore.putIfAbsent(token, new Observation(request, null)) != null); } else { observationStore.put(token, new Observation(request, null)); } request.addMessageObserver(new MessageObserverAdapter() { @Override public void onCancel() { failed(); } @Override protected void failed() { observationStore.remove(request.getToken()); } }); } }

Target:
protected final void registerObserve(final Request request) { if (!request.getOptions().hasBlock2() || request.getOptions().getBlock2().getNum() == 0) { LOG.debug("registering observe request {}", request); Token token = request.getToken(); if (token == null) { do { token = tokenGenerator.createToken(true); request.setToken(token); } while (observationStore.putIfAbsent(token, new Observation(request, null)) != null); } else { observationStore.put(token, new Observation(request, null)); } request.addMessageObserver(new MessageObserverAdapter() { @Override public void onCancel() { failed(); } @Override protected void failed() { observationStore.remove(request.getToken()); } }); } }
Source:
private void broadcastExcept(String noteId, Message m, NotebookSocket exclude) { synchronized (noteSocketMap) { List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } LOG.debug("SEND >> " + m.op); broadcastToWatchers(noteId, StringUtils.EMPTY, m); for (NotebookSocket conn : socketLists) { if (exclude.equals(conn)) { continue; } try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } } }

Target:
private void broadcastExcept(String noteId, Message m, NotebookSocket exclude) { synchronized (noteSocketMap) { broadcastToWatchers(noteId, StringUtils.EMPTY, m); List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } LOG.debug("SEND >> " + m.op); for (NotebookSocket conn : socketLists) { if (exclude.equals(conn)) { continue; } try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } } }
Source:
public void registerConsumers(int numConsumers) { if (registered.get()) { if (isDebug) log.info("Master thread locks at RC"); while (registered.get()) { LockSupport.parkNanos(100L); } if (isDebug) log.info("Master thread unlocks at RC"); } if (externalSource != null && externalSource instanceof Registerable) ((Registerable) externalSource).registerConsumers(numConsumers); currentConsumers.set(numConsumers); registered.set(true); }

Target:
public void registerConsumers(int numConsumers) { if (registered.get()) { if (isDebug) log.info("Master thread locks at RC"); while (registered.get()) { LockSupport.parkNanos(100L); if (throwable.isTriggered()) throw new RuntimeException(throwable.get()); } if (isDebug) log.info("Master thread unlocks at RC"); } if (externalSource != null && externalSource instanceof Registerable) ((Registerable) externalSource).registerConsumers(numConsumers); currentConsumers.set(numConsumers); registered.set(true); }
Source:
public Object deserializeWithType(JsonParser jp, DeserializationContext cxt, TypeDeserializer tDeserializer) throws IOException { JsonNode currentJsonNode = mapper.readTree(jp); final Class<?> tClass = this.defaultDeserializer.handledType(); for (Class<?> c : TypeUtil.getAllClasses(tClass)) { if (c.isAssignableFrom(Object.class)) { continue; } else { final JsonTypeInfo typeInfo = c.getAnnotation(com.fasterxml.jackson.annotation.JsonTypeInfo.class); if (typeInfo != null) { String typeId = typeInfo.property(); if (containsDot(typeId)) { final String typeIdOnWire = unescapeEscapedDots(typeId); JsonNode typeIdValue = ((ObjectNode) currentJsonNode).remove(typeIdOnWire); if (typeIdValue != null) { ((ObjectNode) currentJsonNode).put(typeId, typeIdValue); } } } } } return tDeserializer.deserializeTypedFromAny(newJsonParserForNode(currentJsonNode), cxt); }

Target:
public Object deserializeWithType(JsonParser jp, DeserializationContext cxt, TypeDeserializer tDeserializer) throws IOException { JsonNode currentJsonNode = mapper.readTree(jp); final Class<?> tClass = this.defaultDeserializer.handledType(); for (Class<?> c : TypeUtil.getAllClasses(tClass)) { final JsonTypeInfo typeInfo = c.getAnnotation(com.fasterxml.jackson.annotation.JsonTypeInfo.class); if (typeInfo != null) { String typeId = typeInfo.property(); if (containsDot(typeId)) { final String typeIdOnWire = unescapeEscapedDots(typeId); JsonNode typeIdValue = ((ObjectNode) currentJsonNode).remove(typeIdOnWire); if (typeIdValue != null) { ((ObjectNode) currentJsonNode).put(typeId, typeIdValue); } } } } return tDeserializer.deserializeTypedFromAny(newJsonParserForNode(currentJsonNode), cxt); }
Source:
public void add(Storable storable) throws AlreadyExistsException { log.debug("Adding storable [{}]", storable); try { queryExecutor.insert(storable); } catch (StorageException ex) { if (ex.getCause() instanceof SQLIntegrityConstraintViolationException) { throw new AlreadyExistsException("Another instance with same id = " + storable.getPrimaryKey() + " exists with different value in namespace " + storable.getNameSpace() + ". Consider using addOrUpdate method if you always want to overwrite."); } throw ex; } }

Target:
public void add(Storable storable) throws AlreadyExistsException { log.debug("Adding storable [{}]", storable); queryExecutor.insert(storable); }
Source:
public void fromJSON_getProjectId() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addServiceAccount(SA_CLIENT_EMAIL, ACCESS_TOKEN); GenericJson json = writeServiceAccountJson( SA_CLIENT_ID, SA_CLIENT_EMAIL, SA_PRIVATE_KEY_PKCS8, SA_PRIVATE_KEY_ID, PROJECT_ID, null); ServiceAccountCredentials credentials = ServiceAccountCredentials.fromJson(json, transportFactory); assertEquals(PROJECT_ID, credentials.getProjectId()); }

Target:
public void fromJSON_getProjectId() throws IOException { MockTokenServerTransportFactory transportFactory = new MockTokenServerTransportFactory(); transportFactory.transport.addServiceAccount(CLIENT_EMAIL, ACCESS_TOKEN); GenericJson json = writeServiceAccountJson( CLIENT_ID, CLIENT_EMAIL, PRIVATE_KEY_PKCS8, PRIVATE_KEY_ID, PROJECT_ID, null); ServiceAccountCredentials credentials = ServiceAccountCredentials.fromJson(json, transportFactory); assertEquals(PROJECT_ID, credentials.getProjectId()); }
Source:
private void checkExecutableElement(ExecutableElement e, List<ExecutableElement> modelMethods, List<ExecutableElement> staticModelMethods) { Set<Modifier> modifiers = e.getModifiers(); if (e.getKind() == ElementKind.CONSTRUCTOR) { return; } if (!modifiers.contains(Modifier.STATIC)) { pluginEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "Model spec objects should never be instantiated, so non-static methods are meaningless. " + "Did you mean to make this a static method?", e); return; } ModelMethod methodAnnotation = e.getAnnotation(ModelMethod.class); if (methodAnnotation == null) { if (modifiers.contains(Modifier.PUBLIC)) { staticModelMethods.add(e); } else if (!modifiers.contains(Modifier.PRIVATE)) { pluginEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "This method will not be added to the model definition. " + "Did you mean to annotate this method with @ModelMethod?", e); } } else { List<? extends VariableElement> params = e.getParameters(); if (params.size() == 0) { modelSpec.logError("@ModelMethod methods must have an abstract model as their first argument", e); } else { VariableElement firstParam = params.get(0); TypeMirror paramType = firstParam.asType(); if (!checkFirstArgType(paramType)) { modelSpec.logError("@ModelMethod methods must have either this model class or an appropriate model " + "superclass as their first argument", e); } else { modelMethods.add(e); } } } }

Target:
private void checkExecutableElement(ExecutableElement e, List<ExecutableElement> modelMethods, List<ExecutableElement> staticModelMethods) { Set<Modifier> modifiers = e.getModifiers(); if (e.getKind() == ElementKind.CONSTRUCTOR) { return; } if (!modifiers.contains(Modifier.STATIC)) { pluginEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "Model spec objects should never be instantiated, so non-static methods are meaningless. " + "Did you mean to make this a static method?", e); return; } ModelMethod methodAnnotation = e.getAnnotation(ModelMethod.class); if (methodAnnotation == null) { if (modifiers.contains(Modifier.PUBLIC)) { staticModelMethods.add(e); } else if (!modifiers.contains(Modifier.PRIVATE)) { pluginEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "This method will not be added to the model definition. " + "Did you mean to annotate this method with @ModelMethod?", e); } } else { List<? extends VariableElement> params = e.getParameters(); String firstArgError = "@ModelMethod methods must have either this model class or an appropriate model " + "superclass as their first argument"; if (params.size() == 0) { modelSpec.logError(firstArgError, e); } else { VariableElement firstParam = params.get(0); TypeMirror paramType = firstParam.asType(); if (!checkFirstArgType(paramType)) { modelSpec.logError(firstArgError, e); } else { modelMethods.add(e); } } } }
Source:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher(dimension, new Predicate<String>() { @Override public boolean apply(String input) { return value.equals(fn.apply(Strings.emptyToNull(input))); } }); }

Target:
public ValueMatcher makeMatcher(ValueMatcherFactory factory) { return factory.makeValueMatcher( dimension, new Predicate<String>() { @Override public boolean apply(String input) { return value.equals(Strings.nullToEmpty(fn.apply(Strings.emptyToNull(input)))); } } ); }
Source:
public ItemWire(String id) { super(id); }

Target:
public ItemWire(String id) { super(id); setHasSubtypes(true); }
Source:
public void clearOnNonRedundantPartitionRegionWithConcurrentPutGetRemoveShouldFailWhenNonCoordinatorMembersAreBounced( TestVM coordinatorVM) throws InterruptedException { final int entries = 7500; final int workSeconds = 45; parametrizedSetup(RegionShortcut.PARTITION); registerVMKillerAsCacheWriter(Collections.singletonList(server2)); populateRegion(accessor, entries, asList(accessor, server1, server2)); List<AsyncInvocation<Void>> asyncInvocationList = Arrays.asList( server1.invokeAsync(() -> executeGets(entries, workSeconds)), server1.invokeAsync(() -> executePuts(entries, workSeconds)), accessor.invokeAsync(() -> executeGets(entries, workSeconds)), accessor.invokeAsync(() -> executeRemoves(entries, workSeconds))); getVM(coordinatorVM.vmNumber).invoke(() -> { assertThatThrownBy(() -> cacheRule.getCache().getRegion(REGION_NAME).clear()) .isInstanceOf(PartitionedRegionPartialClearException.class) .hasMessage("Unable to clear all the buckets from the partitioned region " + REGION_NAME + ", either data (buckets) moved or member departed."); }); for (AsyncInvocation<Void> asyncInvocation : asyncInvocationList) { asyncInvocation.await(); } }

Target:
public void clearOnNonRedundantPartitionRegionWithConcurrentPutGetRemoveShouldFailWhenNonCoordinatorMembersAreBounced( TestVM coordinatorVM) throws InterruptedException { final int entries = 7500; final int workMillis = 30000; parametrizedSetup(RegionShortcut.PARTITION); populateRegion(accessor, entries, asList(accessor, server1, server2)); server2.invoke(() -> DistributionMessageObserver.setInstance(new MemberKiller(false))); List<AsyncInvocation<Void>> asyncInvocationList = Arrays.asList( server1.invokeAsync(() -> executeGets(entries, workMillis)), server1.invokeAsync(() -> executePuts(entries, workMillis)), accessor.invokeAsync(() -> executeGets(entries, workMillis)), accessor.invokeAsync(() -> executeRemoves(entries, workMillis))); getVM(coordinatorVM.vmNumber).invoke(() -> { assertThatThrownBy(() -> cacheRule.getCache().getRegion(REGION_NAME).clear()) .isInstanceOf(PartitionedRegionPartialClearException.class); }); for (AsyncInvocation<Void> asyncInvocation : asyncInvocationList) { asyncInvocation.await(); } }
Source:
public void enableRecovery(@Observes @Initialized(ApplicationScoped.class) Object init ) { if (lraRecoveryModule == null) { lraRecoveryModule = new LRARecoveryModule(); lraRecoveryModule.getRecoveringLRAs(recoveringLRAs); RecoveryManager.manager().addModule(lraRecoveryModule); Implementations.install(); } RecoveryManager.manager().scan(); }

Target:
void enableRecovery(@Observes @Initialized(ApplicationScoped.class) Object init) { assert lraRecoveryModule == null; System.out.printf("LRA recovery is enabled%n"); lraRecoveryModule = new LRARecoveryModule(this); RecoveryManager.manager().addModule(lraRecoveryModule); Implementations.install(); lraRecoveryModule.getRecoveringLRAs(recoveringLRAs); for (Transaction transaction : recoveringLRAs.values()) transaction.getRecoveryCoordinatorUrls(participants); }
Source:
public void emptyLine() { String html = parseToHtml(" "); assertEquals(html, ""); }

Target:
public void emptyLine() { String html = parseToHtml(" "); assertEquals("", html); }
Source:
protected void generateNode(BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { nodeCu.addImport(CloneVisitor.class); MethodDeclaration cloneMethod = (MethodDeclaration) parseBodyDeclaration(f( "@Override public %s clone() { return (%s) this.accept(new CloneVisitor(), null); }", nodeMetaModel.getTypeNameGenerified(), nodeMetaModel.getTypeNameGenerified() )); this.addOrReplaceWhenSameSignature(nodeCoid, cloneMethod); }

Target:
protected void generateNode(BaseNodeMetaModel nodeMetaModel, CompilationUnit nodeCu, ClassOrInterfaceDeclaration nodeCoid) { nodeCu.addImport(CloneVisitor.class); MethodDeclaration cloneMethod = (MethodDeclaration) parseBodyDeclaration(f( "@Override public %s clone() { return (%s) accept(new CloneVisitor(), null); }", nodeMetaModel.getTypeNameGenerified(), nodeMetaModel.getTypeNameGenerified() )); addOrReplaceWhenSameSignature(nodeCoid, cloneMethod); }
Source:
public void initGui() { this.maxRows = this.getMaxRows(); final int magicNumber = ITEMSTACK_TOP_OFFSET + CPU_TOP_OFFSET; final int extraSpace = this.height - magicNumber; this.rows = (int) Math.floor( extraSpace / SECTION_HEIGHT ); if( this.rows > this.maxRows ) { this.rows = this.maxRows; } if( this.rows < 5 ) { this.rows = 5; } super.initGui(); this.setScrollBar(); this.ySize = magicNumber + this.rows * SECTION_HEIGHT; final int unusedSpace = this.height - this.ySize; this.guiTop = (int) Math.floor( unusedSpace / ( unusedSpace < 0 ? 3.8f : 2.0f ) ); int offset = this.guiTop + 8; this.setScrollBar(); this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() ); this.start.enabled = false; this.buttonList.add( this.start ); this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - CPU_TOP_OFFSET, 180, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic ); this.selectCPU.enabled = false; this.buttonList.add( this.selectCPU ); if( this.OriginalGui != null ) { this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() ); } this.buttonList.add( this.cancel ); this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) ); this.buttonList.add( this.terminalStyleBox ); }

Target:
public void initGui() { final int staticSpace = ITEMSTACK_TOP_OFFSET + CPU_TOP_OFFSET; calculateRows( staticSpace ); super.initGui(); this.ySize = staticSpace + this.rows * SECTION_HEIGHT; final int unusedSpace = this.height - this.ySize; this.guiTop = (int) Math.floor( unusedSpace / ( unusedSpace < 0 ? 3.8f : 2.0f ) ); int offset = this.guiTop + 8; this.setScrollBar(); this.start = new GuiButton( 0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal() ); this.start.enabled = false; this.buttonList.add( this.start ); this.selectCPU = new GuiButton( 0, this.guiLeft + ( 219 - 180 ) / 2, this.guiTop + this.ySize - CPU_TOP_OFFSET, 180, 20, GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic ); this.selectCPU.enabled = false; this.buttonList.add( this.selectCPU ); if( this.OriginalGui != null ) { this.cancel = new GuiButton( 0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal() ); } this.buttonList.add( this.cancel ); this.terminalStyleBox = new GuiImgButton( this.guiLeft - 18, offset, Settings.TERMINAL_STYLE, AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) ); this.buttonList.add( this.terminalStyleBox ); }
Source:
public Constant(Sort sort, String value) { super(sort, null); this.value = value; }

Target:
public Constant(Sort sort, String value) { super(sort, null); assert value != null; this.value = value; }
Source:
public Map<String, String> getSettings() { if (pluginRegistryUrl == null) { return ImmutableMap.of( Constants.SUPPORTED_RECIPE_TYPES, Joiner.on(",").join(workspaceManager.getSupportedRecipes()), CHE_WORKSPACE_AUTO_START, Boolean.toString(cheWorkspaceAutoStart)); } else { return ImmutableMap.of( Constants.SUPPORTED_RECIPE_TYPES, Joiner.on(",").join(workspaceManager.getSupportedRecipes()), CHE_WORKSPACE_AUTO_START, Boolean.toString(cheWorkspaceAutoStart), CHE_WORKSPACE_PLUGIN_REGISTRY_ULR, pluginRegistryUrl); } }

Target:
public Map<String, String> getSettings() { Builder<String, String> settings = ImmutableMap.builder(); settings.put( Constants.SUPPORTED_RECIPE_TYPES, Joiner.on(",").join(workspaceManager.getSupportedRecipes())); settings.put(CHE_WORKSPACE_AUTO_START, Boolean.toString(cheWorkspaceAutoStart)); if (pluginRegistryUrl != null) { settings.put(CHE_WORKSPACE_PLUGIN_REGISTRY_ULR, pluginRegistryUrl); } return settings.build(); }