auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void configureForOrientation(Configuration newConfig) { LinearLayout mainContainer = getView().findViewById(R.id.cover_fragment); LinearLayout textContainer = getView().findViewById(R.id.cover_fragment_text_container); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) imgvCover.getLayoutParams(); LinearLayout.LayoutParams textParams = (LinearLayout.LayoutParams) textContainer.getLayoutParams(); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { double ratio = (float) newConfig.screenHeightDp / (float) newConfig.screenWidthDp; double percentageWidth = 0.8; if (ratio <= 1.7) { percentageWidth = (ratio / 1.7) * percentageWidth * 0.8; } mainContainer.setOrientation(LinearLayout.VERTICAL); if (newConfig.screenWidthDp > 0) { params.width = (int) (convertDpToPixel(newConfig.screenWidthDp) * percentageWidth); params.height = params.width; textParams.weight = 0; imgvCover.setLayoutParams(params); } } else { double ratio = (float) newConfig.screenHeightDp / (float) newConfig.screenWidthDp; double percentageHeight = 0.4; percentageHeight = (ratio / 0.5) * percentageHeight; mainContainer.setOrientation(LinearLayout.HORIZONTAL); if (newConfig.screenHeightDp > 0) { params.height = (int) (convertDpToPixel(newConfig.screenHeightDp) * percentageHeight); params.width = params.height; textParams.weight = 1; imgvCover.setLayoutParams(params); } } }

Target:
private void configureForOrientation(Configuration newConfig) { LinearLayout mainContainer = getView().findViewById(R.id.cover_fragment); LinearLayout textContainer = getView().findViewById(R.id.cover_fragment_text_container); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) imgvCover.getLayoutParams(); LinearLayout.LayoutParams textParams = (LinearLayout.LayoutParams) textContainer.getLayoutParams(); double ratio = (float) newConfig.screenHeightDp / (float) newConfig.screenWidthDp; if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { double percentageWidth = 0.8; if (ratio <= SIXTEEN_BY_NINE) { percentageWidth = (ratio / SIXTEEN_BY_NINE) * percentageWidth * 0.8; } mainContainer.setOrientation(LinearLayout.VERTICAL); if (newConfig.screenWidthDp > 0) { params.width = (int) (convertDpToPixel(newConfig.screenWidthDp) * percentageWidth); params.height = params.width; textParams.weight = 0; imgvCover.setLayoutParams(params); } } else { double percentageHeight = ratio * 0.8; mainContainer.setOrientation(LinearLayout.HORIZONTAL); if (newConfig.screenHeightDp > 0) { params.height = (int) (convertDpToPixel(newConfig.screenHeightDp) * percentageHeight); params.width = params.height; textParams.weight = 1; imgvCover.setLayoutParams(params); } } }
Source:
protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); setTheme(R.style.Theme_Piwigo_Login); super.onCreate(savedInstanceState); idleResource = new CountingIdlingResource("LoginActivity", true); userManager.setIdleResource(idleResource); authenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (authenticatorResponse != null) { authenticatorResponse.onRequestContinued(); } viewModel = ViewModelProviders.of(this, viewModelFactory).get(LoginViewModel.class); binding = DataBindingUtil.setContentView(this, R.layout.activity_login); binding.setViewModel(viewModel); urlEditText = findViewById(R.id.url); loginButton = findViewById(R.id.login_button); fabProgressCircle = findViewById(R.id.fabLoginCircle); viewModel.getLoginSuccess().observe(this, this::loginSuccess); viewModel.getLoginError().observe(this, this::loginError); loginButton.setOnClickListener(v -> viewModel.onLoginClick(fabProgressCircle)); urlEditText.setOnTouchListener((v, event) -> { final int DRAWABLE_RIGHT = 2; if(event.getAction() == MotionEvent.ACTION_UP) { if(event.getRawX() >= (urlEditText.getRight() - urlEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { DialogHelper.INSTANCE.showInfoDialog(R.string.login_url_hint, R.string.login_url_how_to, LoginActivity.this); return true; } } return false; }); handleIntent(getIntent()); }

Target:
protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); setTheme(R.style.Theme_Piwigo_Login); super.onCreate(savedInstanceState); authenticatorResponse = getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (authenticatorResponse != null) { authenticatorResponse.onRequestContinued(); } viewModel = ViewModelProviders.of(this, viewModelFactory).get(LoginViewModel.class); binding = DataBindingUtil.setContentView(this, R.layout.activity_login); binding.setViewModel(viewModel); urlEditText = findViewById(R.id.url); loginButton = findViewById(R.id.login_button); fabProgressCircle = findViewById(R.id.fabLoginCircle); viewModel.getLoginSuccess().observe(this, this::loginSuccess); viewModel.getLoginError().observe(this, this::loginError); loginButton.setOnClickListener(v -> viewModel.onLoginClick(fabProgressCircle)); urlEditText.setOnTouchListener((v, event) -> { final int DRAWABLE_RIGHT = 2; if(event.getAction() == MotionEvent.ACTION_UP) { if(event.getRawX() >= (urlEditText.getRight() - urlEditText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) { DialogHelper.INSTANCE.showInfoDialog(R.string.login_url_hint, R.string.login_url_how_to, LoginActivity.this); return true; } } return false; }); handleIntent(getIntent()); }
Source:
private void reportException(Exception e) { String msg = messageOf(e); try { LOG.error(msg, e); printlnSafely(msg); } catch (Exception reportException) { LOG.error("Unable to report error message - %s.", messageOf(e), reportException); } }

Target:
private void reportException(Exception e) { String msg = messageOf(e); try { LOG.error(msg, e); printlnSafely(msg); } catch (Exception reportException) { LOG.error("Unable to report error message - {}.", messageOf(e), reportException); } }
Source:
public void initalizeTimestamp(final long intervalOffset) { switch (timeUnits) { case NANOSECONDS: currentTimestamp = System.nanoTime() + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case MICROSECONDS: currentTimestamp = (System.nanoTime() / 1000) + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case MILLISECONDS: currentTimestamp = System.currentTimeMillis() + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case SECONDS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case MINUTES: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case HOURS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; case DAYS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); startTimestamp = currentTimestamp; break; default: throw new IllegalArgumentException("Unhandled time unit type: " + timeUnits); } }

Target:
public void initalizeTimestamp(final long intervalOffset) { switch (timeUnits) { case NANOSECONDS: currentTimestamp = System.nanoTime() + getOffset(intervalOffset); break; case MICROSECONDS: currentTimestamp = (System.nanoTime() / 1000) + getOffset(intervalOffset); break; case MILLISECONDS: currentTimestamp = System.currentTimeMillis() + getOffset(intervalOffset); break; case SECONDS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); break; case MINUTES: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); break; case HOURS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); break; case DAYS: currentTimestamp = (System.currentTimeMillis() / 1000) + getOffset(intervalOffset); break; default: throw new IllegalArgumentException("Unhandled time unit type: " + timeUnits); } startTimestamp = currentTimestamp; }
Source:
public void updateMessage() { long hwnd = hwndToolTip(); if (OS.SendMessage (hwnd, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) { TOOLINFO lpti = new TOOLINFO (); lpti.cbSize = TOOLINFO.sizeof; if (OS.SendMessage (hwnd, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) { long hHeap = OS.GetProcessHeap (); TCHAR buffer = new TCHAR (0, message, true); int byteCount = buffer.length () * TCHAR.sizeof; lpti.lpszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpti.lpszText, buffer, byteCount); OS.SendMessage (hwnd, OS.TTM_UPDATETIPTEXT, 0, lpti); OS.HeapFree(hHeap, 0, lpti.lpszText); } } }

Target:
void updateMessage () { long hwnd = hwndToolTip(); if (OS.SendMessage (hwnd, OS.TTM_GETCURRENTTOOL, 0, 0) != 0) { TOOLINFO lpti = new TOOLINFO (); lpti.cbSize = TOOLINFO.sizeof; if (OS.SendMessage (hwnd, OS.TTM_GETCURRENTTOOL, 0, lpti) != 0) { long hHeap = OS.GetProcessHeap (); TCHAR buffer = new TCHAR (0, message, true); int byteCount = buffer.length () * TCHAR.sizeof; lpti.lpszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); OS.MoveMemory (lpti.lpszText, buffer, byteCount); OS.SendMessage (hwnd, OS.TTM_UPDATETIPTEXT, 0, lpti); OS.HeapFree(hHeap, 0, lpti.lpszText); } } }
Source:
public void waitOpen() { webDriverWaitFactory.get().until(ExpectedConditions.visibilityOf(form)); }

Target:
public void waitOpen() { seleniumWebDriverHelper.waitVisibility(form); }
Source:
public Default(final String... users) { this.usernames = convert(users); }

Target:
public Default(final String... users) { this.usernames = converter(users); }
Source:
private void deployAPIsInSyncMode() { isAPIsDeployedInSyncMode = deployArtifactsAtStartup(); if (!isAPIsDeployedInSyncMode) { log.error("Unable to deploy synapse artifacts at gateway"); deployAPIsInAsyncMode(); } }

Target:
private void deployAPIsInSyncMode() { syncModeDeploymentCount ++; isAPIsDeployedInSyncMode = deployArtifactsAtStartup(); if (!isAPIsDeployedInSyncMode) { log.error("Deployment attempt : " + syncModeDeploymentCount + " was unsuccessful") ; if (!(syncModeDeploymentCount > retryCount)) { deployAPIsInSyncMode(); } else { log.error("Maximum retry limit exceeded. Server is starting without deploying all synapse artifacts"); } } else { log.info("Deployment attempt : " + syncModeDeploymentCount + " was successful"); } }
Source:
public Optional<ColumnMapper<?>> build(Type type, ConfigRegistry config) { Class<?> erasedType = GenericTypes.getErasedType(type); if (ImmutableList.class.equals(erasedType)) { return GenericTypes.findGenericParameter(type, ImmutableList.class) .flatMap(t -> config.get(ColumnMappers.class).findFor(type, config)) .map(ImmutableListArrayColumnMapper::new); } return Optional.empty(); }

Target:
public Optional<ColumnMapper<?>> build(Type type, ConfigRegistry config) { Class<?> erasedType = GenericTypes.getErasedType(type); if (ImmutableList.class.equals(erasedType)) { return GenericTypes.findGenericParameter(type, ImmutableList.class) .flatMap(t -> config.get(ColumnMappers.class).findFor(t)) .map(ImmutableListArrayColumnMapper::new); } return Optional.empty(); }
Source:
public VisualEditorPageObject typeInParameterField(int i, String parameter) { WebElement element = parametersFieldList.get(i); wait.forElementClickable(element); element.click(); element.sendKeys(parameter); return this; }

Target:
public VisualEditorPageObject typeInParameterField(int i, String parameter) { WebElement field = parametersFieldList.get(i); wait.forElementClickable(field); field.click(); field.sendKeys(parameter); return this; }
Source:
public void testDDiagramSetRemovalMigrationDone() { ResourceSet set = new ResourceSetImpl(); DAnalysis analysis = null; try { analysis = (DAnalysis) ModelUtils.load(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + SESSION_RESOURCE_NAME, true), set); } catch (IOException e) { failCheckData(); } assertNotNull("Check the representation file test data.", analysis); assertTrue("Check the migration logic.", ((XMLResource) analysis.eResource()).getEObjectToExtensionMap().size() == 0); String version = analysis.getVersion(); assertTrue("Before save, the migration framework will return true even if the migration has been done during load.", RepresentationsFileMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); try { analysis.eResource().save(Collections.emptyMap()); } catch (IOException e) { failCheckData(); } version = analysis.getVersion(); assertFalse("The version tag should now be set telling that the migration was done.", RepresentationsFileMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); checkFileContainDDiagramSet(analysis.eResource().getURI(), false, "After migration, the resource should not contains any DDiagramSet."); assertFalse(getErrorLoggersMessage(), doesAnErrorOccurs()); }

Target:
public void testDDiagramSetRemovalMigrationDone() { ResourceSet set = new ResourceSetImpl(); DAnalysis analysis = null; try { analysis = (DAnalysis) ModelUtils.load(URI.createPlatformResourceURI(TEMPORARY_PROJECT_NAME + "/" + SESSION_RESOURCE_NAME, true), set); } catch (IOException e) { failCheckData(); } assertNotNull("Check the representation file test data.", analysis); assertTrue("Check the migration logic.", ((XMLResource) analysis.eResource()).getEObjectToExtensionMap().isEmpty()); String version = analysis.getVersion(); assertTrue("Before save, the migration framework will return true even if the migration has been done during load.", RepresentationsFileMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); try { analysis.eResource().save(Collections.emptyMap()); } catch (IOException e) { failCheckData(); } version = analysis.getVersion(); assertFalse("The version tag should now be set telling that the migration was done.", RepresentationsFileMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version))); checkFileContainDDiagramSet(analysis.eResource().getURI(), false, "After migration, the resource should not contains any DDiagramSet."); assertFalse(getErrorLoggersMessage(), doesAnErrorOccurs()); }
Source:
protected void dropCycle(Integer cycle) { WireStore store = getStoreForCycle(cycle); File file = store.file(); if (!file.exists()) { return; } log.info(String.format("Deleting Chronicle file: %s according to retention: %s", file.getAbsolutePath(), retention)); try { Files.delete(file.toPath()); queue.refreshDirectlyListing(); log.debug(file + " deleted"); queue.release(store); } catch (IOException | SecurityException e) { log.warn(String.format("Unable to delete Chronicle file: %s, %s", file.getAbsolutePath(), e.getMessage())); } }

Target:
protected void dropCycle(Integer cycle) { WireStore store = queue.storeForCycle(cycle, queue.epoch(), false); if (store == null) { return; } File file = store.file(); if (file == null || !file.exists()) { return; } log.info("Deleting Chronicle file: according to retention: {}", file::getAbsolutePath, () -> retention); try { Files.delete(file.toPath()); queue.refreshDirectlyListing(); log.debug(file + " deleted"); queue.release(store); } catch (IOException | SecurityException e) { log.warn("Unable to delete Chronicle file: {}, {}", file::getAbsolutePath, e::getMessage); } }
Source:
protected <S extends Score, W extends TestScoreWrapper<S>> void assertSerializeAndDeserializeXML(S expectedScore, W input) { String xmlString; W output; try { JAXBContext jaxbContext = JAXBContext.newInstance(input.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); StringWriter writer = new StringWriter(); jaxbMarshaller.marshal(input, writer); xmlString = writer.toString(); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(xmlString); output = (W) unmarshaller.unmarshal(reader); } catch (JAXBException e) { throw new IllegalStateException("Marshalling or unmarshalling for input (" + input + ") failed.", e); } assertEquals(expectedScore, output.getScore()); String regex; if (expectedScore != null) { regex = "<\\?[^\\?]*\\?>" + "<([\\w\\-\\.]+)>\\s*" + "<score>" + expectedScore.toString().replaceAll("\\[", "\\\\[").replaceAll("\\]", "\\\\]") + "</score>" + "\\s*</\\1>"; } else { regex = "<\\?[^\\?]*\\?>" + "<([\\w\\-\\.]+)/>"; } if (!xmlString.matches(regex)) { fail(String.format("Regular expression match failed.%nExpected regular expression: " + regex + "%nActual string: " + xmlString)); } }

Target:
protected <S extends Score, W extends TestScoreWrapper<S>> void assertSerializeAndDeserializeXML(S expectedScore, W input) { String xmlString; W output; try { JAXBContext jaxbContext = JAXBContext.newInstance(input.getClass()); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); StringWriter writer = new StringWriter(); jaxbMarshaller.marshal(input, writer); xmlString = writer.toString(); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(xmlString); output = (W) unmarshaller.unmarshal(reader); } catch (JAXBException e) { throw new IllegalStateException("Marshalling or unmarshalling for input (" + input + ") failed.", e); } assertEquals(expectedScore, output.getScore()); String regex; if (expectedScore != null) { regex = "<\\?[^\\?]*\\?>" + "<([\\w\\-\\.]+)>\\s*" + "<score>" + expectedScore.toString().replaceAll("\\[", "\\\\[").replaceAll("\\]", "\\\\]") + "</score>" + "\\s*</\\1>"; } else { regex = "<\\?[^\\?]*\\?>" + "<([\\w\\-\\.]+)/>"; } if (!xmlString.matches(regex)) { fail(String.format("Regular expression match failed.%nExpected regular expression: %s%n" + "Actual string: %s", regex, xmlString)); } }
Source:
protected String getRemoveQosMessage(int size) { return ConstantsManager.getInstance().getMessages().removeStorageQoSMessage(); }

Target:
protected String getRemoveQosMessage(int size) { return ConstantsManager.getInstance().getMessages().removeStorageQoSMessage(size); }
Source:
public List<Attribute> getAttributes(PerunSession sess, Member member, Group group, List<String> attrNames) throws InternalErrorException, WrongAttributeAssignmentException { if(attrNames.isEmpty()) return new ArrayList<>(); List<Attribute> attributes = getAttributesManagerImpl().getVirtualAttributes(sess, member, group); Iterator<Attribute> attributeIterator = attributes.iterator(); while(attributeIterator.hasNext()) if(attributeIterator.next().getValue() == null) attributeIterator.remove(); attributes.addAll(getAttributesManagerImpl().getAttributes(sess, member, group, attrNames)); return attributes; }

Target:
public List<Attribute> getAttributes(PerunSession sess, Member member, Group group, List<String> attrNames) throws InternalErrorException, WrongAttributeAssignmentException { if (attrNames.isEmpty()) return new ArrayList<>(); return getAttributesManagerImpl().getAttributes(sess, member, group, attrNames); }
Source:
public void testApplication() throws IOException, Exception { try { cleanup(); createTopics(); LocalMode.Controller lc = asyncRun(); Thread.sleep(10000); lc.shutdown(); Thread.sleep(1000); checkOutput(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }

Target:
public void testApplication() throws IOException, Exception { try { cleanup(); createTopics(); Configuration conf = getConfig(); LocalMode lma = LocalMode.newInstance(); lma.prepareDAG(new Application(), conf); ValidationToFile validationToFile = (ValidationToFile)lma.getDAG().getOperatorMeta("validationToFile").getOperator(); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while(!validationToFile.validationDone) { System.out.println("Sleeping ...."); Thread.sleep(500); } lc.shutdown(); Thread.sleep(1000); checkOutput(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
public long save(Library library) throws IOException { Date now = new Date(); if (library.getCreationDate() == null) library.setCreationDate(now); long id; if (library.getId() == AbstractLibrary.UNSAVED_ID) { if (!namingScheme.duplicateLibraryAliasAllowed() && !listByAlias(library.getAlias()).isEmpty() && (LimsUtils.isDetailedLibrary(library) && !((DetailedLibrary) library).hasNonStandardAlias())) { throw new IOException("NEW: A library with this alias already exists in the database"); } id = (long) currentSession().save(library); } else { currentSession().update(library); id = library.getId(); } return id; }

Target:
public long save(Library library) throws IOException { Date now = new Date(); if (library.getCreationDate() == null) library.setCreationDate(now); long id; if (library.getId() == AbstractLibrary.UNSAVED_ID) { id = (long) currentSession().save(library); } else { if (library.isDiscarded()) { getBoxDao().removeBoxableFromBox(library); } currentSession().update(library); id = library.getId(); } return id; }
Source:
private StateSystemDataProvider getDataProvider() { ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> dataProvider = DataProviderManager .getInstance().getDataProvider(getTrace(), getProviderId(), ITimeGraphDataProvider.class); if (dataProvider instanceof StateSystemDataProvider) { return (StateSystemDataProvider) dataProvider; } return null; }

Target:
private StateSystemDataProvider getDataProvider() { ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> dataProvider = DataProviderManager .getInstance().getDataProvider(getTrace(), getProviderId(), ITimeGraphDataProvider.class); if (dataProvider instanceof StateSystemDataProvider) { return (StateSystemDataProvider) dataProvider; } throw new NullPointerException(); }
Source:
public void unzipData(IgniteLogger log) { if (COMPRESSION_LEVEL < 0) return; for (Map.Entry<Integer, byte[]> entry : joiningNodeData.entrySet()) { try { entry.setValue(U.unzip(entry.getValue())); } catch (IgniteCheckedException e) { U.error(log, "Failed to marshal discovery data " + "[comp=" + entry.getKey() + ", data=" + entry.getValue() + ']', e); } } }

Target:
public void unzipData(IgniteLogger log) { for (Map.Entry<Integer, byte[]> entry : joiningNodeData.entrySet()) { try { entry.setValue(U.unzip(entry.getValue())); } catch (IgniteCheckedException e) { U.error(log, "Failed to marshal discovery data " + "[comp=" + entry.getKey() + ", data=" + entry.getValue() + ']', e); } } }
Source:
public Mono<byte[]> getSessionState(String sessionId) { if (!isSessionReceiver) { return monoError(logger, new IllegalStateException("Cannot get session state on a non-session receiver.")); } else { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType, sessionId)) .flatMap(channel -> channel.getSessionState()); } }

Target:
public Mono<byte[]> getSessionState(String sessionId) { if (isDisposed.get()) { return monoError(logger, new IllegalStateException( String.format(INVALID_OPERATION_DISPOSED_RECEIVER, "getSessionState"))); } else if (!isSessionReceiver) { return monoError(logger, new IllegalStateException("Cannot get session state on a non-session receiver.")); } else { return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityPath, entityType, sessionId)) .flatMap(channel -> channel.getSessionState()); } }
Source:
public void init() throws IdentityOAuth2Exception { super.init(); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); try { DefaultBootstrap.bootstrap(); } catch (ConfigurationException e) { log.error(e.getMessage(),e); throw new IdentityOAuth2Exception("Error in bootstrapping the OpenSAML2 library"); } finally { thread.setContextClassLoader(loader); } profileValidator = new SAMLSignatureProfileValidator(); Properties grantTypeProperties = new Properties(); InputStream stream = loader.getResourceAsStream("repository/conf/" + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE); if (stream != null) { try { grantTypeProperties.load(stream); audienceRestrictionValidationEnabled = Boolean.parseBoolean(grantTypeProperties.getProperty("audienceRestrictionValidationEnabled")); log.debug("Audience restriction validation enabled is set to " + audienceRestrictionValidationEnabled); } catch (IOException e) { log.warn("Failed to load the SAML-1.0-BearerGrantType.properties stream. The default configurations are " + "used instead of configurations defined in " + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE + " file."); } finally { try { stream.close(); } catch (IOException e) { log.warn("Failed to close the input stream of " + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE, e); } } } }

Target:
public void init() throws IdentityOAuth2Exception { super.init(); Thread thread = Thread.currentThread(); ClassLoader loader = thread.getContextClassLoader(); thread.setContextClassLoader(this.getClass().getClassLoader()); try { DefaultBootstrap.bootstrap(); } catch (ConfigurationException e) { String errorMessage = "Error in bootstrapping the OpenSAML2 library"; log.error(errorMessage, e); throw new IdentityOAuth2Exception(errorMessage, e); } finally { thread.setContextClassLoader(loader); } profileValidator = new SAMLSignatureProfileValidator(); Properties grantTypeProperties = new Properties(); InputStream stream = loader.getResourceAsStream("repository/conf/" + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE); if (stream != null) { try { grantTypeProperties.load(stream); audienceRestrictionValidationEnabled = Boolean.parseBoolean(grantTypeProperties.getProperty("audienceRestrictionValidationEnabled")); if (log.isDebugEnabled()) { log.debug("Audience restriction validation enabled is set to " + audienceRestrictionValidationEnabled); } } catch (IOException e) { log.warn( "Failed to load the SAML-1.0-BearerGrantType.properties stream. The default configurations are " + "used instead of configurations defined in " + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE + " file."); } finally { try { stream.close(); } catch (IOException e) { log.warn("Failed to close the input stream of " + SAML10_BEARER_GRANT_TYPE_CONFIG_FILE, e); } } } }
Source:
public ContentData updateContent(@PathParam("owner_key") String ownerKey, @PathParam("content_id") String contentId, ContentData content) { Owner owner = this.getOwnerByKey(ownerKey); Content existing = this.fetchContent(owner, contentId); if (existing.isLocked()) { throw new ForbiddenException(i18n.tr("content \"{0}\" is locked", existing.getId())); } existing = this.contentManager.updateContent(content, owner, true); try { ownerManager.refreshOwnerForContentAccess(owner); } catch (Exception e) { log.error("Unable to handle content access certs.", e.getStackTrace().toString()); } return existing.toDTO(); }

Target:
public ContentData updateContent(@PathParam("owner_key") String ownerKey, @PathParam("content_id") String contentId, ContentData content) { Owner owner = this.getOwnerByKey(ownerKey); Content existing = this.fetchContent(owner, contentId); if (existing.isLocked()) { throw new ForbiddenException(i18n.tr("content \"{0}\" is locked", existing.getId())); } existing = this.contentManager.updateContent(content, owner, true); ownerManager.refreshOwnerForContentAccess(owner); return existing.toDTO(); }
Source:
protected void startScan() { if (usbSerialDiscovery != null) { usbSerialDiscovery.doSingleScan(); } else { logger.info("Could not scan, as there is no usb serial discovery service configured."); } }

Target:
protected void startScan() { if (usbSerialDiscovery != null) { usbSerialDiscovery.doSingleScan(); } else { logger.info("Could not scan, as there is no USB-Serial discovery service configured."); } }
Source:
public long executeTask(String taskName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs) { RequestCriteria requestCriteria = createLaunchRequest(taskName, taskDeploymentProperties,commandLineArgs); String id = this.taskLauncher.launch(requestCriteria.getAppDeploymentRequest()); if (!StringUtils.hasText(id)) { throw new IllegalStateException("Deployment ID is null for the task:" + taskName); } postLaunchProcessing(requestCriteria, id); return requestCriteria.getTaskExecution().getExecutionId(); }

Target:
public long executeTask(String taskName, Map<String, String> taskDeploymentProperties, List<String> commandLineArgs) { RequestCriteria requestCriteria = createLaunchRequest(taskName, taskDeploymentProperties,commandLineArgs); String id; try { id = this.taskLauncher.launch(requestCriteria.getAppDeploymentRequest()); } catch (Throwable throwable) { recordFailedTaskLaunch(requestCriteria.taskExecution.getExecutionId(), "An error occurred while attempting to launch task: " + taskName); throw throwable; } if (!StringUtils.hasText(id)) { recordFailedTaskLaunch(requestCriteria.taskExecution.getExecutionId(), "Deployment ID is null for the task:" + taskName); throw new IllegalStateException("Deployment ID is null for the task:" + taskName); } try { taskExecutionRepository.updateExternalExecutionId( requestCriteria.getTaskExecution().getExecutionId(), id); } catch (Throwable throwable) { logger.warn("Unable to update taskExecution's externalExecutionId", throwable); } postLaunchProcessing(requestCriteria, id); return requestCriteria.getTaskExecution().getExecutionId(); }
Source:
public List<UUID> getDeviceAnonymizedIds() { return Arrays.stream(deviceAnonymizedIds.split(DeviceBase.DEVICE_NAMES_SEPARATOR)).map(UUID::fromString) .collect(Collectors.toList()); }

Target:
public List<UUID> getDeviceAnonymizedIds() { return Arrays.stream(deviceAnonymizedIds.split(SEPARATOR)).map(UUID::fromString).collect(Collectors.toList()); }
Source:
public String getFirstParam(String param) { throw new RuntimeException("NOT IMPLEMENTED"); }

Target:
public String getFirstParam(String param) { throw new UnsupportedOperationException("Not supported yet"); }
Source:
protected void executeQueryCommand() { Map<Guid, DiskImage> imagesAncestors = new HashMap<>(); for (Guid id : getParameters().getIds()) { DiskImage ancestor = diskImageDao.getAncestor(id, getUserID(), getParameters().isFiltered()); if (ancestor != null) { imagesAncestors.put(id, ancestor); } } getQueryReturnValue().setReturnValue(imagesAncestors); }

Target:
protected void executeQueryCommand() { Function<Guid, DiskImage> getAncestor = (Guid imageId) -> diskImageDao.getAncestor(imageId, getUserID(), getParameters().isFiltered()); getQueryReturnValue().setReturnValue(getParameters().getIds().stream() .map(guid -> new Pair<>(guid, getAncestor.apply(guid))) .filter(pair -> pair.getSecond() != null) .collect(Collectors.toMap(Pair::getFirst, Pair::getSecond))); }
Source:
@Test public void fromJsonDoesNotFailOnNullValues() throws Exception { Moshi moshi = new Moshi.Builder().build(); JsonAdapter<Object> adapter = moshi.adapter(Object.class); try { adapter.fromJson("{\"address\":null, \"items\":null}"); } catch (IllegalStateException ex) { fail(); } }

Target:
@Test public void fromJsonDoesNotFailOnNullValues() throws Exception { Map<Object, Object> emptyDelivery = new LinkedHashMap<>(); emptyDelivery.put("address", null); emptyDelivery.put("items", null); Moshi moshi = new Moshi.Builder().build(); JsonAdapter<Object> adapter = moshi.adapter(Object.class); assertThat(adapter.fromJson("{\"address\":null, \"items\":null}")) .isEqualTo(emptyDelivery); }
Source:
private boolean isSubdeployment(ModuleIdentifier dependency, DeploymentUnit deploymentUnit) { DeploymentUnit top = deploymentUnit.getParent()==null?deploymentUnit:deploymentUnit.getParent(); return top != null && dependency.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX.concat(top.getName())); }

Target:
private boolean isSubdeployment(ModuleIdentifier dependency, DeploymentUnit deploymentUnit) { DeploymentUnit top = deploymentUnit.getParent()==null?deploymentUnit:deploymentUnit.getParent(); return dependency.getName().startsWith(ServiceModuleLoader.MODULE_PREFIX.concat(top.getName())); }
Source:
public void removeTarget(TelepadTarget target) { if (target == null) { return; } for (TelepadTarget t : targets) { if (target.equals(t)) { targets.remove(t); } } markDirty(); }

Target:
public void removeTarget(TelepadTarget target) { if (target == null) { return; } targets.remove(target); markDirty(); }
Source:
public HL7Recipient(String recipientName, String recipientUrl) { this.recipientName = recipientName; this.recipientUrl = recipientUrl; this.recipientUsername = null; this.recipientPassword = null; }

Target:
public HL7Recipient(String recipientName, String recipientUrl) { this(recipientName, recipientUrl, null, null); }
Source:
public void configure() throws Exception { onException(Exception.class) .maximumRedeliveries("{{error.maxRedeliveries}}") .log("Event Routing Error: ${routeId}"); from("activemq:{{jms.fcrepoEndpoint}}") .routeId("AuditFcrepoRouter") .choice() .when(not(header("org.fcrepo.jms.identifier").startsWith(simple("{{audit.container}}")))) .to("direct:event"); from("direct:event") .routeId("AuditEventRouter") .setHeader(AuditHeaders.EVENT_BASE_URI, simple("{{event.baseUri}}")) .process(new AuditSparqlProcessor()) .log(LoggingLevel.INFO, "org.fcrepo.camel.audit", "Audit Event: ${headers[org.fcrepo.jms.identifier]} :: ${headers[CamelAuditEventUri]}") .to("http4:{{triplestore.baseUrl}}"); }

Target:
public void configure() throws Exception { onException(Exception.class) .maximumRedeliveries("{{error.maxRedeliveries}}") .log("Event Routing Error: ${routeId}"); from("activemq:{{jms.fcrepoEndpoint}}") .routeId("AuditFcrepoRouter") .filter(not(or(header(IDENTIFIER).startsWith(simple("{{audit.container}}/")), header(IDENTIFIER).isEqualTo(simple("{{audit.container}}"))))) .to("direct:event"); from("direct:event") .routeId("AuditEventRouter") .setHeader(AuditHeaders.EVENT_BASE_URI, simple("{{event.baseUri}}")) .process(new AuditSparqlProcessor()) .log(LoggingLevel.INFO, "org.fcrepo.camel.audit", "Audit Event: ${headers[org.fcrepo.jms.identifier]} :: ${headers[CamelAuditEventUri]}") .to("http4:{{triplestore.baseUrl}}"); }
Source:
public String getProcessId(Process process) { int timeout = 5000; while(process.isAlive() && timeout>0){ try { timeout-=500; Thread.sleep(500); } catch (InterruptedException e) { log.error("Interrupted while waiting for start process to finish ", e); return super.getProcessId(process); } } File[] pidFiles = FileSystems.getDefault().getPath(service.home, "pids").toFile().listFiles(new PidFileNameFilter()); if (pidFiles.length != 1) { log.error("Multiple or no PID files containing " + service.getPidFileIdent() + " found, something has gone wrong"); return super.getProcessId(process); } char[] buffer = new char[(int) pidFiles[0].length()]; try { FileReader fr = new FileReader(pidFiles[0]); fr.read(buffer); fr.close(); } catch (IOException e) { log.error("Error reading PID file" + pidFiles[0].getName(), e); return super.getProcessId(process); } return new String(buffer).trim(); }

Target:
public String getProcessId(Process process) { long end = TimeService.currentTimeMillis() + service.startupProcessTimeout; while (process.isAlive() && TimeService.currentTimeMillis() <= end) { try { Thread.sleep(500); } catch (InterruptedException e) { log.error("Interrupted while waiting for start process to finish ", e); Thread.currentThread().interrupt(); } } File[] pidFiles = FileSystems.getDefault().getPath(service.home, "pids").toFile().listFiles(new PidFileNameFilter()); if (pidFiles.length != 1) { log.error("Multiple or no PID files containing " + service.getPidFileIdent() + " found, something has gone wrong"); return super.getProcessId(process); } byte[] buffer; try { buffer = Files.readAllBytes(pidFiles[0].toPath()); } catch (IOException e) { log.error("Error reading PID file" + pidFiles[0].getName(), e); return super.getProcessId(process); } return new String(buffer).trim(); }
Source:
public boolean attachDatabase(JournalContext journalContext, String udbType, String udbConnectionUri, String udbDbName, String dbName, Map<String, String> map) throws IOException { try (LockResource l = getLock(dbName, false)) { if (mDBs.containsKey(dbName)) { throw new IOException(String .format("Unable to attach database. Database name %s (type: %s) already exists.", dbName, udbType)); } applyAndJournal(journalContext, Journal.JournalEntry.newBuilder().setAttachDb( alluxio.proto.journal.Table.AttachDbEntry.newBuilder() .setUdbType(udbType) .setUdbConnectionUri(udbConnectionUri) .setUdbDbName(udbDbName) .setDbName(dbName) .putAllConfig(map).build()).build()); mDBs.get(dbName).sync(journalContext); return true; } }

Target:
public boolean attachDatabase(JournalContext journalContext, String udbType, String udbConnectionUri, String udbDbName, String dbName, Map<String, String> map) throws IOException { try (LockResource l = getLock(dbName, false)) { if (mDBs.containsKey(dbName)) { throw new IOException(String .format("Unable to attach database. Database name %s (type: %s) already exists.", dbName, udbType)); } applyAndJournal(journalContext, Journal.JournalEntry.newBuilder().setAttachDb( alluxio.proto.journal.Table.AttachDbEntry.newBuilder() .setUdbType(udbType) .setUdbConnectionUri(udbConnectionUri) .setUdbDbName(udbDbName) .setDbName(dbName) .putAllConfig(map).build()).build()); try { mDBs.get(dbName).sync(journalContext); } catch (Exception e) { applyAndJournal(journalContext, Journal.JournalEntry.newBuilder().setDetachDb( alluxio.proto.journal.Table.DetachDbEntry.newBuilder().setDbName(dbName).build()) .build()); throw new IOException(String .format("Failed to connect underDb for Alluxio db '%s': %s", dbName, e.getMessage()), e); } return true; } }
Source:
public LogoutConfigurer<H> defaultLogoutSuccessHandlerFor( LogoutSuccessHandler handler, RequestMatcher preferredMatcher) { this.defaultLogoutSuccessHandlerMappings.put(preferredMatcher, handler); return this; }

Target:
public LogoutConfigurer<H> defaultLogoutSuccessHandlerFor( LogoutSuccessHandler handler, RequestMatcher preferredMatcher) { Assert.notNull(handler, "handler cannot be null"); Assert.notNull(preferredMatcher, "preferredMatcher cannot be null"); this.defaultLogoutSuccessHandlerMappings.put(preferredMatcher, handler); return this; }
Source:
public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException { TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset); try { Case currentCase = Case.getCurrentCaseThrows(); for (ContentTag tag : tagChange.getRemovedTags()) { currentCase.notifyContentTagDeleted(tag); } currentCase.notifyContentTagAdded(tagChange.getAddedTag()); } catch (NoCurrentCaseException ex) { throw new TskCoreException("Added a tag to a closed case", ex); } return tagChange.getAddedTag(); }

Target:
public ContentTag addContentTag(Content content, TagName tagName, String comment, long beginByteOffset, long endByteOffset) throws TskCoreException { TaggingManager.ContentTagChange tagChange = caseDb.getTaggingManager().addContentTag(content, tagName, comment, beginByteOffset, endByteOffset); try { Case currentCase = Case.getCurrentCaseThrows(); currentCase.notifyContentTagAdded(tagChange.getAddedTag(), tagChange.getRemovedTags().isEmpty() ? null : tagChange.getRemovedTags().get(0)); } catch (NoCurrentCaseException ex) { throw new TskCoreException("Added a tag to a closed case", ex); } return tagChange.getAddedTag(); }
Source:
private void setupCellTableWidgetProviderTooltip() { final ContactCellTable contactCellTable = new ContactCellTable(); final ContactDatabase contactDatabase = ContactDatabase.get(); contactDatabase.addDataDisplay(contactCellTable); ShowMorePagerPanel pagerPanel = new ShowMorePagerPanel(); pagerPanel.setDisplay(contactCellTable); pagerPanel.addStyleName("pagerLarge"); RootPanel.get("contactWidgetProvider").add(pagerPanel); TooltipOptions options = new TooltipOptions(); options.withContent(new TooltipOptions.TooltipWidgetContentProvider() { @Override public IsWidget getContent(Element element) { return createWidget(element); } private IsWidget createWidget(Element element) { int absoluteRowIndex = Integer.valueOf($(element).attr("__gwt_row")); int pageStartIndex = contactCellTable.getVisibleRange().getStart(); int relativeIndex = absoluteRowIndex - pageStartIndex; final ContactInfo contactInfo = contactCellTable.getVisibleItem(relativeIndex); Button deleteButton = new Button("Delete"); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { contactDatabase.remove(contactInfo); } }); return deleteButton; } }); options.withResources(ContactTooltipResources.INSTANCE); options.withPlacement(TooltipPlacement.LEFT); options.withSelector("tbody tr"); options.withContainer("element"); $(contactCellTable).as(Tooltip).tooltip(options); }

Target:
private void setupCellTableWidgetProviderTooltip() { final ContactCellTable contactCellTable = new ContactCellTable(); final ContactDatabase contactDatabase = ContactDatabase.get(); contactDatabase.addDataDisplay(contactCellTable); ShowMorePagerPanel pagerPanel = new ShowMorePagerPanel(); pagerPanel.setDisplay(contactCellTable); pagerPanel.addStyleName("pagerLarge"); RootPanel.get("contactWidgetProvider").add(pagerPanel); TooltipOptions options = new TooltipOptions(); options.withContent(new TooltipOptions.TooltipWidgetContentProvider() { @Override public IsWidget getContent(Element element) { int absoluteRowIndex = Integer.valueOf($(element).attr("__gwt_row")); int pageStartIndex = contactCellTable.getVisibleRange().getStart(); int relativeIndex = absoluteRowIndex - pageStartIndex; final ContactInfo contactInfo = contactCellTable.getVisibleItem(relativeIndex); Button deleteButton = new Button("Delete"); deleteButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { contactDatabase.remove(contactInfo); } }); return deleteButton; } }); options.withResources(ContactTooltipResources.INSTANCE); options.withPlacement(TooltipPlacement.LEFT); options.withSelector("tbody tr"); options.withContainer("element"); $(contactCellTable).as(Tooltip).tooltip(options); }
Source:
public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) throws ProjectBuildingException { List<ProjectBuildingResult> results = new ArrayList<>(); List<InterimResult> interimResults = new ArrayList<>(); ReactorModelPool modelPool = new ReactorModelPool(); InternalConfig config = new InternalConfig( request, modelPool, useGlobalModelCache() ? getModelCache() : new ReactorModelCache() ); Map<String, MavenProject> projectIndex = new HashMap<>( 256 ); boolean noErrors = build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive, config ); populateReactorModelPool( modelPool, interimResults ); ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); try { noErrors = build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request, new HashMap<File, Boolean>() ) && noErrors; } finally { Thread.currentThread().setContextClassLoader( oldContextClassLoader ); } if ( !noErrors ) { throw new ProjectBuildingException( results ); } return results; }

Target:
public List<ProjectBuildingResult> build( List<File> pomFiles, boolean recursive, ProjectBuildingRequest request ) throws ProjectBuildingException { List<ProjectBuildingResult> results = new ArrayList<>(); List<InterimResult> interimResults = new ArrayList<>(); ReactorModelPool modelPool = new ReactorModelPool(); InternalConfig config = new InternalConfig( request, modelPool, useGlobalModelCache() ? getModelCache() : new ReactorModelCache() ); Map<String, MavenProject> projectIndex = new HashMap<>( 256 ); boolean noErrors = build( results, interimResults, projectIndex, pomFiles, new LinkedHashSet<File>(), true, recursive, config ); populateReactorModelPool( modelPool, interimResults ); ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); try { noErrors = build( results, new ArrayList<MavenProject>(), projectIndex, interimResults, request, new HashMap<File, Boolean>(), config.session ) && noErrors; } finally { Thread.currentThread().setContextClassLoader( oldContextClassLoader ); } if ( !noErrors ) { throw new ProjectBuildingException( results ); } return results; }
Source:
protected void addTaskBAMEventListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) { final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer); descriptor.getBuilder().addTaskEventListener( new NamedObjectModel( "mvel", "taskBAM", "new org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener(false)" ) ); unit.setDeploymentDescriptor(descriptor); }

Target:
protected void addTaskBAMEventListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) { final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer); descriptor.getBuilder().addTaskEventListener( new ObjectModel( "mvel", "new org.jbpm.services.task.lifecycle.listeners.BAMTaskEventListener(false)" ) ); unit.setDeploymentDescriptor(descriptor); }
Source:
public Set<String> call() throws NoWorkTreeException, GitAPIException { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> untrackedAndIgnoredFiles = new TreeSet<String>( status.getUntracked()); Set<String> untrackedAndIgnoredDirs = new TreeSet<String>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); for (String p : status.getIgnoredNotInIndex()) { File f = new File(repo.getWorkTree(), p); if (fs.isFile(f) || fs.isSymLink(f)) untrackedAndIgnoredFiles.add(p); else if (fs.isDirectory(f)) untrackedAndIgnoredDirs.add(p); } Set<String> filtered = filterFolders(untrackedAndIgnoredFiles, untrackedAndIgnoredDirs); Set<String> notIgnoredFiles = filterIgnorePaths(filtered, status.getIgnoredNotInIndex(), true); Set<String> notIgnoredDirs = filterIgnorePaths( untrackedAndIgnoredDirs, status.getIgnoredNotInIndex(), false); for (String file : notIgnoredFiles) if (paths.isEmpty() || paths.contains(file)) { files = cleanPath(file, false, files); } if (directories) for (String dir : notIgnoredDirs) if (paths.isEmpty() || paths.contains(dir)) { File curDir = new File(repo.getWorkTree(), dir); if (RepositoryCache.FileKey.isGitRepository(new File(curDir, DOT_GIT), fs)) { if (force) { files = cleanPath(dir, true, files); } } else { files = cleanPath(dir, true, files); } } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }

Target:
public Set<String> call() throws NoWorkTreeException, GitAPIException { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> untrackedAndIgnoredFiles = new TreeSet<String>( status.getUntracked()); Set<String> untrackedAndIgnoredDirs = new TreeSet<String>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); for (String p : status.getIgnoredNotInIndex()) { File f = new File(repo.getWorkTree(), p); if (fs.isFile(f) || fs.isSymLink(f)) untrackedAndIgnoredFiles.add(p); else if (fs.isDirectory(f)) untrackedAndIgnoredDirs.add(p); } Set<String> filtered = filterFolders(untrackedAndIgnoredFiles, untrackedAndIgnoredDirs); Set<String> notIgnoredFiles = filterIgnorePaths(filtered, status.getIgnoredNotInIndex(), true); Set<String> notIgnoredDirs = filterIgnorePaths( untrackedAndIgnoredDirs, status.getIgnoredNotInIndex(), false); for (String file : notIgnoredFiles) if (paths.isEmpty() || paths.contains(file)) { files = cleanPath(file, false, files); } if (directories) for (String dir : notIgnoredDirs) if (paths.isEmpty() || paths.contains(dir)) { files = cleanPath(dir, true, files); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }
Source:
public static String getKind(String uniqueId) { if (StringUtils.isEmpty(uniqueId)) { return null; } String[] comps = uniqueId.split("@"); if (comps.length == 2) { return ResourceKind.SERVICE; } else { return comps[1]; } }

Target:
public static String getKind(String uniqueId) { if (StringUtils.isEmpty(uniqueId)) { return null; } String[] comps = uniqueId.split(String.valueOf(UNIQUE_ID_PROJECT_NAME_DELIMITER)); if (comps.length == 2) { return ResourceKind.SERVICE; } else if (comps.length == 3) { return comps[1]; } else { return null; } }