auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void configureWebResources(GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) { ApplicationContext parent = context.getParent(); if ((!(parent instanceof WebApplicationContext))) { String resourceBasePath = webMergedConfig.getResourceBasePath(); ResourceLoader resourceLoader = (resourceBasePath.startsWith(ResourceLoader.CLASSPATH_URL_PREFIX) ? new DefaultResourceLoader() : new FileSystemResourceLoader()); ServletContext servletContext = new MockServletContext(resourceBasePath, resourceLoader); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); context.setServletContext(servletContext); } else { ServletContext servletContext = null; while (parent != null) { if (parent instanceof WebApplicationContext && !(parent.getParent() instanceof WebApplicationContext)) { servletContext = ((WebApplicationContext) parent).getServletContext(); break; } parent = parent.getParent(); } Assert.state(servletContext != null, "Failed to find root WebApplicationContext in the context hierarchy"); context.setServletContext(servletContext); } }

Target:
protected void configureWebResources(GenericWebApplicationContext context, WebMergedContextConfiguration webMergedConfig) { ApplicationContext parent = context.getParent(); if (!(parent instanceof WebApplicationContext)) { String resourceBasePath = webMergedConfig.getResourceBasePath(); ResourceLoader resourceLoader = (resourceBasePath.startsWith(ResourceLoader.CLASSPATH_URL_PREFIX) ? new DefaultResourceLoader() : new FileSystemResourceLoader()); ServletContext servletContext = new MockServletContext(resourceBasePath, resourceLoader); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); context.setServletContext(servletContext); } else { ServletContext servletContext = null; while (parent != null) { if (parent instanceof WebApplicationContext && !(parent.getParent() instanceof WebApplicationContext)) { servletContext = ((WebApplicationContext) parent).getServletContext(); break; } parent = parent.getParent(); } Assert.state(servletContext != null, "Failed to find root WebApplicationContext in the context hierarchy"); context.setServletContext(servletContext); } }
Source:
private void setDefaultDateFormatterBuilder() { if (dateFormatterBuilder == null) { String tzStr = config.getString("gitiles", null, "fixedTimeZone"); Optional<TimeZone> tz; if (tzStr == null) { tz = Optional.absent(); } else if (tzStr.equalsIgnoreCase("default")) { tz = Optional.of(SystemReader.getInstance().getTimeZone()); } else { tz = Optional.of(TimeZone.getTimeZone(tzStr)); } dateFormatterBuilder = new DateFormatterBuilder(tz); } }

Target:
private void setDefaultDateFormatterBuilder() { if (dateFormatterBuilder == null) { String tzStr = config.getString("gitiles", null, "fixedTimeZone"); Optional<TimeZone> tz; if (tzStr == null) { tz = Optional.absent(); } else { tz = Optional.of(TimeZone.getTimeZone(tzStr)); } dateFormatterBuilder = new DateFormatterBuilder(tz); } }
Source:
public void processVirtualAttributeChanged(String msg, MessageBeans beans) { if (beans.getUser() == null || beans.getAttribute() == null || beans.getResource() == null) { return; } try { log.debug("Getting resources assigned to facility {}", beans.getFacility().getId()); List<Resource> resources = ldapcManager.getPerunBl().getFacilitiesManager().getAssignedResources(ldapcManager.getPerunSession(), beans.getFacility()); Attribute virtAttr = ((PerunBl) ldapcManager.getPerunBl()).getAttributesManagerBl(). getAttribute(ldapcManager.getPerunSession(), beans.getUser(), beans.getAttribute().getName()); for (Resource resource : resources) { log.debug("Changing virtual attribute for resource {}", beans.getAttribute(), resource); perunResource.modifyEntry(resource, virtAttr); } } catch (InternalErrorException | AttributeNotExistsException | WrongAttributeAssignmentException | FacilityNotExistsException | PrivilegeException | NamingException e) { log.error("Error changing virtual attribute:", e); } }

Target:
public void processVirtualAttributeChanged(String msg, MessageBeans beans) { PerunBl perun = (PerunBl) ldapcManager.getPerunBl(); if (beans.getAttribute() == null || beans.getFacility() == null) { return; } try { log.debug("Getting resources assigned to facility {}", beans.getFacility().getId()); List<Resource> resources = perun.getFacilitiesManagerBl().getAssignedResources(ldapcManager.getPerunSession(), beans.getFacility()); Attribute virtAttr = perun.getAttributesManagerBl(). getAttribute(ldapcManager.getPerunSession(), beans.getFacility(), beans.getAttribute().getName()); log.debug("Changing virtual attribute for facility {}", virtAttr, beans.getFacility()); perunFacility.modifyEntry(beans.getFacility(), virtAttr); for (Resource resource : resources) { log.debug("Changing virtual attribute for resource {}", virtAttr, resource); perunResource.modifyEntry(resource, virtAttr); } } catch (InternalErrorException | AttributeNotExistsException | WrongAttributeAssignmentException | NamingException e) { log.error("Error changing virtual attribute:", e); } }
Source:
public boolean remove(Connection connection) { boolean removed = connectionPool.remove(connection); if (getHttpExchanges().isEmpty()) { tryRemoveIdleDestination(); } else { if (removed) process(true); } return connectionPool.remove(connection); }

Target:
public boolean remove(Connection connection) { boolean removed = connectionPool.remove(connection); if (getHttpExchanges().isEmpty()) { tryRemoveIdleDestination(); } else if (removed) { process(true); } return removed; }
Source:
public void cancelInput() { if (aliquotHandlingSteps.stream().anyMatch(this::hasInput)) { getLastCompletedAliquotHandlingStep().cancelInput(); } else if (hasInput(boxStep)) { boxStep.cancelInput(); } else if (hasInput(aliquotStep)) { aliquotStep.cancelInput(); } else if (hasInput(qcStep)) { qcStep.cancelInput(); } else if (hasInput(sampleStep)) { sampleStep.cancelInput(); } }

Target:
public void cancelInput() { if (aliquotHandlingSteps.stream().anyMatch(this::hasInput)) { getLastCompletedAliquotHandlingStep().cancelInput(); } else if (hasInput(aliquotBoxStep)) { aliquotBoxStep.cancelInput(); } else if (hasInput(aliquotStep)) { aliquotStep.cancelInput(); } else if (hasInput(stockBoxPositionStep)) { stockBoxPositionStep.cancelInput(); } else if (hasInput(stockBoxStep)) { stockBoxStep.cancelInput(); } else if (hasInput(qcStep)) { qcStep.cancelInput(); } else if (hasInput(stockStep)) { stockStep.cancelInput(); } }
Source:
public Uri insertTestRaw() { ContentValues values = new ContentValues(); values.put("address", "+19998880002"); values.put("display_originating_addr", "+1234567890"); values.put("count", 1); values.put("message_body", TEST_RAW_MESSAGE_BODY); return mContentResolver.insert(RAW_URI, values); }

Target:
public Uri insertTestRaw() { ContentValues values = new ContentValues(); values.put(Telephony.Raw.ADDRESS, "1234567890"); values.put(Telephony.Raw.DISPLAY_ORIGINATING_ADDRESS, "+1234567890"); values.put(Telephony.Raw.COUNT, 1); values.put(Telephony.Raw.MESSAGE_BODY, TEST_RAW_MESSAGE_BODY); return mContentResolver.insert(RAW_URI, values); }
Source:
public Relationship getByTypeUuidAndPersonUuid(String configName, String typeUuid, String personUuid) { Config config = configService.getConfigByName(configName); RelationshipListResult result = relationshipResource.getByPersonUuid(config, personUuid); List<Relationship> relationships = new ArrayList<>(Collections2.filter(result.getResults(), new Predicate<Relationship>() { @Override public boolean apply(Relationship relationship) { String personBUuid = null; String relationshipTypeUuid = null; if (relationship.getPersonB() != null) { personBUuid = relationship.getPersonB().getUuid(); } if (relationship.getRelationshipType() != null) { relationshipTypeUuid = relationship.getRelationshipType().getUuid(); } return StringUtils.equals(personBUuid, personUuid) && StringUtils.equals(relationshipTypeUuid, typeUuid); } })); if (relationships.size() > 1) { LOGGER.warn(String.format("Multiple relationships found for the type with the \"%s\" UUID and the person" + "with the \"%s\" UUID. The first relationship in the list will be returned", typeUuid, personUuid)); } return relationships.isEmpty() ? null : relationships.get(0); }

Target:
public List<Relationship> getByTypeUuidAndPersonUuid(String configName, String typeUuid, String personUuid) { Config config = configService.getConfigByName(configName); RelationshipListResult result = relationshipResource.getByPersonUuid(config, personUuid); return new ArrayList<>(Collections2.filter(result.getResults(), new Predicate<Relationship>() { @Override public boolean apply(Relationship relationship) { String personBUuid = null; String relationshipTypeUuid = null; if (relationship.getPersonB() != null) { personBUuid = relationship.getPersonB().getUuid(); } if (relationship.getRelationshipType() != null) { relationshipTypeUuid = relationship.getRelationshipType().getUuid(); } return StringUtils.equals(personBUuid, personUuid) && StringUtils.equals(relationshipTypeUuid, typeUuid); } })); }
Source:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); } catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } } }; }

Target:
protected IScalarEvaluator createEvaluator(IHyracksTaskContext ctx, IScalarEvaluator[] args) throws AlgebricksException { final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage(); final UTF8StringPointable stringp = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable(); final TaggedValuePointable nodep = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable(); final ByteBufferInputStream bbis = new ByteBufferInputStream(); final DataInputStream di = new DataInputStream(bbis); final SequenceBuilder sb = new SequenceBuilder(); final ArrayBackedValueStorage abvsFileNode = new ArrayBackedValueStorage(); final int partition = ctx.getTaskAttemptId().getTaskId().getPartition(); final String nodeId = ctx.getJobletContext().getApplicationContext().getNodeId(); final ITreeNodeIdProvider nodeIdProvider = new TreeNodeIdProvider((short) partition); return new AbstractTaggedValueArgumentScalarEvaluator(args) { @Override protected void evaluate(TaggedValuePointable[] args, IPointable result) throws SystemException { IndexUpdater updater = new IndexUpdater(args, result, stringp, bbis, di, sb, abvs, nodeIdProvider, abvsFileNode, nodep, nodeId); try { updater.setup(); updater.deleteAllIndexes(); } catch (IOException | NoSuchAlgorithmException | JAXBException e) { throw new SystemException(ErrorCode.SYSE0001, e); } } }; }
Source:
protected Object readInternal(Class<? extends Object> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { Object result = null; InputStream inputStream = inputMessage.getBody(); try { result = convertStreamToConsoleConnectionDetails(inputStream); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { Log.e(TAG, "failed to close input stream"); } } } return result; }

Target:
protected Object readInternal(Class<? extends Object> clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { Object result = null; InputStream inputStream = inputMessage.getBody(); try { result = convertStreamToConsoleConnectionDetails(inputStream); } catch (Exception x) { throw new IllegalStateException("Couldn't parse .vv file response", x); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { Log.e(TAG, "failed to close input stream"); } } } return result; }
Source:
public void delay(Guid vdsId) { log.debug("try to wait for te engine update the host memory and cpu stats"); try { long t = Math.max( ResourceManager.getInstance().GetVdsManager(vdsId).getLastUpdateElapsed(), TimeUnit.SECONDS.toMillis(Config.<Integer> getValue(VdsRefreshRate))); t = Math.max(Config.<Integer> getValue(ConfigValues.ThrottlerMaxWaitForVdsUpdateInMillis), t); VmHandler.getBlockingQueue(vdsId).poll(t, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { } }

Target:
public void delay(Guid vdsId) { log.debug("try to wait for te engine update the host memory and cpu stats"); try { long t = Math.max( ResourceManager.getInstance().GetVdsManager(vdsId).getLastUpdateElapsed(), TimeUnit.SECONDS.toMillis(Config.<Integer> getValue(VdsRefreshRate))); t = Math.max(Config.<Integer> getValue(ConfigValues.ThrottlerMaxWaitForVdsUpdateInMillis), t); getBlockingQueue(vdsId).poll(t, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { } }
Source:
public GithubProfileScraper() { super(); this.baseUrl = "<LINK_0>"; String scraperName = "Github"; }

Target:
public GithubProfileScraper() { super(); this.baseUrl = "<LINK_0>"; this.scraperName = "Github"; }
Source:
public void testCleanResource() throws Exception { String[] cmdArrayToRecreateDB; if (CarbonCommandToolsUtil.isCurrentOSWindows()) { cmdArrayToRecreateDB = new String[]{"-Dsetup"}; process = CarbonCommandToolsUtil. startServerUsingCarbonHome(carbonHome, 1, context, cmdArrayToRecreateDB); } else { cmdArrayToRecreateDB = new String[]{"-Dsetup"}; process = CarbonCommandToolsUtil. startServerUsingCarbonHome(carbonHome, 1, context, cmdArrayToRecreateDB); } boolean startupStatus = CarbonCommandToolsUtil.isServerStartedUp(context, portOffset); log.info("Server startup status : " + startupStatus); boolean fileCreated = CarbonCommandToolsUtil. waitForFileCreation(carbonHome + File.separator + "repository" + File.separator + "database" + File.separator + "DsetupCommandTEST_DB.h2.db"); Assert.assertTrue(fileCreated, "Java file not created successfully"); String loginStatusString = authenticatorClient.login(); assertTrue(loginStatusString.contains("JSESSIONID"), "Unsuccessful login"); }

Target:
public void testCleanResource() throws Exception { String[] cmdArrayToRecreateDB; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase()))) { cmdArrayToRecreateDB = new String[]{"-Dsetup"}; process = CarbonCommandToolsUtil. startServerUsingCarbonHome(carbonHome, 1, context, cmdArrayToRecreateDB); } else { cmdArrayToRecreateDB = new String[]{"-Dsetup"}; process = CarbonCommandToolsUtil. startServerUsingCarbonHome(carbonHome, 1, context, cmdArrayToRecreateDB); } boolean startupStatus = CarbonCommandToolsUtil.isServerStartedUp(context, portOffset); log.info("Server startup status : " + startupStatus); boolean fileCreated = CarbonCommandToolsUtil. waitForFileCreation(carbonHome + File.separator + "repository" + File.separator + "database" + File.separator + "DsetupCommandTEST_DB.h2.db"); Assert.assertTrue(fileCreated, "Java file not created successfully"); String loginStatusString = authenticatorClient.login(); assertTrue(loginStatusString.contains("JSESSIONID"), "Unsuccessful login"); }
Source:
public Object deserialize(byte[] data) { try { ByteArrayInputStream buffer = new ByteArrayInputStream(data); FSTObjectInput in = fastSerialConfig.getObjectInput(buffer); Object result = in.readObject(); buffer.close(); return result; } catch (IOException e) { throw new Fast2WicketSerialException("deserialize", e); } catch (ClassNotFoundException e) { throw new Fast2WicketSerialException("deserialize", e); } }

Target:
public Object deserialize(byte[] data) { try { return fastSerializationConfig.getObjectInput(data).readObject(); } catch (Exception e) { throw new Fast2WicketSerialException("Unable to deserialize the data", e); } }
Source:
protected void activate(ComponentContext componentContext) { eventHandler = new ThreadedEventHandler(typedEventSubscribers, typedEventFactories, safeCaller); eventSubscriberServiceTracker = new EventSubscriberServiceTracker(componentContext.getBundleContext()); eventSubscriberServiceTracker.open(); }

Target:
protected void activate(ComponentContext componentContext) { eventHandler = new ThreadedEventHandler(typedEventFactories, safeCaller); eventSubscriberServiceTracker = new EventSubscriberServiceTracker(componentContext.getBundleContext()); eventSubscriberServiceTracker.open(); }
Source:
public void removeBindingProvider(BindingProvider provider) { super.removeBindingProvider(provider); logger.debug("removeBindingProvider: " + Arrays.toString(provider.getItemNames().toArray())); for (String itemName: provider.getItemNames()) { unBindGpioPin((MCP23017BindingProvider) provider, itemName); } }

Target:
public void removeBindingProvider(BindingProvider provider) { super.removeBindingProvider(provider); logger.debug("removeBindingProvider: {}", Arrays.toString(provider.getItemNames().toArray())); for (String itemName : provider.getItemNames()) { unBindGpioPin((MCP23017BindingProvider) provider, itemName); } }
Source:
public static <T, E extends Exception> ListenableFuture<T> maybeLogAsync( CallableCheckedException<ListenableFuture<T>, E> action, BiConsumer<LoggingFunction, Stopwatch> primaryLogger, BiConsumer<LoggingFunction, T> additionalLoggerWithAccessToResult) throws E { ListenableFuture<T> future = action.call(); if (log.isTraceEnabled() || slowlogger.isWarnEnabled()) { Monitor<T> monitor = Monitor.createMonitor( primaryLogger, additionalLoggerWithAccessToResult, slowLogPredicate); Futures.addCallback(future, new FutureCallback<T>() { @Override public void onSuccess(T result) { monitor.registerResult(result); monitor.log(); } @Override public void onFailure(Throwable t) { monitor.registerException(new Exception(t)); monitor.log(); } }, MoreExecutors.directExecutor()); } return future; }

Target:
public static <T, E extends Exception> ListenableFuture<T> maybeLogAsync( CallableCheckedException<ListenableFuture<T>, E> action, BiConsumer<LoggingFunction, Stopwatch> primaryLogger, BiConsumer<LoggingFunction, T> additionalLoggerWithAccessToResult) throws E { ListenableFuture<T> future = action.call(); if (log.isTraceEnabled() || slowlogger.isWarnEnabled()) { Monitor<T> monitor = Monitor.createMonitor( primaryLogger, additionalLoggerWithAccessToResult, slowLogPredicate); Futures.addCallback(future, new FutureCallback<T>() { @Override public void onSuccess(@Nullable T result) { monitor.registerResult(result); monitor.log(); } @Override public void onFailure(Throwable t) { monitor.registerException(new Exception(t)); monitor.log(); } }, MoreExecutors.directExecutor()); } return future; }
Source:
public EntitySubnodeDetailAdapter(Context context, Detail detail, List<TreeReference> references, List<Entity<TreeReference>> entities, ListItemViewModifier modifier) { this.context = context; this.detail = detail; this.references = references; this.references = new Vector<>(); this.entities = new Vector<>(); int entityIndex = 0; for (Entity e : entities) { boolean isValid = false; for (int i = 0; i < e.getNumFields(); i++) { if (e.isValidField(i)) { isValid = true; } } if (isValid) { this.entities.add(e); this.references.add(references.get(entityIndex)); } entityIndex++; } }

Target:
public EntitySubnodeDetailAdapter(Context context, Detail detail, List<TreeReference> references, List<Entity<TreeReference>> entities, ListItemViewModifier modifier) { this.context = context; this.detail = detail; this.modifier = modifier; this.initializeData(references, entities); }
Source:
public PublishingEndPoint getEnabledSendingEndPointByAddress(String address) throws DotDataException { ensureCacheIsLoaded(); List<PublishingEndPoint> allEndPoints = getEndPoints(); String ipOrNetMask; boolean match; for(PublishingEndPoint endPoint : allEndPoints) { ipOrNetMask = endPoint.getAddress(); if (ipOrNetMask.contains("/")) { match = new SubnetUtils(ipOrNetMask).getInfo().isInRange(address); } else { match = isMatchingEndpoint(ipOrNetMask, address); } if(match && endPoint.isEnabled() && endPoint.isSending()) return endPoint; } return null; }

Target:
public PublishingEndPoint getEnabledSendingEndPointByAddress(String address) throws DotDataException { ensureCacheIsLoaded(); List<PublishingEndPoint> allEndPoints = getEndPoints(); for(PublishingEndPoint endPoint : allEndPoints) { if (validateAddress(address, endPoint.getAddress(), endPoint)) { return endPoint; } } return null; }
Source:
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { if (vm.getLeaseStorageDomainId() == null) { return hosts; } return hosts.stream() .filter(vds -> { ArrayList<VDSDomainsData> domainsData = resourceManager.getVdsManager(vds.getId()).getDomains(); if (domainsData == null) { log.info("No domain data, skipping host {}", vds.getName()); messages.addMessage(vds.getId(), EngineMessage.ACTION_TYPE_FAILED_VM_LEASE_IS_NOT_READY_FOR_HOST.toString()); return false; } else if (!isVmLeaseReadyForHost(domainsData, vm)) { messages.addMessage(vds.getId(), EngineMessage.ACTION_TYPE_FAILED_VM_LEASE_IS_NOT_READY_FOR_HOST.toString()); return false; } return true; }).collect(Collectors.toList()); }

Target:
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { if (vm.getLeaseStorageDomainId() == null) { return hosts; } return hosts.stream() .filter(vds -> { ArrayList<VDSDomainsData> domainsData = resourceManager.getVdsManager(vds.getId()).getDomains(); if (domainsData == null) { log.debug("No domain data, skipping host {}", vds.getName()); messages.addMessage(vds.getId(), EngineMessage.ACTION_TYPE_FAILED_VM_LEASE_IS_NOT_READY_FOR_HOST.toString()); return false; } else if (!isVmLeaseReadyForHost(domainsData, vm)) { messages.addMessage(vds.getId(), EngineMessage.ACTION_TYPE_FAILED_VM_LEASE_IS_NOT_READY_FOR_HOST.toString()); return false; } return true; }).collect(Collectors.toList()); }
Source:
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("position") && arg.matchesPrefix("position")) { scriptEntry.addObject("position", arg.asType(LocationTag.class)); } else if (!scriptEntry.hasObject("file") && arg.matchesPrefix("file")) { scriptEntry.addObject("file", arg.asElement()); } else if (!scriptEntry.hasObject("cuboid") && arg.matchesPrefix("cuboid")) { scriptEntry.addObject("cuboid", arg.asType(CuboidTag.class)); } else if (!scriptEntry.hasObject("noair") && arg.matches("noair")) { scriptEntry.addObject("noair", new ElementTag(true)); } else if (!scriptEntry.hasObject("undoable") && arg.matches("undoable")) { scriptEntry.addObject("undoable", new ElementTag(true)); } else if (!scriptEntry.hasObject("rotate") && arg.matchesPrefix("rotate")) { scriptEntry.addObject("rotate", arg.asElement()); } else if (!scriptEntry.hasObject("action") && arg.matchesEnum(Action.values())) { scriptEntry.addObject("action", arg.asElement()); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("action")) { throw new InvalidArgumentsException("Action not specified!"); } if (Utilities.entryHasPlayer(scriptEntry)) { scriptEntry.addObject("target", Utilities.getEntryPlayer(scriptEntry)); } }

Target:
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException { for (Argument arg : scriptEntry.getProcessedArgs()) { if (!scriptEntry.hasObject("position") && arg.matchesPrefix("position")) { scriptEntry.addObject("position", arg.asType(LocationTag.class)); } else if (!scriptEntry.hasObject("file") && arg.matchesPrefix("file")) { scriptEntry.addObject("file", arg.asElement()); } else if (!scriptEntry.hasObject("cuboid") && arg.matchesPrefix("cuboid")) { scriptEntry.addObject("cuboid", arg.asType(CuboidTag.class)); } else if (!scriptEntry.hasObject("noair") && arg.matches("noair")) { scriptEntry.addObject("noair", new ElementTag(true)); } else if (!scriptEntry.hasObject("undoable") && arg.matches("undoable")) { scriptEntry.addObject("undoable", new ElementTag(true)); } else if (!scriptEntry.hasObject("rotate") && arg.matchesPrefix("rotate")) { scriptEntry.addObject("rotate", arg.asElement()); } else if (!scriptEntry.hasObject("action") && arg.matchesEnum(Action.values())) { scriptEntry.addObject("action", arg.asElement()); } else { arg.reportUnhandled(); } } if (!scriptEntry.hasObject("action")) { throw new InvalidArgumentsException("Action not specified!"); } }
Source:
private Object readResolve() { if(includeRegex!=null) { try { includePattern = Pattern.compile(includeRegex); } catch (PatternSyntaxException x) { includeRegex = null; OldDataMonitor.report(this, Collections.singleton(x)); } } synchronized(this) { if (jobNames == null) { jobNames = new TreeSet<>(CaseInsensitiveComparator.INSTANCE); } } initColumns(); initJobFilters(); if (statusFilter != null) { jobFilters.add(new StatusFilter(statusFilter)); } return this; }

Target:
private Object readResolve() { if(includeRegex!=null) { try { includePattern = Pattern.compile(includeRegex); } catch (PatternSyntaxException x) { includeRegex = null; OldDataMonitor.report(this, Collections.singleton(x)); } } synchronized(this) { if (jobNames == null) { jobNames = new TreeSet<>(CaseInsensitiveComparator.INSTANCE); } } initColumns(); initJobFilters(); if (statusFilter != null) { jobFilters.add(0, new StatusFilter(statusFilter)); } return this; }
Source:
private final boolean isPasteTriggeredByMiddleClick() { EventData event = history_.findEvent(new JavaScriptEventHistory.Predicate() { @Override public boolean accept(EventData event) { String type = event.getType(); for (String candidate : CANDIDATES) if (type.contentEquals(candidate)) return true; return false; } private final String[] CANDIDATES = new String[] { "mousedown", "click", "mouseup", "keydown", "keypress", "keyup" }; }); if (event == null) return false; String type = event.getType(); return type.equals("mousedown") || type.equals("click") || type.equals("mouseup"); }

Target:
private final boolean isPasteTriggeredByMiddleClick() { EventData event = history_.findEvent(new JavaScriptEventHistory.Predicate() { @Override public boolean accept(EventData event) { String type = event.getType(); for (String candidate : CANDIDATES) if (type.contentEquals(candidate)) return true; return false; } private final String[] CANDIDATES = new String[] { "mousedown", "click", "mouseup", "keydown", "keypress", "keyup" }; }); if (event == null) return false; int button = event.getButton(); if (button != Event.BUTTON_MIDDLE) return false; String type = event.getType(); return type.equals("mousedown") || type.equals("click") || type.equals("mouseup"); }
Source:
public void tracingDisabledUpdatesInstantly() { boolean initialTracingDisabled = Boolean.parseBoolean(Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_TRACING_DISABLED)); System.setProperty(Configuration.PROPERTY_AZURE_TRACING_DISABLED, Boolean.toString(!initialTracingDisabled)); assertNotEquals(initialTracingDisabled, Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_TRACING_DISABLED)); System.setProperty(Configuration.PROPERTY_AZURE_TRACING_DISABLED, Boolean.toString(initialTracingDisabled)); }

Target:
public void tracingDisabledUpdatesInstantly() { boolean initialTracingDisabled = Boolean.parseBoolean(Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_TRACING_DISABLED)); try { System.setProperty(Configuration.PROPERTY_AZURE_TRACING_DISABLED, Boolean.toString(!initialTracingDisabled)); assertNotEquals(initialTracingDisabled, Configuration.getGlobalConfiguration().get(Configuration.PROPERTY_AZURE_TRACING_DISABLED)); } finally { System.setProperty(Configuration.PROPERTY_AZURE_TRACING_DISABLED, Boolean.toString(initialTracingDisabled)); } }
Source:
private static String normalizePath(final String path) { String s = path; if (s == null || "".equals(s)) { return ""; } int n = 0; for (; n < s.length(); n++) { if (s.charAt(n) != '/') { break; } } if (n > 1) { s = s.substring(n - 1); } if (!s.startsWith("/")) { s = "/" + s; } return s; }

Target:
private static String normalizePath(final String path) { String s = path; if (TextUtils.isBlank(s)) { return ""; } int n = 0; for (; n < s.length(); n++) { if (s.charAt(n) != '/') { break; } } if (n > 1) { s = s.substring(n - 1); } if (!s.startsWith("/")) { s = "/" + s; } return s; }
Source:
public boolean isUnifiable(Index index) { return index instanceof TopIndex || equals(index) || (index instanceof KLabelIndex && ((KLabelIndex) index).kLabel().sorts().contains(sort)); }

Target:
public boolean isUnifiable(Index index) { return index instanceof TopIndex || equals(index); }
Source:
private List<StoreKey> deserializeMetadataContent(ByteBuffer metadataContent, StoreKeyFactory storeKeyFactory) throws MessageFormatException, IOException { ByteBufferInputStream byteBufferInputStream = new ByteBufferInputStream(metadataContent); DataInputStream inputStream = new DataInputStream(byteBufferInputStream); short metdataContentVersion = inputStream.readShort(); Assert.assertEquals("Metadata Content Version mismatch ", metdataContentVersion, MessageFormatRecord.Metadata_Content_Version_V1); return MessageFormatRecord.Metadata_Content_Format_V1.deserializeMetadataContentRecord(inputStream, storeKeyFactory); }

Target:
private List<StoreKey> deserializeMetadataContent(ByteBuffer metadataContent, StoreKeyFactory storeKeyFactory) throws MessageFormatException, IOException { ByteBufferInputStream byteBufferInputStream = new ByteBufferInputStream(metadataContent); DataInputStream inputStream = new DataInputStream(byteBufferInputStream); short metdataContentVersion = inputStream.readShort(); Assert.assertEquals("Metadata Content Version mismatch ", MessageFormatRecord.Metadata_Content_Version_V1, metdataContentVersion); return MessageFormatRecord.Metadata_Content_Format_V1 .deserializeMetadataContentRecord(inputStream, storeKeyFactory); }
Source:
void updateData(List<Podcast> result) { this.searchResults = result; adapter.clear(); if (result != null && result.size() > 0) { gridView.setVisibility(View.VISIBLE); txtvEmpty.setVisibility(View.GONE); adapter.addAll(result); adapter.notifyDataSetInvalidated(); } else { gridView.setVisibility(View.GONE); txtvEmpty.setVisibility(View.VISIBLE); } }

Target:
void updateData(List<Podcast> result) { this.searchResults = result; adapter.clear(); if (result != null && result.size() > 0) { gridView.setVisibility(View.VISIBLE); txtvEmpty.setVisibility(View.GONE); for (Podcast p : result) { adapter.add(p); } adapter.notifyDataSetInvalidated(); } else { gridView.setVisibility(View.GONE); txtvEmpty.setVisibility(View.VISIBLE); } }
Source:
public SingleServerAppliance getImage(String id) { logger.trace("<< searching for image with id=%s", id); GenericQueryOptions options = new GenericQueryOptions(); options.options(0, 0, null, id, null); try { List<ServerAppliance> list = api.serverApplianceApi().list(options); if (list.size() > 0) { ServerAppliance appliance = list.get(0); List<SingleServerAppliance.AvailableDataCenters> availableDatacenters = new ArrayList<SingleServerAppliance.AvailableDataCenters>(); for (String dcId : appliance.availableDataCenters()) { availableDatacenters.add(SingleServerAppliance.AvailableDataCenters.create(dcId, "")); } SingleServerAppliance image = SingleServerAppliance.create(appliance.id(), appliance.name(), availableDatacenters, appliance.osInstallationBase(), appliance.osFamily(), appliance.os(), appliance.osVersion(), appliance.osArchitecture(), appliance.osImageType(), appliance.minHddSize(), appliance.type(), appliance.state(), appliance.version(), appliance.categories(), appliance.eulaUrl()); if (image != null) { logger.trace(">> found image [%s].", image.name()); return image; } } } catch (Exception ex) { throw new ResourceNotFoundException("No image with id '" + id + "' was found"); } throw new ResourceNotFoundException("No image with id '" + id + "' was found"); }

Target:
public SingleServerAppliance getImage(String id) { logger.trace("<< searching for image with id=%s", id); GenericQueryOptions options = new GenericQueryOptions(); options.options(0, 0, null, id, null); try { List<ServerAppliance> list = api.serverApplianceApi().list(options); if (list.size() > 0) { ServerAppliance appliance = list.get(0); List<SingleServerAppliance.AvailableDataCenters> availableDatacenters = new ArrayList<SingleServerAppliance.AvailableDataCenters>(); for (String dcId : appliance.availableDataCenters()) { availableDatacenters.add(SingleServerAppliance.AvailableDataCenters.create(dcId, "")); } SingleServerAppliance image = SingleServerAppliance.create(appliance.id(), appliance.name(), availableDatacenters, appliance.osInstallationBase(), appliance.osFamily(), appliance.os(), appliance.osVersion(), appliance.osArchitecture(), appliance.osImageType(), appliance.minHddSize(), appliance.type(), appliance.state(), appliance.version(), appliance.categories(), appliance.eulaUrl()); logger.trace(">> found image [%s].", image.name()); return image; } } catch (Exception ex) { throw new ResourceNotFoundException("No image with id '" + id + "' was found"); } throw new ResourceNotFoundException("No image with id '" + id + "' was found"); }
Source:
public AsyncExecutorService(Elide elide, Integer threadPoolSize, Integer maxRunTime, AsyncQueryDAO asyncQueryDao) { this.elide = elide; this.runner = new QueryRunner(elide); this.maxRunTime = maxRunTime; executor = AsyncExecutorService.getInstance(threadPoolSize == null ? DEFAULT_THREADPOOL_SIZE : threadPoolSize).getExecutorService(); interruptor = AsyncExecutorService.getInstance(threadPoolSize == null ? DEFAULT_THREADPOOL_SIZE : threadPoolSize).getInterruptorService(); this.asyncQueryDao = asyncQueryDao; }

Target:
private AsyncExecutorService(Elide elide, Integer threadPoolSize, Integer maxRunTime, AsyncQueryDAO asyncQueryDao) { this.elide = elide; this.runner = new QueryRunner(elide); this.maxRunTime = maxRunTime; executor = Executors.newFixedThreadPool(threadPoolSize == null ? defaultThreadpoolSize : threadPoolSize); interruptor = Executors.newFixedThreadPool(threadPoolSize == null ? defaultThreadpoolSize : threadPoolSize); this.asyncQueryDao = asyncQueryDao; }
Source:
public void run() { if (!isEnabled()) { return; } TaskContainmentHierarchyFacade facade = createContainmentFacade(); for (Task t : facade.getTasksInDocumentOrder()) { if (facade.getDepth(t) == 0) { run(t); } } }

Target:
public void run() { if (!isEnabled()) { return; } TaskContainmentHierarchyFacade facade = createContainmentFacade(); recalculateSupertaskCompletionPercentage(facade.getRootTask(), facade); }
Source:
default Instant getClaimAsInstant(String claim) { if (!this.containsClaim(claim)) { return null; } Object claimValue = this.getClaims().get(claim); if (Long.class.isAssignableFrom(claimValue.getClass()) || Integer.class.isAssignableFrom(claimValue.getClass()) || Double.class.isAssignableFrom(claimValue.getClass())) { return Instant.ofEpochSecond(((Number) claimValue).longValue()); } if (Date.class.isAssignableFrom(claimValue.getClass())) { return ((Date) claimValue).toInstant(); } if (Instant.class.isAssignableFrom(claimValue.getClass())) { return (Instant) claimValue; } if (String.class.isAssignableFrom(claimValue.getClass())) { try { return Instant.parse((String) claimValue); } catch(DateTimeParseException e){ throw new IllegalArgumentException("Unable to convert claim '" + claim + "' from string '" + claimValue + "' to Instant."); } } throw new IllegalArgumentException("Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Instant."); }

Target:
default Instant getClaimAsInstant(String claim) { if (!this.containsClaim(claim)) { return null; } Object claimValue = this.getClaims().get(claim); if (Long.class.isAssignableFrom(claimValue.getClass()) || Integer.class.isAssignableFrom(claimValue.getClass()) || Double.class.isAssignableFrom(claimValue.getClass())) { return Instant.ofEpochSecond(((Number) claimValue).longValue()); } if (Date.class.isAssignableFrom(claimValue.getClass())) { return ((Date) claimValue).toInstant(); } if (Instant.class.isAssignableFrom(claimValue.getClass())) { return (Instant) claimValue; } if (String.class.isAssignableFrom(claimValue.getClass())) { try { return Instant.from(DateTimeFormatter.ISO_INSTANT.parse((String)claimValue)); } catch(DateTimeParseException e){ try { return ZonedDateTime.from(DateTimeFormatter.ISO_ZONED_DATE_TIME.parse((String)claimValue)) .toInstant(); } catch(DateTimeParseException e2){ throw new IllegalArgumentException("Unable to convert claim '" + claim + "' from string '" + claimValue + "' to Instant."); } } } throw new IllegalArgumentException("Unable to convert claim '" + claim + "' of type '" + claimValue.getClass() + "' to Instant."); }
Source:
public void setValue(ProjectAccess value) { if (editing && value.isOwnerOf(AccessSection.GLOBAL_CAPABILITIES) && value.getLocal(AccessSection.GLOBAL_CAPABILITIES) == null) { value.getLocal().add(0, new AccessSection(AccessSection.GLOBAL_CAPABILITIES)); } this.value = value; List<Project.NameKey> parents = value.getInheritsFrom(); if (parents != null && parents.size() > 0) { inheritsFrom.getStyle().setDisplay(Display.BLOCK); String text = new String(); for (int i = 0; i < parents.size(); i++) { text += parents.get(i).get(); if (i + 1 < parents.size()) text += ", "; } parentProject.setText(text); parentProject.setTargetHistoryToken( Dispatcher.toProjectAdmin(parents.get(0), ProjectScreen.ACCESS)); } else { inheritsFrom.getStyle().setDisplay(Display.NONE); } final GitwebLink c = Gerrit.getGitwebLink(); if (value.isConfigVisible() && c != null) { history.getStyle().setDisplay(Display.BLOCK); gitweb.setText(c.getLinkName()); gitweb.setHref(c.toFileHistory(new Branch.NameKey(value.getProjectName(), "refs/meta/config"), "project.config")); } else { history.getStyle().setDisplay(Display.NONE); } addSection.setVisible(value != null && editing && (!value.getOwnerOf().isEmpty() || value.canUpload())); }

Target:
public void setValue(ProjectAccess value) { if (editing && value.isOwnerOf(AccessSection.GLOBAL_CAPABILITIES) && value.getLocal(AccessSection.GLOBAL_CAPABILITIES) == null) { value.getLocal().add(0, new AccessSection(AccessSection.GLOBAL_CAPABILITIES)); } this.value = value; List<Project.NameKey> parents = value.getInheritsFrom(); if (parents != null && parents.size() > 0) { inheritsFrom.getStyle().setDisplay(Display.BLOCK); String text = new String(parents.get(0).get()); for (int i = 1; i < parents.size(); i++) { text += ", " + parents.get(i).get(); } parentProject.setText(text); parentProject.setTargetHistoryToken( Dispatcher.toProjectAdmin(parents.get(0), ProjectScreen.ACCESS)); } else { inheritsFrom.getStyle().setDisplay(Display.NONE); } final GitwebLink c = Gerrit.getGitwebLink(); if (value.isConfigVisible() && c != null) { history.getStyle().setDisplay(Display.BLOCK); gitweb.setText(c.getLinkName()); gitweb.setHref(c.toFileHistory(new Branch.NameKey(value.getProjectName(), "refs/meta/config"), "project.config")); } else { history.getStyle().setDisplay(Display.NONE); } addSection.setVisible(value != null && editing && (!value.getOwnerOf().isEmpty() || value.canUpload())); }
Source:
public void testUrlWithSchema() throws Exception { String url = "jdbc:splice://localhost:1527/splicedb;create=true;user=%s;password=%s;schema=" + CLASS_NAME; try (Connection connection = SpliceNetConnection.getConnectionAs(url, SpliceNetConnection.DEFAULT_USER, SpliceNetConnection.DEFAULT_USER_PASSWORD)) { try (Statement statement = connection.createStatement()) { statement.executeQuery("select * from a"); } } }

Target:
public void testUrlWithSchema() throws Exception { String url = "jdbc:splice://localhost:1527/splicedb;user=%s;password=%s;schema=" + CLASS_NAME; try (Connection connection = SpliceNetConnection.getConnectionAs(url, SpliceNetConnection.DEFAULT_USER, SpliceNetConnection.DEFAULT_USER_PASSWORD)) { try (Statement statement = connection.createStatement()) { statement.executeQuery("select * from a"); } } }
Source:
protected void setUp() throws Exception { super.setUp(); genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); }

Target:
protected void setUp() throws Exception { super.setUp(); genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH); initViewpoint(DESIGN_VIEWPOINT_NAME); TestsUtil.emptyEventsFromUIThread(); backedUpValue = TestsUtil.isCreateRepresentationInSeparateResource(); }
Source:
private void updatePresenceStatusForXmppProvider( ProtocolProviderService pps) { SipGateway sipGateway= ServiceUtils.getService( osgiContext, SipGateway.class); TranscriptionGateway transcriptionGateway = ServiceUtils.getService( osgiContext, TranscriptionGateway.class); int participants = 0; int sessions = 0; if(sipGateway != null) { for(SipGatewaySession ses : sipGateway.getActiveSessions()) { participants += ses.getJvbChatRoom().getMembersCount(); sessions++; } } if(transcriptionGateway != null) { for(TranscriptionGatewaySession ses : transcriptionGateway.getActiveSessions()) { participants += ses.getJvbChatRoom().getMembersCount(); sessions++; } } updatePresenceStatusForXmppProvider(pps, participants, sessions); }

Target:
private void updatePresenceStatusForXmppProvider( ProtocolProviderService pps) { SipGateway sipGateway= ServiceUtils.getService( osgiContext, SipGateway.class); TranscriptionGateway transcriptionGateway = ServiceUtils.getService( osgiContext, TranscriptionGateway.class); List<AbstractGatewaySession> sessions = new ArrayList<>(); if(sipGateway != null) { sessions.addAll(sipGateway.getActiveSessions()); } if(transcriptionGateway != null) { sessions.addAll(transcriptionGateway.getActiveSessions()); } int sesCount = 0; int participantCount = 0; for(AbstractGatewaySession ses : sessions) { ChatRoom room = ses.getJvbChatRoom(); if(room != null) { participantCount += ses.getJvbChatRoom().getMembersCount(); sesCount++; } else { logger.warn("non-active session in active session list"); } } updatePresenceStatusForXmppProvider(pps, participantCount, sesCount); }
Source:
protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; if (config.getBoolean(ConfigProperties.TOKEN_ENABLED)) { regex = "^(?!/docs|/token).*"; filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(EventFilter.class); } else if (config.getBoolean(ConfigProperties.TOKEN_ENABLED)) { regex = "^(?!/docs).*"; filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(EventFilter.class); } else { regex = "^(?!/token).*"; } serveRegex(regex).with(HttpServletDispatcher.class); }

Target:
protected void configureServlets() { Map<String, String> loggingFilterConfig = new HashMap<>(); loggingFilterConfig.put("header.name", "x-candlepin-request-uuid"); String regex = ".*"; if (config.getBoolean(ConfigProperties.TOKENPAGE_ENABLED) && config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs|/token).*"; } else if (config.getBoolean(ConfigProperties.SWAGGER_ENABLED)) { regex = "^(?!/docs).*"; } else if (config.getBoolean(ConfigProperties.TOKENPAGE_ENABLED)) { regex = "^(?!/token).*"; } filterRegex(regex).through(CandlepinScopeFilter.class); filterRegex(regex).through(CandlepinPersistFilter.class); filterRegex(regex).through(LoggingFilter.class, loggingFilterConfig); filterRegex(regex).through(EventFilter.class); serveRegex(regex).with(HttpServletDispatcher.class); }
Source:
private void validateSortingPath(Path path, Set<String> allFields) { List<Path.PathElement> pathElemenets = path.getPathElements(); if (pathElemenets.size() > 2) { throw new UnsupportedOperationException( "Currently sorting on double nested fields is not supported"); } Path.PathElement currentElement = pathElemenets.get(0); String currentField = currentElement.getFieldName(); Class<?> currentClass = currentElement.getType(); if (!allFields.stream().anyMatch(field -> field.equals(currentField))) { throw new InvalidOperationException("Can't sort on " + currentField + " as it is not present in query"); } if (dictionary.getIdFieldName(currentClass).equals(currentField) || currentField.equals(EntityDictionary.REGULAR_ID_NAME)) { throw new InvalidOperationException("Sorting on id field is not permitted"); } }

Target:
private void validateSortingPath(Path path, Set<String> allFields) { List<Path.PathElement> pathElemenets = path.getPathElements(); if (pathElemenets.size() > 2) { throw new UnsupportedOperationException( "Currently sorting on double nested fields is not supported"); } Path.PathElement currentElement = pathElemenets.get(0); String currentField = currentElement.getFieldName(); Class<?> currentClass = currentElement.getType(); if (!allFields.stream().anyMatch(field -> field.equals(currentField))) { throw new InvalidOperationException("Can't sort on " + currentField + " as it is not present in query"); } if (currentField.equals(dictionary.getIdFieldName(currentClass)) || currentField.equals(EntityDictionary.REGULAR_ID_NAME)) { throw new InvalidOperationException("Sorting on id field is not permitted"); } }
Source:
private EdgeMapping createEdgeMappingInheritance(Layer layer, ToolSection toolSection, ContainerMapping classMapping) { EdgeMapping edgeMappingInheritance = DescriptionFactory.eINSTANCE.createEdgeMapping(); EdgeStyleDescription edgeStyleI = StyleFactory.eINSTANCE.createEdgeStyleDescription(); edgeMappingInheritance.setName(BASE_ID + ".edge.inheritance"); edgeMappingInheritance.setLabel("Inheritance"); edgeStyleI.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription()); edgeMappingInheritance.setStyle(edgeStyleI); edgeMappingInheritance.getSourceMapping().add(classMapping); edgeMappingInheritance.getTargetMapping().add(classMapping); layer.getEdgeMappings().add(edgeMappingInheritance); EdgeCreationDescription edgeCreationDescription = ToolFactory.eINSTANCE.createEdgeCreationDescription(); edgeCreationDescription.setName(BASE_ID + ".package.toolsection.containerEdgeMappingInheritance"); edgeCreationDescription.setLabel("Container EdgeMapping Inheritance"); edgeCreationDescription.getEdgeMappings().add(edgeMappingInheritance); toolSection.getOwnedTools().add(edgeCreationDescription); return edgeMappingInheritance; }

Target:
private EdgeMapping createEdgeMappingInheritance(Layer layer, ToolSection toolSection, ContainerMapping classMapping) { EdgeMapping edgeMappingInheritance = DescriptionFactory.eINSTANCE.createEdgeMapping(); EdgeStyleDescription edgeStyleI = StyleFactory.eINSTANCE.createEdgeStyleDescription(); edgeMappingInheritance.setName(BASE_ID + ".edge.inheritance"); edgeMappingInheritance.setLabel("Inheritance"); edgeStyleI.setCenterLabelStyleDescription(StyleFactory.eINSTANCE.createCenterLabelStyleDescription()); edgeMappingInheritance.setStyle(edgeStyleI); edgeMappingInheritance.getSourceMapping().add(classMapping); edgeMappingInheritance.getTargetMapping().add(classMapping); layer.getEdgeMappings().add(edgeMappingInheritance); EdgeCreationDescription edgeCreationDescription = ToolFactory.eINSTANCE.createEdgeCreationDescription(); edgeCreationDescription.setName(BASE_ID + ".edge.inheritance.creation"); edgeCreationDescription.setLabel("Inheritance"); edgeCreationDescription.getEdgeMappings().add(edgeMappingInheritance); toolSection.getOwnedTools().add(edgeCreationDescription); return edgeMappingInheritance; }