auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAddObectSpecificData() throws UnsupportedEncodingException { bitstreamEventProcessor.configurationService = configurationService; when(configurationService.getProperty(any(String.class))).thenReturn("demo.dspace.org"); when(item.getHandle()).thenReturn("123456789/1"); String result = bitstreamEventProcessor.addObjectSpecificData("existing-string", item, bitstream); assertThat(result, is("existing-string&svc_dat=demo.dspace.org%2Fbitstream%2Fhandle%2F123456789%2F1%2F%3Fsequence%3D0" + "&rft_dat=Request")); }

Target:
public void testAddObectSpecificData() throws UnsupportedEncodingException { bitstreamEventProcessor.configurationService = configurationService; when(bitstream.getID()).thenReturn(UUID.fromString("455bd3cf-31d3-40db-b283-4106c47fc025")); String result = bitstreamEventProcessor.addObjectSpecificData("existing-string", bitstream); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fapi%2Fcore%2Fbitstreams%2F455bd3cf-31d3-40db" + "-b283-4106c47fc025%2Fcontent&rft_dat=Request")); }
Source:
private ReplicationSourceInterface addSource(ReplicationPeer peer) throws IOException { String id = peer.getId(); ReplicationSourceInterface src; synchronized (this.latestPaths) { src = this.sources.get(id); if (src == null) { src = createSource(id, peer); ReplicationSourceInterface newSrc = this.sources.putIfAbsent(id, src); if (newSrc != null) { src.terminate("Another beat us to the installation of an instance of " + id); src = newSrc; } } Map<String, NavigableSet<String>> walsByGroup = new HashMap<>(); this.walsById.put(id, walsByGroup); if (!this.latestPaths.isEmpty()) { for (Path logPath: this.latestPaths) { String name = logPath.getName(); NavigableSet<String> logs = new TreeSet<>(); logs.add(name); walsByGroup.put(AbstractFSWALProvider.getWALPrefixFromWALName(name), logs); if (src.isQueueStored()) { abortAndThrowIOExceptionWhenFail( () -> this.queueStorage.addWAL(server.getServerName(), id, name)); } src.enqueueLog(logPath); } } } src.startup(); return src; }

Target:
private ReplicationSourceInterface addSource(ReplicationPeer peer) throws IOException { String rpid = peer.getId(); ReplicationSourceInterface src; synchronized (this.latestPaths) { src = this.sources.get(rpid); if (src == null) { src = this.sources.putIfAbsent(rpid, createSource(rpid, peer)); } Map<String, NavigableSet<String>> walsByGroup = new HashMap<>(); this.walsById.put(rpid, walsByGroup); if (!this.latestPaths.isEmpty()) { for (Path logPath: this.latestPaths) { String name = logPath.getName(); NavigableSet<String> logs = new TreeSet<>(); logs.add(name); walsByGroup.put(AbstractFSWALProvider.getWALPrefixFromWALName(name), logs); if (src.isQueuePersisted()) { abortAndThrowIOExceptionWhenFail( () -> this.queueStorage.addWAL(server.getServerName(), rpid, name)); } src.enqueueLog(logPath); } } } src.startup(); return src; }
Source:
private Organization toOrganization(DbSession dbSession, String organizationUuid) { analysisMetadata.setOrganizationsEnabled(organizationFlags.isEnabled(dbSession)); Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByUuid(dbSession, organizationUuid); checkState(organizationDto.isPresent(), "Organization with uuid '%s' can't be found", organizationUuid); return Organization.from(organizationDto.get()); }

Target:
private Organization toOrganization(DbSession dbSession, String organizationUuid) { Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByUuid(dbSession, organizationUuid); checkState(organizationDto.isPresent(), "Organization with uuid '%s' can't be found", organizationUuid); return Organization.from(organizationDto.get()); }
Source:
public IpAddressMatcher(String ipAddress) { String ipAddr = ipAddress; if (ipAddress.indexOf('/') > 0) { String[] addressAndMask = StringUtils.split(ipAddress, "/"); ipAddr = addressAndMask[0]; nMaskBits = Integer.parseInt(addressAndMask[1]); } else { nMaskBits = -1; } requiredAddress = parseAddress(ipAddr); Assert.isTrue(requiredAddress.getAddress().length * 8 >= nMaskBits, String.format("Mask bits too long for this address %s", ipAddress)); }

Target:
public IpAddressMatcher(String ipAddress) { if (ipAddress.indexOf('/') > 0) { String[] addressAndMask = StringUtils.split(ipAddress, "/"); ipAddress = addressAndMask[0]; nMaskBits = Integer.parseInt(addressAndMask[1]); } else { nMaskBits = -1; } requiredAddress = parseAddress(ipAddress); Assert.isTrue(requiredAddress.getAddress().length * 8 >= nMaskBits, String.format("IP address %s is too short for bitmask of length %d", ipAddress, nMaskBits)); }
Source:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()){ StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); String preferredFiatCurrency = FiatCurrency.USD.getCode(); if ("coinmarketcap".equalsIgnoreCase(exchangeType)){ String apiKey = null; if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } if (st.hasMoreTokens()) { apiKey = st.nextToken(); } return new CoinmarketcapRateSource(apiKey, preferredFiatCurrency); } else if("xsgfix".equalsIgnoreCase(exchangeType)){ BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }

Target:
public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()){ StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); String preferredFiatCurrency = FiatCurrency.USD.getCode(); if("xsgfix".equalsIgnoreCase(exchangeType)){ BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } if (st.hasMoreTokens()) { preferredFiatCurrency = st.nextToken().toUpperCase(); } return new FixPriceRateSource(rate, preferredFiatCurrency); } } return null; }
Source:
protected boolean canDoAction() { if (!FeatureSupported.refreshLunSupported(getStoragePool().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getStorageDomain().getStorageType().isBlockDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); return false; } if (!checkStorageDomainStatusNotEqual(StorageDomainStatus.Locked)) { return false; } if (!checkLunsInStorageDomain(getParameters().getLunIds(), getStorageDomain())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_LUNS_NOT_PART_OF_STORAGE_DOMAIN); return false; } return true; }

Target:
protected boolean canDoAction() { if (!validate(new StoragePoolValidator(getStoragePool()).isUp())) { return false; } if (!FeatureSupported.refreshLunSupported(getStoragePool().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getStorageDomain().getStorageType().isBlockDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!checkLunsInStorageDomain(getParameters().getLunIds(), getStorageDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_LUNS_NOT_PART_OF_STORAGE_DOMAIN); } return true; }
Source:
public void setUp() throws Exception { super.init(); }

Target:
public void setUp() { super.init(); }
Source:
public void populateSpatial( WebClient client, @Nullable Geometry geometry, @Nullable BoundingBox boundingBox, @Nullable Polygon polygon, @Nullable PointRadius pointRadius, List<String> parameters) { if (Stream.of(geometry, boundingBox, polygon, pointRadius).filter(Objects::nonNull).count() > 1) { throw new IllegalArgumentException("Only one spatial search may be populated"); } if (geometry != null) { checkAndReplace(client, new WKTWriter().write(geometry), OpenSearchConstants.GEOMETRY, parameters); } else if (boundingBox != null) { checkAndReplace( client, Stream.of( boundingBox.getWest(), boundingBox.getSouth(), boundingBox.getEast(), boundingBox.getNorth()) .map(String::valueOf) .collect(Collectors.joining(OpenSearchConstants.BBOX_DELIMITER)), OpenSearchConstants.BBOX, parameters); } else if (polygon != null) { checkAndReplace( client, Arrays.stream(polygon.getCoordinates()) .flatMap(coordinate -> Stream.of(coordinate.y, coordinate.x)) .map(String::valueOf) .collect(Collectors.joining(OpenSearchConstants.POLYGON_LON_LAT_DELIMITER)), OpenSearchConstants.POLYGON, parameters); } else if (pointRadius != null) { checkAndReplace( client, String.valueOf(pointRadius.getLat()), OpenSearchConstants.LAT, parameters); checkAndReplace( client, String.valueOf(pointRadius.getLon()), OpenSearchConstants.LON, parameters); checkAndReplace( client, String.valueOf(pointRadius.getRadius()), OpenSearchConstants.RADIUS, parameters); } }

Target:
public void populateSpatial( WebClient client, @Nullable Geometry geometry, @Nullable BoundingBox boundingBox, @Nullable Polygon polygon, @Nullable PointRadius pointRadius, List<String> parameters) { if (Stream.of(geometry, boundingBox, polygon, pointRadius).filter(Objects::nonNull).count() > 1) { throw new IllegalArgumentException("Only one spatial search may be populated"); } if (geometry != null) { checkAndReplace( client, WKT_WRITER_THREAD_LOCAL.get().write(geometry), OpenSearchConstants.GEOMETRY, parameters); } else if (boundingBox != null) { checkAndReplace( client, Stream.of( boundingBox.getWest(), boundingBox.getSouth(), boundingBox.getEast(), boundingBox.getNorth()) .map(String::valueOf) .collect(Collectors.joining(OpenSearchConstants.BBOX_DELIMITER)), OpenSearchConstants.BBOX, parameters); } else if (polygon != null) { checkAndReplace( client, Arrays.stream(polygon.getCoordinates()) .flatMap(coordinate -> Stream.of(coordinate.y, coordinate.x)) .map(String::valueOf) .collect(Collectors.joining(OpenSearchConstants.POLYGON_LON_LAT_DELIMITER)), OpenSearchConstants.POLYGON, parameters); } else if (pointRadius != null) { checkAndReplace( client, String.valueOf(pointRadius.getLat()), OpenSearchConstants.LAT, parameters); checkAndReplace( client, String.valueOf(pointRadius.getLon()), OpenSearchConstants.LON, parameters); checkAndReplace( client, String.valueOf(pointRadius.getRadius()), OpenSearchConstants.RADIUS, parameters); } }
Source:
protected void executeCommand() { try { reconstructOpsSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpsSucceeded); if (!_isLastMaster && reconstructOpsSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(reconstructOpsSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }

Target:
protected void executeCommand() { try { reconstructOpSucceeded = reconstructMaster(); connectAndRefreshAllUpHosts(reconstructOpSucceeded); if (!_isLastMaster && reconstructOpSucceeded) { SearchParameters p = new SearchParameters( MessageFormat.format(DesktopsInStoragePoolQuery, getStoragePool().getname()), SearchType.VM); p.setMaxCount(Integer.MAX_VALUE); @SuppressWarnings("unchecked") List<VM> vmsInPool = (List<VM>) Backend.getInstance() .runInternalQuery(VdcQueryType.Search, p).getReturnValue(); VmCommand.updateVmInSpm(getStoragePool().getId(), vmsInPool); } setSucceeded(reconstructOpSucceeded); } finally { Backend.getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.MarkPoolInReconstructMode, new MarkPoolInReconstructModeVDSCommandParameters(getStoragePoolId() .getValue(), ReconstructMarkAction.ClearCache)); } }
Source:
private MenuItem[] createBoardsMenu() { MenuItem save = new MenuItem("Save"); save.setOnAction(e -> onBoardSave()); Menu open = new Menu("Open"); Menu delete = new Menu("Delete"); ui.registerEvent((BoardSavedEventHandler) e -> { open.getItems().clear(); delete.getItems().clear(); Map<String, List<String>> boards = prefs.getAllBoards(); for (Map.Entry<String, List<String>> entry : boards.entrySet()) { final String boardName = entry.getKey(); final List<String> filterSet = entry.getValue(); MenuItem openItem = new MenuItem(); openItem.setOnAction(e1 -> onBoardOpen(boardName, filterSet)); open.getItems().add(openItem); MenuItem deleteItem = new MenuItem(boardName); deleteItem.setOnAction(e1 -> onBoardDelete(boardName)); delete.getItems().add(deleteItem); } }); return new MenuItem[] {save, open, delete}; }

Target:
private MenuItem[] createBoardsMenu() { MenuItem save = new MenuItem("Save"); save.setOnAction(e -> onBoardSave()); Menu open = new Menu("Open"); Menu delete = new Menu("Delete"); ui.registerEvent((BoardSavedEventHandler) e -> { open.getItems().clear(); delete.getItems().clear(); Map<String, List<String>> boards = prefs.getAllBoards(); for (Map.Entry<String, List<String>> entry : boards.entrySet()) { final String boardName = entry.getKey(); final List<String> filterSet = entry.getValue(); MenuItem openItem = new MenuItem(boardName); openItem.setOnAction(e1 -> onBoardOpen(boardName, filterSet)); open.getItems().add(openItem); MenuItem deleteItem = new MenuItem(boardName); deleteItem.setOnAction(e1 -> onBoardDelete(boardName)); delete.getItems().add(deleteItem); } }); return new MenuItem[] {save, open, delete}; }
Source:
public ReferenceBinding getMemberType(char[] typeName) { if (!isPrototype()) { ReferenceBinding memberType = this.prototype.getMemberType(typeName); return memberType == null ? null : this.environment.createMemberType(memberType, this); } ReferenceBinding[] members = sortedMemberTypes(); if ((this.tagBits & TagBits.HasUnresolvedMemberTypes) != 0) { for (int i = members.length; --i >= 0;) { ReferenceBinding memberType = members[i]; if (memberType instanceof UnresolvedReferenceBinding) { char[] name = memberType.sourceName; int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; if (name.length == (prefixLength + typeName.length)) if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) return members[i] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } else if (CharOperation.equals(typeName, memberType.sourceName)) { return memberType; } } return null; } int memberTypeIndex = unresolvedTypesAwareBinarySearch(typeName, members); if (memberTypeIndex >= 0) { ReferenceBinding memberType = members[memberTypeIndex]; if (memberType instanceof UnresolvedReferenceBinding) { return members[memberTypeIndex] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } return memberType; } return null; }

Target:
public ReferenceBinding getMemberType(char[] typeName) { if (!isPrototype()) { ReferenceBinding memberType = this.prototype.getMemberType(typeName); return memberType == null ? null : this.environment.createMemberType(memberType, this); } ReferenceBinding[] members = sortedMemberTypes(); if (!this.memberTypesSorted) { for (int i = members.length; --i >= 0;) { ReferenceBinding memberType = members[i]; if (memberType instanceof UnresolvedReferenceBinding) { char[] name = memberType.sourceName; int prefixLength = this.compoundName[this.compoundName.length - 1].length + 1; if (name.length == (prefixLength + typeName.length)) if (CharOperation.fragmentEquals(typeName, name, prefixLength, true)) return members[i] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } else if (CharOperation.equals(typeName, memberType.sourceName)) { return memberType; } } return null; } int memberTypeIndex = unresolvedTypesAwareBinarySearch(typeName, members); if (memberTypeIndex >= 0) { ReferenceBinding memberType = members[memberTypeIndex]; if (memberType instanceof UnresolvedReferenceBinding) { return members[memberTypeIndex] = (ReferenceBinding) resolveType(memberType, this.environment, false ); } return memberType; } return null; }
Source:
public void afterClass() throws Exception { String testClassName = this.getShortClassName(); System.out.println("AfterClass: " + testClassName + " of TestListenerCallback called."); if (_manager != null && _manager.isConnected()) { _manager.disconnect(); } TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }

Target:
public void afterClass() throws Exception { if (_manager != null && _manager.isConnected()) { _manager.disconnect(); } TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }
Source:
private Hashtable<String, String> convertMapToHashTable(Map<String, String> map) { Hashtable<String, String> table = new Hashtable<>(); for (Map.Entry<String, String> stringStringEntry : map.entrySet()) { Map.Entry pair = (Map.Entry) stringStringEntry; if (pair.getValue() != null) { table.put(pair.getKey().toString(), pair.getValue().toString()); } } return table; }

Target:
private Hashtable<String, String> convertMapToHashTable(Map<String, String> map) { Hashtable<String, String> table = new Hashtable<>(); map.forEach( (key, value) -> { if (value != null) { table.put(key.toString(), value.toString()); } }); return table; }
Source:
public static Diamond3iIterable.Builder shell(Vector3ic origin, int radius) { return new Diamond3iIterable.Builder(origin, radius).start(radius - 1); }

Target:
public static Diamond3iIterable.Builder shell(Vector3ic origin, int radius) { return new Diamond3iIterable.Builder(origin, radius).start(radius); }
Source:
private Predicate createResourceLinkPathPredicate(FhirContext theContext, String theParamName, From<?, ? extends ResourceLink> theFrom, String theResourceType) { RuntimeResourceDefinition resourceDef = theContext.getResourceDefinition(theResourceType); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); List<String> path = param.getPathsSplit(); path = new ArrayList<>(path); for (int i = 0; i < path.size(); i++) { String nextPath = trim(path.get(i)); if (!nextPath.contains(theResourceType + ".")) { path.remove(i); i--; } } return theFrom.get("mySourcePath").in(path); }

Target:
private Predicate createResourceLinkPathPredicate(FhirContext theContext, String theParamName, From<?, ? extends ResourceLink> theFrom, String theResourceType) { RuntimeResourceDefinition resourceDef = theContext.getResourceDefinition(theResourceType); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); List<String> path = param.getPathsSplit(); path = new ArrayList<>(path); ListIterator<String> iter = path.listIterator(); while (iter.hasNext()) { String nextPath = trim(iter.next()); if (!nextPath.contains(theResourceType + ".")) { iter.remove(); } } return theFrom.get("mySourcePath").in(path); }
Source:
@Override public HttpRequest filter(HttpRequest request) throws HttpException { long now = currentTimeSeconds(); ClientSecret client = ClientSecret.create( credentialsSupplier.get().identity, credentialsSupplier.get().credential, resource == null ? "" : resource, ON_SPACE.join(scopes.forRequest(request)), now + tokenDuration ); Token token = tokenCache.getUnchecked(client); String authorization = String.format("%s %s", token.tokenType(), token.accessToken()); return request.toBuilder().addHeader("Authorization", authorization).build(); }

Target:
@Override public HttpRequest filter(HttpRequest request) throws HttpException { long now = currentTimeSeconds(); ClientSecret client = ClientSecret.create( credentialsSupplier.get().identity, credentialsSupplier.get().credential, resource == null ? "" : resource, scopes == null ? null : ON_SPACE.join(scopes.forRequest(request)), now + tokenDuration ); Token token = tokenCache.getUnchecked(client); String authorization = String.format("%s %s", token.tokenType(), token.accessToken()); return request.toBuilder().addHeader("Authorization", authorization).build(); }
Source:
public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= MPConfig.getInstance(activity.getApplicationContext()).getMinimumSessionDuration() && sessionLength < MPConfig.getInstance(activity.getApplicationContext()).getSessionTimeoutDuration()) { DecimalFormat df = new DecimalFormat("#.0"); String sessionLengthString = df.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS, 1); mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS_LENGTH, Double.valueOf(sessionLengthString)); mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.flush(); } } }, CHECK_DELAY); }

Target:
public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= MPConfig.getInstance(activity.getApplicationContext()).getMinimumSessionDuration() && sessionLength < MPConfig.getInstance(activity.getApplicationContext()).getSessionTimeoutDuration()) { DecimalFormat df = new DecimalFormat("#.0"); String sessionLengthString = df.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.flush(); } } }, CHECK_DELAY); }
Source:
public Response approve(@PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label, @QueryParam("enableChannels") @DefaultValue("true") @ApiParam(value = "enable channels", required = false) boolean enableChannels) { ThingUID thingUIDObject = new ThingUID(thingUID); List<DiscoveryResult> results = inbox.get(new InboxFilterCriteria(thingUIDObject, null)); if (results.isEmpty()) { return Response.status(Status.NOT_FOUND).build(); } Thing thing = inbox.approve(thingUIDObject, label != null && !label.isEmpty() ? label : null); DiscoveryResult result = results.get(0); thingSetupManager.addItems(label, new ArrayList<String>(), thing, result.getThingTypeUID()); if (enableChannels){ thingSetupManager.enableChannels(thing, result.getThingTypeUID()); } return Response.ok().build(); }

Target:
public Response approve(@PathParam("thingUID") @ApiParam(value = "thingUID", required = true) String thingUID, @ApiParam(value = "thing label") String label, @QueryParam("enableChannels") @DefaultValue("true") @ApiParam(value = "enable channels", required = false) boolean enableChannels) { ThingUID thingUIDObject = new ThingUID(thingUID); String notEmptyLabel = label != null && !label.isEmpty() ? label : null; Thing thing = null; try { thing = inbox.approve(thingUIDObject, notEmptyLabel); } catch (IllegalArgumentException e){ return Response.status(Status.NOT_FOUND).build(); } thingSetupManager.createGroupItems(notEmptyLabel, new ArrayList<String>(), thing, thing.getThingTypeUID()); if (enableChannels) { thingSetupManager.enableChannels(thing, thing.getThingTypeUID()); } return Response.ok().build(); }
Source:
private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { String timeColumnName = validationConfig.getTimeColumnName(); if(timeColumnName == null) { throw new IllegalStateException("Must provide valid timeColumnName in tableConfig"); } String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equalsIgnoreCase(peerSegmentDownloadScheme) && !"https".equalsIgnoreCase(peerSegmentDownloadScheme)) { throw new IllegalStateException("Invalid value '" + peerSegmentDownloadScheme + "' for peerSegmentDownloadScheme. Must be one of http nor https" ); } } } }

Target:
private static void validateValidationConfig(TableConfig tableConfig) { SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); if (validationConfig != null) { if (tableConfig.getTableType() == TableType.REALTIME && validationConfig.getTimeColumnName() == null) { throw new IllegalStateException("Must provide time column in real-time table config"); } String peerSegmentDownloadScheme = validationConfig.getPeerSegmentDownloadScheme(); if (peerSegmentDownloadScheme != null) { if (!"http".equalsIgnoreCase(peerSegmentDownloadScheme) && !"https".equalsIgnoreCase(peerSegmentDownloadScheme)) { throw new IllegalStateException("Invalid value '" + peerSegmentDownloadScheme + "' for peerSegmentDownloadScheme. Must be one of http nor https" ); } } } }
Source:
public void testAllNodesDieOnRequest() throws Exception { CountDownLatch nodeStopLatch = new CountDownLatch(3); Ignite srv1 = startGrid(0); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv1, "ctx")).io(), 0, nodeStopLatch); Ignite srv2 = startGrid(1); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv2, "ctx")).io(), 1, nodeStopLatch); Ignite srv3 = startGrid(2); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv3, "ctx")).io(), 2, nodeStopLatch); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); clientMode = true; Ignite cl1 = startClientGrid(4); try { cl1.cache(DEFAULT_CACHE_NAME).get(1); } catch (Exception e) { e.printStackTrace(); } nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 3, actual is " + result, 3, result); }

Target:
public void testAllNodesDieOnRequest() throws Exception { CountDownLatch nodeStopLatch = new CountDownLatch(3); Ignite srv1 = startGrid(0); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv1, "ctx")).io(), 0, nodeStopLatch); Ignite srv2 = startGrid(1); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv2, "ctx")).io(), 1, nodeStopLatch); Ignite srv3 = startGrid(2); replaceWithStoppingMappingRequestListener( ((GridKernalContext)U.field(srv3, "ctx")).io(), 2, nodeStopLatch); srv3.cache(DEFAULT_CACHE_NAME).put( 1, new Organization(1, "Microsoft", "One Microsoft Way Redmond, WA 98052-6399, USA")); Ignite cl1 = startClientGrid(4); try { cl1.cache(DEFAULT_CACHE_NAME).get(1); } catch (Exception e) { e.printStackTrace(); } nodeStopLatch.await(5_000, TimeUnit.MILLISECONDS); int result = mappingReqsCounter.get(); assertEquals("Expected requests count is 3, actual is " + result, 3, result); }
Source:
public void testBlockOperations() throws Exception { String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt(); String blockBlob = "myblockblob-" + new SecureRandom().nextInt(); String A = "A"; String B = "B"; String C = "C"; String blockIdA = BaseEncoding.base64().encode((blockBlob + "-" + A).getBytes()); String blockIdB = BaseEncoding.base64().encode((blockBlob + "-" + B).getBytes()); String blockIdC = BaseEncoding.base64().encode((blockBlob + "-" + C).getBytes()); getApi().createContainer(blockContainer); getApi().putBlock(blockContainer, blockBlob, blockIdA, new ByteArrayPayload(A.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdB, new ByteArrayPayload(B.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdC, new ByteArrayPayload(C.getBytes())); getApi().putBlockList(blockContainer, blockBlob, Arrays.asList(blockIdA, blockIdB, blockIdC)); ListBlobBlocksResponse blocks = getApi().getBlockList(blockContainer, blockBlob); assertEquals(3, blocks.getBlocks().size()); assertEquals(blockIdA, blocks.getBlocks().get(0).getBlockName()); assertEquals(blockIdB, blocks.getBlocks().get(1).getBlockName()); assertEquals(blockIdC, blocks.getBlocks().get(2).getBlockName()); assertEquals(1, blocks.getBlocks().get(0).getContentLength()); assertEquals(1, blocks.getBlocks().get(1).getContentLength()); assertEquals(1, blocks.getBlocks().get(2).getContentLength()); getApi().deleteContainer(blockContainer); }

Target:
public void testBlockOperations() throws Exception { String blockContainer = CONTAINER_PREFIX + new SecureRandom().nextInt(); String blockBlob = "myblockblob-" + new SecureRandom().nextInt(); String A = "A"; String B = "B"; String C = "C"; String blockIdA = BaseEncoding.base64().encode((blockBlob + "-" + A).getBytes()); String blockIdB = BaseEncoding.base64().encode((blockBlob + "-" + B).getBytes()); String blockIdC = BaseEncoding.base64().encode((blockBlob + "-" + C).getBytes()); getApi().createContainer(blockContainer); getApi().putBlock(blockContainer, blockBlob, blockIdA, Payloads.newByteArrayPayload(A.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdB, Payloads.newByteArrayPayload(B.getBytes())); getApi().putBlock(blockContainer, blockBlob, blockIdC, Payloads.newByteArrayPayload(C.getBytes())); getApi().putBlockList(blockContainer, blockBlob, Arrays.asList(blockIdA, blockIdB, blockIdC)); ListBlobBlocksResponse blocks = getApi().getBlockList(blockContainer, blockBlob); assertEquals(3, blocks.getBlocks().size()); assertEquals(blockIdA, blocks.getBlocks().get(0).getBlockName()); assertEquals(blockIdB, blocks.getBlocks().get(1).getBlockName()); assertEquals(blockIdC, blocks.getBlocks().get(2).getBlockName()); assertEquals(1, blocks.getBlocks().get(0).getContentLength()); assertEquals(1, blocks.getBlocks().get(1).getContentLength()); assertEquals(1, blocks.getBlocks().get(2).getContentLength()); getApi().deleteContainer(blockContainer); }
Source:
ConsumerRateHistory decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); RateHistoryDecoder body = new RateHistoryDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.templateId() != RateHistoryDecoder.TEMPLATE_ID) { throw new IllegalStateException(String.format("RateHistoryDecoder TEMPLATE_ID=%d does not match encoded TEMPLATE_ID=%d", RateHistoryDecoder.TEMPLATE_ID, header.templateId())); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); ConsumerRateHistory result = new ConsumerRateHistory(); for (RateHistoryDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); List<Double> rates = new ArrayList<>(); for (RateHistoryDecoder.SubscriptionsDecoder.RatesDecoder ratesDecoder : subscriptionDecoder.rates()) { rates.add(ratesDecoder.rate()); } subscriptionIds.getSubscriptionId(id) .ifPresent(subscriptionId -> { result.setRateHistory(subscriptionId.getSubscriptionName(), new RateHistory(rates)); }); } return result; }

Target:
ConsumerRateHistory decode(byte[] data) { MessageHeaderDecoder header = new MessageHeaderDecoder(); RateHistoryDecoder body = new RateHistoryDecoder(); UnsafeBuffer buffer = new UnsafeBuffer(data); header.wrap(buffer, 0); if (header.templateId() != RateHistoryDecoder.TEMPLATE_ID) { throw new IllegalStateException(String.format("RateHistoryDecoder TEMPLATE_ID=%d does not match encoded TEMPLATE_ID=%d", RateHistoryDecoder.TEMPLATE_ID, header.templateId())); } body.wrap(buffer, header.encodedLength(), header.blockLength(), header.version()); ConsumerRateHistory result = new ConsumerRateHistory(); for (RateHistoryDecoder.SubscriptionsDecoder subscriptionDecoder : body.subscriptions()) { long id = subscriptionDecoder.id(); List<Double> rates = StreamSupport.stream(subscriptionDecoder.rates().spliterator(), false) .map(RatesDecoder::rate) .collect(Collectors.toList()); subscriptionIds.getSubscriptionId(id) .ifPresent(subscriptionId -> { result.setRateHistory(subscriptionId.getSubscriptionName(), new RateHistory(rates)); }); } return result; }
Source:
public static List<CredentialsProvider> enabled(Object context) { List<CredentialsProvider> providers = new ArrayList<>(ExtensionList.lookup(CredentialsProvider.class)); providers.removeIf(p -> !p.isEnabled(context)); return providers; }

Target:
public static List<CredentialsProvider> enabled(Object context) { return ExtensionList.lookup(CredentialsProvider.class) .stream() .filter(p -> p.isEnabled(context)) .collect(Collectors.toList()); }
Source:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); boolean isDefaultGiven = true; try { Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions == null) { securityDefinitions = new HashMap<>(); } OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { isDefaultGiven = false; } return isDefaultGiven; } catch (NullPointerException e){ isDefaultGiven = false; return isDefaultGiven; } }

Target:
private boolean isDefaultGiven(String swaggerContent) throws APIManagementException { Swagger swagger = getSwagger(swaggerContent); Map<String, SecuritySchemeDefinition> securityDefinitions = swagger.getSecurityDefinitions(); if (securityDefinitions == null) { return false; } OAuth2Definition checkDefault = (OAuth2Definition) securityDefinitions.get(SWAGGER_SECURITY_SCHEMA_KEY); if (checkDefault == null) { return false; } return true; }
Source:
private HttpHeaders changeResponseHeader(String headerName, Object headerValue) throws RestServiceException { try { responseMetadataChangeLock.lockInterruptibly(); verifyResponseAlive(); logger.trace("Changing response metadata for channel {}", ctx.channel()); return responseMetadata.headers().set(headerName, headerValue); } catch (InterruptedException e) { logger.error("Internal metadata change lock acquiring interrupted. Throwing exception.. (channel {})", ctx.channel(), e); nettyMetrics.responseMetadataWriteLockInterrupted.inc(); throw new RestServiceException("Response metadata change synchronization was interrupted", e, RestServiceErrorCode.OperationInterrupted); } finally { if (channelWriteLock.isHeldByCurrentThread()) { channelWriteLock.unlock(); } } }

Target:
private HttpHeaders changeResponseHeader(String headerName, Object headerValue) throws RestServiceException { try { responseMetadataChangeLock.lockInterruptibly(); verifyResponseAlive(); logger.trace("Changing header to for channel {}", headerName, headerValue, ctx.channel()); return responseMetadata.headers().set(headerName, headerValue); } catch (InterruptedException e) { nettyMetrics.responseMetadataWriteLockInterruptedError.inc(); throw new RestServiceException("Internal metadata change lock acquiring interrupted. Response header not changed", e, RestServiceErrorCode.OperationInterrupted); } catch (RestServiceException e) { nettyMetrics.deadResponseAccessError.inc(); throw e; } finally { if (channelWriteLock.isHeldByCurrentThread()) { channelWriteLock.unlock(); } } }
Source:
public void testExtraction() { ResourceGroupIdTemplate template = new ResourceGroupIdTemplate("test.pipeline.${pipeline}.${USER}"); ResourceGroupId expected = new ResourceGroupId(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("test"), "pipeline"), "testpipeline"), "user"); Pattern sourcePattern = Pattern.compile("scheduler.important.(?<pipeline>([^\\[]*)).*"); StaticSelector selector = new StaticSelector(Optional.empty(), Optional.of(sourcePattern), Optional.empty(), Optional.empty(), template); SelectionCriteria context = new SelectionCriteria(true, "user", Optional.of("scheduler.important.testpipeline[5]"), ImmutableSet.of(), 1, Optional.empty()); assertEquals(selector.match(context).map(SelectionContext::getResourceGroupId), Optional.of(expected)); }

Target:
public void testExtraction() { ResourceGroupIdTemplate template = new ResourceGroupIdTemplate("test.pipeline.job_${pipeline}_user:${USER}.${USER}"); ResourceGroupId expected = new ResourceGroupId(new ResourceGroupId(new ResourceGroupId(new ResourceGroupId("test"), "pipeline"), "job_testpipeline_user:user"), "user"); Pattern sourcePattern = Pattern.compile("scheduler.important.(?<pipeline>[^\\[]*).*"); StaticSelector selector = new StaticSelector(Optional.empty(), Optional.of(sourcePattern), Optional.empty(), Optional.empty(), template); SelectionCriteria context = new SelectionCriteria(true, "user", Optional.of("scheduler.important.testpipeline[5]"), ImmutableSet.of(), 1, Optional.empty()); assertEquals(selector.match(context).map(SelectionContext::getResourceGroupId), Optional.of(expected)); }
Source:
public Collection<TurnCostTableEntry> analyzeTurnRelation(OSMTurnRelation turnRelation) { Map<Long, TurnCostTableEntry> entries = new LinkedHashMap<>(); for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { if ((turnRelation == null) || ((turnRelation != null) && encoder.acceptsRelation(turnRelation))) { for (TurnCostTableEntry entry : analyzeTurnRelation(encoder, turnRelation)) { TurnCostTableEntry oldEntry = entries.get(entry.getItemId()); if (oldEntry != null) { oldEntry.flags |= entry.flags; } else { entries.put(entry.getItemId(), entry); } } } } return entries.values(); }

Target:
public Collection<TurnCostTableEntry> analyzeTurnRelation(OSMTurnRelation turnRelation) { Map<Long, TurnCostTableEntry> entries = new LinkedHashMap<>(); for (FlagEncoder encoder : encodingManager.fetchEdgeEncoders()) { if (encoder.acceptsTurnRelation(turnRelation)) { for (TurnCostTableEntry entry : analyzeTurnRelation(encoder, turnRelation)) { TurnCostTableEntry oldEntry = entries.get(entry.getItemId()); if (oldEntry != null) { oldEntry.flags |= entry.flags; } else { entries.put(entry.getItemId(), entry); } } } } return entries.values(); }
Source:
public WeldContainer initialize() { ResourceLoader resourceLoader = new WeldSEResourceLoader(); if (resourceLoader.getResource(WeldSEUrlDeployment.BEANS_XML) == null) { throw new IllegalStateException("Missing beans.xml file in META-INF!"); } final CDI11Bootstrap bootstrap; try { bootstrap = (CDI11Bootstrap) resourceLoader.classForName(BOOTSTRAP_IMPL_CLASS_NAME).newInstance(); } catch (InstantiationException ex) { throw new IllegalStateException(ERROR_LOADING_WELD_BOOTSTRAP_EXC_MESSAGE, ex); } catch (IllegalAccessException ex) { throw new IllegalStateException(ERROR_LOADING_WELD_BOOTSTRAP_EXC_MESSAGE, ex); } Deployment deployment = createDeployment(resourceLoader, bootstrap); if (strategy.getClass().getName().equals(JANDEX_ENABLED_DISCOVERY_STRATEGY_CLASS_STRING)) { Class<?> clazz = Reflections.loadClass(WELD_SE_CLASS_FILE_SERVICES_CLASS_NAME, resourceLoader); ClassFileServices classFileServices = null; try { Method declaredMethod = strategy.getClass().getDeclaredMethod("getCindex"); classFileServices = (ClassFileServices) clazz.getConstructor(Object.class).newInstance(declaredMethod.invoke(strategy)); } catch (Exception e) { throw new IllegalStateException("Unable to instantiate WeldSEClassFileServices even when the jandex discovery strategy was instantiated", e); } deployment.getServices().add(ClassFileServices.class, classFileServices); } bootstrap.startContainer(Environments.SE, deployment); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); this.shutdownManager = new ShutdownManager(bootstrap); WeldContainer container = getInstanceByType(bootstrap.getManager(deployment.loadBeanDeploymentArchive(WeldContainer.class)), WeldContainer.class); container.event().select(ContainerInitialized.class).fire(new ContainerInitialized()); return container; }

Target:
public WeldContainer initialize() { ResourceLoader resourceLoader = new WeldSEResourceLoader(); if (resourceLoader.getResource(WeldSEUrlDeployment.BEANS_XML) == null) { throw new IllegalStateException("Missing beans.xml file in META-INF!"); } final CDI11Bootstrap bootstrap; try { bootstrap = (CDI11Bootstrap) resourceLoader.classForName(BOOTSTRAP_IMPL_CLASS_NAME).newInstance(); } catch (InstantiationException ex) { throw new IllegalStateException(ERROR_LOADING_WELD_BOOTSTRAP_EXC_MESSAGE, ex); } catch (IllegalAccessException ex) { throw new IllegalStateException(ERROR_LOADING_WELD_BOOTSTRAP_EXC_MESSAGE, ex); } Deployment deployment = createDeployment(resourceLoader, bootstrap); bootstrap.startContainer(Environments.SE, deployment); bootstrap.startInitialization(); bootstrap.deployBeans(); bootstrap.validateBeans(); bootstrap.endInitialization(); this.shutdownManager = new ShutdownManager(bootstrap); WeldContainer container = getInstanceByType(bootstrap.getManager(deployment.loadBeanDeploymentArchive(WeldContainer.class)), WeldContainer.class); container.event().select(ContainerInitialized.class).fire(new ContainerInitialized()); return container; }
Source:
public static void setUp() throws InterruptedException, TimeoutException, IOException { operations.add(HTTP_SERVER_ADDRESS); administration.reloadIfRequired(); operations.add(HOST_ADDRESS); operations.add(HOST_TBR_ADDRESS); administration.reloadIfRequired(); }

Target:
public static void setUp() throws InterruptedException, TimeoutException, IOException { operations.add(HTTP_SERVER_ADDRESS); operations.add(HOST_ADDRESS); operations.add(HOST_TBR_ADDRESS); administration.reloadIfRequired(); }
Source:
public MavenProject resolveParentProject(final MavenProject child, IProgressMonitor monitor) throws CoreException { return context().execute(child, new ICallable<MavenProject>() { public MavenProject call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { return resolveParentProject(context.getRepositorySession(), child, context.getExecutionRequest() .getProjectBuildingRequest()); } }, monitor); }

Target:
public MavenProject resolveParentProject(final MavenProject child, IProgressMonitor monitor) throws CoreException { return context().execute(child, (context, pm) -> resolveParentProject(context.getRepositorySession(), child, context.getExecutionRequest().getProjectBuildingRequest()), monitor); }
Source:
private PathMatcher folderMatcher() { return it -> isSourceFolder(it); }

Target:
private PathMatcher folderMatcher() { return it -> isDirectory(it); }
Source:
private Filter createLowerBoundFilter(Object value, boolean inclusive) { Filter filter = createBoundFilter(Bound.LOWER, value, inclusive); filter.setBooleanOperator(booleanOperator); return filter; }

Target:
private Filter createLowerBoundFilter(Object value, boolean inclusive) { return createBoundFilter(Bound.LOWER, value, inclusive, booleanOperator); }
Source:
public int compareTo(final DayProfileAction other) { return other.scriptLogicalName.compareTo(this.scriptLogicalName); }

Target:
public int compareTo(final DayProfileAction other) { final int rank = this.scriptSelector.compareTo(other.scriptSelector); if (rank != 0) { return rank; } return this.startTime.compareTo(other.startTime); }
Source:
protected static URI createAnnouncementLocation(URI baseUri, String nodeId) { return HttpUriBuilder.uriBuilderFrom(baseUri) .appendPath("/v1/announcement") .appendPath(nodeId) .build(); }

Target:
static URI createAnnouncementLocation(URI baseUri, String nodeId) { return uriBuilderFrom(baseUri) .appendPath("/v1/announcement") .appendPath(nodeId) .build(); }
Source:
private void evaluate(String target, Map<String, BucketPoint> queryResults, ConditionEvaluator evaluator) { Map<String, String> preparedCondition = null; try { preparedCondition = evaluator.prepare(queryResults); } catch (Exception e) { log.debugf("Could not prepare evaluation, Skipping due to [%s]", e.getMessage()); } if (evaluator.evaluate()) { try { Data externalData = Data.forString(externalCondition.getTenantId(), externalCondition.getDataId(), System.currentTimeMillis(), preparedCondition.toString()); if (log.isDebugEnabled()) { log.debug("Sending External Condition Data to Alerting! " + externalData); } alertsService.sendData(Collections.singleton(externalData)); } catch (Exception e) { log.error("Failed to send external data to alerts system.", e); } } }

Target:
private void evaluate(String target, Map<String, BucketPoint> queryResults, ConditionEvaluator evaluator) { Map<String, String> preparedCondition = null; try { preparedCondition = evaluator.prepare(queryResults); } catch (Exception e) { log.debugf("Could not prepare evaluation, Skipping due to [%s]", e.getMessage()); } if (evaluator.evaluate()) { try { Event externalEvent = new Event(externalCondition.getTenantId(), UUID.randomUUID().toString(), System.currentTimeMillis(), externalCondition.getDataId(), TAG_EXTERNAL_CONDITION_VALUE, preparedCondition.toString()); log.debugf("Sending External Condition Event to Alerting %s", externalEvent); alertsService.sendEvents(Collections.singleton(externalEvent)); } catch (Exception e) { log.error("Failed to send external [ALL] event to alerts system.", e); } } }
Source:
public String addEndpointRegistryEntry(EndpointRegistryEntry registryEntry) throws EndpointRegistryException { if (StringUtils.isEmpty(registryEntry.getDisplayName())) { registryEntry.setDisplayName(registryEntry.getEntryName()); } if (registryDAO.isRegistryEntryNameExists(registryEntry, false)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry Entry with name '" + registryEntry.getEntryName() + "' already exists"); } else if (registryDAO.isRegistryEntryNameExists(registryEntry, true)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry Entry with display name '" + registryEntry.getDisplayName() + "' already exists"); } return registryDAO.addEndpointRegistryEntry(registryEntry, username); }

Target:
public String addEndpointRegistryEntry(EndpointRegistryEntry registryEntry) throws EndpointRegistryException { if (registryDAO.isRegistryEntryNameExists(registryEntry, false)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry Entry with name '" + registryEntry.getEntryName() + "' already exists"); } else if (registryDAO.isRegistryEntryNameExists(registryEntry, true)) { EndpointRegistryUtil.raiseResourceAlreadyExistsException("Endpoint Registry Entry with display name '" + registryEntry.getDisplayName() + "' already exists"); } return registryDAO.addEndpointRegistryEntry(registryEntry, username); }