auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void shouldThrowBadCredentialsExceptionWhenNoUserFound_WithMultipleSearchBase() { final FilterBasedLdapUserSearch filter1 = mock(FilterBasedLdapUserSearch.class); final FilterBasedLdapUserSearch filter2 = mock(FilterBasedLdapUserSearch.class); LdapConfig ldapConfig = setLdapConfig(new BasesConfig(new BaseConfig("base1"), new BaseConfig("base2"))); doReturn(filter1).when(spy).getFilterBasedLdapUserSearch(ldapConfig.getBasesConfig().get(0).getValue(), ldapConfig.searchFilter()); doReturn(filter2).when(spy).getFilterBasedLdapUserSearch(ldapConfig.getBasesConfig().get(1).getValue(), ldapConfig.searchFilter()); when(filter1.searchForUser("username")).thenThrow(new UsernameNotFoundException("User username not found in directory.")); when(filter2.searchForUser("username")).thenThrow(new UsernameNotFoundException("User username not found in directory.")); try { spy.searchForUser("username"); fail("Should have thrown up"); } catch (BadCredentialsException e) { assertThat(e.getMessage(), is("Bad credentials")); } verify(filter1).searchForUser("username"); verify(filter2).searchForUser("username"); }

Target:
public void shouldThrowBadCredentialsExceptionWhenNoUserFound_WithMultipleSearchBase() { final FilterBasedLdapUserSearch filter1 = mock(FilterBasedLdapUserSearch.class); final FilterBasedLdapUserSearch filter2 = mock(FilterBasedLdapUserSearch.class); LdapConfig ldapConfig = setLdapConfig(new BasesConfig(new BaseConfig("base1"), new BaseConfig("base2"))); doReturn(filter1).when(spy).getFilterBasedLdapUserSearch(ldapConfig.getBasesConfig().get(0).getValue(), ldapConfig.searchFilter()); doReturn(filter2).when(spy).getFilterBasedLdapUserSearch(ldapConfig.getBasesConfig().get(1).getValue(), ldapConfig.searchFilter()); when(filter1.searchForUser("username")).thenThrow(new UsernameNotFoundException("User username not found in directory.")); when(filter2.searchForUser("username")).thenThrow(new UsernameNotFoundException("User username not found in directory.")); thrown.expect(BadCredentialsException.class); thrown.expectMessage(is("Bad credentials")); spy.searchForUser("username"); verify(filter1).searchForUser("username"); verify(filter2).searchForUser("username"); }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitLeftHandExprList(@NotNull GoLeftHandExprList o) { super.visitLeftHandExprList(o); for (GoExpression expression : o.getExpressionList()) { ProgressManager.checkCanceled(); if (!(expression instanceof GoSelectorExpr)) continue; GoExpression expr = ContainerUtil.getFirstItem(((GoSelectorExpr)expression).getExpressionList()); if (expr instanceof GoIndexOrSliceExpr) { GoType exprType = expr.getGoType(null); if (exprType != null && exprType.getParent() instanceof GoMapType) { holder.registerProblem(o, "cannot assign to " + expression.getText(), GENERIC_ERROR_OR_WARNING); } } } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitLeftHandExprList(@NotNull GoLeftHandExprList o) { super.visitLeftHandExprList(o); for (GoExpression expression : o.getExpressionList()) { ProgressManager.checkCanceled(); if (!(expression instanceof GoSelectorExpr)) continue; GoExpression expr = ContainerUtil.getFirstItem(((GoSelectorExpr)expression).getExpressionList()); if (expr instanceof GoIndexOrSliceExpr) { GoType exprType = expr.getGoType(null); if (exprType != null && !(exprType instanceof GoPointerType) && exprType.getParent() instanceof GoMapType) { holder.registerProblem(o, "cannot assign to " + expression.getText(), GENERIC_ERROR_OR_WARNING); } } } } }; }
Source:
public List<DeviceStatus> getPillStatus(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("email") final String email, @QueryParam("pill_id_partial") final String pillIdPartial, @QueryParam("end_ts") final Long endTs) { final List<DeviceAccountPair> pills = new ArrayList<>(); if (email != null) { LOGGER.debug("Querying all pills for email = {}", email); final Optional<Long> accountIdOptional = Util.getAccountIdByEmail(accountDAO, email); if (!accountIdOptional.isPresent()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Account not found!").build()); } pills.addAll(deviceDAO.getPillsForAccountId(accountIdOptional.get())); } else if (pillIdPartial != null) { LOGGER.debug("Querying all pills whose IDs contain = {}", pillIdPartial); pills.addAll(deviceDAO.getPillsByPillIdHint(pillIdPartial)); } else { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity("Missing query params!").build()); } final List<DeviceStatus> pillStatuses = new ArrayList<>(); for (final DeviceAccountPair pill : pills) { pillStatuses.addAll(deviceDAO.pillStatusBeforeTs(pill.internalDeviceId, new DateTime(endTs, DateTimeZone.UTC))); } return pillStatuses; }

Target:
public List<DeviceStatus> getPillStatus(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("email") final String email, @QueryParam("pill_id_partial") final String pillIdPartial, @QueryParam("end_ts") final Long endTs) { final List<DeviceAccountPair> pills = new ArrayList<>(); if (email == null && pillIdPartial == null){ throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity("Missing query params!").build()); } else if (email != null) { LOGGER.debug("Querying all pills for email = {}", email); final Optional<Long> accountIdOptional = Util.getAccountIdByEmail(accountDAO, email); if (!accountIdOptional.isPresent()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Account not found!").build()); } pills.addAll(deviceDAO.getPillsForAccountId(accountIdOptional.get())); } else { LOGGER.debug("Querying all pills whose IDs contain = {}", pillIdPartial); pills.addAll(deviceDAOAdmin.getPillsByPillIdHint(pillIdPartial)); } final List<DeviceStatus> pillStatuses = new ArrayList<>(); for (final DeviceAccountPair pill : pills) { pillStatuses.addAll(deviceDAOAdmin.pillStatusBeforeTs(pill.internalDeviceId, new DateTime(endTs, DateTimeZone.UTC))); } return pillStatuses; }
Source:
public Position cursorPosition() { return syncExec(new Result<Position>() { @Override public Position run() { widget.setFocus(); int offset = widget.getSelectionRange().x; int line = widget.getContent().getLineAtOffset(offset); int offsetAtLine = widget.getContent().getOffsetAtLine(line); int column = offset - offsetAtLine; return new Position(line, column); } }); }

Target:
public Position cursorPosition() { return cursorPosition(false); }
Source:
public void findAvailableCapabilitiesByIds() throws Exception { CapabilityList actual = catalog.findByIds(Lists.newArrayList(2, 15, 1)); List<Capability> capabilities = new LinkedList<>(); capabilities.add(new Capability(1, "A")); capabilities.add(new Capability(2, "B")); CapabilityList expected = new CapabilityList(capabilities); assertThat(actual, deepEquals(expected)); }

Target:
public void findAvailableCapabilitiesByIds() throws Exception { CapabilityList actual = catalog.findByIds(Lists.newArrayList(2, 15)); List<Capability> capabilities = Lists.newArrayList(new Capability(2, "B")); CapabilityList expected = new CapabilityList(capabilities); assertThat(actual, deepEquals(expected)); }
Source:
public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutProvider sp = dh.getShortcutProvider(); if (sp == null) return; String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Received shortcut " + name); if (sp.findByName(name) != null) { Log.d("onReceive", "Duplicated shortcut " + name + ", ignoring"); return; } Intent target = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (target.getAction() == null) { target.setAction(Intent.ACTION_VIEW); } ShortcutPojo pojo = sp.createPojo(name); pojo.intentUri = target.toUri(0); Bitmap icon = (Bitmap) data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); if (icon != null) { Log.d("onReceive", "Shortcut " + name + " has embedded icon"); pojo.icon = icon; } else { ShortcutIconResource sir = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); if (sir != null) { Log.d("onReceive", "Received icon package name " + sir.packageName); Log.d("onReceive", "Received icon resource name " + sir.resourceName); pojo.packageName = sir.packageName; pojo.resourceName = sir.resourceName; } else { Log.d("onReceive", "Invalid shortcut " + name + ", ignoring"); return; } } dh.addShortcut(context, pojo); dh.getShortcutProvider().addShortcut(pojo); }

Target:
public void onReceive(Context context, Intent data) { DataHandler dh = KissApplication.getDataHandler(context); ShortcutProvider sp = dh.getShortcutProvider(); if (sp == null) return; String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); Log.d("onReceive", "Received shortcut " + name); if (sp.findByName(name) != null || dh.getContactProvider().findByName(name) != null || dh.getAppProvider().findByName(name) != null ) { Log.d("onReceive", "Duplicated shortcut " + name + ", ignoring"); return; } Intent target = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); if (target.getAction() == null) { target.setAction(Intent.ACTION_VIEW); } ShortcutPojo pojo = createPojo(name); pojo.intentUri = target.toUri(0); Bitmap icon = (Bitmap) data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON); if (icon != null) { Log.d("onReceive", "Shortcut " + name + " has embedded icon"); pojo.icon = icon; } else { ShortcutIconResource sir = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE); if (sir != null) { Log.d("onReceive", "Received icon package name " + sir.packageName); Log.d("onReceive", "Received icon resource name " + sir.resourceName); pojo.packageName = sir.packageName; pojo.resourceName = sir.resourceName; } else { Log.d("onReceive", "Invalid shortcut " + name + ", ignoring"); return; } } dh.getShortcutProvider().addShortcut(pojo); }
Source:
public void updateGroup(byte[] groupId, String name, List<String> members, String avatar) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException { String optName = null; Collection<String> optMembers = null; String optAvatar = null; if(!name.isEmpty()) { optName = name; } if(members.size() > 0) { optMembers = members; } if(!avatar.isEmpty()) { optAvatar = avatar; } System.err.println("sendUpdateGroupMessage(" + Base64.encodeBytes(groupId) + ", " + optName + ", " + optMembers + ", " + optAvatar + ");"); sendUpdateGroupMessage(groupId, optName, optMembers, null); }

Target:
public void updateGroup(byte[] groupId, String name, List<String> members, String avatar) throws IOException, EncapsulatedExceptions, GroupNotFoundException, AttachmentInvalidException { if (name.isEmpty()) { name = null; } if (members.size() == 0) { members = null; } if (avatar.isEmpty()) { avatar = null; } sendUpdateGroupMessage(groupId, name, members, avatar); }
Source:
private List<? extends PsiElement> resolveChain(HaxeReference lefthandExpression, HaxeReference reference) { String identifier = reference instanceof HaxeReferenceExpression ? ((HaxeReferenceExpression)reference).getIdentifier().getText() : reference.getText(); HaxeClassResolveResult leftExpression = lefthandExpression.resolveHaxeClass(); if (leftExpression != HaxeClassResolveResult.EMPTY && leftExpression.getHaxeClass() != null) { HaxeMemberModel member = leftExpression.getHaxeClass().getModel().getMember(identifier); if (member != null) { return Collections.singletonList(member.getBasePsi()); } } if (LOG.isTraceEnabled()) LOG.trace(traceMsg(null)); final HaxeComponentName componentName = tryResolveHelperClass(lefthandExpression, identifier); if (componentName != null) { if (LOG.isTraceEnabled()) LOG.trace("Found component " + componentName.getText()); return Collections.singletonList(componentName); } if (LOG.isTraceEnabled()) LOG.trace(traceMsg("trying keywords (super, new) arrays, literals, etc.")); return resolveByClassAndSymbol(lefthandExpression.resolveHaxeClass(), reference); }

Target:
private List<? extends PsiElement> resolveChain(HaxeReference lefthandExpression, HaxeReference reference) { String identifier = reference instanceof HaxeReferenceExpression ? ((HaxeReferenceExpression)reference).getIdentifier().getText() : reference.getText(); HaxeClassResolveResult leftExpression = lefthandExpression.resolveHaxeClass(); if (leftExpression.getHaxeClass() != null) { HaxeMemberModel member = leftExpression.getHaxeClass().getModel().getMember(identifier); if (member != null) { return Collections.singletonList(member.getBasePsi()); } } if (LOG.isTraceEnabled()) LOG.trace(traceMsg(null)); final HaxeComponentName componentName = tryResolveHelperClass(lefthandExpression, identifier); if (componentName != null) { if (LOG.isTraceEnabled()) LOG.trace("Found component " + componentName.getText()); return Collections.singletonList(componentName); } if (LOG.isTraceEnabled()) LOG.trace(traceMsg("trying keywords (super, new) arrays, literals, etc.")); return resolveByClassAndSymbol(lefthandExpression.resolveHaxeClass(), reference); }
Source:
public Enum<?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { Enum<?>[] constants = ((Class<Enum<?>>) getValueClass()).getEnumConstants(); String text = CharMatcher .WHITESPACE.removeFrom(jp.getText()) .replace('-', '_') .toUpperCase(Locale.ENGLISH); for (Enum<?> constant : constants) { if (constant.name().equals(text)) { return constant; } } return null; }

Target:
public Enum<?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { Enum<?>[] constants = ((Class<Enum<?>>) getValueClass()).getEnumConstants(); String text = CharMatcher .WHITESPACE.removeFrom(jp.getText()) .replace('-', '_') .toUpperCase(Locale.ENGLISH); for (Enum<?> constant : constants) { if (constant.name().equals(text)) { return constant; } } throw ctxt.mappingException(getValueClass()); }
Source:
public static SpinnakerPluginEndPoint spinnakerPluginEndPoint( SpinnakerPluginManager pluginManager) { return new SpinnakerPluginEndPoint(pluginManager); }

Target:
public static SpinnakerPluginEndpoint spinnakerPluginEndPoint( SpinnakerPluginManager pluginManager) { return new SpinnakerPluginEndpoint(pluginManager); }
Source:
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.errorChannel = (MessageChannel) applicationContext.getBean(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME); }

Target:
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; }
Source:
public MutableBoundedValue<Integer> getExperienceBetweenLevels() { return new SpongeBoundedValue<Integer>(Keys.EXPERIENCE_FROM_START_OF_LEVEL, 0, intComparator(), 0, Integer.MAX_VALUE, this.expBetweenLevels); }

Target:
public ImmutableBoundedValue<Integer> getExperienceBetweenLevels() { return new ImmutableSpongeBoundedValue<>(Keys.EXPERIENCE_FROM_START_OF_LEVEL, this.expBetweenLevels, intComparator(), 0, Integer.MAX_VALUE); }
Source:
public String getBackupIdentifier() { return INSTRUCTOR_BACKUP_LOG_MSG + courseId + email; }

Target:
public String getBackupIdentifier() { return INSTRUCTOR_BACKUP_LOG_MSG + courseId + "::" + email; }
Source:
protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { if(fTypes != null && fTypes.length > 0) { for (IType fType : fTypes) { if (itemsFilter.isConsistentItem(fType)) { contentProvider.add(fType, itemsFilter); } } } }

Target:
protected void fillContentProvider(AbstractContentProvider contentProvider, ItemsFilter itemsFilter, IProgressMonitor progressMonitor) throws CoreException { if(fTypes != null && fTypes.length > 0) { for (IType type : fTypes) { if (itemsFilter.isConsistentItem(type)) { contentProvider.add(type, itemsFilter); } } } }
Source:
private void deleteNetwork(GcpContext context, AuthenticatedContext auth, Network network, String networkId) throws IOException { CloudResource networkResource = createNamedResource(GCP_NETWORK, networkId); try { CloudResource deletedResource = gcpNetworkResourceBuilder.delete(context, auth, networkResource, network); if (deletedResource != null) { PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask( gcpSubnetResourceBuilder, auth, Collections.singletonList(deletedResource), context, true); syncPollingScheduler.schedule(task); } } catch (Exception e) { LOGGER.debug("Skipping resource creation: {}", e.getMessage()); } }

Target:
private void deleteNetwork(GcpContext context, AuthenticatedContext auth, Network network, String networkId) throws IOException { CloudResource networkResource = createNamedResource(GCP_NETWORK, networkId); try { CloudResource deletedResource = gcpNetworkResourceBuilder.delete(context, auth, networkResource, network); if (deletedResource != null) { PollTask<List<CloudResourceStatus>> task = statusCheckFactory.newPollResourceTask( gcpSubnetResourceBuilder, auth, Collections.singletonList(deletedResource), context, true); syncPollingScheduler.schedule(task); } } catch (Exception e) { LOGGER.debug("Skipping resource deletion: {}", e.getMessage()); } }
Source:
public String[] getSupportedExtensions() { return new String[] { "wtt" }; }

Target:
public String[] getSupportedExtensions() { return new String[] { "vtt" }; }
Source:
public Integer getPartSize() { return getPropertyAsInt(FIELD_PART_SIZE); }

Target:
public int getPartSize() { return getPropertyAsInt(FIELD_PART_SIZE); }
Source:
public boolean isInVisibleLines(AbstractInlinedAnnotation annotation) { return visibleLines.isInVisibleLines(annotation); }

Target:
boolean isInVisibleLines(AbstractInlinedAnnotation annotation) { return visibleLines.isInVisibleLines(annotation); }
Source:
public ContentAssistant openContentAssistant() { return openContentAssistant(ContentAssistantEnum.DEFAULT); }

Target:
public ContentAssistant openContentAssistant() { Menu assistMenu = new ShellMenu("Edit", "Content Assist"); boolean hasAssistMenuChildren = MenuHandler.getInstance().getMenuFromMenuItem(assistMenu.getSWTWidget()) != null; if (hasAssistMenuChildren) return openContentAssistant(ContentAssistantEnum.DEFAULT); else return openContentAssistant("Edit", "Content Assist"); }
Source:
void send(final long destinations[], final VoltMessage message) { if (destinations.length == 0) { return; } final HashMap<Subconnection, ArrayList<Long>> destinationsPerConn = new HashMap<Subconnection, ArrayList<Long>>(); if (m_hasMultiConnections) { for (long remoteHsId : destinations) { Subconnection c = m_connByHSIds.get(remoteHsId); if (c == null) { c = m_connections.get(m_nextConnection.getAndIncrement() % m_connections.size()); bindConnection(remoteHsId, c); } ArrayList<Long> bundle = destinationsPerConn.get(c); if (bundle == null) { bundle = new ArrayList<Long>(); destinationsPerConn.put(c, bundle); } bundle.add(remoteHsId); } for (Entry<Subconnection, ArrayList<Long>> e : destinationsPerConn.entrySet()) { e.getKey().send(Longs.toArray(e.getValue()), message); } } else { m_firstConn.send(destinations, message); } detectDeadHost(); }

Target:
void send(final long destinations[], final VoltMessage message) { if (destinations.length == 0) { return; } final HashMap<Subconnection, ArrayList<Long>> destinationsPerConn = new HashMap<Subconnection, ArrayList<Long>>(); if (m_hasMultiConnections) { for (long remoteHsId : destinations) { Subconnection c = null; if (remoteHsId < 0) { c = m_connBySpecialHSIds.get(remoteHsId); } else { c = m_connByHSIds.get(remoteHsId); } if (c == null) { if (remoteHsId < 0) { c = m_connections.get(m_nextConnectionForSpecialHSId.getAndIncrement() % m_connections.size()); } else { c = m_connections.get(m_nextConnection.getAndIncrement() % m_connections.size()); } bindConnection(remoteHsId, c); } ArrayList<Long> bundle = destinationsPerConn.get(c); if (bundle == null) { bundle = new ArrayList<Long>(); destinationsPerConn.put(c, bundle); } bundle.add(remoteHsId); } for (Entry<Subconnection, ArrayList<Long>> e : destinationsPerConn.entrySet()) { e.getKey().send(Longs.toArray(e.getValue()), message); } } else { m_firstConn.send(destinations, message); } detectDeadHost(); }
Source:
public static ArrayOfDoublesSketch deserialize(final Object serializedSketch) { if (serializedSketch instanceof String) { return deserializeFromBase64EncodedString((String) serializedSketch); } else if (serializedSketch instanceof byte[]) { return deserializeFromByteArray((byte[]) serializedSketch); } else if (serializedSketch instanceof ArrayOfDoublesSketch) { return (ArrayOfDoublesSketch) serializedSketch; } throw new IllegalStateException( "Object is not of a type that can deserialize to sketch: " + serializedSketch.getClass() ); }

Target:
public static ArrayOfDoublesSketch deserialize(final Object serializedSketch) { if (serializedSketch instanceof String) { return deserializeFromBase64EncodedString((String) serializedSketch); } else if (serializedSketch instanceof byte[]) { return deserializeFromByteArray((byte[]) serializedSketch); } else if (serializedSketch instanceof ArrayOfDoublesSketch) { return (ArrayOfDoublesSketch) serializedSketch; } throw new ISE("Object is not of a type that can deserialize to sketch: %s", serializedSketch.getClass()); }
Source:
protected Note importNoteFromUrl(NotebookSocket conn, HashSet<String> userAndRoles, Notebook notebook, Message fromMessage) throws IOException { Note note = null; if (fromMessage != null) { String urlHash = (String) fromMessage.get("hash"); AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal); note = notebook.importNote(urlHash, subject); Message message = new Message(OP.IMPORT_NOTE_STATUS); if (note != null) { note.persist(subject); message.put("importStatus", "success"); } else { message.put("importStatus", "failure"); } conn.send(serializeMessage(message)); broadcastNoteList(subject); } return note; }

Target:
protected Note importNoteFromUrl(NotebookSocket conn, HashSet<String> userAndRoles, Notebook notebook, Message fromMessage) throws IOException { Note note = null; if (fromMessage != null) { String type = (String) fromMessage.get("type"); if (type.equals("ipfs")) { String name = (String) fromMessage.get("name"); Map<String, Object> options = ((Map<String, Object>) fromMessage.get("options")); String urlHash = (String) options.get("hash"); AuthenticationInfo subject = new AuthenticationInfo(fromMessage.principal); note = notebook.importNoteFromBackend(urlHash, name, subject); Message message = new Message(OP.IMPORT_NOTE_STATUS); message.put("type", "ipfs"); message.put("options", options); if (note != null) { note.persist(subject); message.put("importStatus", "success"); } else { message.put("importStatus", "failure"); } conn.send(serializeMessage(message)); broadcastNoteList(subject); } } return note; }
Source:
private void testImmediateSingle(Boolean expected, Boolean lhs, Boolean rhs) { OrExpression and = createOr(lhs, rhs); ImmutableBytesWritable out = new ImmutableBytesWritable(); MultiKeyValueTuple tuple = new MultiKeyValueTuple(); boolean success = and.evaluate(tuple, out); assertTrue(success); assertEquals(expected, PBoolean.INSTANCE.toObject(out)); }

Target:
private void testImmediateSingle(Boolean expected, Boolean lhs, Boolean rhs) { OrExpression or = createOr(lhs, rhs); ImmutableBytesWritable out = new ImmutableBytesWritable(); MultiKeyValueTuple tuple = new MultiKeyValueTuple(); boolean success = or.evaluate(tuple, out); assertTrue(success); assertEquals(expected, PBoolean.INSTANCE.toObject(out)); }
Source:
public void delete() { KernelTransaction transaction = safeAcquireTransaction(); try { boolean deleted = transaction.dataWrite().relationshipDelete( id ); if ( !deleted ) { throw new NotFoundException( "Unable to delete Relationship[" + id + "] since it has already been deleted." ); } } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while deleting the relationship: " + e.getMessage(), e ); } catch ( EntityNotFoundException e ) { throw new NotFoundException( "Unable to delete relationship[" + getId() + "] since it is already deleted." ); } }

Target:
public void delete() { KernelTransaction transaction = safeAcquireTransaction(); try { boolean deleted = transaction.dataWrite().relationshipDelete( id ); if ( !deleted ) { throw new NotFoundException( "Unable to delete relationship[" + getId() + "] since it is already deleted." ); } } catch ( InvalidTransactionTypeKernelException e ) { throw new ConstraintViolationException( e.getMessage(), e ); } catch ( AutoIndexingKernelException e ) { throw new IllegalStateException( "Auto indexing encountered a failure while deleting the relationship: " + e.getMessage(), e ); } }
Source:
public Iterator<Messages.Envelope> iterator() { return new Iterator<Messages.Envelope>() { @Override public boolean hasNext() { try { String line = input.readLine(); if (line == null) return false; if (line.trim().equals("")) { return hasNext(); } Messages.Envelope.Builder builder = Messages.Envelope.newBuilder(); try { JSON_PARSER.merge(line, builder); } catch(InvalidProtocolBufferException e) { throw new RuntimeException(String.format("Not JSON: %s", line)); } next = builder.build(); return true; } catch (IOException e) { throw new RuntimeException(e); } } @Override public Messages.Envelope next() { if (next == null) { throw new IllegalStateException("next() should only be called after a call to hasNext() that returns true"); } return next; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

Target:
public Iterator<Messages.Envelope> iterator() { return new Iterator<Messages.Envelope>() { @Override public boolean hasNext() { try { String line = input.readLine(); if (line == null) return false; if (line.trim().equals("")) { return hasNext(); } Messages.Envelope.Builder builder = Messages.Envelope.newBuilder(); try { JSON_PARSER.merge(line, builder); } catch(InvalidProtocolBufferException e) { throw new RuntimeException(String.format("Not JSON: %s", line), e); } next = builder.build(); return true; } catch (IOException e) { throw new RuntimeException(e); } } @Override public Messages.Envelope next() { if (next == null) { throw new IllegalStateException("next() should only be called after a call to hasNext() that returns true"); } return next; } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
private static void cleanCredentialStore() { File dir = new File(BASE_STORE_DIRECTORY); dir.mkdirs(); File file = new File(BASE_STORE_DIRECTORY + "/mycredstore.cs"); file.delete(); }

Target:
private static void cleanCredentialStore() { File file = new File(BASE_STORE_DIRECTORY + "/mycredstore.cs"); file.delete(); }
Source:
public List<TransactionDto> getAvailableBalanceTransactions(final Integer lotId) { try { if (lotId != null) { final StringBuilder sql = new StringBuilder(this.SEARCH_TRANSACTIONS_QUERY); sql.append(" and (act.trnstat =").append(TransactionStatus.CONFIRMED.getIntValue()).append(" or (act.trnstat = ") .append(TransactionStatus.PENDING.getIntValue()). append(" and act.trntype = ").append(TransactionType.WITHDRAWAL.getId()).append(")) "); sql.append(" and act.lotid = ").append(lotId).append(" "); final SQLQuery query = this.getSession().createSQLQuery(sql.toString()); query.addScalar("transactionId"); query.addScalar("createdByUsername"); query.addScalar("transactionType"); query.addScalar("amount"); query.addScalar("notes"); query.addScalar("transactionDate", Hibernate.DATE); query.addScalar("lotLotId"); query.addScalar("lotGid"); query.addScalar("lotDesignation"); query.addScalar("lotStockId"); query.addScalar("lotScaleId"); query.addScalar("lotScaleName"); query.addScalar("lotStatus"); query.addScalar("transactionStatus"); query.addScalar("lotLocationId"); query.addScalar("lotComments"); query.setResultTransformer(new AliasToBeanConstructorResultTransformer(this.getTransactionDtoConstructor())); final List<TransactionDto> transactionDtos = query.list(); return transactionDtos; } else { return new ArrayList<>(); } } catch (final HibernateException e) { throw new MiddlewareQueryException("Error at getAvailableBalanceTransactions() query on TransactionDAO: " + e.getMessage(), e); } }

Target:
public List<TransactionDto> getAvailableBalanceTransactions(final Integer lotId) { try { if (lotId != null) { final StringBuilder sql = new StringBuilder(SEARCH_TRANSACTIONS_QUERY); sql.append(" and (act.trnstat =").append(TransactionStatus.CONFIRMED.getIntValue()).append(" or (act.trnstat = ") .append(TransactionStatus.PENDING.getIntValue()). append(" and act.trntype = ").append(TransactionType.WITHDRAWAL.getId()).append(")) "); sql.append(" and act.lotid = ").append(lotId).append(" "); final SQLQuery query = this.getSession().createSQLQuery(sql.toString()); this.addSearchTransactionsQueryScalars(query); query.setResultTransformer(new AliasToBeanConstructorResultTransformer(this.getTransactionDtoConstructor())); final List<TransactionDto> transactionDtos = query.list(); return transactionDtos; } else { return new ArrayList<>(); } } catch (final HibernateException e) { throw new MiddlewareQueryException("Error at getAvailableBalanceTransactions() query on TransactionDAO: " + e.getMessage(), e); } }
Source:
public static void handlePartialDownload(InputStream is, HttpHeaders headers, HttpServletResponse response) throws IOException { String contentRange = headers.getFirst(HttpHeaders.RANGE); ByteRangeHeaderParser parser = new ByteRangeHeaderParser(contentRange); List<ByteRange> ranges = parser.getRanges(); if (!CollectionUtils.isEmpty(ranges)) { if (ranges.size() == 1) { logger.debug("Received request for a partial download with a single range."); handlePartialDownloadWithSingleRange(is, ranges.get(0), response); } else { logger.debug("Received request for a partial download with multiple ranges."); handlePartialDownloadWithMultipleRanges(is, ranges, response); } } }

Target:
public static void handlePartialDownload(InputStream is, HttpHeaders headers, HttpServletResponse response) throws IOException { String contentRange = headers.getFirst(HttpHeaders.RANGE); ByteRangeHeaderParser parser = new ByteRangeHeaderParser(contentRange); try { List<ByteRange> ranges = parser.getRanges(); if (!CollectionUtils.isEmpty(ranges)) { if (ranges.size() == 1) { logger.debug("Received request for a partial download with a single range."); handlePartialDownloadWithSingleRange(is, ranges.get(0), response); } else { logger.debug("Received request for a partial download with multiple ranges."); handlePartialDownloadWithMultipleRanges(is, ranges, response); } } } catch (ByteRangeValidationException e) { logger.error(e.getMessage(), e); ByteRangeInputStream bris = StreamUtils.findSource(ByteRangeInputStream.class, is); long length = bris != null ? StreamUtils.getLength(bris) : 0; setRangeNotSatisfiable(response, length); } }
Source:
public List<GroupModel> getGroups() { List<GroupModel> ldapGroupMappings = getLDAPGroupMappingsConverted(); if (config.getMode() == LDAPGroupMapperMode.LDAP_ONLY) { return ldapGroupMappings; } else { List<GroupModel> modelGroupMappings = super.getGroups(); ldapGroupMappings.addAll(modelGroupMappings); return ldapGroupMappings; } }

Target:
public Set<GroupModel> getGroups() { Set<GroupModel> ldapGroupMappings = getLDAPGroupMappingsConverted(); if (config.getMode() == LDAPGroupMapperMode.LDAP_ONLY) { return ldapGroupMappings; } else { Set<GroupModel> modelGroupMappings = super.getGroups(); ldapGroupMappings.addAll(modelGroupMappings); return ldapGroupMappings; } }
Source:
private long getDefaultTimeout() { long timeout = 5 * 60 * 1000; try { timeout = Long.getLong(DEFAULT_TIMEOUT_PROPERTY, timeout); } catch (Exception e) { LOGGER.error(DEFAULT_TIMEOUT_PROPERTY + " is not a number. Using default value " + timeout + "."); } return timeout; }

Target:
private long getDefaultTimeout() { long timeout = DEFAULT_TIMEOUT; try { timeout = Long.getLong(DEFAULT_TIMEOUT_PROPERTY, DEFAULT_TIMEOUT); if (timeout != DEFAULT_TIMEOUT) { LOGGER.debug(DEFAULT_TIMEOUT_PROPERTY + " is set to " + timeout + "."); } } catch (Exception e) { LOGGER.error(DEFAULT_TIMEOUT_PROPERTY + " is not a number. Using default value " + timeout + "."); } return timeout; }
Source:
public void assertAbsenceOfErrors() { if (hasUnhandledErrors()) { if (log.isDebugEnabled()) { try { validator.onErrorUse(nothing()); } catch (ValidationException e) { log.debug("Some validation errors occured: {}", e.getErrors()); } } throw new IllegalStateException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } }

Target:
public void assertAbsenceOfErrors() { if (hasUnhandledErrors()) { log.debug("Some validation errors occured: {}", getErrors()); throw new IllegalStateException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } }
Source:
private void init(final Object target, Method method) { final Map<Class<? extends Throwable>, Method> types = new HashMap<Class<? extends Throwable>, Method>(); final Method failingMethod = method; Retryable retryable = method.getAnnotation(Retryable.class); if (retryable != null) { this.recoverMethodName = retryable.recover(); } ReflectionUtils.doWithMethods(target.getClass(), new MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Recover recover = AnnotationUtils.findAnnotation(method, Recover.class); if (recover == null) { recover = findAnnotationOnTarget(target, method); } if (recover != null && failingMethod.getGenericReturnType() instanceof ParameterizedType) { if (method.getGenericReturnType().equals(failingMethod.getGenericReturnType())) { putToMethodsMap(method, types); } } else if (recover != null && method.getReturnType().isAssignableFrom(failingMethod.getReturnType())) { putToMethodsMap(method, types); } } }); this.classifier.setTypeMap(types); optionallyFilterMethodsBy(failingMethod.getReturnType()); }

Target:
private void init(final Object target, Method method) { final Map<Class<? extends Throwable>, Method> types = new HashMap<Class<? extends Throwable>, Method>(); final Method failingMethod = method; Retryable retryable = method.getAnnotation(Retryable.class); if (retryable != null) { this.recoverMethodName = retryable.recover(); } ReflectionUtils.doWithMethods(target.getClass(), new MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { Recover recover = AnnotationUtils.findAnnotation(method, Recover.class); if (recover == null) { recover = findAnnotationOnTarget(target, method); } if (recover != null && failingMethod.getGenericReturnType() instanceof ParameterizedType && method.getGenericReturnType() instanceof ParameterizedType) { if (isParameterizedTypeAssignable((ParameterizedType) method.getGenericReturnType(), (ParameterizedType) failingMethod.getGenericReturnType())) { putToMethodsMap(method, types); } } else if (recover != null && method.getReturnType().isAssignableFrom(failingMethod.getReturnType())) { putToMethodsMap(method, types); } } }); this.classifier.setTypeMap(types); optionallyFilterMethodsBy(failingMethod.getReturnType()); }
Source:
public void setUp() { super.setUp(); getUtil().deletePage(SPACE_NAME, DOC_NAME); adminPage.gotoPage(); annotationsAdminPage = adminPage.clickAnnotationsSection(); annotationsAdminPage.activateAnnotations(); annotationsAdminPage.displayAnnotationsByDefault(); annotationsAdminPage.displayAnnotationsHighlightByDefault(); annotationsAdminPage.clickSave(); annotableViewPage = new AnnotableViewPage(); adminPage = new AdministrationPage(); getUtil().createPage(SPACE_NAME, DOC_NAME, CONTENT, DOC_TITLE, "xwiki/1.0"); }

Target:
public void setUp() { super.setUp(); getUtil().deletePage(SPACE_NAME, DOC_NAME); adminPage.gotoPage(); annotationsAdminPage = adminPage.clickAnnotationsSection(); annotationsAdminPage.activateAnnotations(); annotationsAdminPage.displayAnnotationsByDefault(); annotationsAdminPage.displayAnnotationsHighlightByDefault(); annotationsAdminPage.clickSave(); annotatableViewPage = new AnnotatableViewPage(); adminPage = new AdministrationPage(); getUtil().createPage(SPACE_NAME, DOC_NAME, CONTENT, DOC_TITLE, "xwiki/1.0"); }
Source:
public void onAdd(Entity entity) throws FalconException { Set<String> currentClusters = DeploymentUtil.getCurrentClusters(); if (entity.getEntityType() == EntityType.FEED) { Feed feed = (Feed) entity; if (feed.getLocations() != null) { for (Cluster cluster : feed.getClusters().getClusters()) { if (currentClusters.contains(cluster.getName())) { if (FeedHelper.getSLA(cluster, feed) != null) { LOG.debug("Adding feed:{} for monitoring", feed.getName()); MONITORING_JDBC_STATE_STORE.putMonitoredFeed(feed.getName(), EntityType.FEED.toString()); } } } } } if (entity.getEntityType() == EntityType.PROCESS){ Process process = (Process) entity; if (process.getSla() != null || checkProcessClusterSLA(process)){ for (org.apache.falcon.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { if (currentClusters.contains(cluster.getName())) { LOG.debug("Adding process:{} for monitoring", process.getName()); MONITORING_JDBC_STATE_STORE.putMonitoredFeed(process.getName(), EntityType.PROCESS.toString()); } } } } }

Target:
public void onAdd(Entity entity) throws FalconException { Set<String> currentClusters = DeploymentUtil.getCurrentClusters(); if (entity.getEntityType() == EntityType.FEED) { Feed feed = (Feed) entity; if (feed.getLocations() != null || feed.getSla() != null || checkFeedClusterSLA(feed)) { for (Cluster cluster : feed.getClusters().getClusters()) { if (currentClusters.contains(cluster.getName())) { if (FeedHelper.getSLA(cluster, feed) != null) { LOG.debug("Adding feed:{} for monitoring", feed.getName()); MONITORING_JDBC_STATE_STORE.putMonitoredEntity(feed.getName(), EntityType.FEED.toString()); break; } } } } } if (entity.getEntityType() == EntityType.PROCESS){ Process process = (Process) entity; if (process.getSla() != null || checkProcessClusterSLA(process)){ for (org.apache.falcon.entity.v0.process.Cluster cluster : process.getClusters().getClusters()) { if (currentClusters.contains(cluster.getName())) { LOG.debug("Adding process:{} for monitoring", process.getName()); MONITORING_JDBC_STATE_STORE.putMonitoredEntity(process.getName(), EntityType.PROCESS.toString()); break; } } } } }
Source:
public void fetchLanguages() throws IOException { final String user = "testuser4"; final Repo repo = new MkRepo( new MkStorage.InFile(), user, new Coordinates.Simple(user, "testrepo4") ); MatcherAssert.assertThat(repo.languages(), Matchers.notNullValue()); }

Target:
public void fetchLanguages() throws IOException { final String user = "testuser4"; final Repo repo = new MkRepo( new MkStorage.InFile(), user, new Coordinates.Simple(user, "testrepo4") ); final Iterable<Language> languages = repo.languages(); MatcherAssert.assertThat(languages, Matchers.notNullValue()); MatcherAssert.assertThat( Lists.newArrayList(languages), Matchers.hasSize(Tv.THREE) ); }
Source:
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) { return size; } size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(1, year_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, month_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(4, dayOfMonth_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(5, dayOfWeek_.getNumber()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(6, hour_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(7, minute_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(8, second_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }

Target:
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(1, year_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(2, month_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(4, dayOfMonth_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(5, dayOfWeek_.getNumber()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(6, hour_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(7, minute_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeUInt32Size(8, second_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
Source:
private static NotificationCompat.Builder getNotificationBuilder(Context context, @StringRes int title, @StringRes int content) { NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle.setBigContentTitle(context.getString(title)); bigTextStyle.bigText(context.getString(content)); return new NotificationCompat.Builder(context) .setStyle(bigTextStyle) .setSmallIcon(R.drawable.ic_my_sites_24dp) .setColor(context.getResources().getColor(R.color.blue_wordpress)) .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.app_icon)) .setAutoCancel(true); }

Target:
private static NotificationCompat.Builder getNotificationBuilder(Context context, @StringRes int title, @StringRes int content) { NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle(); bigTextStyle.setBigContentTitle(context.getString(title)); bigTextStyle.bigText(context.getString(content)); return new NotificationCompat.Builder(context) .setStyle(bigTextStyle) .setContentTitle(context.getString(title)) .setContentText(context.getString(content)) .setSmallIcon(R.drawable.ic_my_sites_24dp) .setColor(context.getResources().getColor(R.color.blue_wordpress)) .setAutoCancel(true); }
Source:
private static String internalNameToCanonicalName(String typeName) { String canonicalName = typeName.replaceAll("\\$", "."); if (canonicalName.contains("<")) { canonicalName = canonicalName.substring(0, canonicalName.indexOf('<')); } return canonicalName; }

Target:
private static String internalNameToCanonicalName(String typeName) { return typeName.replaceAll("\\$", "."); }
Source:
public BitstreamResource updateBitstreamFormat(@PathVariable UUID uuid, HttpServletRequest request) throws SQLException { Context context = obtainContext(request); List<BitstreamFormat> bitstreamFormats = utils.constructBitstreamFormatList(request, context); if (bitstreamFormats.size() > 1) { throw new DSpaceBadRequestException("Only one bitstream format is allowed"); } BitstreamFormat bitstreamFormat = bitstreamFormats.stream().findFirst() .orElseThrow(() -> new DSpaceBadRequestException("The bitstream format doesn't exist " + "or the data cannot be resolved to a bitstream format.")); Bitstream bitstream = bitstreamService.find(context, uuid); if (bitstream == null) { throw new ResourceNotFoundException("Bitstream with id: " + uuid + " not found"); } if (bitstreamFormat.equals(bitstream.getFormat(context))) { throw new DSpaceBadRequestException("The provided bitstream format is already the bitstream format"); } bitstream.setFormat(context, bitstreamFormat); context.commit(); return (BitstreamResource) utils.getResourceRepository(BitstreamRest.CATEGORY, BitstreamRest.NAME) .wrapResource(converter.fromModel(context.reloadEntity(bitstream))); }

Target:
public BitstreamResource updateBitstreamFormat(@PathVariable UUID uuid, HttpServletRequest request) throws SQLException { Context context = obtainContext(request); List<BitstreamFormat> bitstreamFormats = utils.constructBitstreamFormatList(request, context); if (bitstreamFormats.size() > 1) { throw new DSpaceBadRequestException("Only one bitstream format is allowed"); } BitstreamFormat bitstreamFormat = bitstreamFormats.stream().findFirst() .orElseThrow(() -> new DSpaceBadRequestException("No valid bitstream format was provided")); Bitstream bitstream = bitstreamService.find(context, uuid); if (bitstream == null) { throw new ResourceNotFoundException("Bitstream with id: " + uuid + " not found"); } bitstream.setFormat(context, bitstreamFormat); context.commit(); return (BitstreamResource) utils.getResourceRepository(BitstreamRest.CATEGORY, BitstreamRest.NAME) .wrapResource(converter.fromModel(context.reloadEntity(bitstream))); }
Source:
public static char[] instantiateName(char[] name, InstantiationContext context, IBinding enclosingTemplate) { if (name == null || name.length == 0 || name[0] != '~') { return name; } String typename = new String(name).substring(1); ICPPTemplateParameterMap map = context.getParameterMap(); IBinding enclosing = enclosingTemplate; while (enclosing != null) { if (enclosing instanceof ICPPTemplateDefinition) { for (ICPPTemplateParameter param : ((ICPPTemplateDefinition) enclosing).getTemplateParameters()) { if (param instanceof ICPPTemplateTypeParameter) { if (param.getName().equals(typename)) { ICPPTemplateArgument arg = map.getArgument(param); if (arg instanceof CPPTemplateTypeArgument) { IType argType = arg.getTypeValue(); if (argType instanceof ICPPClassType) { StringBuilder result = new StringBuilder(); result.append('~'); result.append(((ICPPClassType) argType).getName()); return result.toString().toCharArray(); } } } } } } enclosing = enclosing.getOwner(); } return name; }

Target:
public static char[] instantiateName(char[] name, InstantiationContext context, IBinding enclosingTemplate) { if (name == null || name.length == 0 || name[0] != '~') { return name; } String typename = new String(name).substring(1); ICPPTemplateParameterMap map = context.getParameterMap(); IBinding enclosing = enclosingTemplate; while (enclosing != null) { if (enclosing instanceof ICPPTemplateDefinition) { for (ICPPTemplateParameter param : ((ICPPTemplateDefinition) enclosing).getTemplateParameters()) { if (param instanceof ICPPTemplateTypeParameter) { if (param.getName().equals(typename)) { ICPPTemplateArgument arg = map.getArgument(param); if (arg instanceof CPPTemplateTypeArgument) { IType argType = arg.getTypeValue(); argType = SemanticUtil.getNestedType(argType, CVTYPE | TDEF); if (argType instanceof ICPPClassType) { StringBuilder result = new StringBuilder(); result.append('~'); result.append(((ICPPClassType) argType).getName()); return result.toString().toCharArray(); } } } } } } enclosing = enclosing.getOwner(); } return name; }