auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUserSpecifiedRule() throws Exception { Style multipleRulesStyle = getCatalog().getStyleByName(MockData.ROAD_SEGMENTS.getLocalPart()).getStyle(); assertNotNull(multipleRulesStyle); @SuppressWarnings("deprecation") Rule rule = multipleRulesStyle.getFeatureTypeStyles()[0].getRules()[0]; LOGGER.info( "testing single rule " + rule.getName() + " from style " + multipleRulesStyle.getName()); FeatureTypeInfo ftInfo = getCatalog() .getFeatureTypeByName( MockData.ROAD_SEGMENTS.getNamespaceURI(), MockData.ROAD_SEGMENTS.getLocalPart()); GetLegendGraphicRequest req = getRequest(ftInfo.getFeatureType(), multipleRulesStyle); req.setRule(rule.getName()); req.setLegendOptions(new HashMap<String, String>()); req.setFormat(JSONFormat); final int HEIGHT_HINT = 30; req.setHeight(HEIGHT_HINT); JSONObject result = (JSONObject) this.legendProducer.buildLegendGraphic(req); JSONArray rules = result.getJSONArray(JSONLegendGraphicBuilder.LEGEND); assertEquals(1, rules.size()); assertEquals( rule.getDescription().getTitle().toString(), rules.getJSONObject(0) .getJSONArray(JSONLegendGraphicBuilder.RULES) .getJSONObject(0) .get(JSONLegendGraphicBuilder.TITLE)); }

Target:
public void testUserSpecifiedRule() throws Exception { Style multipleRulesStyle = getCatalog().getStyleByName(MockData.ROAD_SEGMENTS.getLocalPart()).getStyle(); assertNotNull(multipleRulesStyle); Rule rule = multipleRulesStyle.featureTypeStyles().get(0).rules().get(0); LOGGER.info( "testing single rule " + rule.getName() + " from style " + multipleRulesStyle.getName()); FeatureTypeInfo ftInfo = getCatalog() .getFeatureTypeByName( MockData.ROAD_SEGMENTS.getNamespaceURI(), MockData.ROAD_SEGMENTS.getLocalPart()); GetLegendGraphicRequest req = getRequest(ftInfo.getFeatureType(), multipleRulesStyle); req.setRule(rule.getName()); req.setLegendOptions(new HashMap<String, String>()); req.setFormat(JSONFormat); final int HEIGHT_HINT = 30; req.setHeight(HEIGHT_HINT); JSONObject result = this.legendProducer.buildLegendGraphic(req); JSONArray rules = result.getJSONArray(JSONLegendGraphicBuilder.LEGEND); assertEquals(1, rules.size()); assertEquals( rule.getDescription().getTitle().toString(), rules.getJSONObject(0) .getJSONArray(JSONLegendGraphicBuilder.RULES) .getJSONObject(0) .get(JSONLegendGraphicBuilder.TITLE)); }
Source:
public ASTNode visit(Sentence node, Void _) { boolean change = false; Set<Variable> vars = node.getBody().variables(); KList ands = new KList(); Term condition = node.getRequires(); if (null != condition) { ands.getContents().add(condition); } for (Variable var : vars) { if (var.isSyntactic()) continue; if ((var.getExpectedSort()==null && MetaK.isKSort(var.getSort())) || (var.getExpectedSort()!=null && MetaK.isKSort(var.getExpectedSort()))) continue; change = true; ands.getContents().add(getPredicateTerm(var)); } if (!change) return node; if (ands.getContents().size() > 1) { condition = new KApp(KLabelConstant.ANDBOOL_KLABEL, ands); } else { condition = ands.getContents().get(0); } node = node.shallowCopy(); node.setRequires(condition); return node; }

Target:
public ASTNode visit(Sentence node, Void _) { boolean change = false; Set<Variable> vars = node.getBody().variables(); KList ands = new KList(); Term condition = node.getRequires(); if (null != condition) { ands.getContents().add(condition); } for (Variable var : vars) { if (var.isSyntactic()) continue; if (MetaK.isKSort(var.getSort())) continue; change = true; ands.getContents().add(getPredicateTerm(var)); } if (!change) return node; if (ands.getContents().size() > 1) { condition = new KApp(KLabelConstant.ANDBOOL_KLABEL, ands); } else { condition = ands.getContents().get(0); } node = node.shallowCopy(); node.setRequires(condition); return node; }
Source:
public long getNotificationCount() { return adapter.map(ad -> ad.getNotificationCount()).orElse(0l); }

Target:
public long getNotificationCount() { return adapter.getNotificationCount(); }
Source:
public void initTunedProfiles() { this.startProgress(); if (getVersion() == null || getVersion().getSelectedItem() == null) { return; } Version version = getVersion().getSelectedItem(); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterTunedProfiles, new IdAndNameQueryParameters(null, version.getValue()), new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { ClusterModel.this.stopProgress(); ClusterModel clusterModel = (ClusterModel)model; List<String> glusterTunedProfiles = new ArrayList<>(); if (((VdcQueryReturnValue) returnValue).getSucceeded()) { glusterTunedProfiles.addAll((List<String>)(((VdcQueryReturnValue) returnValue).getReturnValue())); } final String oldSelectedProfile = clusterModel != null && clusterModel.getGlusterTunedProfile() != null ? clusterModel.getGlusterTunedProfile().getSelectedItem() : getEntity() != null ? getEntity().getGlusterTunedProfile() : null; glusterTunedProfile.setItems(glusterTunedProfiles); glusterTunedProfile.setIsAvailable(glusterTunedProfile.getItems().size() > 0); if (oldSelectedProfile != null) { String newSelectedItem = Linq.firstOrDefault(glusterTunedProfiles, new IPredicate<String>() { @Override public boolean match(String item) { return item.equals(oldSelectedProfile); } }); if (newSelectedItem != null) { glusterTunedProfile.setSelectedItem(newSelectedItem); } } if (glusterTunedProfile.getSelectedItem() == null) { glusterTunedProfile.setSelectedItem(Linq.firstOrDefault(glusterTunedProfiles)); } } })); }

Target:
public void initTunedProfiles() { this.startProgress(); if (getVersion() == null || getVersion().getSelectedItem() == null) { return; } Version version = getVersion().getSelectedItem(); Frontend.getInstance().runQuery(VdcQueryType.GetGlusterTunedProfiles, new IdAndNameQueryParameters(null, version.getValue()), new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { ClusterModel.this.stopProgress(); List<String> glusterTunedProfiles = new ArrayList<>(); if (((VdcQueryReturnValue) returnValue).getSucceeded()) { glusterTunedProfiles.addAll((List<String>)(((VdcQueryReturnValue) returnValue).getReturnValue())); } final String oldSelectedProfile = glusterTunedProfile.getSelectedItem(); glusterTunedProfile.setItems(glusterTunedProfiles); glusterTunedProfile.setIsAvailable(glusterTunedProfile.getItems().size() > 0); if (oldSelectedProfile != null) { String newSelectedItem = Linq.firstOrNull(glusterTunedProfiles, new Linq.EqualsPredicate(oldSelectedProfile)); if (newSelectedItem != null) { glusterTunedProfile.setSelectedItem(newSelectedItem); } else if (getIsEdit()) { glusterTunedProfile.setSelectedItem(Linq.firstOrNull(glusterTunedProfiles, new Linq.EqualsPredicate(getEntity().getGlusterTunedProfile()))); } } } })); }
Source:
public List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws FileDoesNotExistException, IOException, AlluxioException { checkUri(path); List<URIStatus> statuses = mMetadataCache.listStatus(path); if (statuses == null) { statuses = super.listStatus(path, options); mMetadataCache.put(path, statuses); } return statuses; }

Target:
public List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options) throws FileDoesNotExistException, IOException, AlluxioException { checkUri(path); if (options.getRecursive()) { return super.listStatus(path, options); } List<URIStatus> statuses = mMetadataCache.listStatus(path); if (statuses == null) { statuses = super.listStatus(path, options); mMetadataCache.put(path, statuses); } return statuses; }
Source:
public void testBigUsage() { final long maxMemory = Math.min(Runtime.getRuntime().maxMemory(), 10*1024*1024*1024L); List<Maybe<byte[]>> references = MutableList.of(); long created = 0; while (created < 2*maxMemory) { byte d[] = new byte[10*1000*1000]; references.add(Maybe.soft(d)); MemoryUsageTracker.SOFT_REFERENCES.track(d, d.length); created += d.length; long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); LOG.info("created "+Strings.makeSizeString(created) + " ... in use: "+Strings.makeSizeString(totalMemory - freeMemory)+" / " + Strings.makeSizeString(totalMemory) + " ... reclaimable: "+Strings.makeSizeString(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed()) + " ... live refs: "+Strings.makeSizeString(sizeOfActiveReferences(references)) + " ... maxMem="+maxMemory+"; totalMem="+totalMemory+"; usedMem="+(totalMemory-freeMemory)); } Asserts.succeedsEventually(new Runnable() { public void run() { long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), maxMemory); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), totalMemory); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), totalMemory - freeMemory); }}); }

Target:
public void testBigUsage() { final int ALLOCATION_CHUNK_SIZE = 10*1000*1000; final long MAX_MEMORY_CAP = 10*1024*1024*1024L; final long maxMemory = Math.min(Runtime.getRuntime().maxMemory(), MAX_MEMORY_CAP); List<Maybe<byte[]>> references = MutableList.of(); long created = 0; while (created < 2*maxMemory) { byte d[] = new byte[ALLOCATION_CHUNK_SIZE]; references.add(Maybe.soft(d)); MemoryUsageTracker.SOFT_REFERENCES.track(d, d.length); created += d.length; long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); LOG.info("created "+Strings.makeSizeString(created) + " ... in use: "+Strings.makeSizeString(totalMemory - freeMemory)+" / " + Strings.makeSizeString(totalMemory) + " ... reclaimable: "+Strings.makeSizeString(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed()) + " ... live refs: "+Strings.makeSizeString(sizeOfActiveReferences(references)) + " ... maxMem="+maxMemory+"; totalMem="+totalMemory+"; usedMem="+(totalMemory-freeMemory)); } Asserts.succeedsEventually(new Runnable() { public void run() { long totalMemory = Runtime.getRuntime().totalMemory(); long freeMemory = Runtime.getRuntime().freeMemory(); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), maxMemory); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), totalMemory); assertLessThan(MemoryUsageTracker.SOFT_REFERENCES.getBytesUsed(), totalMemory - freeMemory); }}); }
Source:
public void getProblemFactsWithNullField() { TestdataAbstractSolutionBasedSolution solution = new TestdataAbstractSolutionBasedSolution(); solution.setSingleValue(null); TestdataValue v1 = new TestdataValue("v1"); TestdataValue v2 = new TestdataValue("v2"); TestdataValue v3 = new TestdataValue("v3"); List<TestdataValue> valueList = Arrays.asList(v1, v2, v3); solution.setValueList(valueList); solution.setEntityList(null); solution.setSingleEntity(null); solution.setScore(null); assertThat((Collection<Object>) solution.getProblemFactList()).containsExactly(v1, v2, v3); }

Target:
public void getProblemFactsWithNullField() { TestdataAbstractSolutionBasedSolution solution = new TestdataAbstractSolutionBasedSolution(); solution.setSingleValue(null); TestdataValue v1 = new TestdataValue("v1"); TestdataValue v2 = new TestdataValue("v2"); TestdataValue v3 = new TestdataValue("v3"); List<TestdataValue> valueList = Arrays.asList(v1, v2, v3); solution.setValueList(valueList); solution.setEntityList(null); solution.setSingleEntity(null); solution.setScore(null); assertThat(solution.getProblemFactList()).containsExactly(v1, v2, v3); }
Source:
protected boolean canDoAction() { VmHandler.updateDisksFromDb(getVm()); Collection<DiskImage> diskImages = ImagesHandler.filterDiskBasedOnImages(getVm().getDiskMap().values()); DiskImage vmDisk = LinqUtils.first(diskImages); boolean result = true; Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); result = result && validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && validate(snapshotsValidator.snapshotNotBroken(snapshot)); if (vmDisk != null) { result = result && ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getstorage_pool_id(), Guid.Empty, true, true, false, false, true, true, true, true, new ArrayList<DiskImage>(diskImages)); } if (result && LinqUtils.foreach(diskImages, new Function<DiskImage, Guid>() { @Override public Guid eval(DiskImage disk) { return disk.getvm_snapshot_id().getValue(); } }).contains(getParameters().getDstSnapshotId())) { result = false; addCanDoActionMessage(VdcBllMessages.CANNOT_PREIEW_CURRENT_IMAGE); } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PREVIEW); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); } return result; }

Target:
protected boolean canDoAction() { VmHandler.updateDisksFromDb(getVm()); Collection<DiskImage> diskImages = ImagesHandler.filterDiskBasedOnImages(getVm().getDiskMap().values()); DiskImage vmDisk = LinqUtils.first(diskImages); boolean result = true; Snapshot snapshot = getSnapshotDao().get(getParameters().getDstSnapshotId()); SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); result = result && validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && validate(snapshotsValidator.snapshotNotBroken(snapshot)); if (vmDisk != null) { result = result && ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getstorage_pool_id(), Guid.Empty, true, true, false, false, true, true, true, true, getVm().getDiskMap().values()); } if (result && LinqUtils.foreach(diskImages, new Function<DiskImage, Guid>() { @Override public Guid eval(DiskImage disk) { return disk.getvm_snapshot_id().getValue(); } }).contains(getParameters().getDstSnapshotId())) { result = false; addCanDoActionMessage(VdcBllMessages.CANNOT_PREIEW_CURRENT_IMAGE); } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__PREVIEW); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT); } return result; }
Source:
private void initProperties() { properties.put(ClusterPropertyTypes.TITLE, null); List<String> nodeids = cluster.getNodes().stream() .map(e -> e.getId()) .collect(Collectors.toList()); if (cluster.getNodes().size() > 1) { properties.put(ClusterPropertyTypes.ID, nodeids.toString()); properties.put(ClusterPropertyTypes.STARTRANK, Integer.toString(cluster.getStartRank())); } else if (cluster.getNodes().size() == 1) { SequenceNode sn = cluster.getNodes().iterator().next(); properties.put(ClusterPropertyTypes.ID, sn.getId()); properties.put(ClusterPropertyTypes.STARTREF, Integer.toString(sn.getStartRef())); properties.put(ClusterPropertyTypes.ENDREF, Integer.toString(sn.getEndRef())); properties.put(ClusterPropertyTypes.SOURCES, sn.getSources().toString()); properties.put(ClusterPropertyTypes.SEQUENCE, sn.getSequence()); } }

Target:
private void initProperties() { properties.put(ClusterPropertyTypes.TITLE, null); List<String> nodeIds = cluster.getNodes().stream() .map(e -> e.getId()) .collect(Collectors.toList()); if (cluster.getNodes().size() > 1) { properties.put(ClusterPropertyTypes.ID, nodeIds.toString()); properties.put(ClusterPropertyTypes.STARTRANK, Integer.toString(cluster.getStartRank())); } else { SequenceNode sn = cluster.getNodes().iterator().next(); properties.put(ClusterPropertyTypes.ID, sn.getId()); properties.put(ClusterPropertyTypes.STARTREF, Integer.toString(sn.getStartRef())); properties.put(ClusterPropertyTypes.ENDREF, Integer.toString(sn.getEndRef())); properties.put(ClusterPropertyTypes.SOURCES, sn.getSources().toString()); properties.put(ClusterPropertyTypes.SEQUENCE, sn.getSequence()); } }
Source:
private State getItemState(String itemId) throws ServiceException { ItemRegistry itemRegistry = getItemRegistry(); State itemState = null; try { Item item = itemRegistry.getItem(itemId); itemState = item.getState(); logger.debug("{}: State: {}", itemId, itemState.toString()); } catch (ItemNotFoundException ex) { logger.info("{} not found {}", itemId, ex); } return itemState; }

Target:
private State getItemState(String itemId) throws ServiceException { ItemRegistry itemRegistry = getItemRegistry(); State itemState = null; try { Item item = itemRegistry.getItem(itemId); itemState = item.getState(); logger.debug("{}: State: {}", itemId, itemState); } catch (ItemNotFoundException ex) { logger.info("{} not found {}", itemId, ex.getMessage()); } return itemState; }
Source:
ReviewedPanel(PatchSet.Id id, String path, boolean bottom) { initWidget(uiBinder.createAndBindUi(this)); patchId = id; fileId = path; if (bottom) { fileName.setVisible(false); } else { fileName.setText(path); } nextLink.setHTML(PatchUtil.C.next() + Util.C.nextPatchLinkIcon()); }

Target:
ReviewedPanel(PatchSet.Id id, String path, boolean bottom) { initWidget(uiBinder.createAndBindUi(this)); patchId = id; fileId = path; if (bottom) { UIObject.setVisible(fileName, false); } else { fileName.setInnerText(path); } nextLink.setHTML(PatchUtil.C.next() + Util.C.nextPatchLinkIcon()); }
Source:
public void readsByte() throws IOException { final String data = "{test}"; final InputStream stream = new RqLengthAware( new RqFake( Arrays.asList( "GET /test1", "Host: b.example.com", "Content-type: text/json" ), data ) ).body(); MatcherAssert.assertThat( stream.read(), Matchers.equalTo((int) data.getBytes()[0]) ); MatcherAssert.assertThat( stream.available(), Matchers.equalTo(data.length() - 1) ); }

Target:
public void readsByte() throws IOException { final String data = "test"; final InputStream stream = new RqLengthAware( new RqFake( Arrays.asList( "GET /test1", "Host: b.example.com" ), data ) ).body(); MatcherAssert.assertThat( stream.read(), Matchers.equalTo((int) data.getBytes()[0]) ); MatcherAssert.assertThat( stream.available(), Matchers.equalTo(data.length() - 1) ); }
Source:
protected void performFirstChildNegotiation( List<IkePayload> childReqList, List<IkePayload> childRespList) { childReqList.add(mIkeInitNoncePayload); childRespList.add(mIkeRespNoncePayload); deferMessage( obtainMessage( CMD_HANDLE_FIRST_CHILD_NEGOTIATION, new FirstChildNegotiationData( mFirstChildSessionParams, mFirstChildCallbacks, childReqList, childRespList))); mUserCbExecutor.execute( () -> { IkeSessionConfiguration ikeSessionConfiguration = null; for (IkePayload payload : childRespList) { if (payload instanceof IkeConfigPayload) { ikeSessionConfiguration = new IkeSessionConfiguration((IkeConfigPayload) payload); } } mIkeSessionCallback.onOpened(ikeSessionConfiguration); }); transitionTo(mChildProcedureOngoing); }

Target:
protected void performFirstChildNegotiation( List<IkePayload> childReqList, List<IkePayload> childRespList) { childReqList.add(mIkeInitNoncePayload); childRespList.add(mIkeRespNoncePayload); deferMessage( obtainMessage( CMD_HANDLE_FIRST_CHILD_NEGOTIATION, new FirstChildNegotiationData( mFirstChildSessionParams, mFirstChildCallbacks, childReqList, childRespList))); mUserCbExecutor.execute( () -> { mIkeSessionCallback.onOpened(mIkeSessionConfiguration); }); transitionTo(mChildProcedureOngoing); }
Source:
protected void doSetUserClaimValues(String userName, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws UserStoreException, NotImplementedException { if (profileName == null) { profileName = UserCoreConstants.DEFAULT_PROFILE; } Map<String, List<String>> claimAttributeValueMapToAdd = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToAdd); Map<String, List<String>> claimAttributeValueMapToDelete = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToDelete); Map<String, List<String>> claimAttributeValueMapToModify = resolveUserStoreAttributeValueMaps(userName, claimsExcludingMultiValuedClaims); processAttributesBeforeUpdate(userName, claimAttributeValueMapToAdd, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToDelete, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToModify, profileName); doSetUserAttributes(userName, claimAttributeValueMapToAdd, claimAttributeValueMapToDelete, claimAttributeValueMapToModify, profileName); }

Target:
protected void doSetUserClaimValues(String userName, Map<String, List<String>> multiValuedClaimsToAdd, Map<String, List<String>> multiValuedClaimsToDelete, Map<String, List<String>> claimsExcludingMultiValuedClaims, String profileName) throws UserStoreException, NotImplementedException { if (StringUtils.isBlank(profileName)) { profileName = UserCoreConstants.DEFAULT_PROFILE; } Map<String, List<String>> claimAttributeValueMapToAdd = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToAdd); Map<String, List<String>> claimAttributeValueMapToDelete = resolveUserStoreAttributeValueMaps(userName, multiValuedClaimsToDelete); Map<String, List<String>> claimAttributeValueMapToModify = resolveUserStoreAttributeValueMaps(userName, claimsExcludingMultiValuedClaims); processAttributesBeforeUpdate(userName, claimAttributeValueMapToAdd, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToDelete, profileName); processAttributesBeforeUpdate(userName, claimAttributeValueMapToModify, profileName); doSetUserAttributes(userName, claimAttributeValueMapToAdd, claimAttributeValueMapToDelete, claimAttributeValueMapToModify, profileName); }
Source:
public void handleRequest(final HttpServerExchange exchange) throws Exception { ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if( src != null && exchange.getStatusCode() > 399 && exchange.getResponseContentLength() == -1 ) { ((HttpServletResponse)src.getServletResponse()).sendError(exchange.getStatusCode()); } else { next.handleRequest(exchange); } }

Target:
public void handleRequest(final HttpServerExchange exchange) throws Exception { ServletRequestContext src = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY); if( src != null && exchange.getStatusCode() > 399 && !exchange.isResponseStarted() ) { ((HttpServletResponse)src.getServletResponse()).sendError(exchange.getStatusCode()); } else { next.handleRequest(exchange); } }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ImportTree importTree = (ImportTree)tree; if (importTree.qualifiedIdentifier().is(Kind.MEMBER_SELECT)) { IdentifierTree identifier = ((MemberSelectExpressionTree) importTree.qualifiedIdentifier()).identifier(); if ("*".equals(identifier.name())) { fileContainsWildcardImport = true; return; } } importTrees.add(importTree); }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ImportTree importTree = (ImportTree)tree; if (importTree.qualifiedIdentifier().is(Kind.MEMBER_SELECT)) { IdentifierTree identifier = ((MemberSelectExpressionTree) importTree.qualifiedIdentifier()).identifier(); if ("*".equals(identifier.name())) { fileContainsStarImport = true; return; } } importTrees.add(importTree); }
Source:
private void onGoogleSignInAccountReady(@NonNull GoogleSignInAccount signInAccount) { synchronized (initializationLock) { if (isInitializing.get()) { Single.fromCallable(() -> { final String scopes = "oauth2:" + DriveScopes.DRIVE_APPDATA + " " + DriveScopes.DRIVE_FILE; return GoogleAuthUtil.getToken(context, signInAccount.getAccount(), scopes); }).doOnError(throwable -> { Logger.error(GoogleDriveBackupManager.this, "Failed to authenticate user with status: {}", throwable.getMessage()); }).subscribeOn(Schedulers.io()) .subscribe(onSuccess -> GoogleSignInAccountFinalization(signInAccount, onSuccess), onError -> { if (onError instanceof UserRecoverableAuthException) { activity.startActivityForResult(((UserRecoverableAuthException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } else if (onError instanceof UserRecoverableAuthIOException) { activity.startActivityForResult(((UserRecoverableAuthIOException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } }); } } }

Target:
private void onGoogleSignInAccountReady(@NonNull GoogleSignInAccount signInAccount) { synchronized (initializationLock) { if (isInitializing.get()) { Single.fromCallable(() -> { final String scopes = "oauth2:" + DriveScopes.DRIVE_APPDATA + " " + DriveScopes.DRIVE_FILE; return GoogleAuthUtil.getToken(context, signInAccount.getAccount(), scopes); }).doOnError(throwable -> { Logger.error(GoogleDriveBackupManager.this, "Failed to authenticate user with status: {}", throwable.getMessage()); }).subscribeOn(Schedulers.io()) .subscribe(token -> GoogleSignInAccountFinalization(signInAccount, token), onError -> { if (onError instanceof UserRecoverableAuthException) { activity.startActivityForResult(((UserRecoverableAuthException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } else if (onError instanceof UserRecoverableAuthIOException) { activity.startActivityForResult(((UserRecoverableAuthIOException) onError).getIntent(), REQUEST_CODE_GOOGLE_SERVICE_REAUTH); } }); } } }
Source:
private ConfigurationChangeResourceAddHandler() { super(CONFIGURATION_CHANGES_CAPABILITY, MAX_HISTORY); }

Target:
private ConfigurationChangeResourceAddHandler() { super(MAX_HISTORY); }
Source:
public BlobHolder getBlobHolderAdapter(DocumentModel doc, String factoryName) { if (StringUtils.isNotBlank(factoryName) && factoriesByName.containsKey(factoryName)) { BlobHolderFactory factory = factoriesByName.get(factoryName); return factory.getBlobHolder(doc); } if (factories.containsKey(doc.getType())) { BlobHolderFactory factory = factories.get(doc.getType()); return factory.getBlobHolder(doc); } for (Map.Entry<String, BlobHolderFactory> entry : factoriesByFacets.entrySet()) { if (doc.hasFacet(entry.getKey())) { return entry.getValue().getBlobHolder(doc); } } if (doc.hasSchema("file")) { return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { mt = (String) doc.getPropertyValue("note:mime_type"); if (mt == null) { String note = (String) doc.getPropertyValue("note:note"); if (note != null && !"".equals(note)) { mt = "text/plain"; } } } catch (PropertyException e) { } return new DocumentStringBlobHolder(doc, "note:note", mt); } return null; }

Target:
public BlobHolder getBlobHolderAdapter(DocumentModel doc, String factoryName) { if (factoryName != null && factoriesByName.containsKey(factoryName)) { BlobHolderFactory factory = factoriesByName.get(factoryName); return factory.getBlobHolder(doc); } if (factories.containsKey(doc.getType())) { BlobHolderFactory factory = factories.get(doc.getType()); return factory.getBlobHolder(doc); } for (Map.Entry<String, BlobHolderFactory> entry : factoriesByFacets.entrySet()) { if (doc.hasFacet(entry.getKey())) { return entry.getValue().getBlobHolder(doc); } } if (doc.hasSchema("file")) { return new DocumentBlobHolder(doc, "file:content"); } else if (doc.hasSchema("note")) { String mt = null; try { mt = (String) doc.getPropertyValue("note:mime_type"); if (mt == null) { String note = (String) doc.getPropertyValue("note:note"); if (note != null && !"".equals(note)) { mt = "text/plain"; } } } catch (PropertyException e) { } return new DocumentStringBlobHolder(doc, "note:note", mt); } return null; }
Source:
private Response handleError(UserInfoEndpointException e) throws OAuthSystemException { log.debug(e); OAuthResponse res = null; try { res = OAuthASResponse.errorResponse(HttpServletResponse.SC_BAD_REQUEST) .setError(e.getErrorCode()).setErrorDescription(e.getErrorMessage()) .buildJSONMessage(); } catch (OAuthSystemException e1) { log.error(e1.getMessage(), e1); OAuthResponse response = OAuthASResponse.errorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR) .setError(OAuth2ErrorCodes.SERVER_ERROR) .setErrorDescription(e1.getMessage()).buildJSONMessage(); return Response.status(response.getResponseStatus()).entity(response.getBody()).build(); } return Response.status(res.getResponseStatus()).entity(res.getBody()).build(); }

Target:
private Response handleError(UserInfoEndpointException e) throws OAuthSystemException { log.debug(e); OAuthResponse res = null; try { res = OAuthASResponse.errorResponse(HttpServletResponse.SC_BAD_REQUEST) .setError(e.getErrorCode()).setErrorDescription(e.getErrorMessage()) .buildJSONMessage(); } catch (OAuthSystemException e1) { log.error("Error while building the JSON message", e1); OAuthResponse response = OAuthASResponse.errorResponse(HttpServletResponse.SC_INTERNAL_SERVER_ERROR) .setError(OAuth2ErrorCodes.SERVER_ERROR) .setErrorDescription(e1.getMessage()).buildJSONMessage(); return Response.status(response.getResponseStatus()).entity(response.getBody()).build(); } return Response.status(res.getResponseStatus()).entity(res.getBody()).build(); }
Source:
private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); ImmutableMap.Builder<UUID, UUID> shardMapBuilder = new ImmutableMap.Builder<>(); shards.forEach( shard -> { if (shard.getDeltaShardUuid().isPresent()) { shardMapBuilder.put(shard.getShardUuid(), shard.getDeltaShardUuid().get()); } }); HostAddress address = node.getHostAndPort(); return new RaptorSplit( connectorId, shardUuids, shardMapBuilder.build(), tableSupportsDeltaDelete, bucketNumber, address, effectivePredicate, transactionId, columnTypes); }

Target:
private ConnectorSplit createBucketSplit(int bucketNumber, Set<ShardNodes> shards) { String nodeId = bucketToNode.get().get(bucketNumber); Node node = nodesById.get(nodeId); if (node == null) { throw new PrestoException(NO_NODES_AVAILABLE, "Node for bucket is offline: " + nodeId); } Set<UUID> shardUuids = shards.stream() .map(ShardNodes::getShardUuid) .collect(toSet()); ImmutableMap.Builder<UUID, UUID> shardMapBuilder = ImmutableMap.builder(); shards.forEach( shard -> { if (shard.getDeltaShardUuid().isPresent()) { shardMapBuilder.put(shard.getShardUuid(), shard.getDeltaShardUuid().get()); } }); HostAddress address = node.getHostAndPort(); return new RaptorSplit( connectorId, shardUuids, shardMapBuilder.build(), tableSupportsDeltaDelete, bucketNumber, address, effectivePredicate, transactionId, columnTypes); }
Source:
private void initActors(List<Sprite> sprites) { if (sprites.isEmpty()) { return; } for (Sprite sprite : sprites) { sprite.resetSprite(); sprite.look.createBrightnessContrastHueShader(); if (!sprite.getLookList().isEmpty()) { sprite.look.setLookData(sprite.getLookList().get(0)); } stage.addActor(sprite.look); } penActor = new PenActor(); stage.addActor(penActor); penActor.setZIndex(Z_LAYER_PEN_ACTOR); screenRatio = calculateScreenRatio(); embroideryActor = new EmbroideryActor(screenRatio); stage.addActor(embroideryActor); embroideryActor.setZIndex(Z_LAYER_EMBROIDERY_ACTOR); }

Target:
private void initActors(List<Sprite> sprites) { if (sprites.isEmpty()) { return; } for (Sprite sprite : sprites) { sprite.resetSprite(); sprite.look.createBrightnessContrastHueShader(); stage.addActor(sprite.look); } penActor = new PenActor(); stage.addActor(penActor); penActor.setZIndex(Z_LAYER_PEN_ACTOR); screenRatio = calculateScreenRatio(); embroideryActor = new EmbroideryActor(screenRatio); stage.addActor(embroideryActor); embroideryActor.setZIndex(Z_LAYER_EMBROIDERY_ACTOR); }
Source:
public User setupCommCareUser(){ User user = null; String commCareUserName = Context.getRuntimeProperties().getProperty("commcare.username", "commCareUser"); String commCareUserPassword = Context.getRuntimeProperties().getProperty("commcare.password", "CommCare12"); if (StringUtils.isNotBlank(commCareUserName)) { user = Context.getUserService().getUserByUsername(commCareUserName); if (user == null) { user = new User(); } user.setUsername(commCareUserName); Person person = user.getPerson(); if (person == null) { person = new Person(); person.addName(new PersonName("CommCare", "", "Integration")); person.setGender("M"); user.setPerson(person); } user.addRole(Context.getUserService().getRole("Authenticated")); user.addRole(Context.getUserService().getRole("Privilege Level: Full")); if (user.getId() == null ) { user = Context.getUserService().createUser(user, commCareUserPassword); } else { user = Context.getUserService().saveUser(user); } person = user.getPerson(); Collection<Provider> providers = Context.getProviderService().getProvidersByPerson(person); if (providers == null || providers.size() < 1 ){ Provider provider = new Provider(); provider.setPerson(person); Context.getProviderService().saveProvider(provider); } } return user; }

Target:
public User setupCommCareUser(){ User user = null; String commCareUserName = Context.getRuntimeProperties().getProperty("commcare.username", null); String commCareUserPassword = Context.getRuntimeProperties().getProperty("commcare.password", null); if (StringUtils.isNotBlank(commCareUserName) && StringUtils.isNotBlank(commCareUserPassword)) { user = Context.getUserService().getUserByUsername(commCareUserName); if (user == null) { user = new User(); } user.setUsername(commCareUserName); Person person = user.getPerson(); if (person == null) { person = new Person(); person.addName(new PersonName("CommCare", "", "Integration")); person.setGender("M"); user.setPerson(person); } user.addRole(Context.getUserService().getRole("Authenticated")); user.addRole(Context.getUserService().getRole("Privilege Level: Full")); if (user.getId() == null ) { user = Context.getUserService().createUser(user, commCareUserPassword); } else { user = Context.getUserService().saveUser(user); } person = user.getPerson(); Collection<Provider> providers = Context.getProviderService().getProvidersByPerson(person); if (providers == null || providers.size() < 1 ){ Provider provider = new Provider(); provider.setUuid(PihCoreConstants.COMMCARE_PROVIDER_UUID); provider.setPerson(person); Context.getProviderService().saveProvider(provider); } } return user; }
Source:
public void updateButtons() { super.updateButtons(); final Button nextButton = getButton(IDialogConstants.NEXT_ID); if (getCurrentPage() instanceof CreateContractInputFromBusinessObjectWizardPage) { final CreateContractInputFromBusinessObjectWizardPage page = (CreateContractInputFromBusinessObjectWizardPage) getCurrentPage(); nextButton.setText(Messages.preview); } else { nextButton.setText(IDialogConstants.NEXT_LABEL); } }

Target:
public void updateButtons() { super.updateButtons(); final Button nextButton = getButton(IDialogConstants.NEXT_ID); if (getCurrentPage() instanceof CreateContractInputFromBusinessObjectWizardPage) { nextButton.setText(Messages.preview); } else { nextButton.setText(IDialogConstants.NEXT_LABEL); } }
Source:
private static OGCGeometry tileToPolygon(BingTile tile) { Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel()); Polyline boundary = new Polyline(); boundary.startPath(upperLeftCorner); boundary.lineTo(lowerRightCorner.getX(), upperLeftCorner.getY()); boundary.lineTo(lowerRightCorner); boundary.lineTo(upperLeftCorner.getX(), lowerRightCorner.getY()); final Polygon polygon = new Polygon(); polygon.add(boundary, false); return OGCGeometry.createFromEsriGeometry(polygon, null); }

Target:
private static OGCGeometry tileToPolygon(BingTile tile) { Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel()); Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel()); Polyline boundary = new Polyline(); boundary.startPath(upperLeftCorner); boundary.lineTo(lowerRightCorner.getX(), upperLeftCorner.getY()); boundary.lineTo(lowerRightCorner); boundary.lineTo(upperLeftCorner.getX(), lowerRightCorner.getY()); Polygon polygon = new Polygon(); polygon.add(boundary, false); return OGCGeometry.createFromEsriGeometry(polygon, null); }
Source:
public MouseOverArea[] createMouseOverAreas(float overCoordX, float overCoordY, GameContainer container, String[] text,TrueTypeFont typeFont, ResourcesWrapper res) throws SlickException { MouseOverArea[] areas = new MouseOverArea[text.length]; for (int i = 0; i < areas.length; i++) { Image button = res.createImage(typeFont.getWidth(text[i]), typeFont.getHeight()); Shape shape = new Rectangle(overCoordX, overCoordY + i * 50, typeFont.getWidth(text[0]), typeFont.getHeight()); areas[i] = new MouseOverArea(container, button, shape); } return areas; }

Target:
protected MouseOverArea[] createMouseOverAreas(float overCoordX, float overCoordY, GameContainer container, String[] text,TrueTypeFont typeFont, ResourcesWrapper res) throws SlickException { MouseOverArea[] areas = new MouseOverArea[text.length]; for (int i = 0; i < areas.length; i++) { Image button = res.createImage(typeFont.getWidth(text[i]), typeFont.getHeight()); Shape shape = new Rectangle(overCoordX, overCoordY + i * 50, typeFont.getWidth(text[0]), typeFont.getHeight()); areas[i] = new MouseOverArea(container, button, shape); } return areas; }
Source:
public Order updateStatus(String orderReference) { Client mollie = new ClientBuilder().withApiKey(apiKey).build(); Order order = orderRepository.findByReference(orderReference) .orElseThrow(() -> new OrderNotFoundException("Order with reference " + orderReference + " not found")); try { ResponseOrError<Payment> molliePaymentStatus = mollie.payments().get(orderReference); if (molliePaymentStatus.getSuccess()) { switch (molliePaymentStatus.getData().getStatus()) { case "pending": { order.setStatus(OrderStatus.PENDING); break; } case "open": { order.setStatus(OrderStatus.PENDING); break; } case "cancelled": { order.setStatus(OrderStatus.CANCELLED); break; } case "failed": { order.setStatus(OrderStatus.CANCELLED); break; } case "expired": { order.setStatus(OrderStatus.EXPIRED); break; } case "paid": { order.setStatus(OrderStatus.PAID); slackNotificationService.sendSlackMessage(order.getTickets().size() + " tickets bought!"); break; } case "paidout": { order.setStatus(OrderStatus.PAID); break; } } return orderRepository.save(order); } else { handleMollieError(molliePaymentStatus); return order; } } catch (IOException e) { throw new PaymentServiceConnectionException(e.getMessage()); } }

Target:
public Order updateStatus(String orderReference) { Client mollie = new ClientBuilder().withApiKey(apiKey).build(); Order order = orderRepository.findByReference(orderReference) .orElseThrow(() -> new OrderNotFoundException("Order with reference " + orderReference + " not found")); try { ResponseOrError<Payment> molliePaymentStatus = mollie.payments().get(orderReference); if (molliePaymentStatus.getSuccess()) { switch (molliePaymentStatus.getData().getStatus()) { case "pending": { order.setStatus(OrderStatus.PENDING); break; } case "open": { order.setStatus(OrderStatus.PENDING); break; } case "cancelled": { order.setStatus(OrderStatus.CANCELLED); break; } case "failed": { order.setStatus(OrderStatus.CANCELLED); break; } case "expired": { order.setStatus(OrderStatus.EXPIRED); break; } case "paid": { order.setStatus(OrderStatus.PAID); break; } case "paidout": { order.setStatus(OrderStatus.PAID); break; } } return orderRepository.save(order); } else { handleMollieError(molliePaymentStatus); return order; } } catch (IOException e) { throw new PaymentServiceConnectionException(e.getMessage()); } }
Source:
protected void setInputStream(InputStream is) { this.is = is; }

Target:
protected void setInputStream(InputStream is) { this.is = is; resetEntity(); }
Source:
protected MultivaluedMap<String, String> getQueryParams(String query) throws URISyntaxException { URIBuilder uri; uri = new URIBuilder(query); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); for (NameValuePair queryParam : uri.getQueryParams()) { queryParams.add(queryParam.getName(), queryParam.getValue()); } log.debug("QueryParams: {}", queryParams); return queryParams; }

Target:
protected MultivaluedMap<String, String> getQueryParams(String query) throws URISyntaxException { URIBuilder uri; uri = new URIBuilder(query); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<String, String>(); for (NameValuePair queryParam : uri.getQueryParams()) { queryParams.add(queryParam.getName(), queryParam.getValue()); } return queryParams; }
Source:
public void onStartup(final PlaceRequest place) { signalProcessInstanceAction = new PrimaryActionMenuBuilder(constants.Signal(), () -> signalProcessInstance()); abortProcessInstanceAction = new PrimaryActionMenuBuilder(constants.Abort(), () -> openAbortProcessInstancePopup()); this.place = place; }

Target:
public void onStartup(final PlaceRequest place) { setSignalProcessInstanceAction(new PrimaryActionMenuBuilder(constants.Signal(), () -> signalProcessInstance())); setAbortProcessInstanceAction(new PrimaryActionMenuBuilder(constants.Abort(), () -> openAbortProcessInstancePopup())); this.place = place; }
Source:
private void append(String arg) { buf.append(arg); cursor = Position.pos(cursor.line, cursor.column + arg.length()); }

Target:
private void append(String arg) { buf.append(arg); cursor = cursor.withColumn(cursor.column + arg.length()); }
Source:
public CookieCredentials extract(final WebContext context) { final Collection<Cookie> col = context.getRequestCookies(); if (col.contains(new Cookie(this.cookieName, this.cookieValue))) { return null; } return new CookieCredentials(this.cookieName, this.cookieValue, clientName); }

Target:
public TokenCredentials extract(final WebContext context) { final Collection<Cookie> col = context.getRequestCookies(); for (final Cookie c : col) { if (c.getName().equals(this.cookieName)) { return new TokenCredentials(c.getValue(), clientName); } } return null; }
Source:
public void stop() throws XAException, SystemException, InvalidTransactionException, NamingException { txbridgeLogger.logger.trace("InboundBridge.stop("+xid+")"); TransactionManager.transactionManager(new InitialContext()).suspend(); }

Target:
public void stop() throws XAException, SystemException, InvalidTransactionException { txbridgeLogger.logger.trace("InboundBridge.stop("+xid+")"); TransactionManager.transactionManager(ctx).suspend(); }
Source:
protected DBObject normalizeResponse(DBObject rawJson) { List<DBObject> curatedList = new ArrayList<>(); for (DBObject dbObject: Transformer.convertToDbObjectList(rawJson)) { try { this.checkForErrorResponse(dbObject); this.normalizeRcv(dbObject); this.objectMapper.convertValue(dbObject, this.type); curatedList.add(dbObject); } catch (Exception e) { LOG.warn(this.getId(dbObject) + ": " + e.getLocalizedMessage()); } } BasicDBList list = new BasicDBList(); list.addAll(curatedList); return list; }

Target:
protected DBObject normalizeResponse(DBObject rawJson) { List<DBObject> curatedList = new ArrayList<>(); for (DBObject dbObject: Transformer.convertToDbObjectList(rawJson)) { try { this.checkForErrorResponse(dbObject); this.objectMapper.convertValue(dbObject, this.type); curatedList.add(dbObject); } catch (MyVariantInfoNotFoundException e) { } catch (Exception e) { LOG.warn(this.getId(dbObject) + ": " + e.getLocalizedMessage()); } } BasicDBList list = new BasicDBList(); list.addAll(curatedList); return list; }
Source:
public void setCompareMode(boolean compareMode) { if (compareModeAction!=null) { this.compareMode = !compareMode; compareModeAction.run(); } }

Target:
public void setCompareMode(boolean compareMode) { if (compareModeAction!=null) { this.compareMode = compareMode; compareModeAction.setChecked(compareMode); } }
Source:
public void childModuleMissingModuleAnnotation() { ObjectGraph.createWith(new TestingLoader(), new TestingLoader(), new ChildModuleMissingModuleAnnotation()); }

Target:
public void childModuleMissingModuleAnnotation() { try { ObjectGraph.createWith(new TestingLoader(), new ChildModuleMissingModuleAnnotation()); } catch (IllegalArgumentException e) { assertThat(e.getMessage()) .contains("No @Module on dagger.ModuleTest$ModuleMissingModuleAnnotation"); } }
Source:
public boolean isFirstBookingOK(ArrayList<LocalDate> dates) { try { WebElement firstVisitElement = findElement(FIRST_VISIT); if (firstVisitElement == null) { return true; } else { LocalDate date = LocalDate.parse((firstVisitElement.getAttribute("title")).toString()); if (containsDate(dates, date)) { return true; } return false; } } catch (Exception e) { return true; } }

Target:
public boolean isFirstBookingOK(ArrayList<LocalDate> dates) { try { WebElement firstVisitElement = findElement(FIRST_VISIT); if (firstVisitElement == null) { return true; } else { LocalDate date = LocalDate.parse((firstVisitElement.getAttribute("title")).toString(), DateTimeFormat.forPattern("yyyy-MM-dd")); if (dates.contains(date)) { return true; } return false; } } catch (Exception e) { return true; } }
Source:
private Object[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; StringBuilder newSelection = new StringBuilder(selection); newSelection.append(" OR " + TABLE_BOOKMARKS + "._id IN ("); List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { Object[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); String[] bookmarkIds = (String[]) bookmarks[1]; for (String bookmarkId : bookmarkIds) { newSelection.append("'" + bookmarkId + "',"); newSelectionArgs.add(bookmarkId); } newSelection.deleteCharAt(newSelection.length() - 1); } } } } finally { if (cursor != null) { cursor.close(); } } newSelection.append(")"); return new Object[] { newSelection.toString(), newSelectionArgs.toArray(new String[newSelectionArgs.size()]) }; }

Target:
private Object[] appendBookmarksIfFolder(String selection, String[] selectionArgs) { final SQLiteDatabase db = mOpenHelper.getReadableDatabase(); final String[] bookmarksProjection = new String[] { Bookmarks._ID, Bookmarks.IS_FOLDER }; StringBuilder newSelection = new StringBuilder(selection); List<String> newSelectionArgs = new ArrayList<String>(); Cursor cursor = null; try { cursor = db.query(TABLE_BOOKMARKS, bookmarksProjection, selection, selectionArgs, null, null, null); if (cursor != null) { while (cursor.moveToNext()) { String id = Long.toString(cursor.getLong(0)); newSelectionArgs.add(id); if (cursor.getInt(1) != 0) { Object[] bookmarks = appendBookmarksIfFolder( Bookmarks.PARENT + "=?", new String[] { id }); String[] bookmarkIds = (String[]) bookmarks[1]; if (bookmarkIds.length > 0) { newSelection.append(" OR " + TABLE_BOOKMARKS + "._id IN ("); for (String bookmarkId : bookmarkIds) { newSelection.append("?,"); newSelectionArgs.add(bookmarkId); } newSelection.deleteCharAt(newSelection.length() - 1); newSelection.append(")"); } } } } } finally { if (cursor != null) { cursor.close(); } } return new Object[] { newSelection.toString(), newSelectionArgs.toArray(new String[newSelectionArgs.size()]) }; }
Source:
public void validate(final String name, final String value) throws ParameterException { if (Strings.isNullOrEmpty(value)) { throw new ParameterException(name + " is null or empty"); } }

Target:
public void validate(final String name, final String value) throws ParameterException { if (StringUtils.isBlank(value)) { throw new ParameterException(name + " is null or empty"); } }
Source:
public void setFakeHash() { if (hash.length() == 0) { hash = this.pack.getId(); if (hash.length() == SpongeResourcePack.HASH_SIZE) { hash += " "; } } }

Target:
public String setFakeHash() { if (this.hash.length() == 0) { this.hash = this.pack.getId(); if (this.hash.length() == SpongeResourcePack.HASH_SIZE) { this.hash += " "; } } return this.hash.trim(); }