auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void test_setCursorLocationII() { Display display = new Display(); try { Point originalLocation = display.getCursorLocation(); display.addListener(SWT.Dispose, e -> display.setCursorLocation(originalLocation)); Point location = new Point(100, 100); display.setCursorLocation(location.x, location.y); drainEventQueue(display, 150); Point actual = display.getCursorLocation(); if (!BUG_492569 && !wayland) { if (!location.equals(actual)) { Screenshots.takeScreenshot(getClass(), testName.getMethodName()); fail("\nExpected:"+location.toString()+" Actual:"+actual.toString()); } } else { System.out.println(getClass().getName() + "#" + testName.getMethodName() + ": actual == " + actual); } } finally { display.dispose(); } }

Target:
public void test_setCursorLocationII() { Display display = new Display(); try { Point originalLocation = display.getCursorLocation(); display.addListener(SWT.Dispose, e -> display.setCursorLocation(originalLocation)); Point location = new Point(100, 100); display.setCursorLocation(location.x, location.y); drainEventQueue(display, 150); Point actual = display.getCursorLocation(); if (!BUG_492569 && !SwtTestUtil.isWayland) { if (!location.equals(actual)) { Screenshots.takeScreenshot(getClass(), testName.getMethodName()); fail("\nExpected:"+location.toString()+" Actual:"+actual.toString()); } } else { System.out.println(getClass().getName() + "#" + testName.getMethodName() + ": actual == " + actual); } } finally { display.dispose(); } }
Source:
public String getQueryEncoding() { return _queryEncoding == null ? null : _queryEncoding.toString(); }

Target:
public String getQueryEncoding() { return _queryEncoding == null ? null : _queryEncoding.name(); }
Source:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { int created = 0; int deleted = 0; for (Notification n : notifications) { Object notifier = n.getNotifier(); if (notifier instanceof DView && n.getFeatureID(DView.class) == ViewpointPackage.DVIEW__OWNED_REPRESENTATIONS) { switch (n.getEventType()) { case Notification.ADD: created += 1; break; case Notification.ADD_MANY: int oldSize = ((Collection<?>) n.getOldValue()).size(); int newSize = ((Collection<?>) n.getNewValue()).size(); created += (newSize - oldSize); break; case Notification.REMOVE: created += 1; break; case Notification.REMOVE_MANY: oldSize = ((Collection<?>) n.getOldValue()).size(); newSize = ((Collection<?>) n.getNewValue()).size(); deleted += (oldSize - newSize); break; default: break; } } } if (created > 0 || deleted > 0) { Command cmd = new SendNotificationsCommand(session, created, deleted); return Options.newSome(cmd); } else { return Options.newNone(); } }

Target:
public Option<Command> localChangesAboutToCommit(Collection<Notification> notifications) { int created = 0; int deleted = 0; for (Notification n : notifications) { if (n.getFeature() == ViewpointPackage.Literals.DVIEW__OWNED_REPRESENTATIONS) { switch (n.getEventType()) { case Notification.ADD: created += 1; break; case Notification.ADD_MANY: int oldSize = ((Collection<?>) n.getOldValue()).size(); int newSize = ((Collection<?>) n.getNewValue()).size(); created += newSize - oldSize; break; case Notification.REMOVE: created += 1; break; case Notification.REMOVE_MANY: oldSize = ((Collection<?>) n.getOldValue()).size(); newSize = ((Collection<?>) n.getNewValue()).size(); deleted += oldSize - newSize; break; default: break; } } } if (created > 0 || deleted > 0) { Command cmd = new SendNotificationsCommand(session, created, deleted); return Options.newSome(cmd); } else { return Options.newNone(); } }
Source:
public Collection<ServerHolder> getAllServers() { final List<ServerHolder> allServers = historicals.values().stream() .flatMap(Collection::stream) .collect(Collectors.toList()); allServers.addAll(realtimes); return allServers; }

Target:
public Collection<ServerHolder> getAllServers() { final int historicalSize = historicals.values().stream().mapToInt(Collection::size).sum(); final int realtimeSize = realtimes.size(); final List<ServerHolder> allServers = new ArrayList<>(historicalSize + realtimeSize); historicals.values().forEach(allServers::addAll); allServers.addAll(realtimes); return allServers; }
Source:
public Long encode(OffsetTime value) { if ( value == null ) { return null; } OffsetDateTime offsetDateTime = value.atDate( LocalDate.of( 2019, Month.JANUARY, 1 ) ); return offsetDateTime.toInstant().toEpochMilli(); }

Target:
public Long encode(OffsetTime value) { if ( value == null ) { return null; } long nod = value.toLocalTime().toNanoOfDay(); long offsetNanos = value.getOffset().getTotalSeconds() * 1000_000_000L; return nod - offsetNanos; }
Source:
static List<String> buildNimbusCommands(Map conf) throws IOException { List<String> toRet = getCommonJavaParameters(conf, backtype.storm.Config.NIMBUS_CHILDOPTS); File jvm = new File(new File(System.getProperty("java.home"), "bin"), "java"); toRet.add(0, jvm.toString()); toRet.add("-Dlogfile.name=nimbus.log"); toRet.add("backtype.storm.daemon.nimbus"); return toRet; }

Target:
static List<String> buildNimbusCommands(Map conf) throws IOException { String javaHome = System.getProperty("java.home"); List<String> toRet = buildCommandPrefix(javaHome, null, conf, backtype.storm.Config.NIMBUS_CHILDOPTS); toRet.add("-Dlogfile.name=nimbus.log"); toRet.add("backtype.storm.daemon.nimbus"); return toRet; }
Source:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } }

Target:
public void execute(IProgressMonitor monitor) throws CoreException { Git repoTree; if (resources.length > 0) { if (paths != null) { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().setPaths(paths).call(); } } else { for (IResource res : resources) { repoTree = new Git(getRepository(res)); repoTree.clean().call(); } } } }
Source:
public boolean canStart(String line, int lineOffset) { blockLineCount = 0; listState = null; matcher = LIST_PATTERN.matcher(line); matcher.region(lineOffset, line.length()); final boolean matches = matcher.matches(); if (matches) { String listSpec = matcher.group(1); if (listSpec.charAt(0) == '-') { int level = calculateLevel(listSpec); if (level > 1) { return false; } } } return matches; }

Target:
public boolean canStart(String line, int lineOffset) { blockLineCount = 0; listState = null; matcher = LIST_PATTERN.matcher(line); matcher.region(lineOffset, line.length()); boolean matches = matcher.matches(); if (matches) { String listSpec = matcher.group(1); if (listSpec.charAt(0) == '-') { int level = calculateLevel(listSpec); if (level > 1) { return false; } } } return matches; }
Source:
void flushSessions(Date now) { if (shuttingDown) { return; } updateBatchCountIfNeeded(DateUtils.roundTimeToLatestMinute(now)); if (!enqueuedSessionCounts.isEmpty() && flushingRequest.tryAcquire(1)) { try { Collection<SessionCount> requestValues = new ArrayList<SessionCount>(); requestValues.addAll(enqueuedSessionCounts); SessionPayload payload = new SessionPayload(requestValues, config); Delivery delivery = config.sessionDelivery; delivery.deliver(config.serializer, payload, config.getErrorApiHeaders()); enqueuedSessionCounts.removeAll(requestValues); } finally { flushingRequest.release(1); } } }

Target:
void flushSessions(Date now) { if (shuttingDown.get()) { return; } sendSessions(now); }
Source:
protected static CompareEditorInput createCompareEditorInput(IWorkbenchPart part, AdapterFactory adapterFactory, Notifier left, Notifier right, Notifier origin) { CompareEditorInput input = null; ICompareEditingDomain editingDomain = createEMFCompareEditingDomain(part, left, right, origin); final CompareConfiguration configuration = new CompareConfiguration(); IMatchEngine.Factory eObjectEngineFactory = new MatchEObjectEngineFactory(); eObjectEngineFactory.setRanking(9); IMatchEngine.Factory.Registry matchEngineFactoryRegistry = EMFCompareRCPPlugin.getDefault() .getMatchEngineFactoryRegistry(); matchEngineFactoryRegistry.add(eObjectEngineFactory); EMFCompare comparator = EMFCompare.builder() .setMatchEngineFactoryRegistry(matchEngineFactoryRegistry).setPostProcessorRegistry( EMFCompareRCPPlugin.getDefault().getPostProcessorRegistry()).build(); IComparisonScope scope = EMFCompare.createDefaultScope(left, right, origin); input = new ComparisonScopeEditorInput(configuration, editingDomain, adapterFactory, comparator, scope); input.setTitle("Compare ('" + AdapterFactoryUtil.getText(adapterFactory, left) + "' - '" + AdapterFactoryUtil.getText(adapterFactory, right) + "')"); configuration.setContainer(input); return input; }

Target:
protected static CompareEditorInput createCompareEditorInput(IWorkbenchPart part, AdapterFactory adapterFactory, Notifier left, Notifier right, Notifier origin) { CompareEditorInput input = null; ICompareEditingDomain editingDomain = createEMFCompareEditingDomain(part, left, right, origin); final CompareConfiguration configuration = new CompareConfiguration(); IMatchEngine.Factory eObjectMatchEngineFactory = new MatchEObjectEngineFactory(); eObjectMatchEngineFactory.setRanking(9); IMatchEngine.Factory.Registry matchEngineFactoryRegistry = EMFCompareRCPPlugin.getDefault() .getMatchEngineFactoryRegistry(); matchEngineFactoryRegistry.add(eObjectMatchEngineFactory); EMFCompare comparator = EMFCompare.builder() .setMatchEngineFactoryRegistry(matchEngineFactoryRegistry).setPostProcessorRegistry( EMFCompareRCPPlugin.getDefault().getPostProcessorRegistry()).build(); IComparisonScope scope = EMFCompare.createDefaultScope(left, right, origin); input = new ComparisonScopeEditorInput(configuration, editingDomain, adapterFactory, comparator, scope); input.setTitle("Compare ('" + AdapterFactoryUtil.getText(adapterFactory, left) + "' - '" + AdapterFactoryUtil.getText(adapterFactory, right) + "')"); configuration.setContainer(input); return input; }
Source:
public static SymbolicValue literal(boolean isTruthy) { return isTruthy ? UNKNOWN_TRUTHY : UNKNOWN_FALSY; }

Target:
public static SymbolicValue literal(boolean isTruthy) { return isTruthy ? TRUTHY : FALSY; }
Source:
public boolean exists(String bucketName) { return this.regionMap.get(bucketName) == null; }

Target:
public boolean exists(String bucketName) { return this.regionMap.get(bucketName) != null; }
Source:
public void testLogBundleEventInfo() throws Exception { TestListener listener = new TestListener(); reader.addLogListener(listener); Bundle testBundle = installer.installBundle("test.logging.a"); synchronized (listener) { testBundle.start(); listener.waitForLogEntry(); } ExtendedLogEntry entry = listener.getEntryX(); assertTrue(entry.getLevel() == LogService.LOG_INFO); assertEquals("Wrong level.", LogLevel.INFO, entry.getLogLevel()); assertTrue("Wrong context: " + entry.getContext(), entry.getContext() instanceof BundleEvent); }

Target:
public void testLogBundleEventInfo() throws Exception { Bundle testBundle = installer.installBundle("test.logging.a"); TestListener listener = new TestListener(testBundle.getLocation()); reader.addLogListener(listener); synchronized (listener) { testBundle.start(); listener.waitForLogEntry(); } ExtendedLogEntry entry = listener.getEntryX(); assertTrue(entry.getLevel() == LogService.LOG_INFO); assertEquals("Wrong level.", LogLevel.INFO, entry.getLogLevel()); assertTrue("Wrong context: " + entry.getContext(), entry.getContext() instanceof BundleEvent); }
Source:
public void productProjectionCanBeUsedToUpdateAProduct() throws Exception { withUpdateableProduct(client(), product -> { final MetaAttributes metaAttributes = MetaAttributes.metaAttributesOf(ENGLISH, "commercetools SPHERE.IO&#8482; - Next generation eCommerce", "SPHERE.IO&#8482; is the first and leading Platform-as-a-Service solution for eCommerce.", "Platform-as-a-Service, e-commerce, http, api, tool"); final List<UpdateAction<Product>> updateActions = MetaAttributesUpdateActions.of(metaAttributes); final ProductProjection productProjection = client().executeBlocking(ProductProjectionByIdGet.of(product, STAGED)); SphereJsonUtils.toJsonString(productProjection); SphereJsonUtils.toJsonNode(productProjection).forEach(System.out::println); final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(productProjection, updateActions)); final ProductData productData = updatedProduct.getMasterData().getStaged(); assertThat(productData.getMetaTitle()).isEqualTo(metaAttributes.getMetaTitle()); assertThat(productData.getMetaDescription()).isEqualTo(metaAttributes.getMetaDescription()); assertThat(productData.getMetaKeywords()).isEqualTo(metaAttributes.getMetaKeywords()); return updatedProduct; }); }

Target:
public void productProjectionCanBeUsedToUpdateAProduct() throws Exception { withUpdateableProduct(client(), product -> { final MetaAttributes metaAttributes = MetaAttributes.metaAttributesOf(ENGLISH, "commercetools SPHERE.IO&#8482; - Next generation eCommerce", "SPHERE.IO&#8482; is the first and leading Platform-as-a-Service solution for eCommerce.", "Platform-as-a-Service, e-commerce, http, api, tool"); final List<UpdateAction<Product>> updateActions = MetaAttributesUpdateActions.of(metaAttributes); final ProductProjection productProjection = client().executeBlocking(ProductProjectionByIdGet.of(product, STAGED)); final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(productProjection, updateActions)); final ProductData productData = updatedProduct.getMasterData().getStaged(); assertThat(productData.getMetaTitle()).isEqualTo(metaAttributes.getMetaTitle()); assertThat(productData.getMetaDescription()).isEqualTo(metaAttributes.getMetaDescription()); assertThat(productData.getMetaKeywords()).isEqualTo(metaAttributes.getMetaKeywords()); return updatedProduct; }); }
Source:
public static Cursor streamCheckBeforeMessageSend(ZulipApp app, CharSequence streamName){ if (streamName == null) { streamName = ""; } String query = "SELECT rowid _id, * FROM streams WHERE " + Stream.NAME_FIELD + " = '" + streamName +"' " + " ORDER BY " +Stream.NAME_FIELD; Cursor cursor = ((AndroidDatabaseResults) app .getDao(Stream.class).queryRaw(query).closeableIterator() .getRawResults()).getRawCursor(); if (cursor.getCount()==1) { cursor.moveToFirst(); return cursor; }else { return null; } }

Target:
public static Stream streamCheckBeforeMessageSend(ZulipApp app, CharSequence streamName) { if (streamName == null) { return null; } try { return app.getDao(Stream.class) .queryBuilder().where() .eq(Stream.NAME_FIELD, new SelectArg(Stream.NAME_FIELD, streamName)).queryForFirst(); } catch (SQLException e) { ZLog.logException(e); } return null; }
Source:
private void verifyInstructorCanViewProfile(InstructorAttributes instructor, String section) { if (!instructor.isAllowedForPrivilege(section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)) { throw new UnauthorizedAccessException("Instructor does not have enough privileges to view the photo"); } }

Target:
private void verifyInstructorCanViewProfile(InstructorAttributes instructor, String section) { if (!instructor.isAllowedForPrivilege(section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)) { throw new UnauthorizedAccessException("Instructor does not have enough privileges to view the profile."); } }
Source:
private void registerWithZooKeeper(CuratorFramework client) { try { String containerId = runtimeAttributes.getId(); String containerPath = Paths.build(Paths.ADMINS, containerId); Stat containerPathStat = client.checkExists().forPath(containerPath); if (containerPathStat != null) { long prevSession = containerPathStat.getEphemeralOwner(); long currSession = client.getZookeeperClient().getZooKeeper().getSessionId(); if (prevSession == currSession) { logger.info(String.format( "Existing registration for container runtime %s with session 0x%x detected", containerId, currSession)); return; } logger.info(String.format("Previous registration for container runtime %s with " + "session %x detected; current session: 0x%x", containerId, prevSession, currSession)); int i = 1; long startTime = System.currentTimeMillis(); while (client.checkExists().forPath(containerPath) != null) { logger.info("Waiting for container registration cleanup (elapsed time seconds)...", ((System.currentTimeMillis() - startTime) / 1000)); Thread.sleep(exponentialDelay(i++, 60) * 1000); } } synchronized (runtimeAttributes) { runtimeRepository.save(new ContainerRuntime(containerId, runtimeAttributes)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw ZooKeeperUtils.wrapThrowable(e); } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }

Target:
private void registerWithZooKeeper(CuratorFramework client) { try { String containerId = adminAttributes.getId(); String containerPath = Paths.build(Paths.ADMINS, containerId); Stat containerPathStat = client.checkExists().forPath(containerPath); if (containerPathStat != null) { long prevSession = containerPathStat.getEphemeralOwner(); long currSession = client.getZookeeperClient().getZooKeeper().getSessionId(); if (prevSession == currSession) { logger.info(String.format( "Existing registration for admin runtime %s with session 0x%x detected", containerId, currSession)); return; } logger.info(String.format("Trying to delete previous registration for admin runtime %s with " + "session %x detected; current session: 0x%x; path: %s", containerId, prevSession, currSession, containerPath)); try { client.delete().forPath(containerPath); } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } } synchronized (adminAttributes) { adminRepository.save(new Admin(containerId, adminAttributes)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw ZooKeeperUtils.wrapThrowable(e); } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }
Source:
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { final String realmName = Optional.ofNullable(req.getHeader(REALM_NAME_HEADER)).orElse(configuration.getRealmName()); final String authEndPoint = configuration.getAuthEndpoint(); final byte[] content = ConnectionUtils.readContent(req.getInputStream()); final URI url = new URI(authEndPoint + "/realms/" + realmName + "/protocol/openid-connect/token"); final HttpClientConnection clientConnection = new HttpClientConnection(url, RequestMethod.POST); clientConnection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final byte[] responseContent = clientConnection.readResponseContent(); ConnectionUtils.writeContent(resp.getOutputStream(), responseContent); } catch (Exception e) { resp.sendError(SC_HTTP_UNAUTHORIZED, "Can not authorize"); } }

Target:
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { final String realmName = Optional.ofNullable(req.getHeader(REALM_NAME_HEADER)).orElse(configuration.getRealmName()); final String authEndPoint = configuration.getAuthEndpoint(); final byte[] content = ConnectionUtils.readContent(req.getInputStream()); final URI url = new URI(authEndPoint + "/realms/" + realmName + "/protocol/openid-connect/token"); final HttpClientConnection clientConnection = new HttpClientConnection(url, RequestMethod.POST); clientConnection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final byte[] responseContent = clientConnection.readResponseContent(); ConnectionUtils.writeContent(resp.getOutputStream(), responseContent); } catch (final Exception e) { resp.sendError(SC_HTTP_UNAUTHORIZED, "Can not authorize"); } }
Source:
public void edit(T object) { doEdit(object); updateUiCommonMaps(); updateUiCommonEditorVisitor(); registerPropertyChangeListener(object); accept(visitor); }

Target:
public void edit(T object) { removePropertyChangeListener(getObject()); doEdit(object); updateUiCommonMaps(); updateUiCommonEditorVisitor(); updatePropertyChangeListener(object); accept(visitor); }
Source:
PinotDataTableWithSize(DataTable dataTable, int estimatedSizeInBytes) { this.dataTable = dataTable; this.estimatedSizeInBytes = estimatedSizeInBytes; }

Target:
PinotDataTableWithSize(DataTable dataTable, int estimatedSizeInBytes) { this.dataTable = requireNonNull(dataTable); this.estimatedSizeInBytes = estimatedSizeInBytes; }
Source:
private boolean isReloadConfigEvent(Event event) { boolean isTarget = false; if (EventConstants.RELOAD_DAEMON_CONFIG_UEI.equals(event.getUei())) { Parm target = event.getParm(EventConstants.PARM_DAEMON_NAME); if (target != null && "Eventd".equalsIgnoreCase(target.getValue().getContent())) { isTarget = true; } } else if (EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI.equals(event.getUei())) { isTarget = true; } return isTarget; }

Target:
private boolean isReloadConfigEvent(Event event) { boolean isTarget = false; if (EventConstants.RELOAD_DAEMON_CONFIG_UEI.equals(event.getUei())) { final Parm target = event.getParm(EventConstants.PARM_DAEMON_NAME); if (target != null && "Eventd".equalsIgnoreCase(target.getValue().getContent())) { isTarget = true; } } else if (EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI.equals(event.getUei())) { isTarget = true; } return isTarget; }
Source:
public void blockNumericListUnsupported() { builder.setSupportedBlockTypes(Sets.newHashSet(BlockType.PARAGRAPH)); buildList(BlockType.NUMERIC_LIST); assertContent("<p>test 0</p><p>test 1</p><br/><br/>"); }

Target:
public void blockNumericListUnsupported() { builder.setSupportedBlockTypes(Sets.newHashSet(BlockType.PARAGRAPH)); buildList(BlockType.NUMERIC_LIST); assertContent("<p>test 0</p><p>test 1</p><br/>"); }
Source:
default Collection<Class> getServices() { return Collections.emptyList(); }

Target:
default Collection<Class<? extends ThingHandlerService>> getServices() { return Collections.emptyList(); }
Source:
public void passesWindowsEndsOfLineWithoutException() throws Exception { this.validateCheckstyle( "MainWindows.java", false, Matchers.containsString("LICENSE found") ); }

Target:
public void passesWindowsEndsOfLineWithoutException() throws Exception { this.validateCheckstyle( "WindowsEol.java", false, Matchers.containsString("LICENSE found") ); }
Source:
private void validateExpectedClaims(Header header, Claims claims) { for (String expectedClaimName : expectedClaims.keySet()) { Object expectedClaimValue = expectedClaims.get(expectedClaimName); Object actualClaimValue = claims.get(expectedClaimName); if (Claims.ISSUED_AT.equals(expectedClaimName)) { expectedClaimValue = expectedClaims.getIssuedAt(); actualClaimValue = claims.getIssuedAt(); } else if (Claims.EXPIRATION.equals(expectedClaimName)) { expectedClaimValue = expectedClaims.getExpiration(); actualClaimValue = claims.getExpiration(); } else if (Claims.NOT_BEFORE.equals(expectedClaimName)) { expectedClaimValue = expectedClaims.getNotBefore(); actualClaimValue = claims.getNotBefore(); } else if (expectedClaimValue instanceof Date && actualClaimValue != null && actualClaimValue instanceof Long) { actualClaimValue = new Date((Long)actualClaimValue); } InvalidClaimException invalidClaimException = null; if (actualClaimValue == null) { String msg = String.format( ClaimJwtException.MISSING_EXPECTED_CLAIM_MESSAGE_TEMPLATE, expectedClaimName, expectedClaimValue ); invalidClaimException = new MissingClaimException(header, claims, msg); } else if (!expectedClaimValue.equals(actualClaimValue)) { String msg = String.format( ClaimJwtException.INCORRECT_EXPECTED_CLAIM_MESSAGE_TEMPLATE, expectedClaimName, expectedClaimValue, actualClaimValue ); invalidClaimException = new IncorrectClaimException(header, claims, msg); } if (invalidClaimException != null) { invalidClaimException.setClaimName(expectedClaimName); invalidClaimException.setClaimValue(expectedClaimValue); throw invalidClaimException; } } }

Target:
private void validateExpectedClaims(Header header, Claims claims) { for (String expectedClaimName : expectedClaims.keySet()) { Object expectedClaimValue = expectedClaims.get(expectedClaimName); Object actualClaimValue = claims.get(expectedClaimName); if ( Claims.ISSUED_AT.equals(expectedClaimName) || Claims.EXPIRATION.equals(expectedClaimName) || Claims.NOT_BEFORE.equals(expectedClaimName) ) { expectedClaimValue = expectedClaims.get(expectedClaimName, Date.class); actualClaimValue = claims.get(expectedClaimName, Date.class); } else if ( expectedClaimValue instanceof Date && actualClaimValue != null && actualClaimValue instanceof Long ) { actualClaimValue = new Date((Long)actualClaimValue); } InvalidClaimException invalidClaimException = null; if (actualClaimValue == null) { String msg = String.format( ClaimJwtException.MISSING_EXPECTED_CLAIM_MESSAGE_TEMPLATE, expectedClaimName, expectedClaimValue ); invalidClaimException = new MissingClaimException(header, claims, msg); } else if (!expectedClaimValue.equals(actualClaimValue)) { String msg = String.format( ClaimJwtException.INCORRECT_EXPECTED_CLAIM_MESSAGE_TEMPLATE, expectedClaimName, expectedClaimValue, actualClaimValue ); invalidClaimException = new IncorrectClaimException(header, claims, msg); } if (invalidClaimException != null) { invalidClaimException.setClaimName(expectedClaimName); invalidClaimException.setClaimValue(expectedClaimValue); throw invalidClaimException; } } }
Source:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { mWifiTetherRequested = enable; final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e(TAG, "setWifiTethering: failed to get WifiManager!"); rval = TETHER_ERROR_SERVICE_UNAVAIL; } else if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { rval = TETHER_ERROR_NO_ERROR; } } } finally { Binder.restoreCallingIdentity(ident); } if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return rval; }

Target:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { mWifiTetherRequested = enable; final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); rval = TETHER_ERROR_SERVICE_UNAVAIL; } else if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { rval = TETHER_ERROR_NO_ERROR; } } } finally { Binder.restoreCallingIdentity(ident); } if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return rval; }
Source:
public void execute(Database database) throws CustomChangeException { try { T task = this.typeClass.getConstructor(Database.class, CustomTaskLogger.class) .newInstance(database, new LiquibaseCustomTaskLogger()); task.execute(); task.close(); } catch (Exception e) { throw new CustomChangeException(e); } }

Target:
public void execute(Database database) throws CustomChangeException { CustomTaskLogger logger = new LiquibaseCustomTaskLogger(); try (T task = this.instantiateTask(database, logger)) { task.execute(); } catch (Exception e) { throw new CustomChangeException(e); } }
Source:
public boolean apply(Resource resource) { Predicate<EObject> hasOuterRef = new EObjectHasReferencesTo(modifiedResources); boolean result = Iterators.any(EcoreUtil.<EObject> getAllProperContents(resource, false), hasOuterRef); return result; }

Target:
public boolean apply(Resource resource) { Predicate<EObject> hasOuterRef = new EObjectHasReferencesTo(modifiedResources); return Iterators.any(EcoreUtil.<EObject> getAllProperContents(resource, false), hasOuterRef); }
Source:
public Response toResponse(NotFoundException ex){ String uri = request.getRequestURI(); String exMessage = ex.getMessage(); String outputMessage; if (exMessage != null && exMessage.startsWith("Datafile")) { outputMessage = exMessage; } else { outputMessage = "endpoint does not exist on this server. Please check your code for typos, or consult our API guide at <LINK_0>"; } return Response.status(404) .entity( Json.createObjectBuilder() .add("status", "ERROR") .add("code", 404) .add("message", "'" + uri + "' " + outputMessage) .build()) .type("application/json").build(); }

Target:
public Response toResponse(NotFoundException ex){ String uri = request.getRequestURI(); String exMessage = ex.getMessage(); String outputMessage; if (exMessage != null && exMessage.toLowerCase().startsWith("datafile")) { outputMessage = exMessage; } else { outputMessage = "endpoint does not exist on this server. Please check your code for typos, or consult our API guide at <LINK_0>"; } return Response.status(404) .entity( Json.createObjectBuilder() .add("status", "ERROR") .add("code", 404) .add("message", "'" + uri + "' " + outputMessage) .build()) .type("application/json").build(); }
Source:
private void setLengths() { if (common_alg != null) { switch (common_alg) { case AES_CCM_16_64_128: case AES_CCM_64_64_128: case AES_CCM_16_128_128: case AES_CCM_64_128_128: iv_length = ivLength(common_alg); id_length = iv_length - 6; key_length = common_alg.getKeySize() / 8; break; default: LOGGER.error("Unable to set lengths, since algorithm"); throw new RuntimeException("Unable to set lengths, since algorithm"); } } else { LOGGER.error("Common_alg has not yet been initiated."); throw new RuntimeException("Common_alg has not yet been initiated."); } }

Target:
private void setLengths() { if (common_alg != null) { iv_length = EncryptCommon.ivLength(common_alg); if (iv_length > 0) { id_length = iv_length - 6; key_length = common_alg.getKeySize() / 8; } else { LOGGER.error("Unable to set lengths, since algorithm"); throw new RuntimeException("Unable to set lengths, since algorithm"); } } else { LOGGER.error("Common_alg has not yet been initiated."); throw new RuntimeException("Common_alg has not yet been initiated."); } }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProgramState that = (ProgramState) o; return Objects.equals(values, that.values) && Objects.equals(constraints, that.constraints) && Objects.equals(exitSymbolicValue, that.exitSymbolicValue) && Objects.equals(stack, that.stack) && Objects.equals(lastAssociatedSymbol, that.lastAssociatedSymbol); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProgramState that = (ProgramState) o; return Objects.equals(values, that.values) && Objects.equals(constraints, that.constraints) && Objects.equals(exitSymbolicValue, that.exitSymbolicValue) && Objects.equals(stack, that.stack); }
Source:
public void testDoWhile() throws Exception{ final DefaultConfiguration configurationTestDoWhile = createCheckConfig(WhitespaceAfterCheck.class); configurationTestDoWhile.addAttribute("tokens", "DO_WHILE"); final String[] expected = { "18:16 " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "do{}while"), }; verify(configurationTestDoWhile, getPath("InputDoWhile.java"), expected); }

Target:
public void testDoWhile() throws Exception { final DefaultConfiguration configurationTestDoWhile = createCheckConfig(WhitespaceAfterCheck.class); configurationTestDoWhile.addAttribute("tokens", "DO_WHILE"); final String[] expected = { "18:16: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "while"), }; verify(configurationTestDoWhile, getPath("InputDoWhile.java"), expected); }
Source:
public void testGLnotOverridePL() { VCFFileReader reader = new VCFFileReader(new File("src/test/resources/htsjdk/variant/test_withGLandPL.vcf"), false); VariantContext variant = reader.iterator().next(); reader.close(); Assert.assertEquals(variant.getGenotype(0).getPL(), new int[]{45, 0, 50}); }

Target:
public void testGLnotOverridePL() { final VariantContext variant; try (final VCFFileReader reader = new VCFFileReader( new File("src/test/resources/htsjdk/variant/test_withGLandPL.vcf"), false)) { variant = reader.iterator().next(); } Assert.assertEquals(variant.getGenotype(0).getPL(), new int[]{45, 0, 50}); }
Source:
public void anonCanSignUpWithUsernameContainingJapaneseSpecialCharacters() { WikiBasePageObject base = new WikiBasePageObject(); SignUpPageObject signUp = base.navigateToSpecialSignUpPage(wikiURL); signUp.disableCaptcha(); String userName = "ユーザー" + signUp.getTimeStamp(); String password = "パス" + signUp.getTimeStamp(); String email = credentials.emailQaart2; RegisterArea register = new RegisterArea(false); register.typeEmailAddress(email); register.typeUsername(userName); register.typePassword(password); register.typeBirthdate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); register.clickSignUpSubmitButton(); base.verifyUserLoggedIn(userName); BannerNotifications notification = new BannerNotifications(); Assertion.assertEquals(notification.getBannerNotificationTextEmailNotConfirmed(), "メールアドレスの認証が完了していないようです。受信トレイの確認メールをチェックしてみてください。確認メールが見つからない場合は、ここをクリックすると新しい確認メールが送信されます。メールアドレスを変更する必要がある場合は、「個人設定」ページにアクセスしてください。"); }

Target:
public void anonCanSignUpWithUsernameContainingJapaneseSpecialCharacters() { WikiBasePageObject base = new WikiBasePageObject(); SignUpPageObject signUp = base.navigateToSpecialSignUpPage(wikiURL); signUp.disableCaptcha(); String userName = "ユーザー" + signUp.getTimeStamp(); String password = "パス" + signUp.getTimeStamp(); String email = credentials.emailQaart2; RegisterArea register = new RegisterArea(false); register.typeEmailAddress(email); register.typeUsername(userName); register.typePassword(password); register.typeBirthdate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); register.clickSignUpSubmitButton(); base.verifyUserLoggedIn(userName); BannerNotifications notification = new BannerNotifications(); String banerNotifMessageJapanese = "メールアドレスの認証が完了していないようです。受信トレイの確認メー" + "ルをチェックしてみてください。確認メールが見つからない場合は、こ" + "こをクリックすると新しい確認メールが送信されます。メールアドレス" + "を変更する必要がある場合は、" + "「個人設定」ページにアクセスしてください。"; Assertion.assertEquals( notification.getBannerNotificationTextEmailNotConfirmed(), banerNotifMessageJapanese); }
Source:
protected List<DockerInspectTransformVolume> transformMounts(List<Object> mounts) { if (mounts == null) { return null; } List<DockerInspectTransformVolume> volumes = new ArrayList<DockerInspectTransformVolume>(); for (Object mount : mounts) { Map<String, Object> mountObj = (Map<String, Object>)mount; String am = ((boolean)mountObj.get(ACCESS_MODE)) ? "rw" : "ro"; String dr = (String)mountObj.get(DRIVER); String containerPath = (String)mountObj.get(DEST); String hostPath = (String)mountObj.get(SRC); String name = (String)mountObj.get(NAME); String externalId = null; if (StringUtils.startsWith(hostPath, "/var/lib/rancher/volumes/rancher-")) { name = Paths.get(hostPath).getFileName().toString(); dr = Paths.get(hostPath).getParent().getFileName().toString(); } if (StringUtils.isEmpty(name)) { name = hostPath; } else { externalId = name; } if ("rancher-cni".equals(name)) { continue; } boolean isBindMount = (dr == null); String uriPrefix = StringUtils.isEmpty(dr) || StringUtils.equals(dr, VolumeConstants.LOCAL_DRIVER) ? VolumeConstants.FILE_PREFIX : dr; String uri = String.format(VolumeConstants.URI_FORMAT, uriPrefix, hostPath); volumes.add(new DockerInspectTransformVolume(containerPath, uri, am, isBindMount, dr, name, externalId)); } return volumes; }

Target:
protected List<DockerInspectTransformVolume> transformMounts(List<Object> mounts) { if (mounts == null) { return null; } List<DockerInspectTransformVolume> volumes = new ArrayList<DockerInspectTransformVolume>(); for (Object mount : mounts) { Map<String, Object> mountObj = (Map<String, Object>)mount; String am = ((boolean)mountObj.get(ACCESS_MODE)) ? DockerVolumeConstants.READ_WRITE : DockerVolumeConstants.READ_ONLY; String dr = (String)mountObj.get(DRIVER); String containerPath = (String)mountObj.get(DEST); String hostPath = (String)mountObj.get(SRC); String name = (String)mountObj.get(NAME); String externalId = null; if (StringUtils.startsWith(hostPath, RANCHER_VOLUME_PREFIX)) { name = Paths.get(hostPath).getFileName().toString(); dr = Paths.get(hostPath).getParent().getFileName().toString(); } if (StringUtils.isEmpty(name)) { name = hostPath; } else { externalId = name; } if ("rancher-cni".equals(name)) { continue; } boolean isBindMount = (dr == null); String uriPrefix = StringUtils.isEmpty(dr) || StringUtils.equals(dr, VolumeConstants.LOCAL_DRIVER) ? VolumeConstants.FILE_PREFIX : dr; String uri = String.format(VolumeConstants.URI_FORMAT, uriPrefix, hostPath); volumes.add(new DockerInspectTransformVolume(containerPath, uri, am, isBindMount, dr, name, externalId)); } return volumes; }
Source:
public static void getNextPageUsersInCategory(String nextURL, CanvasCallback<User[]> callback) { if (APIHelpers.paramIsNull(callback, nextURL)) { return; } callback.setIsNextPage(true); buildInterface(callback).getNextPageUsersInCategory(nextURL, callback); }

Target:
public static void getNextPageUsersInCategory(String nextURL, CanvasCallback<User[]> callback) { if (APIHelpers.paramIsNull(callback, nextURL)) return; callback.setIsNextPage(true); buildInterface(callback).getNextPageUsersInCategory(nextURL, callback); }
Source:
public void testCall() { String change_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !"); gAccess.pushFile(); change_id = gAccess.getChangeId(); } catch (Exception e1) { fail(e1.getMessage()); } GetChangeCommand command = fGerrit.getChange(change_id); command.addOption(ChangeOption.DETAILED_LABELS); ChangeInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } catch (ClientProtocolException e) { fail(e.getMessage()); } for (Entry<String, String[]> entry : result.getPermittedLabels().entrySet()) { System.out.println(entry.getKey() + ": "); for (String strArr : entry.getValue()) { System.out.println(strArr); } } assertEquals(change_id, result.getChange_id()); }

Target:
public void testCall() { String change_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !"); gAccess.pushFile(); change_id = gAccess.getChangeId(); } catch (Exception e1) { fail(e1.getMessage()); } GetChangeCommand command = fGerrit.getChange(change_id); command.addOption(ChangeOption.DETAILED_LABELS); ChangeInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } catch (ClientProtocolException e) { fail(e.getMessage()); } assertEquals(change_id, result.getChange_id()); }
Source:
public static final Object[][] collapse() { return new Object[][]{ { "project43", "SyntheticTests/AdType/Collapse", new String[] { AdsContent.TOP_LB, AdsContent.MEDREC } }, }; }

Target:
public static final Object[][] collapse() { return new Object[][]{ { "project43", "SyntheticTests/AdType/Collapse", "wka.life/_project43 new String[] { AdsContent.TOP_LB, AdsContent.MEDREC } }, }; }
Source:
public void updateScores(HashMap<Integer, Double> scoreMap) { for (Integer id : scoreMap.keySet()) { GameObject go = gameObjects.get(id); if (go != null && go instanceof BoDCharacter) { BoDCharacter bodCharacter = (BoDCharacter)go; double score = scoreMap.get(id); bodCharacter.setScore(score); } } }

Target:
public void updateScores(HashMap<Integer, Double> scoreMap) { for (Integer id : scoreMap.keySet()) { GameObject go = gameObjects.get(id); if (go != null ) { BoDCharacter bodCharacter = (BoDCharacter)go; double score = scoreMap.get(id); bodCharacter.setScore(score); } } }
Source:
private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException { MimeHeaders mimeHeaders = new MimeHeaders(); if (inputStream instanceof TransportInputStream) { TransportInputStream transportInputStream = (TransportInputStream) inputStream; Iterator<String> headerNamesWithDuplicate = transportInputStream.getHeaderNames(); List<String> headerKeys = new ArrayList<String>(); while (headerNamesWithDuplicate.hasNext()) { String key = headerNamesWithDuplicate.next(); if(!headerKeys.contains(key)) { headerKeys.add(key); } } for (Iterator<String> headerNames = headerKeys.iterator(); headerNames.hasNext();) { String headerName = headerNames.next(); for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) { String headerValue = headerValues.next(); StringTokenizer tokenizer = new StringTokenizer(headerValue, ","); while (tokenizer.hasMoreTokens()) { mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim()); } } } } return mimeHeaders; }

Target:
private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException { MimeHeaders mimeHeaders = new MimeHeaders(); if (inputStream instanceof TransportInputStream) { TransportInputStream transportInputStream = (TransportInputStream) inputStream; for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) { String headerName = headerNames.next(); for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) { String headerValue = headerValues.next(); StringTokenizer tokenizer = new StringTokenizer(headerValue, ","); while (tokenizer.hasMoreTokens()) { mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim()); } } } } return mimeHeaders; }
Source:
private DiskImage createMetadataDisk(VM vm, Snapshot snapshot) { StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, memoryDiskDomainMap.get(snapshot.getMetadataDiskId())); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, snapshot.getMetadataDiskId()); if (sd == null || disk != null) { return null; } DiskImage memoryDisk = MemoryUtils.createSnapshotMetadataDisk(vm, MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(snapshot.getMetadataDiskId()); memoryDisk.setImageId(getMemoryDiskImageId(snapshot.getMetadataDiskId())); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(sd.getId()))); memoryDisk.setStoragePoolId(getStoragePoolId()); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }

Target:
private DiskImage createMetadataDisk(VM vm, Snapshot snapshot) { StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, memoryDiskDomainMap.get(snapshot.getMetadataDiskId())); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, snapshot.getMetadataDiskId()); if (sd == null || disk != null) { return null; } DiskImage memoryDisk = MemoryUtils.createSnapshotMetadataDisk(vm.getname(), MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(snapshot.getMetadataDiskId()); memoryDisk.setImageId(getMemoryDiskImageId(snapshot.getMetadataDiskId())); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(sd.getId()))); memoryDisk.setStoragePoolId(getStoragePoolId()); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }
Source:
private void updateMultiselectMenu() { if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) { return; } mActionBarMenu.findItem(R.id.action_preview).setVisible(mCheckedCardPositions.size() == 1); if (!mCheckedCardPositions.isEmpty()) { DeckTask.launchDeckTask(DeckTask.TASK_TYPE_CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new DeckTask.TaskData(new Object[]{mCheckedCardPositions, getCards()})); } if (mCheckedCardPositions.size() < getCards().size()) { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_all); } else { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_none); } }

Target:
private void updateMultiselectMenu() { if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) { return; } if (!mCheckedCardPositions.isEmpty()) { DeckTask.launchDeckTask(DeckTask.TASK_TYPE_CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new DeckTask.TaskData(new Object[]{mCheckedCardPositions, getCards()})); } if (mCheckedCardPositions.size() < getCards().size()) { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_all); } else { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_none); } }
Source:
public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { CacheAffinityInfo affinityInfo = cacheAffinity.get(cacheId); if (affinityInfo == null || affinityInfo.keyCfg == null || affinityInfo.partMapping == null) return null; Object binaryKey = binary.toBinary(key); if (!affinityInfo.keyCfg.isEmpty()) { int typeId = binary.typeId(key.getClass().getName()); Integer fieldId = affinityInfo.keyCfg.get(typeId); if (fieldId != null) { if (binaryKey instanceof BinaryObjectExImpl) binaryKey = ((BinaryObjectExImpl)binaryKey).field(fieldId); else return null; } } return affinityInfo.nodeForKey(binaryKey); }

Target:
public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { CacheAffinityInfo affinityInfo = cacheAffinity.get(cacheId); if (affinityInfo == null || affinityInfo == NOT_APPLICABLE_CACHE_AFFINITY_INFO) return null; Object binaryKey = binary.toBinary(key); if (!affinityInfo.keyCfg.isEmpty()) { int typeId = binary.typeId(key.getClass().getName()); Integer fieldId = affinityInfo.keyCfg.get(typeId); if (fieldId != null) { if (binaryKey instanceof BinaryObjectExImpl) binaryKey = ((BinaryObjectExImpl)binaryKey).field(fieldId); else return null; } } return affinityInfo.nodeForKey(binaryKey); }
Source:
public Iterable<IEObjectDescription> getElements(EObject object) { Iterable<IEObjectDescription> result = super.getElements(object); if (Iterables.isEmpty(result) && (object instanceof EPackage)) { final EPackage ePackage = (EPackage) object; Iterable<IEObjectDescription> localElements = getLocalElementsByEClass(EcorePackage.Literals.EPACKAGE); result = Iterables.filter(localElements, new Predicate<IEObjectDescription>() { @Override public boolean apply(IEObjectDescription input) { return input.getQualifiedName().toString().equals(ePackage.getNsURI()); } }); } return result; }

Target:
public Iterable<IEObjectDescription> getElements(EObject object) { Iterable<IEObjectDescription> result = super.getElements(object); if (Iterables.isEmpty(result) && (object instanceof EPackage)) { final EPackage ePackage = (EPackage) object; Iterable<IEObjectDescription> localElements = getLocalElementsByEClass(EcorePackage.Literals.EPACKAGE); result = Iterables.filter(localElements, new Predicate<IEObjectDescription>() { @Override public boolean apply(IEObjectDescription input) { return input.getQualifiedName().toString(".").equals(ePackage.getNsURI()); } }); } return result; }