auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); String expectedAudiences = filterConfig.getInitParameter(KNOX_TOKEN_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } String queryParamName = filterConfig.getInitParameter(KNOX_TOKEN_QUERY_PARAM_NAME); if (queryParamName != null) { paramName = queryParamName; } String verificationPEM = filterConfig.getInitParameter(TOKEN_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } String oidcjwksurl = filterConfig.getInitParameter(JWKS_URL); if (oidcjwksurl != null) { expectedJWKSUrl = oidcjwksurl; } String oidcPartyPclaim = filterConfig.getInitParameter(TOKEN_PRINCIPAL_CLAIM); if (oidcPartyPclaim != null) { expectedPrincipalClaim = oidcPartyPclaim; } configureExpectedParameters(filterConfig); }

Target:
public void init( FilterConfig filterConfig ) throws ServletException { super.init(filterConfig); String expectedAudiences = filterConfig.getInitParameter(KNOX_TOKEN_AUDIENCES); if (expectedAudiences != null) { audiences = parseExpectedAudiences(expectedAudiences); } String queryParamName = filterConfig.getInitParameter(KNOX_TOKEN_QUERY_PARAM_NAME); if (queryParamName != null) { paramName = queryParamName; } String oidcjwksurl = filterConfig.getInitParameter(JWKS_URL); if (oidcjwksurl != null) { expectedJWKSUrl = oidcjwksurl; } String oidcPrincipalclaim = filterConfig.getInitParameter(TOKEN_PRINCIPAL_CLAIM); if (oidcPrincipalclaim != null) { expectedPrincipalClaim = oidcPrincipalclaim; } String verificationPEM = filterConfig.getInitParameter(TOKEN_VERIFICATION_PEM); if (verificationPEM != null) { publicKey = CertificateUtils.parseRSAPublicKey(verificationPEM); } configureExpectedParameters(filterConfig); }
Source:
public void testDefault() throws Exception { checkConfig.addAttribute("allowLineBreaks", "false"); final String[] expected = { "5:14: " + getCheckMessage(MSG_KEY, "."), "6:12: " + getCheckMessage(MSG_KEY, "."), "29:14: " + getCheckMessage(MSG_KEY, "-"), "29:21: " + getCheckMessage(MSG_KEY, "+"), "31:15: " + getCheckMessage(MSG_KEY, "++"), "31:22: " + getCheckMessage(MSG_KEY, "--"), "111:22: " + getCheckMessage(MSG_KEY, "!"), "112:23: " + getCheckMessage(MSG_KEY, "~"), "129:24: " + getCheckMessage(MSG_KEY, "."), "132:11: " + getCheckMessage(MSG_KEY, "."), "136:12: " + getCheckMessage(MSG_KEY, "."), "264:2: " + getCheckMessage(MSG_KEY, "."), }; verify(checkConfig, getPath("InputNoWhitespaceAfterWhitespace.java"), expected); }

Target:
public void testDefault() throws Exception { checkConfig.addAttribute("allowLineBreaks", "false"); final String[] expected = { "5:14: " + getCheckMessage(MSG_KEY, "."), "6:12: " + getCheckMessage(MSG_KEY, "."), "29:14: " + getCheckMessage(MSG_KEY, "-"), "29:21: " + getCheckMessage(MSG_KEY, "+"), "31:15: " + getCheckMessage(MSG_KEY, "++"), "31:22: " + getCheckMessage(MSG_KEY, "--"), "111:22: " + getCheckMessage(MSG_KEY, "!"), "112:23: " + getCheckMessage(MSG_KEY, "~"), "129:24: " + getCheckMessage(MSG_KEY, "."), "132:11: " + getCheckMessage(MSG_KEY, "."), "136:12: " + getCheckMessage(MSG_KEY, "."), "264:2: " + getCheckMessage(MSG_KEY, "."), }; verify(checkConfig, getPath("InputNoWhitespaceAfter.java"), expected); }
Source:
public GroupsRemovedFromContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; this.message = formatMessage("Groups (%s) successfully removed from contact groups %s.", groupsId, contactGroup); }

Target:
public GroupsRemovedFromContactGroupOfFacility(List<Integer> groupsId, ContactGroup contactGroup) { this.groupsId = groupsId; this.contactGroup = contactGroup; this.message = formatMessage("Groups (%s) successfully removed from contact group %s.", groupsId, contactGroup); }
Source:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.stream().filter(r -> r.getType() == IResource.ROOT).count() > 0) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { set.removeSet(resource); } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }

Target:
private List<IResource> computeRelated(List<? extends IResource> selection) { if (selection.contains(ResourcesPlugin.getWorkspace().getRoot())) { return new ArrayList<>(); } DisjointSet<IProject> set = buildConnectedComponents(ResourcesPlugin.getWorkspace().getRoot().getProjects()); for (IResource resource : selection) { set.removeSet(resource); } List<IResource> projects = new ArrayList<>(); set.toList(projects); return projects; }
Source:
private void enableCoordinatesFormattingGml32() { FeatureTypeInfo info = getGeoServer() .getCatalog() .getResourceByName( new NameImpl( StationsMockData.STATIONS_PREFIX_GML32, "Station_gml32"), FeatureTypeInfo.class); info.setNumDecimals(8); info.setForcedDecimal(true); info.setPadWithZeros(true); getGeoServer().getCatalog().save(info); }

Target:
private void enableCoordinatesFormattingGml32() { enableCoordinateFormatting( new NameImpl(StationsMockData.STATIONS_PREFIX_GML32, "Station_gml32")); }
Source:
public byte[] getCacheKey() { final byte[] filterBytes = dimFilter == null ? new byte[]{} : dimFilter.getCacheKey(); final byte[] boundBytes = StringUtils.toUtf8(bound); return ByteBuffer.allocate(1 + boundBytes.length) .put(CACHE_TYPE_ID) .put(boundBytes) .put(filterBytes) .array(); }

Target:
public byte[] getCacheKey() { final byte[] filterBytes = dimFilter == null ? new byte[]{} : dimFilter.getCacheKey(); final byte[] boundBytes = StringUtils.toUtf8(bound); final byte delimiter = (byte) 0xff; return ByteBuffer.allocate(2 + boundBytes.length + filterBytes.length) .put(CACHE_TYPE_ID) .put(boundBytes) .put(delimiter) .put(filterBytes) .array(); }
Source:
public int hashCode() { int result = combination != null ? combination.hashCode() : 0; for (String field : combination) { try { Field declaredField = pojo.getClass().getDeclaredField(field); declaredField.setAccessible(true); result = 31 * result + declaredField.get(this.pojo).hashCode(); } catch (NoSuchFieldException e) { e.printStackTrace(); return 0; } catch (IllegalAccessException e) { e.printStackTrace(); return 0; } } return result; }

Target:
public int hashCode() { int result = combination != null ? combination.hashCode() : 0; for (String field : combination) { try { Field declaredField = pojo.getClass().getDeclaredField(field); declaredField.setAccessible(true); result = 31 * result + declaredField.get(this.pojo).hashCode(); } catch (NoSuchFieldException e) { logger.error("No such field: found in pojo. NoSuchFieldException: {}", field, e); return 0; } catch (IllegalAccessException e) { logger.error("Illegal access to field: found in pojo. IllegalAccessException: {}", field, e); return 0; } } return result; }
Source:
public QueryResult query(final Query query) { return execute(query.requiresPost() ? this.influxDBService.postQuery(this.username, this.password, query.getDatabase(), query.getCommand()) : this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommand())); }

Target:
public QueryResult query(final Query query) { Call<QueryResult> call; if (query.requiresPost()) { call = this.influxDBService.postQuery(this.username, this.password, query.getDatabase(), query.getCommand()); } else { call = this.influxDBService.query(this.username, this.password, query.getDatabase(), query.getCommand()); } return execute(call); }
Source:
void addIngredientsImage() { if (imagePath != null) { Intent intent = new Intent(getActivity(), FullScreenImageRotate.class); Bundle bundle = new Bundle(); if (edit_product && !newImageSelected) { bundle.putString("imageurl", imagePath); bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en"); } else { bundle.putString("imageurl", "file://" + imagePath); bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en"); } intent.putExtras(bundle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(activity, imageIngredients, activity.getString(R.string.product_transition)); startActivityForResult(intent,ROTATE_RESULT, options.toBundle()); } else { startActivityForResult(intent, ROTATE_RESULT); } } else { if (ContextCompat.checkSelfPermission(activity, CAMERA) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(activity, new String[]{CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA); } else { EasyImage.openCamera(this, 0); } } }

Target:
void addIngredientsImage() { if (imagePath != null) { Intent intent = new Intent(getActivity(), FullScreenImageRotate.class); Bundle bundle = new Bundle(); if (edit_product && !newImageSelected) { bundle.putString("imageurl", imagePath); } else { bundle.putString("imageurl", "file://" + imagePath); } bundle.putString("code", product.getCode()); bundle.putString("id", "ingredients_en"); intent.putExtras(bundle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ActivityOptionsCompat options = ActivityOptionsCompat. makeSceneTransitionAnimation(activity, imageIngredients, activity.getString(R.string.product_transition)); startActivityForResult(intent,ROTATE_RESULT, options.toBundle()); } else { startActivityForResult(intent, ROTATE_RESULT); } } else { if (ContextCompat.checkSelfPermission(activity, CAMERA) != PERMISSION_GRANTED) { ActivityCompat.requestPermissions(activity, new String[]{CAMERA}, MY_PERMISSIONS_REQUEST_CAMERA); } else { EasyImage.openCamera(this, 0); } } }
Source:
private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { JobKeyConverter jobKeyConv = new JobKeyConverter(); Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.add(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }

Target:
private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.add(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }
Source:
public static Region getRepresentedRegion(Diagram diagram) { Optional<View> mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> StateMachineEditPart.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof StateMachine) { return UMLRTExtensionUtil.getRootDefinition((StateMachine) main).getRegions().get(0); } } else { mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> RTStateEditPartTN.VISUAL_ID.equals(((View) e).getType())).findAny(); EObject main = mainView.get().getElement(); if (main instanceof State) { return UMLRTExtensionUtil.getRootDefinition((State) main).getRegions().get(0); } } return null; }

Target:
public static Region getRepresentedRegion(Diagram diagram) { Optional<View> mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> StateMachineEditPart.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof StateMachine) { return UMLRTExtensionUtil.getRootDefinition((StateMachine) main).getRegions().get(0); } } else { mainView = diagram.getChildren().stream().map(View.class::cast).filter(e -> RTStateEditPartTN.VISUAL_ID.equals(((View) e).getType())).findAny(); if (mainView.isPresent()) { EObject main = mainView.get().getElement(); if (main instanceof State) { return UMLRTExtensionUtil.getRootDefinition((State) main).getRegions().get(0); } } } return null; }
Source:
TransportHttp(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); try { String uriString = uri.toString(); if (!uriString.endsWith("/")) uriString += "/"; baseUrl = new URL(uriString); objectsUrl = new URL(baseUrl, "objects/"); } catch (MalformedURLException e) { throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e); } http = local.getConfig().get(HTTP_KEY); proxySelector = ProxySelector.getDefault(); if (getCredentialsProvider() == null) { setCredentialsProvider(new NetRCCredentialsProvider()); } }

Target:
TransportHttp(final Repository local, final URIish uri) throws NotSupportedException { super(local, uri); try { String uriString = uri.toString(); if (!uriString.endsWith("/")) uriString += "/"; baseUrl = new URL(uriString); objectsUrl = new URL(baseUrl, "objects/"); } catch (MalformedURLException e) { throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e); } http = local.getConfig().get(HTTP_KEY); proxySelector = ProxySelector.getDefault(); if (getCredentialsProvider() == null) setCredentialsProvider(new NetRCCredentialsProvider()); }
Source:
public void testExportWithTransform() throws Exception { DocumentModel root = createSomethingToExport(session); DocumentModelList versions = session.query("select * from Document where ecm:isCheckedInVersion = 1"); assertEquals(2, versions.size()); File out = getExportDirectory(); try { runExport(root, out, skipBlobs); StringBuffer sb = new StringBuffer(); dump(sb, out); String listing = sb.toString(); assertTrue(listing.contains( "ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "__versions__" + File.separator + "1.0" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "invoice" + File.separator + "document.xml")); String xml = FileUtils.readFileToString( <<<<<<< Upstream, based on origin/master new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml"), UTF_8); ======= new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml")); >>>>>>> 26a768b NXP-22544: fix failing tests assertTrue(xml.contains("<type>File</type>")); assertTrue(xml.contains("<facet>Invoice</facet>")); assertTrue(xml.contains("name=\"invoiceNew\">")); assertTrue(xml.contains("<iv:A>")); assertTrue(xml.contains("<iv:B>XYZ")); assertFalse(xml.contains("deprecated")); assertTrue(xml.contains("<schema name=\"new\"")); assertTrue(xml.contains("<Y>foo</Y>")); assertTrue(xml.contains("<lockInfo")); assertTrue(xml.contains("<owner>Administrator</owner>")); } finally { FileUtils.deleteQuietly(out); } }

Target:
public void testExportWithTransform() throws Exception { DocumentModel root = createSomethingToExport(session); DocumentModelList versions = session.query("select * from Document where ecm:isCheckedInVersion = 1"); assertEquals(2, versions.size()); File out = getExportDirectory(); try { runExport(root, out, skipBlobs); StringBuffer sb = new StringBuffer(); dump(sb, out); String listing = sb.toString(); assertTrue(listing.contains( "ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "folder" + File.separator + "file" + File.separator + "__versions__" + File.separator + "1.0" + File.separator + "document.xml")); assertTrue(listing.contains("ws1" + File.separator + "invoice" + File.separator + "document.xml")); String xml = FileUtils.readFileToString( new File(out, "ws1" + File.separator + "invoice" + File.separator + "document.xml"), UTF_8); assertTrue(xml.contains("<type>File</type>")); assertTrue(xml.contains("<facet>Invoice</facet>")); assertTrue(xml.contains("name=\"invoiceNew\">")); assertTrue(xml.contains("<iv:A>")); assertTrue(xml.contains("<iv:B>XYZ")); assertFalse(xml.contains("deprecated")); assertTrue(xml.contains("<schema name=\"new\"")); assertTrue(xml.contains("<Y>foo</Y>")); assertTrue(xml.contains("<lockInfo")); assertTrue(xml.contains("<owner>Administrator</owner>")); } finally { FileUtils.deleteQuietly(out); } }
Source:
public Color getHeaderBackground () { checkWidget (); return headerBackground != null ? headerBackground : defaultBackground(); }

Target:
public Color getHeaderBackground () { checkWidget (); return headerBackground != null ? headerBackground : display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); }
Source:
public void testListenerRemoval() { cache.put("x", "y"); AtomicInteger i = new AtomicInteger(0); assert 1 == cache.getListeners().size(); CacheListener l = new CacheListener(i); cache.addListener(l); assert 2 == cache.getListeners().size(); assert cache.getListeners().contains(l); assert 0 == i.get(); cache.get("x"); assert 1 == i.get(); cache.removeListener(l); assert 1 == cache.getListeners().size(); i.set(0); assert 0 == i.get(); cache.get("x"); assert 0 == i.get(); }

Target:
public void testListenerRemoval() { cache.put("x", "y"); AtomicInteger i = new AtomicInteger(0); assert 0 == cache.getListeners().size(); CacheListener l = new CacheListener(i); cache.addListener(l); assert 1 == cache.getListeners().size(); assert cache.getListeners().contains(l); assert 0 == i.get(); cache.get("x"); assert 1 == i.get(); cache.removeListener(l); assert 0 == cache.getListeners().size(); i.set(0); assert 0 == i.get(); cache.get("x"); assert 0 == i.get(); }
Source:
public void should_try_next_host_on_connection_error(ClosedConnectionConfig.CloseType closeType) { simulateError(1, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(2, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(3, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); try { query(); Fail.fail("expected a TransportException"); } catch (NoHostAvailableException e) { assertThat(e.getErrors().keySet()).hasSize(3).containsOnlyOnce( host1.getSocketAddress(), host2.getSocketAddress(), host3.getSocketAddress()); assertThat(e.getErrors().values()).hasOnlyElementsOfType(TransportException.class); } assertOnRequestErrorWasCalled(3, TransportException.class); assertThat(errors.getRetries().getCount()).isEqualTo(3); assertThat(errors.getConnectionErrors().getCount()).isEqualTo(3); assertThat(errors.getIgnoresOnConnectionError().getCount()).isEqualTo(0); assertThat(errors.getRetriesOnConnectionError().getCount()).isEqualTo(3); assertQueried(1, 1); assertQueried(2, 1); assertQueried(3, 1); }

Target:
public void should_try_next_host_on_connection_error(ClosedConnectionConfig.CloseType closeType) { simulateError(1, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(2, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); simulateError(3, PrimingRequest.Result.closed_connection, new ClosedConnectionConfig(closeType)); try { query(); Fail.fail("expected a NoHostAvailableException"); } catch (NoHostAvailableException e) { assertThat(e.getErrors().keySet()).hasSize(3).containsOnly( host1.getSocketAddress(), host2.getSocketAddress(), host3.getSocketAddress()); assertThat(e.getErrors().values()).hasOnlyElementsOfType(TransportException.class); } assertOnRequestErrorWasCalled(3, TransportException.class); assertThat(errors.getRetries().getCount()).isEqualTo(3); assertThat(errors.getConnectionErrors().getCount()).isEqualTo(3); assertThat(errors.getIgnoresOnConnectionError().getCount()).isEqualTo(0); assertThat(errors.getRetriesOnConnectionError().getCount()).isEqualTo(3); assertQueried(1, 1); assertQueried(2, 1); assertQueried(3, 1); }
Source:
void shouldSaveAndFindAll() { Airport vie = null; try { vie = new Airport("airports::vie", "vie", "loww"); airportRepository.save(vie); List<Airport> all = StreamSupport.stream(airportRepository.findAll().spliterator(), false) .collect(Collectors.toList()); assertFalse(all.isEmpty()); assertTrue(all.stream().anyMatch(a -> a.getId().equals("airports::vie"))); } finally { airportRepository.delete(vie); } }

Target:
void shouldSaveAndFindAll() { Airport vie = null; try { vie = new Airport("airports::vie", "vie", "loww"); airportRepository.save(vie); List<Airport> all = new ArrayList<>(); airportRepository.findAll().forEach(all::add); assertFalse(all.isEmpty()); assertTrue(all.stream().anyMatch(a -> a.getId().equals("airports::vie"))); } finally { airportRepository.delete(vie); } }
Source:
private void removeLocationFromCache(HRegionLocation loc) { TableCache tableCache = cache.get(loc.getRegion().getTable()); if (tableCache == null) { return; } byte[] startKey = loc.getRegion().getStartKey(); for (;;) { RegionLocations oldLocs = tableCache.cache.get(startKey); if (oldLocs == null) { return; } HRegionLocation oldLoc = oldLocs.getRegionLocation(loc.getRegion().getReplicaId()); if (!canUpdateOnError(loc, oldLoc)) { return; } if (this.metaReplicaMode == CatalogReplicaMode.LoadBalance) { metaReplicaSelector.onError(loc, RegionInfo.DEFAULT_REPLICA_ID); } RegionLocations newLocs = removeRegionLocation(oldLocs, loc.getRegion().getReplicaId()); if (newLocs == null) { if (tableCache.cache.remove(startKey, oldLocs)) { recordClearRegionCache(); return; } } else { if (tableCache.cache.replace(startKey, oldLocs, newLocs)) { recordClearRegionCache(); return; } } } }

Target:
private void removeLocationFromCache(HRegionLocation loc) { TableCache tableCache = cache.get(loc.getRegion().getTable()); if (tableCache == null) { return; } byte[] startKey = loc.getRegion().getStartKey(); for (;;) { RegionLocations oldLocs = tableCache.cache.get(startKey); if (oldLocs == null) { return; } HRegionLocation oldLoc = oldLocs.getRegionLocation(loc.getRegion().getReplicaId()); if (!canUpdateOnError(loc, oldLoc)) { return; } if (this.metaReplicaMode == CatalogReplicaMode.LOAD_BALANCE) { metaReplicaSelector.onError(loc); } RegionLocations newLocs = removeRegionLocation(oldLocs, loc.getRegion().getReplicaId()); if (newLocs == null) { if (tableCache.cache.remove(startKey, oldLocs)) { recordClearRegionCache(); return; } } else { if (tableCache.cache.replace(startKey, oldLocs, newLocs)) { recordClearRegionCache(); return; } } } }
Source:
public void fullMaintenance(@NonNull final IOnStatusListener listener) { mExecutor.execute(() -> { try { if (null == mDb) { listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int result = SUCCESS; try { result = IpMemoryStoreDatabase.dropAllExpiredRecords(mDb); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop all zero relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int i = 0; while (!isDbSizeMetThreshold() && i < 500) { try { result = IpMemoryStoreDatabase.dropLowestRelevanceRecord(mDb); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop lowest relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } i++; } listener.onComplete(makeStatus(result)); } catch (final RemoteException e) { } }); }

Target:
public void fullMaintenance(@NonNull final IOnStatusListener listener) { mExecutor.execute(() -> { try { if (null == mDb) { listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int result = SUCCESS; try { result = IpMemoryStoreDatabase.dropAllExpiredRecords(mDb); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop all zero relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } int i = 0; while (!isDbSizeMetThreshold() && i < 500) { try { final int totalNumber = IpMemoryStoreDatabase.getTotalRecordNumber(mDb); final long dbSize = getDbSize(); final float decreaseRate = (float) (dbSize - getDbSizeThreshold()) / (float) dbSize * 0.5f; final int deleteNumber = (int) (totalNumber * decreaseRate); result = IpMemoryStoreDatabase.dropNumberOfRecords(mDb, deleteNumber == 0 ? 1 : deleteNumber); } catch (Exception e) { if (DBG) Log.e(TAG, "Drop lowest relevance failed.", e); listener.onComplete(makeStatus(ERROR_DATABASE_CANNOT_BE_OPENED)); return; } i++; } listener.onComplete(makeStatus(result)); } catch (final RemoteException e) { } }); }
Source:
public void addToGroup(String externalId, String groupName) { LOGGER.debug(ADD_TO_GROUP_NAME, externalId, groupName); try { Group group = groupWebService.getGroupByName(groupName); if (group != null) { Contact contact = findByExternalId(externalId); if (contact != null) { contact.getGroupUUIDs().add(group.getUuid()); Contact updated = contactWebService.createOrUpdateContact(contact); eventPublisher.publishContactAddedToGroup(externalId, updated, group); } else { sendContactDoesNotExistMessage(externalId); } } else { sendGroupDoesNotExistMessage(groupName); } } catch (WebServiceException e) { LOGGER.error(e.getMessage()); sendWebserviceFailAddGroupMessage(e, externalId, groupName); } }

Target:
public void addToGroup(String externalId, String groupName) { LOGGER.debug(ADD_TO_GROUP_NAME, externalId, groupName); try { Group group = groupWebService.getGroupByName(groupName); if (group != null) { Contact contact = findByExternalId(externalId); if (contact != null) { contact.getGroupUUIDs().add(group.getUuid()); Contact updated = contactWebService.createOrUpdateContact(contact); eventPublisher.publishContactAddedToGroup(externalId, updated, group); } else { sendContactDoesNotExistMessage(externalId); } } else { sendGroupDoesNotExistMessage(groupName); } } catch (WebServiceException e) { sendWebserviceFailAddGroupMessage(e, externalId, groupName); } }
Source:
private void handleConstraintViolation(Long conglomerateId, byte[] key, byte[] value) throws StandardException{ ExecRow execRow; if (isIndex(conglomerateId)) { Pair<ExecRow, KeyDecoder> p = (Pair<ExecRow, KeyDecoder>)decoderMap.get(conglomerateId); execRow = p.getFirst(); KeyDecoder decoder = (KeyDecoder) p.getSecond(); decoder.decode(key, 0, key.length, execRow); }else { PairDecoder decoder = (PairDecoder) decoderMap.get(conglomerateId); execRow = decoder.decode(key, value); } if (operationContext != null && operationContext.isPermissive()) { operationContext.recordBadRecord("Unique constraint violation, row: " + execRow.toString(), null); } else { SpliceLogUtils.error(LOG, "Unique constraint violation, row: %s", execRow.toString()); DataDictionary dd = ah.getActivation().getLanguageConnectionContext().getDataDictionary(); ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateId); com.splicemachine.db.catalog.UUID tableID = cd.getTableID(); TableDescriptor td = dd.getTableDescriptor(tableID); String tableName = td.getName(); String indexOrConstraintName; if (isIndex(conglomerateId)) { indexOrConstraintName = cd.getConglomerateName(); } else { ConstraintDescriptor conDesc = dd.getConstraintDescriptor(td, cd.getUUID()); indexOrConstraintName = conDesc.getConstraintName(); } throw StandardException.newException(SQLState.LANG_DUPLICATE_KEY_CONSTRAINT, indexOrConstraintName, tableName); } }

Target:
private void handleConstraintViolation(Long conglomerateId, byte[] key, byte[] value) throws StandardException{ ExecRow execRow; if (isIndex(conglomerateId)) { Pair<ExecRow, KeyDecoder> p = (Pair<ExecRow, KeyDecoder>)decoderMap.get(conglomerateId); execRow = p.getFirst(); KeyDecoder decoder = (KeyDecoder) p.getSecond(); decoder.decode(key, 0, key.length, execRow); }else { PairDecoder decoder = (PairDecoder) decoderMap.get(conglomerateId); execRow = decoder.decode(key, value); } if (operationContext != null && operationContext.isPermissive()) { operationContext.recordBadRecord("Unique constraint violation, row: " + execRow.toString(), null); } else { SpliceLogUtils.error(LOG, "Unique constraint violation, row: %s", execRow.toString()); DataDictionary dd = operationContext.getActivation().getLanguageConnectionContext().getDataDictionary(); ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateId); com.splicemachine.db.catalog.UUID tableID = cd.getTableID(); TableDescriptor td = dd.getTableDescriptor(tableID); String tableName = td.getName(); String indexOrConstraintName; if (isIndex(conglomerateId)) { indexOrConstraintName = cd.getConglomerateName(); } else { ConstraintDescriptor conDesc = dd.getConstraintDescriptor(td, cd.getUUID()); indexOrConstraintName = conDesc.getConstraintName(); } throw StandardException.newException(SQLState.LANG_DUPLICATE_KEY_CONSTRAINT, indexOrConstraintName, tableName); } }
Source:
private static Set<HttpCookie> getCookiesFromConfig(HttpConfig config) { if (!StringUtils.isEmptyOrNull(config.getCookieFile())) { Path cookieFile = Paths.get(config.getCookieFile()); if (Files.exists(cookieFile)) { try { return NetscapeCookieFile.read(cookieFile, new Date()); } catch (IllegalArgumentException | IOException e) { LOG.warn("Could not read cookie file '{}'", cookieFile, e); } } } return Collections.emptySet(); }

Target:
private static Set<HttpCookie> getCookiesFromConfig(HttpConfig config) { if (!StringUtils.isEmptyOrNull(config.getCookieFile())) { try { Path cookieFile = Paths.get(config.getCookieFile()); return NetscapeCookieFile.read(cookieFile, new Date()); } catch (IOException | IllegalArgumentException e) { LOG.warn(MessageFormat.format( JGitText.get().couldNotReadCookieFile, config.getCookieFile(), e.getCause()), e); } } return Collections.emptySet(); }
Source:
public String getUrl() { final StringBuilder b = new StringBuilder(); b.append("jdbc:mysql://"); b.append(hostname(optional(cfg, "hostname"))); b.append(port(optional(cfg, "port"))); b.append("/"); b.append(required(cfg, "database")); return b.toString(); }

Target:
public String getUrl() { final StringBuilder b = new StringBuilder(); final ConfigSection dbs = new ConfigSection(cfg, "database"); b.append("jdbc:mysql://"); b.append(hostname(dbs.optional("hostname"))); b.append(port(dbs.optional("port"))); b.append("/"); b.append(dbs.required("database")); return b.toString(); }
Source:
private void processRow(List<String> row) throws Exception { rowNum++; String id = null; try { id = row.get(idColumn); } catch (IndexOutOfBoundsException e) { } String label = null; try { label = row.get(labelColumn); } catch (IndexOutOfBoundsException e) { } String type = null; try { type = row.get(typeColumn); } catch (IndexOutOfBoundsException e) { } if (id == null && label == null) { return; } if (type == null || type.trim().isEmpty()) { type = "class"; } IRI iri = getIRI(id, label); if (iri == null) { return; } switch (type) { case "owl:Class": case "class": addClassAxioms(iri, row); break; case "owl:ObjectProperty": case "object property": addObjectPropertyAxioms(iri, row); break; case "owl:DataProperty": case "data property": addDataPropertyAxioms(iri, row); break; case "owl:AnnotationProperty": case "annotation property": addAnnotationPropertyAxioms(iri, row); break; case "owl:Datatype": case "datatype": addDatatypeAxioms(iri, row); break; case "owl:Individual": case "individual": case "owl:NamedIndividual": case "named individual": default: addIndividualAxioms(iri, row); break; } }

Target:
private void processRow(List<String> row) throws Exception { rowNum++; String id = null; try { id = row.get(idColumn); } catch (IndexOutOfBoundsException e) { } String label = null; try { label = row.get(labelColumn); } catch (IndexOutOfBoundsException e) { } String type = null; try { type = row.get(typeColumn); } catch (IndexOutOfBoundsException e) { } if (id == null && label == null) { return; } if (type == null || type.trim().isEmpty()) { if (label != null) { OWLEntity e = checker.getOWLEntity(label); if (e != null) { type = e.getEntityType().getIRI().toString(); } } else { OWLEntity e = checker.getOWLEntity(id); if (e != null) { type = e.getEntityType().getIRI().toString(); } } if (type == null) { type = "class"; } } IRI iri = getIRI(id, label); if (iri == null) { return; } IRI typeIRI = ioHelper.createIRI(type); String typeOrIRI = type; if (typeIRI != null) { typeOrIRI = typeIRI.toString(); } switch (typeOrIRI) { case "<LINK_5>": case "class": addClassAxioms(iri, row); break; case "<LINK_3>": case "object property": addObjectPropertyAxioms(iri, row); break; case "<LINK_4>": case "data property": addDataPropertyAxioms(iri, row); break; case "<LINK_0>": case "annotation property": addAnnotationPropertyAxioms(iri, row); break; case "<LINK_6>": case "datatype": addDatatypeAxioms(iri, row); break; case "<LINK_1>": case "individual": case "<LINK_2>": case "named individual": default: addIndividualAxioms(iri, row); break; } }
Source:
boolean isNonBlocking() { return false; }

Target:
boolean isNonBlocking() { return this == NON_BLOCKING; }
Source:
public static void addAttributeToArgs(Attribute<String> attribute, Context context, List<CharSequence> vargs) { if (context.getValue(attribute) != null) { vargs.add(String.format("-D%s=$'%s'", attribute.getLongName(), context.getValue(attribute) .replaceAll("[\\\\]", "\\\\\\\\\\\\\\\\").replaceAll("['\"$]", "\\\\$0"))); } }

Target:
public static void addAttributeToArgs(Attribute<String> attribute, Context context, List<CharSequence> vargs) { String value = context.getValue(attribute); if (value != null) { vargs.add(String.format("-D%s=$'%s'", attribute.getLongName(), value.replace("\\", "\\\\\\\\").replaceAll("['\"$]", "\\\\$0"))); } }
Source:
public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; this.aggFactories = (String[]) Lists.<AggregatorFactory, String>transform( aggFactories, new Function<AggregatorFactory, String>() { @Nullable @Override public String apply(AggregatorFactory input) { return input.getName(); } } ).toArray(new String[0]); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; this.dimValComparator = new Comparator<DimValHolder>() { @Override public int compare(DimValHolder d1, DimValHolder d2) { int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimNameComparator.compare(d1.getDimName(), d2.getDimName()); } return retVal; } }; pQueue = new PriorityQueue<>(this.threshold + 1, this.dimValComparator); }

Target:
public TopNNumericResultBuilder( DateTime timestamp, DimensionSpec dimSpec, String metricName, int threshold, final Comparator comparator, List<AggregatorFactory> aggFactories, List<PostAggregator> postAggs ) { this.timestamp = timestamp; this.dimSpec = dimSpec; this.metricName = metricName; this.aggFactoryNames = TopNQueryQueryToolChest.extractFactoryName(aggFactories); this.postAggs = AggregatorUtil.pruneDependentPostAgg(postAggs, this.metricName); this.threshold = threshold; this.metricComparator = comparator; this.dimValComparator = new Comparator<DimValHolder>() { @Override public int compare(DimValHolder d1, DimValHolder d2) { int retVal = metricComparator.compare(d1.getTopNMetricVal(), d2.getTopNMetricVal()); if (retVal == 0) { retVal = dimNameComparator.compare(d1.getDimName(), d2.getDimName()); } return retVal; } }; pQueue = new PriorityQueue<>(this.threshold + 1, this.dimValComparator); }
Source:
public void erorrResultMapLocation() throws Exception { Configuration configuration = new Configuration(); String resource = "org/apache/ibatis/builder/ProblemResultMapper.xml"; try (InputStream inputStream = Resources.getResourceAsStream(resource)) { XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments()); builder.parse(); MappedStatement mappedStatement = configuration.getMappedStatement("findProblemTypeTest"); } }

Target:
public void erorrResultMapLocation() throws Exception { Configuration configuration = new Configuration(); String resource = "org/apache/ibatis/builder/ProblemResultMapper.xml"; try (InputStream inputStream = Resources.getResourceAsStream(resource)) { XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments()); builder.parse(); String resultMapName = "java.lang.String"; String statementId = "org.mybatis.spring.ErrorProblemMapper" + "." + "findProblemResultMapTest"; String message = "Could not find result map '" + resultMapName + "' referenced from '" + statementId + "'"; IncompleteElementException exception = Assertions.assertThrows(IncompleteElementException.class, ()-> configuration.getMappedStatement("findProblemTypeTest")); assertThat(exception.getMessage()).isEqualTo(message); } }
Source:
private void waitForDeployments() throws MojoFailureException { if (!application.exists()) { throw new MojoFailureException("Application does not exists: " + application); } log.debug("Checking for application [" + application + "] to be deployed."); String app = getApplicationName(application); try { prober.check(AppDeploymentProbe.isDeployed(mule, app)); } catch (AssertionError e) { log.error("Couldn't deploy application [" + app + "] after [" + timeout + "] miliseconds. Check Mule Runtime log"); throw new MojoFailureException("Application deployment timeout."); } }

Target:
private void waitForDeployments() throws DeploymentException { if (!application.exists()) { throw new DeploymentException("Application does not exists: " + application); } log.debug("Waiting for application [" + application + "] to be deployed."); String app = FilenameUtils.getBaseName(application.getName()); try { prober.check(AppDeploymentProbe.isDeployed(mule, app)); } catch (AssertionError e) { log.error("Couldn't deploy application [" + app + "] after [" + timeout + "] miliseconds. Check Mule Runtime log"); throw new DeploymentException("Application deployment timeout."); } }
Source:
public void unlock() { synchronized (DiskRepository.this) { int count = readLockCount.getAndDecrement(); assert count >= 0; if (fileLock != null && readLockCount.get() == 0) { try { fileLock.release(); } catch (IOException ioe) { LOGGER.warn(ioe, DiskConnectorI18n.problemReleasingFileLock, getSourceName()); } } } lock.unlock(); }

Target:
public void unlock() { try { if (fileLock != null) { synchronized (DiskRepository.this) { int count = readLockCount.getAndDecrement(); assert count >= 0; if (readLockCount.get() == 0) { try { fileLock.release(); } catch (IOException ioe) { LOGGER.warn(ioe, DiskConnectorI18n.problemReleasingFileLock, getSourceName()); } } } } } finally { lock.unlock(); } }
Source:
public final boolean incrementToken() throws IOException, IllegalStateException { if (state != null) { restoreState(state); if (scriptOne.length() > 0) { replayTerm(scriptOne); if (scriptTwo.length() == 0) { state = null; } return true; } if (scriptTwo.length() > 0) { replayTerm(scriptTwo); state = null; return true; } throw new IllegalStateException(); } if (!input.incrementToken()) { return false; } boolean matchesBothScripts = hasChars(TranslationTableDictionaries.LATIN_REG) && hasChars(TranslationTableDictionaries.CYR_REG); if (matchesBothScripts) { scriptOne.setLength(0); scriptOne.append(termAtt); translationTable.replaceScriptOne(scriptOne); scriptTwo.setLength(0); scriptTwo.append(termAtt); translationTable.replaceScriptTwo(scriptTwo); if (!TranslationTableDictionaries.LATIN_REG.matcher(scriptOne).find()) { state = captureState(); } else { scriptOne.setLength(0); } if (!TranslationTableDictionaries.CYR_REG.matcher(scriptTwo).find()) { if (state == null) { state = captureState(); } } else { scriptTwo.setLength(0); } } return true; }

Target:
public final boolean incrementToken() throws IOException, IllegalStateException { if (state != null) { restoreState(state); if (scriptOne.length() > 0) { replayTerm(scriptOne); if (scriptTwo.length() == 0) { state = null; } return true; } if (scriptTwo.length() > 0) { replayTerm(scriptTwo); state = null; return true; } throw new IllegalStateException("state should be null"); } if (!input.incrementToken()) { return false; } boolean matchesBothScripts = hasChars(translationTable.getScript1Reg()) && hasChars(translationTable.getScript2Reg()); if (matchesBothScripts) { scriptOne.setLength(0); scriptOne.append(termAtt); translationTable.replaceScriptOne(scriptOne); scriptTwo.setLength(0); scriptTwo.append(termAtt); translationTable.replaceScriptTwo(scriptTwo); if (!translationTable.getScript1Reg().matcher(scriptOne).find()) { state = captureState(); } else { scriptOne.setLength(0); } if (!translationTable.getScript2Reg().matcher(scriptTwo).find()) { if (state == null) { state = captureState(); } } else { scriptTwo.setLength(0); } } return true; }
Source:
public String createMachine( Map<String,String> targetProperties, Map<String,String> messagingConfiguration, String scopedInstancePath, String applicationName ) throws TargetException { this.logger.fine( "Creating a new agent in memory." ); try { String delayAsString = null; if( targetProperties != null ) delayAsString = targetProperties.get( DELAY ); long delay = delayAsString != null ? Long.parseLong( delayAsString ) : this.defaultDelay.get(); if( delay > 0 ) Thread.sleep( delay ); } catch( Exception e ) { this.logger.warning( "An error occurred while applying the delay property. " + e.getMessage()); Utils.logException( this.logger, e ); } Dictionary<String,Object> configuration = new Hashtable<>(); for(String k : messagingConfiguration.keySet()) { configuration.put(k, messagingConfiguration.get(k)); } configuration.put( "application-name", applicationName ); configuration.put( "scoped-instance-path", scopedInstancePath ); String machineId = scopedInstancePath + " @ " + applicationName; configuration.put( Factory.INSTANCE_NAME_PROPERTY, machineId ); if( this.agentFactory == null ) throw new TargetException( "The iPojo factory was not available." ); try { ComponentInstance instance = this.agentFactory.createComponentInstance( configuration ); instance.start(); } catch( Exception e ) { throw new TargetException( "An in-memory agent could not be launched. Scoped instance path: " + scopedInstancePath, e ); } return machineId; }

Target:
public String createMachine( Map<String,String> targetProperties, Map<String,String> messagingConfiguration, String scopedInstancePath, String applicationName ) throws TargetException { this.logger.fine( "Creating a new agent in memory." ); try { String delayAsString = null; if( targetProperties != null ) delayAsString = targetProperties.get( DELAY ); long delay = delayAsString != null ? Long.parseLong( delayAsString ) : this.defaultDelay.get(); if( delay > 0 ) Thread.sleep( delay ); } catch( Exception e ) { this.logger.warning( "An error occurred while applying the delay property. " + e.getMessage()); Utils.logException( this.logger, e ); } Dictionary<String,Object> configuration = new Hashtable<>(); final String messagingType = messagingConfiguration.get("net.roboconf.messaging.type"); configuration.put( "application-name", applicationName ); configuration.put( "scoped-instance-path", scopedInstancePath ); configuration.put( "messaging-type", messagingType); MessagingClientFactory messagingFactory = this.registry.getMessagingClientFactory(messagingType); if (messagingFactory != null) { messagingFactory.setConfiguration(messagingConfiguration); } String machineId = scopedInstancePath + " @ " + applicationName; configuration.put( Factory.INSTANCE_NAME_PROPERTY, machineId ); if( this.agentFactory == null ) throw new TargetException( "The iPojo factory was not available." ); try { ComponentInstance instance = this.agentFactory.createComponentInstance( configuration ); instance.start(); } catch( Exception e ) { throw new TargetException( "An in-memory agent could not be launched. Scoped instance path: " + scopedInstancePath, e ); } return machineId; }
Source:
private void storeGlobalPrincipals(Properties properties) { globalPrincipalToPermissions = properties.entrySet().stream() .filter(p -> p.getKey().toString().startsWith(GLOBAL_PROP_PREFIX)) .map(p -> new SimpleEntry<>((String) p.getValue(), (String) p.getKey())) .collect(Collectors.toMap(SimpleEntry::getKey, p -> { String roleString = p.getValue().substring(GLOBAL_PROP_PREFIX.length()); UserRole role = UserRole.valueOf(roleString); if (role == null) { throw new IllegalArgumentException( "Invalid global role " + p.getValue() + " defined for " + p.getKey()); } return role.getPermissions().stream() .map(q -> q.name()).collect(Collectors.toSet()); })); }

Target:
private void storeGlobalPrincipals(Properties properties) { globalPrincipalToPermissions = properties.entrySet().stream() .filter(p -> p.getKey().toString().startsWith(GLOBAL_PROP_PREFIX)) .map(p -> new SimpleEntry<>((String) p.getValue(), (String) p.getKey())) .collect(Collectors.toMap(SimpleEntry::getKey, p -> { String roleString = p.getValue().substring(GLOBAL_PROP_PREFIX.length()); UserRole role = UserRole.valueOf(roleString); if (role == null || role.isPatronRole()) { throw new IllegalArgumentException( "Invalid global role " + p.getValue() + " defined for " + p.getKey()); } return role.getPermissions().stream() .map(q -> q.name()).collect(Collectors.toSet()); })); }
Source:
protected Map<String, HashSet<String>> findPackageReferences(Collection<String> packages, IProgressMonitor monitor) { IJavaProject jp = JavaCore.create(fProject); HashMap<String, HashSet<String>> pkgsAndUses = new HashMap<>(); IPackageFragment[] frags = PDEJavaHelper.getPackageFragments(jp, Collections.EMPTY_SET, false); SubMonitor subMonitor = SubMonitor.convert(monitor, "", frags.length * 2); for (int i = 0; i < frags.length; i++) { if (subMonitor.isCanceled()) { return pkgsAndUses; } subMonitor.subTask( NLS.bind(PDEUIMessages.CalculateUsesOperation_calculatingDirective, frags[i].getElementName())); if (packages.contains(frags[i].getElementName())) { HashSet<String> pkgs = new HashSet<>(); pkgsAndUses.put(frags[i].getElementName(), pkgs); try { findReferences(frags[i].getCompilationUnits(), pkgs, subMonitor.newChild(1), false); findReferences(frags[i].getClassFiles(), pkgs, subMonitor.newChild(1), true); } catch (JavaModelException e) { } } } return pkgsAndUses; }

Target:
protected Map<String, HashSet<String>> findPackageReferences(Collection<String> packages, IProgressMonitor monitor) { IJavaProject jp = JavaCore.create(fProject); HashMap<String, HashSet<String>> pkgsAndUses = new HashMap<>(); IPackageFragment[] frags = PDEJavaHelper.getPackageFragments(jp, Collections.EMPTY_SET, false); SubMonitor subMonitor = SubMonitor.convert(monitor, frags.length * 2); for (int i = 0; i < frags.length; i++) { SubMonitor iterationMonitor = subMonitor.newChild(2); if (iterationMonitor.isCanceled()) { return pkgsAndUses; } iterationMonitor.subTask( NLS.bind(PDEUIMessages.CalculateUsesOperation_calculatingDirective, frags[i].getElementName())); if (packages.contains(frags[i].getElementName())) { HashSet<String> pkgs = new HashSet<>(); pkgsAndUses.put(frags[i].getElementName(), pkgs); try { findReferences(frags[i].getCompilationUnits(), pkgs, iterationMonitor.newChild(1), false); findReferences(frags[i].getClassFiles(), pkgs, iterationMonitor.newChild(1), true); } catch (JavaModelException e) { } } } return pkgsAndUses; }
Source:
public void testCheckBlobCorrupt() throws CorruptObjectException { checker = new ObjectChecker() { @Override public void checkBlob(byte[] raw) throws CorruptObjectException { String in = decode(raw); if (in.contains("secret_key")) { throw new CorruptObjectException("don't add a secret key"); } } }; checker.check(OBJ_BLOB, encodeASCII("key = \"public_key\"")); try { checker.check(OBJ_BLOB, encodeASCII("key = \"secret_key\"")); fail(); } catch (CorruptObjectException expected) { } }

Target:
public void testCheckBlobCorrupt() throws CorruptObjectException { checker = new ObjectChecker() { @Override public void checkBlob(byte[] raw) throws CorruptObjectException { String in = decode(raw); if (in.contains("secret_key")) { throw new CorruptObjectException("don't add a secret key"); } } }; thrown.expect(CorruptObjectException.class); checker.check(OBJ_BLOB, encodeASCII("key = \"secret_key\"")); }
Source:
synchronized Collection<ClientBuffer> safeGetBuffersSnapshot() { return ImmutableList.copyOf(this.buffers.values()); }

Target:
private synchronized Collection<ClientBuffer> safeGetBuffersSnapshot() { return ImmutableList.copyOf(this.buffers.values()); }