auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if (parameterNames.length != totalLength) { throw new TestNGException( "Cannot inject " + methodAnnotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes) + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } }

Target:
private static void checkParameterTypes(String methodName, Class[] parameterTypes, String methodAnnotation, String[] parameterNames) { int totalLength = parameterTypes.length; Set<Class> injectedTypes = new HashSet<Class>() { private static final long serialVersionUID = -5324894581793435812L; { add(ITestContext.class); add(ITestResult.class); add(XmlTest.class); add(Method.class); add(Object[].class); }}; for (Class parameterType : parameterTypes) { if (injectedTypes.contains(parameterType)) { totalLength--; } } if ( (parameterNames.length ==0) && (totalLength != 0) ) { String errPrefix = "Cannot inject " + methodAnnotation + " annotated Method [" + methodName + "] with " + Arrays.toString(parameterTypes); if (mapping.containsKey(methodAnnotation)) { errPrefix = "Can inject only one of " + prettyFormat(mapping.get(methodAnnotation)) + " into a " + methodAnnotation + " annotated " + methodName; } throw new TestNGException( errPrefix + ".\nFor more information on native dependency injection please refer to " + "<LINK_0>" ); } if (parameterNames.length != totalLength) { throw new TestNGException( "Method " + methodName + " requires " + parameterTypes.length + " parameters but " + parameterNames.length + " were supplied in the " + methodAnnotation + " annotation."); } }
Source:
public List<SourceControl.SourceControlBean> getSourceControlList() { List<SourceControl.SourceControlBean> sourceControlList = new ArrayList<>(); for (SourceControl sourceControl : SourceControl.values()) { sourceControlList.add(new SourceControl.SourceControlBean(sourceControl)); } return sourceControlList; }

Target:
public List<SourceControl.SourceControlBean> getSourceControlList() { List<SourceControl.SourceControlBean> sourceControlList = new ArrayList<>(); Arrays.asList(SourceControl.values()).forEach(sourceControl -> sourceControlList.add(new SourceControl.SourceControlBean(sourceControl))); return sourceControlList; }
Source:
private void changeToolbarVisibilityInFullscreenMode(Object arg) { String notificationName = OoyalaNotification.getNameOrUnknown(arg); if (notificationName.equals(OoyalaSkinLayoutController.FULLSCREEN_CHANGED_NOTIFICATION_NAME)) { if (((OoyalaNotification) arg).getData().equals(Boolean.TRUE)) { toolbar.setVisibility(View.GONE); } else { toolbar.setVisibility(View.VISIBLE); toolbar.bringToFront(); } } }

Target:
private void changeToolbarVisibilityInFullscreenMode(Object arg) { String notificationName = OoyalaNotification.getNameOrUnknown(arg); if (notificationName.equals(OoyalaSkinLayoutController.FULLSCREEN_CHANGED_NOTIFICATION_NAME) && toolbar != null) { if (((OoyalaNotification) arg).getData().equals(Boolean.TRUE)) { toolbar.setVisibility(View.GONE); } else { toolbar.setVisibility(View.VISIBLE); toolbar.bringToFront(); } } }
Source:
public void start() { URI configFileUri = null; try { if (service.configFile != null) { URL configFile = JCacheLifecycle.class.getClassLoader().getResource(service.configFile); if (configFile == null) { throw new IllegalArgumentException(String.format("Unable to locate specified configuration file %s.", service.configFile)); } configFileUri = configFile.toURI(); } } catch (URISyntaxException e) { log.errorf(String.format("Exception while accessing configuration file %s.", service.configFile), e); throw new IllegalStateException(e); } Properties configProperties = null; if (service.propertiesFile != null) { configProperties = new Properties(); try { Utils.loadProperties(configProperties, JCacheLifecycle.class.getClassLoader().getResourceAsStream(service.propertiesFile)); } catch (IOException e) { log.error(String.format("Exception while loading configuration properties file %s.", service.propertiesFile)); throw new IllegalStateException(e); } } cacheManager = Caching.getCachingProvider().getCacheManager(configFileUri, JCacheLifecycle.class.getClassLoader(), configProperties); service.cache = service.createCache ? cacheManager.createCache(service.cacheName, new MutableConfiguration()) : cacheManager.getCache(service.cacheName); }

Target:
public void start() { URI cacheManagerUri = null; try { if (service.configFile != null) { URL cacheManagerUrl = JCacheLifecycle.class.getClassLoader().getResource(service.configFile); if (cacheManagerUrl == null) { throw new IllegalArgumentException(String.format("Unable to locate specified configuration file %s.", service.configFile)); } cacheManagerUri = cacheManagerUrl.toURI(); } } catch (URISyntaxException e) { log.errorf(String.format("Exception while accessing configuration file %s.", service.configFile), e); throw new IllegalStateException(e); } Properties configProperties = null; if (service.propertiesFile != null) { configProperties = new Properties(); try (InputStream propertiesStream = JCacheLifecycle.class.getClassLoader().getResourceAsStream(service.propertiesFile)) { Utils.loadProperties(configProperties, propertiesStream); } catch (IOException e) { log.error(String.format("Exception while loading configuration properties file %s.", service.propertiesFile)); throw new IllegalStateException(e); } } CachingProvider cachingProvider = service.cachingProviderClass == null ? Caching.getCachingProvider() : Caching.getCachingProvider(service.cachingProviderClass); service.cacheManager = cachingProvider.getCacheManager(cacheManagerUri, JCacheLifecycle.class.getClassLoader(), configProperties); }
Source:
public void testIncompleteZKHostInfo() throws Exception { assumeTrue(dcStr.equalsIgnoreCase("all") || dcStr.replaceAll("\\p{Space}", "").split(",").length == dcs.length); if (testHardwareLayout.getDatacenterCount() > 1) { JSONObject partialZkJson = constructZkLayoutJSON(Collections.singleton(dcsToZkInfo.entrySet().iterator().next().getValue())); Utils.writeJsonObjectToFile(partialZkJson, zkLayoutPath); Utils.writeJsonObjectToFile(testHardwareLayout.getHardwareLayout().toJSONObject(), hardwareLayoutPath); Utils.writeJsonObjectToFile(testPartitionLayout.getPartitionLayout().toJSONObject(), partitionLayoutPath); try { HelixBootstrapUpgradeUtil.bootstrapOrUpgrade(hardwareLayoutPath, partitionLayoutPath, zkLayoutPath, CLUSTER_NAME_PREFIX, dcStr, DEFAULT_MAX_PARTITIONS_PER_RESOURCE, false, false, new HelixAdminFactory()); fail("Should have thrown IllegalArgumentException as a zk host is missing for one of the dcs"); } catch (IllegalArgumentException e) { } } }

Target:
public void testIncompleteZKHostInfo() throws Exception { assumeTrue(dcStr.equalsIgnoreCase("all")); if (testHardwareLayout.getDatacenterCount() > 1) { JSONObject partialZkJson = constructZkLayoutJSON(Collections.singleton(dcsToZkInfo.entrySet().iterator().next().getValue())); Utils.writeJsonObjectToFile(partialZkJson, zkLayoutPath); Utils.writeJsonObjectToFile(testHardwareLayout.getHardwareLayout().toJSONObject(), hardwareLayoutPath); Utils.writeJsonObjectToFile(testPartitionLayout.getPartitionLayout().toJSONObject(), partitionLayoutPath); try { HelixBootstrapUpgradeUtil.bootstrapOrUpgrade(hardwareLayoutPath, partitionLayoutPath, zkLayoutPath, CLUSTER_NAME_PREFIX, dcStr, DEFAULT_MAX_PARTITIONS_PER_RESOURCE, false, false, new HelixAdminFactory()); fail("Should have thrown IllegalArgumentException as a zk host is missing for one of the dcs"); } catch (IllegalArgumentException e) { } } }
Source:
private void testUpdateInsertionFeature(String insertion) throws Exception { String url = "/ats/program/" + getSawProgram().getArtId() + "/insertion/1234567800/feature"; JsonArray array = putAndCheck(url, Entity.entity(insertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion Feature", array); Assert.assertNotNull("Did not find value Renamed Insertion Feature", obj); }

Target:
private void testUpdateInsertionFeature(String insertion) throws Exception { String url = "/ats/program/" + getSawProgram().getUuid() + "/insertion/1234567800/feature"; JsonArray array = putAndCheck(url, Entity.entity(insertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion Feature", array); Assert.assertNotNull("Did not find value Renamed Insertion Feature", obj); }
Source:
private boolean upgradeTwentyFourTwentyFive(SQLiteDatabase db) { db.beginTransaction(); try { boolean strandedRecordObserved = false; SqlStorage<FormRecord> formRecordStorage = UserDbUpgradeUtils.getFormRecordStorage(c, db, FormRecord.class); SqlStorage<SessionStateDescriptor> ssdStorage = new SqlStorage<>( SessionStateDescriptor.STORAGE_KEY, SessionStateDescriptor.class, new ConcreteAndroidDbHelper(c, db)); for (SessionStateDescriptor ssd : ssdStorage) { try { FormRecord formRecord = formRecordStorage.read(ssd.getFormRecordId()); if (formRecord.getStatus().contentEquals(FormRecord.STATUS_UNSTARTED)) { strandedRecordObserved = true; break; } } catch (NoSuchElementException e) { strandedRecordObserved = true; break; } } if (strandedRecordObserved) { SqlStorage.wipeTable(db, SessionStateDescriptor.STORAGE_KEY); for (FormRecord formRecord : formRecordStorage) { if (formRecord.getStatus().contentEquals(FormRecord.STATUS_INCOMPLETE)) { formRecordStorage.remove(formRecord); } } } db.setTransactionSuccessful(); return true; } finally { db.endTransaction(); } }

Target:
private boolean upgradeTwentyFourTwentyFive(SQLiteDatabase db) { db.beginTransaction(); try { boolean strandedRecordObserved = false; SqlStorage<FormRecord> formRecordStorage = UserDbUpgradeUtils.getFormRecordStorage(c, db, FormRecord.class); SqlStorage<SessionStateDescriptor> ssdStorage = new SqlStorage<>( SessionStateDescriptor.STORAGE_KEY, SessionStateDescriptor.class, new ConcreteAndroidDbHelper(c, db)); for (SessionStateDescriptor ssd : ssdStorage) { try { FormRecord formRecord = formRecordStorage.read(ssd.getFormRecordId()); if (formRecord.getStatus().contentEquals(FormRecord.STATUS_UNSTARTED)) { strandedRecordObserved = true; break; } } catch (NoSuchElementException e) { strandedRecordObserved = true; break; } } if (strandedRecordObserved) { SqlStorage.wipeTable(db, SessionStateDescriptor.STORAGE_KEY); Vector<FormRecord> incompleteRecords = formRecordStorage.getRecordsForValue(FormRecord.META_STATUS, FormRecord.STATUS_INCOMPLETE); for (FormRecord incompleteRecord : incompleteRecords) { formRecordStorage.remove(incompleteRecord); } } db.setTransactionSuccessful(); return true; } finally { db.endTransaction(); } }
Source:
private KerberosManager() { String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { String msg = String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath()); log.error(msg); throw new RuntimeException(msg); } else { System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); } System.setProperty("sun.security.krb5.msinterop.kstring", "true"); }

Target:
private KerberosManager() { String engineEtc = System.getenv("ENGINE_ETC"); if (engineEtc == null) { engineEtc = "/etc/ovirt-engine"; } File krb5File = new File(engineEtc, "krb5.conf"); if (!krb5File.exists()) { String msg = String.format("Failed loading kerberos settings from File %1$s.", krb5File.getAbsolutePath()); log.error(msg); throw new RuntimeException(msg); } System.setProperty("java.security.krb5.conf", krb5File.getAbsolutePath()); System.setProperty("sun.security.krb5.msinterop.kstring", "true"); }
Source:
public final void parseVersion( String version ) { comparable = new ComparableVersion( version ); int index = version.indexOf( '-' ); String part1; String part2 = null; if ( index < 0 ) { part1 = version; } else { part1 = version.substring( 0, index ); part2 = version.substring( index + 1 ); } if ( part2 != null ) { if ( part2.length() == 1 || !part2.startsWith( "0" ) ) { buildNumber = tryParseInt( part2 ); if ( buildNumber == null ) { qualifier = part2; } } else { qualifier = part2; } } if ( ( !part1.contains( "." ) ) && !part1.startsWith( "0" ) ) { majorVersion = tryParseInt( part1 ); if ( majorVersion == null ) { qualifier = version; buildNumber = null; } } else { boolean fallback = false; StringTokenizer tok = new StringTokenizer( part1, "." ); if ( tok.hasMoreTokens() ) { majorVersion = getNextIntegerToken( tok ); if ( majorVersion == null ) { fallback = true; } } else { fallback = true; } if ( tok.hasMoreTokens() ) { minorVersion = getNextIntegerToken( tok ); if ( minorVersion == null ) { fallback = true; } } if ( tok.hasMoreTokens() ) { incrementalVersion = getNextIntegerToken( tok ); if ( incrementalVersion == null ) { fallback = true; } } if ( tok.hasMoreTokens() ) { qualifier = tok.nextToken(); fallback = Pattern.compile( "\\d+" ).matcher( qualifier ).matches(); } if ( part1.contains( ".." ) || part1.startsWith( "." ) || part1.endsWith( "." ) ) { fallback = true; } if ( fallback ) { qualifier = version; majorVersion = null; minorVersion = null; incrementalVersion = null; buildNumber = null; } } }

Target:
public final void parseVersion( String version ) { comparable = new ComparableVersion( version ); int index = version.indexOf( '-' ); String part1; String part2 = null; if ( index < 0 ) { part1 = version; } else { part1 = version.substring( 0, index ); part2 = version.substring( index + 1 ); } if ( part2 != null ) { if ( part2.length() == 1 || !part2.startsWith( "0" ) ) { buildNumber = tryParseInt( part2 ); if ( buildNumber == null ) { qualifier = part2; } } else { qualifier = part2; } } if ( ( !part1.contains( "." ) ) && !part1.startsWith( "0" ) ) { majorVersion = tryParseInt( part1 ); if ( majorVersion == null ) { qualifier = version; buildNumber = null; } } else { boolean fallback = false; StringTokenizer tok = new StringTokenizer( part1, "." ); if ( tok.hasMoreTokens() ) { majorVersion = getNextIntegerToken( tok ); if ( majorVersion == null ) { fallback = true; } } else { fallback = true; } if ( tok.hasMoreTokens() ) { minorVersion = getNextIntegerToken( tok ); if ( minorVersion == null ) { fallback = true; } } if ( tok.hasMoreTokens() ) { incrementalVersion = getNextIntegerToken( tok ); if ( incrementalVersion == null ) { fallback = true; } } if ( tok.hasMoreTokens() ) { qualifier = tok.nextToken(); fallback = isDigits( qualifier ); } if ( part1.contains( ".." ) || part1.startsWith( "." ) || part1.endsWith( "." ) ) { fallback = true; } if ( fallback ) { qualifier = version; majorVersion = null; minorVersion = null; incrementalVersion = null; buildNumber = null; } } }
Source:
public Message(String nodeName, Id nodeID, User sender, Content content) throws MessageException, NodeException { super(nodeName, nodeID); if (sender == null){ throw new MessageException("Error, null sender in Message constructor"); } else if (content == null){ throw new MessageException("Error, null content in Message constructor"); } else { this.mSender = sender; this.mContent = content; this.mDate = new java.util.Date(); } }

Target:
public Message(String nodeName, Id nodeID, User sender, Content content) { super(nodeName, nodeID); this.mSender = Objects.requireNonNull(sender); this.mContent = Objects.requireNonNull(content); this.mDate = new java.util.Date(); }
Source:
public void start() { mSuccess = false; try { mProjectsFolder = File.createTempFile("targettranslation", "." + Translator.ARCHIVE_EXTENSION); FileUtils.copyInputStreamToFile(resolver.openInputStream(mContentUri), mProjectsFolder); ArchiveDetails details = ArchiveDetails.newInstance(mProjectsFolder, Locale.getDefault().getLanguage(), AppContext.getLibrary()); mProjectsFound = ""; mAlreadyPresent = false; for (ArchiveDetails.TargetTranslationDetails td : details.targetTranslationDetails) { mProjectsFound += td.projectName + " - " + td.targetLanguageName + ", "; String targetTranslationId = td.targetTranslationSlug; File localDir = new File(AppContext.getTranslator().getPath(), targetTranslationId); TargetTranslation localTargetTranslation = TargetTranslation.open(localDir); if ((localTargetTranslation != null)) { mAlreadyPresent = true; } } mProjectsFound = mProjectsFound.replaceAll(", $", ""); mSuccess = true; } catch (Exception e) { Logger.e(TAG,"Error processing input file: " + mContentUri.toString()); } }

Target:
public void start() { mSuccess = false; try { mProjectsFolder = File.createTempFile("targettranslation", "." + Translator.ARCHIVE_EXTENSION); FileUtils.copyInputStreamToFile(resolver.openInputStream(mContentUri), mProjectsFolder); ArchiveDetails details = ArchiveDetails.newInstance(mProjectsFolder, Locale.getDefault().getLanguage(), AppContext.getLibrary()); mProjectsFound = ""; mAlreadyPresent = false; for (ArchiveDetails.TargetTranslationDetails td : details.targetTranslationDetails) { mProjectsFound += td.projectName + " - " + td.targetLanguageName + ", "; String targetTranslationId = td.targetTranslationSlug; TargetTranslation localTargetTranslation = AppContext.getTranslator().getTargetTranslation(targetTranslationId); if ((localTargetTranslation != null)) { mAlreadyPresent = true; } } mProjectsFound = mProjectsFound.replaceAll(", $", ""); mSuccess = true; } catch (Exception e) { Logger.e(TAG,"Error processing input file: " + mContentUri.toString()); } }
Source:
public boolean deployAllAPIsAtGatewayStartup (Set<String> assignedGatewayLabels) throws ArtifactSynchronizerException { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { if (artifactRetriever != null) { try { Iterator<String> it = assignedGatewayLabels.iterator(); APIGatewayAdminClient apiGatewayAdminClient = new APIGatewayAdminClient(); while (it.hasNext()) { String label = it.next(); List<String> gatewayRuntimeArtifacts = ServiceReferenceHolder .getInstance().getArtifactRetriever().retrieveAllArtifacts(label); for (String APIruntimeArtifact :gatewayRuntimeArtifacts){ GatewayAPIDTO gatewayAPIDTO = null; try { if (!StringUtils.isEmpty(APIruntimeArtifact)) { gatewayAPIDTO = new Gson().fromJson(APIruntimeArtifact, GatewayAPIDTO.class); log.info("Deploying synapse artifacts of " + gatewayAPIDTO.getName()); apiGatewayAdminClient.deployAPI(gatewayAPIDTO); } } catch (AxisFault axisFault) { log.error("Error in deploying" + gatewayAPIDTO.getName()+ " to the Gateway "); continue; } } if (debugEnabled) { log.debug("APIs deployed in gateway with the label of " + label); } } return true; } catch (ArtifactSynchronizerException | IOException e ) { String msg = "Error deploying APIs to the Gateway "; log.error(msg, e); throw new ArtifactSynchronizerException(msg, e); } } else { String msg = "Artifact retriever not found"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } return false; }

Target:
public boolean deployAllAPIsAtGatewayStartup (Set<String> assignedGatewayLabels) throws ArtifactSynchronizerException { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled()) { if (artifactRetriever != null) { try { Iterator<String> it = assignedGatewayLabels.iterator(); APIGatewayAdminClient apiGatewayAdminClient = new APIGatewayAdminClient(); while (it.hasNext()) { String label = it.next(); List<String> gatewayRuntimeArtifacts = ServiceReferenceHolder .getInstance().getArtifactRetriever().retrieveAllArtifacts(label); for (String runtimeArtifact :gatewayRuntimeArtifacts){ GatewayAPIDTO gatewayAPIDTO = null; try { if (StringUtils.isNotEmpty(runtimeArtifact)) { gatewayAPIDTO = new Gson().fromJson(runtimeArtifact, GatewayAPIDTO.class); log.info("Deploying synapse artifacts of " + gatewayAPIDTO.getName()); apiGatewayAdminClient.deployAPI(gatewayAPIDTO); } } catch (AxisFault axisFault) { log.error("Error in deploying" + gatewayAPIDTO.getName()+ " to the Gateway "); continue; } } if (debugEnabled) { log.debug("APIs deployed in gateway with the label of " + label); } } return true; } catch (ArtifactSynchronizerException | IOException e ) { String msg = "Error deploying APIs to the Gateway "; log.error(msg, e); throw new ArtifactSynchronizerException(msg, e); } } else { String msg = "Artifact retriever not found"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } return false; }
Source:
private boolean isWorkplaceJoined() { @SuppressWarnings("unchecked") Class<IDeviceCertificate> certClass = (Class<IDeviceCertificate>)AuthenticationSettings.INSTANCE.getDeviceCertificateProxy(); return (certClass != null); }

Target:
private boolean isWorkplaceJoined() { @SuppressWarnings("unchecked") Class<IDeviceCertificate> certClass = (Class<IDeviceCertificate>)AuthenticationSettings.INSTANCE.getDeviceCertificateProxy(); return certClass != null; }
Source:
private void insertIntoInv(List<ItemStack> stacks) { stacks.forEach(stack -> { for (int i = 0; i < 6; i++) { if (insertIntoInv(i, stack).isEmpty()) { break; } } }); }

Target:
private boolean insertIntoInv(List<ItemStack> stacks) { boolean result = false; for (ItemStack stack : stacks) { for (int i = 0; i < 6; i++) { if (insertIntoInv(i, stack)) result = true; if (stack.isEmpty()) break; } } return result; }
Source:
protected void init() throws Exception { if (aggregateMissingLicensesFile!=null&& !aggregateMissingLicensesFile.equals(missingFile)) { getLog().warn(""); getLog().warn("You should use *missingFile* parameter instead of deprecated *aggregateMissingLicensesFile*."); getLog().warn(""); missingFile = aggregateMissingLicensesFile; } if (aggregateMissingLicensesFileArtifact!=null && !aggregateMissingLicensesFileArtifact.equals(missingLicensesFileArtifact)) { getLog().warn(""); getLog().warn("You should use *missingLicensesFileArtifact* parameter instead of deprecated *aggregateMissingLicensesFileArtifact*."); getLog().warn(""); missingLicensesFileArtifact = aggregateMissingLicensesFileArtifact; } isAggregatorBuild = true; reactorProjectDependencies = new TreeMap<>(); for (MavenProject reactorProject : this.reactorProjects) { reactorProjectDependencies.put(String.format("%s:%s", reactorProject.getGroupId(), reactorProject.getArtifactId()), reactorProject.getDependencies()); } super.init(); }

Target:
protected void init() throws Exception { if ( aggregateMissingLicensesFile != null && !aggregateMissingLicensesFile.equals( missingFile ) ) { getLog().warn( "" ); getLog().warn( "You should use *missingFile* parameter instead of deprecated *aggregateMissingLicensesFile*." ); getLog().warn( "" ); missingFile = aggregateMissingLicensesFile; } if ( aggregateMissingLicensesFileArtifact != null && !aggregateMissingLicensesFileArtifact.equals( missingLicensesFileArtifact ) ) { getLog().warn( "" ); getLog().warn( "You should use *missingLicensesFileArtifact* parameter instead of deprecated *aggregateMissingLicensesFileArtifact*." ); getLog().warn( "" ); missingLicensesFileArtifact = aggregateMissingLicensesFileArtifact; } super.init(); }
Source:
@Override public <T> Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback) { context.setAttribute(TraceContext.class.getName(), currentTraceContext.get()); return delegate.execute( new TracingAsyncRequestProducer(requestProducer, context), new TracingAsyncResponseConsumer<>(responseConsumer, context), context, new FutureCallbackWithCurrentSpan(tracer.currentSpan(), callback) ); }

Target:
@Override public <T> Future<T> execute(HttpAsyncRequestProducer requestProducer, HttpAsyncResponseConsumer<T> responseConsumer, HttpContext context, FutureCallback<T> callback) { TraceContext traceCtx = currentTraceContext.get(); context.setAttribute(TraceContext.class.getName(), traceCtx); return delegate.execute( new TracingAsyncRequestProducer(requestProducer, context), new TracingAsyncResponseConsumer<>(responseConsumer, context), context, callback == null ? null : new TraceContextAwareFutureCallback(currentTraceContext, traceCtx, callback) ); }
Source:
private void populateDirectoryList() { setContentView(R.layout.uploader_layout); ListView mListView = (ListView) findViewById(android.R.id.list); ActionBar actionBar = getSupportActionBar(); String current_dir = mParents.peek(); if (current_dir.equals("")) { actionBar.setTitle(getString(R.string.uploader_top_message)); } else { actionBar.setTitle(current_dir); } boolean notRoot = (mParents.size() > 1); actionBar.setDisplayHomeAsUpEnabled(notRoot); actionBar.setHomeButtonEnabled(notRoot); String full_path = generatePath(mParents); Log_OC.d(TAG, "Populating view with content of : " + full_path); mFile = getStorageManager().getFileByPath(full_path); if (mFile != null) { Vector<OCFile> files = getStorageManager().getFolderContent(mFile ); files = sortFileList(files); List<HashMap<String, Object>> data = new LinkedList<>(); for (OCFile f : files) { if (f.isFolder()) { HashMap<String, Object> h = new HashMap<>(); h.put("dirname", f); data.add(h); } } UploaderAdapter sa = new UploaderAdapter(this, data, R.layout.uploader_list_item_layout, new String[] {"dirname"}, new int[] {R.id.filename}, getStorageManager(), getAccount()); mListView.setAdapter(sa); Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder); btnChooseFolder.setOnClickListener(this); Button btnNewFolder = (Button) findViewById(R.id.uploader_cancel); btnNewFolder.setOnClickListener(this); mListView.setOnItemClickListener(this); } }

Target:
private void populateDirectoryList() { setContentView(R.layout.uploader_layout); ListView mListView = (ListView) findViewById(android.R.id.list); ActionBar actionBar = getSupportActionBar(); String current_dir = mParents.peek(); if (current_dir.equals("")) { actionBar.setTitle(getString(R.string.uploader_top_message)); } else { actionBar.setTitle(current_dir); } boolean notRoot = (mParents.size() > 1); actionBar.setDisplayHomeAsUpEnabled(notRoot); actionBar.setHomeButtonEnabled(notRoot); String full_path = generatePath(mParents); Log_OC.d(TAG, "Populating view with content of : " + full_path); mFile = getStorageManager().getFileByPath(full_path); if (mFile != null) { Vector<OCFile> files = getStorageManager().getFolderContent(mFile ); files = sortFileList(files); List<HashMap<String, Object>> data = new LinkedList<>(); for (OCFile f : files) { HashMap<String, Object> h = new HashMap<>(); h.put("dirname", f); data.add(h); } UploaderAdapter sa = new UploaderAdapter(this, data, R.layout.uploader_list_item_layout, new String[] {"dirname"}, new int[] {R.id.filename}, getStorageManager(), getAccount()); mListView.setAdapter(sa); Button btnChooseFolder = (Button) findViewById(R.id.uploader_choose_folder); btnChooseFolder.setOnClickListener(this); Button btnNewFolder = (Button) findViewById(R.id.uploader_cancel); btnNewFolder.setOnClickListener(this); mListView.setOnItemClickListener(this); } }
Source:
public <T> Mono<DecryptionResult<T>> getDecryptionResult(final Class<T> classType) { ObjectNode decryptableContentAsObjectNode = Utils.as(this.decryptableContent, ObjectNode.class); if (decryptableContentAsObjectNode == null) { return Mono.just(new DecryptionResult<>(Utils.getSimpleObjectMapper().convertValue(this.decryptableContent, classType), null)); } Mono<Pair<ObjectNode, DecryptionContext>> decryptedItemAndContextPairMono = EncryptionProcessor.decrypt(decryptableContentAsObjectNode, this.encryptor); return decryptedItemAndContextPairMono.map( decryptedItemAndContextPair -> { T ii = this.cosmosSerializer.convert(classType, decryptedItemAndContextPair.getLeft()); return new DecryptionResult<>(ii, decryptedItemAndContextPair.getRight()); } ).onErrorResume( t -> { Exception exception = Utils.as(t, Exception.class); if (exception == null) { return Mono.error(t); } assert exception != null; JsonNode encryptedInfo = decryptableContentAsObjectNode.get(Constants.ENCRYPTION_INFO); ObjectNode encryptedInfoObject = Utils.as(encryptedInfo, ObjectNode.class); String dataEncryptionKeyId = (encryptedInfoObject != null) ? encryptedInfoObject.get(Constants.DATA_ENCRYPTION_KEY_ID).asText() : null; exception = new EncryptionException( dataEncryptionKeyId, this.decryptableContent.toString(), exception); return Mono.error(exception); } ); }

Target:
public <T> Mono<DecryptionResult<T>> getDecryptionResult(final Class<T> classType) { ObjectNode decryptableContentAsObjectNode = Utils.as(this.decryptableContent, ObjectNode.class); if (decryptableContentAsObjectNode == null) { return Mono.just(new DecryptionResult<>(Utils.getSimpleObjectMapper().convertValue(this.decryptableContent, classType), null)); } Mono<Pair<ObjectNode, DecryptionContext>> decryptedItemAndContextPairMono = EncryptionProcessor.decrypt(decryptableContentAsObjectNode, this.encryptor); return decryptedItemAndContextPairMono.map( decryptedItemAndContextPair -> { T ii = this.cosmosSerializer.convert(classType, decryptedItemAndContextPair.getLeft()); return new DecryptionResult<>(ii, decryptedItemAndContextPair.getRight()); } ).onErrorResume( t -> { Exception exception = Utils.as(t, Exception.class); if (exception == null) { return Mono.error(t); } JsonNode encryptedInfo = decryptableContentAsObjectNode.get(Constants.ENCRYPTION_INFO); ObjectNode encryptedInfoObject = Utils.as(encryptedInfo, ObjectNode.class); String dataEncryptionKeyId = (encryptedInfoObject != null) ? encryptedInfoObject.get(Constants.DATA_ENCRYPTION_KEY_ID).asText() : null; exception = new EncryptionException( dataEncryptionKeyId, this.decryptableContent.toString(), exception); return Mono.error(exception); } ); }
Source:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { SnapshotStatus[] status = null; checkOperation(OperationCategory.READ); boolean success = false; readLock(); try { checkOperation(OperationCategory.READ); status = FSDirSnapshotOp.getSnapshotListing(dir, snapshotManager, snapshotRoot); success = true; } catch (AccessControlException ace) { logAuditEvent(success, "listSnapshots", null, null, null); throw ace; } finally { readUnlock(); } logAuditEvent(success, "listSnapshots", null, null, null); return status; }

Target:
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException { final String operationName = "listSnapshotDirectory"; SnapshotStatus[] status; checkOperation(OperationCategory.READ); boolean success = false; final FSPermissionChecker pc = getPermissionChecker(); FSPermissionChecker.setOperationType(operationName); try { readLock(); try { checkOperation(OperationCategory.READ); status = FSDirSnapshotOp.getSnapshotListing(dir, pc, snapshotManager, snapshotRoot); success = true; } finally { readUnlock(operationName, getLockReportInfoSupplier(null)); } } catch (AccessControlException ace) { logAuditEvent(success, "listSnapshots", snapshotRoot); throw ace; } logAuditEvent(success, "listSnapshots", snapshotRoot); return status; }
Source:
public boolean isNoexcept(boolean inCalledContext) { ICPPFunction overload = getOverload(); if (overload != null) { ICPPASTFunctionDeclarator decl = FunctionHelpers.findDeclarator(overload); if (decl.getNoexceptExpression() == null) return false; } return fArg1.isNoexcept(inCalledContext) && fArg2.isNoexcept(inCalledContext); }

Target:
public boolean isNoexcept(boolean inCalledContext) { ICPPFunction overload = getOverload(); if (overload != null) { return EvalUtil.evaluateNoexceptSpecifier(overload.getType().getNoexceptSpecifier()); } return fArg1.isNoexcept(inCalledContext) && fArg2.isNoexcept(inCalledContext); }
Source:
public Mono<MsalToken> authenticateWithUsernamePassword(TokenRequestContext request, String username, String password) { return Mono.fromFuture(() -> getPublicClientApplication(false).acquireToken( UserNamePasswordParameters.builder(new HashSet<>(request.getScopes()), username, password.toCharArray()) .build())) .onErrorResume(t -> Mono.error(new ClientAuthenticationException("Failed to acquire token with username " + "and password", null, t))).map(ar -> new MsalToken(ar, options)); }

Target:
public Mono<MsalToken> authenticateWithUsernamePassword(TokenRequestContext request, String username, String password) { return Mono.fromFuture(() -> getPublicClientApplication(false).acquireToken( UserNamePasswordParameters.builder(new HashSet<>(request.getScopes()), username, password.toCharArray()) .build())) .onErrorMap(t -> new ClientAuthenticationException("Failed to acquire token with username and password", null, t)).map(ar -> new MsalToken(ar, options)); }
Source:
protected static PromoDialogAdvanced newInstance(Builder builder) { PromoDialogAdvanced fragment = new PromoDialogAdvanced(); Bundle args = new Bundle(); args.putInt("drawableId", builder.drawableId); args.putInt("titleId", builder.titleId); args.putInt("descriptionId", builder.descriptionId); args.putInt("linkId", builder.linkId); args.putInt("buttonNegativeId", builder.buttonNegativeId); args.putInt("buttonPositiveId", builder.buttonPositiveId); fragment.setArguments(args); return fragment; }

Target:
protected static PromoDialogAdvanced newInstance(Builder builder) { PromoDialogAdvanced fragment = new PromoDialogAdvanced(); Bundle args = new Bundle(); args.putInt(KEY_DRAWABLE_RES_ID, builder.drawableResId); args.putInt(KEY_TITLE_RES_ID, builder.titleResId); args.putInt(KEY_DESCRIPTION_RES_ID, builder.descriptionResId); args.putInt(KEY_LINK_RES_ID, builder.linkResId); args.putInt(KEY_BUTTON_NEGATIVE_RES_ID, builder.buttonNegativeResId); args.putInt(KEY_BUTTON_POSITIVE_RES_ID, builder.buttonPositiveResId); fragment.setArguments(args); return fragment; }
Source:
public ResourceProcessor<Resource<CorsSite>> corsSiteResourceProcessor() { return new ResourceProcessor<Resource<CorsSite>>() { @Override public Resource<CorsSite> process(Resource<CorsSite> resource) { LinkBuilder link = configuration.entityLinks().linkForSingleResource( CorsSite.class, resource.getContent().getId() ) .slash("addToNetwork"); resource.add(link.withRel("addToNetwork")); LinkBuilder link2 = configuration.entityLinks().linkForSingleResource( CorsSite.class, resource.getContent().getId() ) .slash("removeFromNetwork"); resource.add(link2.withRel("removeFromNetwork")); return resource; } }; }

Target:
public ResourceProcessor<Resource<CorsSite>> corsSiteResourceProcessor() { return new ResourceProcessor<Resource<CorsSite>>() { @Override public Resource<CorsSite> process(Resource<CorsSite> resource) { LinkBuilder addToNetworkLink = configuration.entityLinks().linkForSingleResource( CorsSite.class, resource.getContent().getId() ) .slash("addToNetwork"); resource.add(addToNetworkLink.withRel("addToNetwork")); LinkBuilder removeFromNetworkLink = configuration.entityLinks().linkForSingleResource( CorsSite.class, resource.getContent().getId() ) .slash("removeFromNetwork"); resource.add(removeFromNetworkLink.withRel("removeFromNetwork")); return resource; } }; }
Source:
protected boolean canDoAction() { Disk disk = getDiskDao().get(getParameters().getImageGroupID()); if (disk.getDiskStorageType() == DiskStorageType.LUN) { return failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_LUN_DISK); } return true; }

Target:
protected boolean canDoAction() { return !isDiskLun(); }
Source:
private Optional<PublicKey> readPublicKeyFromLocation(String publicKeyLocation, String keyID) throws Exception { URL publicKeyURL = currentThread().getContextClassLoader().getResource(publicKeyLocation); if (publicKeyURL == null) { try { publicKeyURL = new URL(publicKeyLocation); } catch (MalformedURLException ex) { publicKeyURL = null; } } if (publicKeyURL == null) { return Optional.empty(); } try (InputStream inputStream = publicKeyURL.openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))){ String keyContents = reader.lines().collect(Collectors.joining(System.lineSeparator())); return createPublicKey(keyContents, keyID); } }

Target:
private Optional<PublicKey> readPublicKeyFromLocation(String publicKeyLocation, String keyID) throws Exception { URL publicKeyURL = currentThread().getContextClassLoader().getResource(publicKeyLocation); if (publicKeyURL == null) { try { publicKeyURL = new URL(publicKeyLocation); } catch (MalformedURLException ex) { publicKeyURL = null; } } if (publicKeyURL == null) { return Optional.empty(); } URLConnection urlConnection = publicKeyURL.openConnection(); Charset charset = Charset.defaultCharset(); ContentType contentType = ContentType.newContentType(urlConnection.getContentType()); if(contentType != null) { String charEncoding = contentType.getCharacterEncoding(); if(charEncoding != null) { try { if (!Charset.isSupported(charEncoding)) { LOGGER.warning("Charset " + charEncoding + " for remote public key not supported, using default charset instead"); } else { charset = Charset.forName(contentType.getCharacterEncoding()); } }catch (IllegalCharsetNameException ex){ LOGGER.severe("Charset " + ex.getCharsetName() + " for remote public key not support, Cause: " + ex.getMessage()); } } } try (InputStream inputStream = urlConnection.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, charset))){ String keyContents = reader.lines().collect(Collectors.joining(System.lineSeparator())); return createPublicKey(keyContents, keyID); } }
Source:
private static boolean setApiTokenVersion2(final SharedPreferences prefs, final String apiToken) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException { final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); Cipher encrypt = Cipher.getInstance(AES_CIPHER); encrypt.init(Cipher.ENCRYPT_MODE, key); final byte[] input = apiToken.getBytes(); final byte[] cypherToken = encrypt.doFinal(input); if (cypherToken == null) { MainActivity.error("[TOKEN] ERROR: unreachable condition, cypherToken NULL. APIv" + Build.VERSION.SDK_INT); return false; } final byte[] iv = encrypt.getIV(); final int tagLength = (cypherToken.length - input.length) * 8; final SharedPreferences.Editor editor = prefs.edit(); editor.putString(ListFragment.PREF_TOKEN, Base64.encodeToString(cypherToken, Base64.DEFAULT)); editor.putString(ListFragment.PREF_TOKEN_IV, Base64.encodeToString(iv, Base64.DEFAULT)); editor.putInt(ListFragment.PREF_TOKEN_TAG_LENGTH, tagLength); editor.apply(); MainActivity.info("[TOKEN] setApiTokenVersion2 set token length: " + apiToken.length()); return true; }

Target:
private static boolean setApiTokenVersion2(final SharedPreferences prefs, final String apiToken) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, InvalidKeyException, UnrecoverableEntryException, IllegalBlockSizeException, BadPaddingException { if (apiToken == null) { MainActivity.error("[TOKEN] ERROR: unreachable condition, apiToken NULL. APIv" + Build.VERSION.SDK_INT); return false; } final KeyStore keyStore = getKeyStore(); final SecretKey key = (SecretKey) keyStore.getKey(KEYSTORE_WIGLE_CREDS_KEY_V2, null); Cipher encrypt = Cipher.getInstance(AES_CIPHER); encrypt.init(Cipher.ENCRYPT_MODE, key); final byte[] input = apiToken.getBytes(); final byte[] cypherToken = encrypt.doFinal(input); if (cypherToken == null) { MainActivity.error("[TOKEN] ERROR: unreachable condition, cypherToken NULL. APIv" + Build.VERSION.SDK_INT); return false; } final byte[] iv = encrypt.getIV(); final int tagLength = (cypherToken.length - input.length) * 8; final SharedPreferences.Editor editor = prefs.edit(); editor.putString(ListFragment.PREF_TOKEN, Base64.encodeToString(cypherToken, Base64.DEFAULT)); editor.putString(ListFragment.PREF_TOKEN_IV, Base64.encodeToString(iv, Base64.DEFAULT)); editor.putInt(ListFragment.PREF_TOKEN_TAG_LENGTH, tagLength); editor.apply(); MainActivity.info("[TOKEN] setApiTokenVersion2 set token length: " + apiToken.length()); return true; }
Source:
private <T extends Trade> ValueWithFailures<List<T>> parseFile(CsvIterator csv, Class<T> tradeType) { List<T> trades = new ArrayList<>(); List<FailureItem> failures = new ArrayList<>(); int line = 2; for (CsvRow row : (Iterable<CsvRow>) () -> csv) { try { String typeRaw = row.getField(TYPE_FIELD); String type = typeRaw.toUpperCase(Locale.ENGLISH); TradeInfo info = parseTradeInfo(row); switch (type.toUpperCase(Locale.ENGLISH)) { case "FRA": if (tradeType == FraTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(FraTradeCsvLoader.parse(row, info, refData))); } break; case "SWAP": if (tradeType == SwapTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(SwapTradeCsvLoader.parse(row, info, refData))); } break; case "TERMDEPOSIT": case "TERM DEPOSIT": if (tradeType == TermDepositTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(TermDepositTradeCsvLoader.parse(row, info, refData))); } break; default: failures.add( FailureItem.of(FailureReason.PARSING, "CSV file trade type '{}' is not known at line {}", typeRaw, line)); break; } line++; } catch (RuntimeException ex) { failures.add( FailureItem.of(FailureReason.PARSING, ex, "CSV file trade could not be parsed at line {}: " + ex.getMessage(), line)); } } return ValueWithFailures.of(trades, failures); }

Target:
private <T extends Trade> ValueWithFailures<List<T>> parseFile(CsvIterator csv, Class<T> tradeType) { List<T> trades = new ArrayList<>(); List<FailureItem> failures = new ArrayList<>(); int line = 2; for (CsvRow row : (Iterable<CsvRow>) () -> csv) { try { String typeRaw = row.getField(TYPE_FIELD); String type = typeRaw.toUpperCase(Locale.ENGLISH); TradeInfo info = parseTradeInfo(row); switch (type.toUpperCase(Locale.ENGLISH)) { case "FRA": if (tradeType == FraTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(FraTradeCsvLoader.parse(row, info, refData))); } break; case "SWAP": if (tradeType == SwapTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(SwapTradeCsvLoader.parse(row, info, refData))); } break; case "TERMDEPOSIT": case "TERM DEPOSIT": if (tradeType == TermDepositTrade.class || tradeType == Trade.class) { trades.add(tradeType.cast(TermDepositTradeCsvLoader.parse(row, info, refData))); } break; default: failures.add( FailureItem.of(FailureReason.PARSING, "CSV file trade type '{}' is not known at line {}", typeRaw, line)); break; } } catch (RuntimeException ex) { failures.add( FailureItem.of(FailureReason.PARSING, ex, "CSV file trade could not be parsed at line {}: " + ex.getMessage(), line)); } line++; } return ValueWithFailures.of(trades, failures); }
Source:
public void setVmNetwork(Boolean vmNetwork) { if (!ObjectUtils.objectsEqual(this.vmNetwork, vmNetwork)) { this.vmNetwork = vmNetwork; onPropertyChanged(new PropertyChangedEventArgs("Vm Network")); } }

Target:
public void setVmNetwork(Boolean vmNetwork) { this.vmNetwork = vmNetwork; }
Source:
public OsmAndProtocolDecoder(OsmAndProtocol protocol) { super(protocol); speedUnits = Context.getConfig().getString("osmand.speedUnits", "kn"); }

Target:
public OsmAndProtocolDecoder(OsmAndProtocol protocol) { super(protocol); }
Source:
protected BinaryData execute( ModelControllerClient mcc, EndpointService<DMRNodeLocation, DMRSession> endpointService, String modelNodePath, BasicMessageWithExtraData<UpdateCollectionIntervalsRequest> envelope, UpdateCollectionIntervalsResponse response, CommandContext context, DMRSession dmrContext) throws Exception { UpdateCollectionIntervalsRequest request = envelope.getBasicMessage(); Map<PathAddress, String> metricTypes = filterUpdates(mcc, request.getMetricTypes(), false); Map<PathAddress, String> availTypes = filterUpdates(mcc, request.getAvailTypes(), true); if (isEmpty(metricTypes) && isEmpty(availTypes)) { log.debug("Skipping collection interval update, no valid type updates provided."); return null; } CompositeOperationBuilder<?> composite = OperationBuilder.composite(); addUpdates(composite, metricTypes); addUpdates(composite, availTypes); composite.byNameOperation("start") .address(PathAddress.parseCLIStyleAddress("/subsystem=hawkular-wildfly-agent/")) .attribute("restart", "true") .attribute("delay", "500") .parentBuilder(); try { OperationResult<?> opResult = composite.execute(mcc).assertSuccess(); setServerRefreshIndicator(opResult, response); } catch (DmrApiException e) { log.errorf("Failed to update collection intervals: %s", e.getMessage()); throw e; } return null; }

Target:
protected BinaryData execute( ModelControllerClient mcc, EndpointService<DMRNodeLocation, DMRSession> endpointService, String modelNodePath, BasicMessageWithExtraData<UpdateCollectionIntervalsRequest> envelope, UpdateCollectionIntervalsResponse response, CommandContext context, DMRSession dmrContext) throws Exception { PathAddress agentAddress = WildflyCompatibilityUtils.parseCLIStyleAddress(modelNodePath); UpdateCollectionIntervalsRequest request = envelope.getBasicMessage(); Map<PathAddress, String> metricTypes = filterUpdates(mcc, request.getMetricTypes(), false, agentAddress); Map<PathAddress, String> availTypes = filterUpdates(mcc, request.getAvailTypes(), true, agentAddress); if (isEmpty(metricTypes) && isEmpty(availTypes)) { log.debug("Skipping collection interval update, no valid type updates provided."); return null; } CompositeOperationBuilder<?> composite = OperationBuilder.composite(); addUpdates(composite, metricTypes); addUpdates(composite, availTypes); composite.allowResourceServiceRestart(false); composite.byNameOperation("start") .address(agentAddress) .attribute("refresh", "true") .attribute("delay", "500") .parentBuilder(); try { OperationResult<?> opResult = composite.execute(mcc).assertSuccess(); setServerRefreshIndicator(opResult, response); } catch (DmrApiException e) { log.errorf("Failed to update collection intervals: %s", e.getMessage()); throw e; } return null; }
Source:
public boolean isAncestorOf(JavaScriptTree tree) { Tree parentTree = tree.getParent(); if (this.equals(parentTree)) { return true; } if (parentTree instanceof JavaScriptTree) { return this.isAncestorOf((JavaScriptTree) parentTree); } return false; }

Target:
public boolean isAncestorOf(JavaScriptTree tree) { Tree parentTree = tree.getParent(); if (this.equals(parentTree)) { return true; } if (parentTree == null) { return false; } return this.isAncestorOf((JavaScriptTree) parentTree); }
Source:
public void deleteNonAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); EPerson user = EPersonBuilder.createEPerson(context) .withNameInMetadata("first", "last") .withEmail("testaze@gmail.com") .withPassword(password) .withLanguage(I18nUtil.getDefaultLocale().getLanguage()) .build(); context.restoreAuthSystemState(); String token = getAuthToken(user.getEmail(), password); getClient(token).perform(delete("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isForbidden()); }

Target:
public void deleteNonAdminAccess() throws Exception { ObjectMapper mapper = new ObjectMapper(); context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description - updateAdminAccess") .build(); EPerson user = EPersonBuilder.createEPerson(context) .withNameInMetadata("first", "last") .withEmail("testaze@gmail.com") .withPassword(password) .withLanguage(I18nUtil.getDefaultLocale().getLanguage()) .build(); context.restoreAuthSystemState(); String token = getAuthToken(user.getEmail(), password); getClient(token).perform(delete("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isForbidden()); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormat.getMIMEType(), bitstreamFormat.getDescription(), bitstreamFormat.getShortDescription()) ))); }