auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Result visit(Project e) { Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder = x.builder(e, Clause.SELECT); final List<SqlNode> selectList = new ArrayList<>(); boolean checkNull = isCastNullNeeded(stack); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (checkNull && SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }

Target:
public Result visit(Project e) { Result x = visitChild(0, e.getInput()); parseCorrelTable(e, x); if (isStar(e.getChildExps(), e.getInput().getRowType(), e.getRowType())) { return x; } final Builder builder = x.builder(e, Clause.SELECT); final List<SqlNode> selectList = new ArrayList<>(); for (RexNode ref : e.getChildExps()) { SqlNode sqlExpr = builder.context.toSql(null, ref); if (SqlUtil.isNullLiteral(sqlExpr, false)) { sqlExpr = castNullType(sqlExpr, e.getRowType().getFieldList().get(selectList.size())); } addSelect(selectList, sqlExpr, e.getRowType()); } builder.setSelect(new SqlNodeList(selectList, POS)); return builder.result(); }
Source:
public void refresh() throws IOException { synchronized (this) { long now = System.currentTimeMillis(); if ((now - lastRefreshTime) > TimeUnit.SECONDS.toMillis(1)) { lastRefreshTime = now; credentials.refresh(); } } }

Target:
public void refresh() throws IOException { synchronized (this) { if (refreshStopwatch.elapsed().compareTo(Duration.ofSeconds(1)) > 0) { credentials.refresh(); refreshStopwatch.reset().start(); } } }
Source:
public static void beforeClass() throws Exception { sLocalAlluxioJobCluster = new LocalAlluxioJobCluster(); sLocalAlluxioJobCluster.setProperty(PropertyKey.JOB_MASTER_WORKER_HEARTBEAT_INTERVAL, "25ms"); sLocalAlluxioJobCluster.start(); sFileSystem = sLocalAlluxioClusterResource.get().getClient(); }

Target:
public static void beforeClass() throws Exception { sLocalAlluxioJobCluster = new LocalAlluxioJobCluster(); sLocalAlluxioJobCluster.setProperty(PropertyKey.JOB_MASTER_WORKER_HEARTBEAT_INTERVAL, "25ms"); sLocalAlluxioJobCluster.start(); }
Source:
public void testIsDrawable_InvalidUserTask() throws Exception { testIsDrawable(CaseManagementDiagram.class, UserTask.class, false); }

Target:
public void testIsDrawable_InvalidUserTask() { testIsDrawable(CaseManagementDiagram.class, UserTask.class, false); }
Source:
public int getSize() throws IOException { File file = directory(); if (file == null) { return 0; } String files[] = file.list(); int keycount = 0; if (files != null) { for (String file1 : files) { if (file1.endsWith (FILE_EXT)) { keycount++; } } } return keycount; }

Target:
public int getSize() throws IOException { File dir = directory(); if (dir == null) { return 0; } String files[] = dir.list(); int keycount = 0; if (files != null) { for (String file : files) { if (file.endsWith(FILE_EXT)) { keycount++; } } } return keycount; }
Source:
public Song loadSongData(SongMetadata metadata) throws SongNotFoundException { String[] proj = { MediaStore.Audio.Media._ID, MediaStore.Audio.Media.DATA, MediaStore.Video.Media.SIZE }; String selection = MediaStore.Audio.Media._ID + "=" + Long.toString(metadata.getId()); Cursor cursor = this.activity.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, selection, null, null); Song song = null; if (cursor.moveToFirst()) { song = new Song(metadata); song.setFilePath(cursor.getString(1)); song.setSize(cursor.getLong(2)); } cursor.close(); if (song == null) { throw new SongNotFoundException("Song not found: " + metadata.getArtist() + " - " + metadata.getTitle()); } return song; }

Target:
public Song loadSongData(SongMetadata metadata) throws SongNotFoundException { String[] proj = {ID, PATH, SIZE}; String selection = ID + "=" + Long.toString(metadata.getId()); Cursor cursor = this.activity.getContentResolver().query(EC_URI, proj, selection, null, null); try { Song song = null; if (cursor.moveToFirst()) { song = new Song(metadata); song.setFilePath(cursor.getString(cursor.getColumnIndex(PATH))); song.setSize(cursor.getLong(cursor.getColumnIndex(SIZE))); } if (song == null) { throw new SongNotFoundException("Song not found: " + metadata.getArtist() + " - " + metadata.getTitle()); } return song; } finally { if (cursor != null) { cursor.close(); } } }
Source:
private void verifyTimes() { assertEquals((long) (task1.getDuration() + task2.getDuration()), (long) task3.getStartTime()); assertEquals((long) (task1.getDuration() + task2.getDuration() + task3.getDuration()), (long) task3.getEndTime()); assertEquals((long) (task1.getDuration() + task2.getDuration() + task3.getDuration()), (long) task4.getStartTime()); assertEquals((long) (task1.getDuration() + task2.getDuration() + task3.getDuration() + task4.getDuration()), (long) task4.getEndTime()); assertEquals((long) (task1.getDuration() + task2.getDuration()) + task3.getDuration() + task4.getDuration(), (long) task5.getStartTime()); assertEquals((long) (task1.getDuration() + task2.getDuration()) + task3.getDuration() + task4.getDuration() + task5.getDuration(), (long) task5.getEndTime()); Stream.of(task3, task4, task5).forEach(task -> { verify(scoreDirector).beforeVariableChanged(task, "startTime"); verify(scoreDirector).afterVariableChanged(task, "startTime"); verify(scoreDirector).beforeVariableChanged(task, "endTime"); verify(scoreDirector).afterVariableChanged(task, "endTime"); }); }

Target:
private void verifyTimes() { assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes()), (long) task3.getStartTimeInMinutes()); assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes() + task3.getDurationInMinutes()), (long) task3.getEndTimeInMinutes()); assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes() + task3.getDurationInMinutes()), (long) task4.getStartTimeInMinutes()); assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes() + task3.getDurationInMinutes() + task4.getDurationInMinutes()), (long) task4.getEndTimeInMinutes()); assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes()) + task3.getDurationInMinutes() + task4.getDurationInMinutes(), (long) task5.getStartTimeInMinutes()); assertEquals((long) (task1.getDurationInMinutes() + task2.getDurationInMinutes()) + task3.getDurationInMinutes() + task4.getDurationInMinutes() + task5.getDurationInMinutes(), (long) task5.getEndTimeInMinutes()); Stream.of(task3, task4, task5).forEach(task -> { verify(scoreDirector).beforeVariableChanged(task, Task.START_TIME_IN_MINUTES); verify(scoreDirector).afterVariableChanged(task, Task.START_TIME_IN_MINUTES); verify(scoreDirector).beforeVariableChanged(task, Task.END_TIME_IN_MINUTES); verify(scoreDirector).afterVariableChanged(task, Task.END_TIME_IN_MINUTES); }); }
Source:
private static ArrayList<String> readSeverityReason(JsonReader reader) throws IOException { reader.beginObject(); String type = null; String attributeValue = null; while (reader.hasNext()) { String name = reader.nextName(); switch (name) { case "type": type = reader.nextString(); break; case "attributes": reader.beginObject(); reader.nextName(); attributeValue = reader.nextString(); reader.endObject(); break; default: reader.skipValue(); break; } } reader.endObject(); ArrayList<String> values = new ArrayList<>(); if (type != null) { values.add(type); } else { throw new IOException("Severity Reason type is required"); } if (attributeValue != null) { values.add(attributeValue); } return values; }

Target:
private static ArrayList<String> readSeverityReason(JsonReader reader) throws IOException { reader.beginObject(); String type = null; String attributeValue = null; while (reader.hasNext()) { switch (reader.nextName()) { case "type": type = reader.nextString(); break; case "attributes": reader.beginObject(); reader.nextName(); attributeValue = reader.nextString(); reader.endObject(); break; default: reader.skipValue(); break; } } reader.endObject(); ArrayList<String> values = new ArrayList<>(); if (type != null) { values.add(type); } else { throw new IOException("Severity Reason type is required"); } if (attributeValue != null) { values.add(attributeValue); } return values; }
Source:
private List<RepresentationDescriptionItemImpl> getRepresentationDescriptionsItems() { List<RepresentationDescriptionItemImpl> representationItemList = new ArrayList<>(); Collection<Viewpoint> availableViewpoints = ViewpointHelper.getAvailableViewpoints(session); for (Viewpoint viewpoint : availableViewpoints) { EList<RepresentationDescription> ownedRepresentations = viewpoint.getOwnedRepresentations(); for (RepresentationDescription representationDescription : ownedRepresentations) { IFile airdFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(session.getSessionResource().getURI().toPlatformString(true))); representationItemList.add(new RepresentationDescriptionItemImpl(session, representationDescription, new ViewpointItemImpl(session, viewpoint, airdFile), viewpoint)); } } return representationItemList; }

Target:
private List<RepresentationDescriptionItemImpl> getRepresentationDescriptionsItems() { List<RepresentationDescriptionItemImpl> representationItemList = new ArrayList<>(); Collection<Viewpoint> availableViewpoints = ViewpointHelper.getAvailableViewpoints(session); for (Viewpoint viewpoint : availableViewpoints) { EList<RepresentationDescription> ownedRepresentations = viewpoint.getOwnedRepresentations(); IFile airdFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(session.getSessionResource().getURI().toPlatformString(true))); for (RepresentationDescription representationDescription : ownedRepresentations) { representationItemList.add(new RepresentationDescriptionItemImpl(session, representationDescription, new ViewpointItemImpl(session, viewpoint, airdFile), viewpoint)); } } return representationItemList; }
Source:
private static boolean doesConfigMethodPassGroupFilters(ConfigurationMethod cm, ITestNGMethod tm) { String[] groupFilters = cm.getGroupFilters(); if (groupFilters == null || groupFilters.length == 0) { return true; } String[] groups = tm.getGroups(); if (groups == null || groups.length == 0) { return false; } HashSet<String> groupSet = new HashSet<>(Arrays.asList(groups)); groupSet.retainAll(new HashSet<>(Arrays.asList(groupFilters))); return !groupSet.isEmpty(); }

Target:
private static boolean doesConfigMethodPassGroupFilters(ConfigurationMethod cm, ITestNGMethod tm) { String[] groupFilters = cm.getGroupFilters(); if (groupFilters.length == 0) { return true; } String[] groups = tm.getGroups(); if (groups.length == 0) { return false; } return !Collections.disjoint(Sets.newHashSet(groups), Sets.newHashSet(groupFilters)); }
Source:
private String findLongestSuffix(String name, String[] suffixes) { String usedPrefix= ""; int bestLen= 0; for (String suffixe : suffixes) { if (name.endsWith(suffixe)) { if (suffixe.length() > bestLen) { bestLen= suffixe.length(); usedPrefix= suffixe; } } } return usedPrefix; }

Target:
private String findLongestSuffix(String name, String[] suffixes) { String usedPrefix= ""; int bestLen= 0; for (String suffix : suffixes) { if (name.endsWith(suffix)) { if (suffix.length() > bestLen) { bestLen= suffix.length(); usedPrefix= suffix; } } } return usedPrefix; }
Source:
public RepositoryConfig getConfig() { synchronized (configLock) { if (userConfig.isOutdated() || config.isOutdated()) try { loadConfig(); } catch (IOException e) { throw new RuntimeException(e); } return config; } }

Target:
public RepositoryConfig getConfig() { if (userConfig.isOutdated()) { try { loadUserConfig(); } catch (IOException e) { throw new RuntimeException(e); } } if (config.isOutdated()) { try { loadConfig(); } catch (IOException e) { throw new RuntimeException(e); } } return config; }
Source:
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_overhaul, container, false); unbinder = ButterKnife.bind(this, view); viewPager.setAdapter(new NavTabViewPagerAdapter(getFragmentManager())); tabLayout.setupWithViewPager(viewPager); viewPager.addOnPageChangeListener(pagerChangeListener); viewPager.post(new Runnable() { @Override public void run() { setToolbarForCurrentFragment(); } }); return view; }

Target:
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_overhaul, container, false); unbinder = ButterKnife.bind(this, view); viewPager.addOnPageChangeListener(pagerChangeListener); viewPager.setAdapter(new NavTabViewPagerAdapter(getChildFragmentManager())); tabLayout.setupWithViewPager(viewPager); return view; }
Source:
public LlapManagementProtocolClientImpl create(LlapServiceInstance serviceInstance) { LlapManagementProtocolClientImpl client = new LlapManagementProtocolClientImpl(conf, serviceInstance.getHost(), serviceInstance.getManagementPort(), retryPolicy, socketFactory); return client; }

Target:
public LlapManagementProtocolClientImpl create(LlapServiceInstance serviceInstance) { return new LlapManagementProtocolClientImpl(conf, serviceInstance.getHost(), serviceInstance.getManagementPort(), retryPolicy, socketFactory); }
Source:
public void log(Log logger, String message, Throwable t) { if (t instanceof ShutdownSignalException) { ShutdownSignalException cause = (ShutdownSignalException) t; if (RabbitUtils.isExclusiveUseChannelClose(cause)) { if (logger.isWarnEnabled()) { logger.warn(message + ": " + cause.toString()); } } else if (!RabbitUtils.isNormalChannelClose(cause)) { logger.error(message + ": " + cause.getMessage()); } } else { logger.error("Unexpected invocation of " + this.getClass() + ", with message: " + message, t); } }

Target:
public void log(Log logger, String message, Throwable t) { if (t instanceof ShutdownSignalException) { ShutdownSignalException cause = (ShutdownSignalException) t; if (RabbitUtils.isExclusiveUseChannelClose(cause)) { if (logger.isWarnEnabled()) { logger.warn(message + ": " + cause.toString()); } } else if (!RabbitUtils.isNormalChannelClose(cause)) { logger.error(message + ": " + cause.getMessage()); } } else { if (logger.isErrorEnabled()) { logger.error("Unexpected invocation of " + this.getClass() + ", with message: " + message, t); } } }
Source:
public AdminTokenCache() { CacheManager singletonManager; try { InputStream inputStream = this.getClass().getResourceAsStream("/ehcache.xml"); singletonManager = CacheManager.newInstance(inputStream); } catch (Exception e) { singletonManager = CacheManager.create(); singletonManager.addCache(CACHE_NAME); cache.getCacheConfiguration(); cache = singletonManager.getCache(CACHE_NAME); CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); cacheConfiguration.setTimeToIdleSeconds(1200); cacheConfiguration.setTimeToLiveSeconds(1200); } cache = singletonManager.getCache(CACHE_NAME); }

Target:
public AdminTokenCache() { CacheManager singletonManager; try { InputStream inputStream = this.getClass().getResourceAsStream("/ehcache.xml"); singletonManager = CacheManager.newInstance(inputStream); } catch (Exception e) { singletonManager = CacheManager.create(); singletonManager.addCache(CACHE_NAME); cache.getCacheConfiguration(); cache = singletonManager.getCache(CACHE_NAME); CacheConfiguration cacheConfiguration = cache.getCacheConfiguration(); cacheConfiguration.setTimeToIdleSeconds(TIME_TO_IDLE); cacheConfiguration.setTimeToLiveSeconds(TIME_TO_LIVE); } cache = singletonManager.getCache(CACHE_NAME); }
Source:
public static int getDatePart(Value date, int field) { java.util.Date d = date.getTimestamp(); Calendar c = getCalendar(); c.setTime(d); if (field == Calendar.YEAR) { return getYear(c); } int value = c.get(field); if (field == Calendar.MONTH) { return value + 1; } return value; }

Target:
public static int getDatePart(Value date, int field) { Calendar c = valueToCalendar(date); if (field == Calendar.YEAR) { return getYear(c); } int value = c.get(field); if (field == Calendar.MONTH) { return value + 1; } return value; }
Source:
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, FileEditor fileEditor) { if (!myShow || !StringResourceEditorProvider.canViewTranslations(myProject, file)) { return null; } final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("View translations for all locales in the translations editor."); panel.createActionLabel("Open editor", new Runnable() { @Override public void run() { StringResourceEditorProvider.openEditor(myProject, file); } }); panel.createActionLabel("Hide notification", new Runnable() { @Override public void run() { panel.setVisible(false); myShow = false; } }); return panel; }

Target:
public EditorNotificationPanel createNotificationPanel(@NotNull final VirtualFile file, FileEditor fileEditor) { if (!myShow || !StringResourceEditorProvider.canViewTranslations(myProject, file)) { return null; } final EditorNotificationPanel panel = new EditorNotificationPanel(); panel.setText("Edit translations for all locales in the translations editor."); panel.createActionLabel("Open editor", new Runnable() { @Override public void run() { StringResourceEditorProvider.openEditor(myProject, file); } }); panel.createActionLabel("Hide notification", new Runnable() { @Override public void run() { panel.setVisible(false); myShow = false; } }); return panel; }
Source:
public void setup() throws Exception { CommonTestUtilities.dropAndCreateWithTestData(SUPPORT, false, DROPWIZARD_CONFIGURATION_FILE_PATH); DockstoreWebserviceApplication application = SUPPORT.getApplication(); SessionFactory sessionFactory = application.getHibernate().getSessionFactory(); this.tokenDAO = new TokenDAO(sessionFactory); testingPostgres.runUpdateStatement("alter sequence enduser_id_seq increment by 50 restart with 100"); testingPostgres.runUpdateStatement("alter sequence token_id_seq increment by 50 restart with 100"); Session session = application.getHibernate().getSessionFactory().openSession(); ManagedSessionContext.bind(session); final Transaction transaction = session.beginTransaction(); tokenDAO.create(createToken(SUFFIX1, GITHUB_ACCOUNT_USERNAME_1, GITHHUB_USER1_ID)); tokenDAO.create(createToken(SUFFIX2, GITHUB_ACCOUNT_USERNAME_2, GITHHUB_USER2_ID)); transaction.commit(); }

Target:
public void setup() throws Exception { CommonTestUtilities.dropAndCreateWithTestData(SUPPORT, false, DROPWIZARD_CONFIGURATION_FILE_PATH); DockstoreWebserviceApplication application = SUPPORT.getApplication(); SessionFactory sessionFactory = application.getHibernate().getSessionFactory(); TokenDAO tokenDAO = new TokenDAO(sessionFactory); testingPostgres.runUpdateStatement("alter sequence enduser_id_seq increment by 50 restart with 100"); testingPostgres.runUpdateStatement("alter sequence token_id_seq increment by 50 restart with 100"); Session session = application.getHibernate().getSessionFactory().openSession(); ManagedSessionContext.bind(session); final Transaction transaction = session.beginTransaction(); tokenDAO.create(createToken(SUFFIX1, GITHUB_ACCOUNT_USERNAME_1, GITHUB_USER1_ID)); tokenDAO.create(createToken(SUFFIX2, GITHUB_ACCOUNT_USERNAME_2, GITHUB_USER2_ID)); transaction.commit(); session.close(); }
Source:
private void assertNoCrLfHelper(String expect, String input) throws IOException { byte[] inbytes = input.getBytes(); byte[] expectBytes = expect.getBytes(); for (int i = 1; i < 5; ++i) { byte[] buf = new byte[i]; ByteArrayInputStream bis = new ByteArrayInputStream(inbytes); InputStream in = new AutoCRLFInputStream(bis, true); ByteArrayOutputStream out = new ByteArrayOutputStream(); if (i > 0) { int n; while ((n = in.read(buf)) >= 0) { out.write(buf, 0, n); } } else { int c; while ((c = in.read()) != -1) out.write(c); } out.flush(); in.close(); out.close(); byte[] actualBytes = out.toByteArray(); Assert.assertEquals("bufsize=" + i, encode(expectBytes), encode(actualBytes)); } }

Target:
private void assertNoCrLfHelper(String expect, String input) throws IOException { byte[] inbytes = input.getBytes(); byte[] expectBytes = expect.getBytes(); for (int i = 0; i < 5; ++i) { byte[] buf = new byte[i]; ByteArrayInputStream bis = new ByteArrayInputStream(inbytes); InputStream in = new AutoCRLFInputStream(bis, true); ByteArrayOutputStream out = new ByteArrayOutputStream(); if (i > 0) { int n; while ((n = in.read(buf)) >= 0) { out.write(buf, 0, n); } } else { int c; while ((c = in.read()) != -1) out.write(c); } out.flush(); in.close(); out.close(); byte[] actualBytes = out.toByteArray(); Assert.assertEquals("bufsize=" + i, encode(expectBytes), encode(actualBytes)); } }
Source:
public void shouldNotRaiseAlertGivenIntegrityAttributeIsPresentInLinkElement() throws HttpMalformedHeaderException { HttpMessage msg = buildMessage( "<html><head><link rel=\"stylesheet\" href=\"<LINK_0>\"\n" + " integrity=\"sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB\"\n" + " crossorigin=\"anonymous\"></head><body></body></html>"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }

Target:
public void shouldNotRaiseAlertGivenIntegrityAttributeIsPresentInLinkElement() throws HttpMalformedHeaderException { HttpMessage msg = buildMessage( "<html><head><link href=\"<LINK_0>\"\n" + " integrity=\"sha384-+/M6kredJcxdsqkczBUjMLvqyHb1K/JThDXWsBVxMEeZHEaMKEOEct339VItX1zB\"\n" + " ></head><body></body></html>"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised.size(), equalTo(0)); }
Source:
boolean isTransportLoad() { return this.unitsToTransports != null; }

Target:
private boolean isTransportLoad() { return this.unitsToTransports != null; }
Source:
public void run(IProject project, IAbstractArtifact artifact, IProgressMonitor monitor) { for (IArtifactAuditor auditor : auditors) { auditor.run(project, artifact, monitor); if (monitor.isCanceled()) { return; } } }

Target:
public void run(IProject project, IAbstractArtifact artifact, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, String.format("Executing auditors on artifact '%s'", artifact.getName()), auditors.size() * 10); auditors.forEach(auditor -> auditor.run(project, artifact, subMonitor.split(10))); }
Source:
protected void reportPendingClientLine(ConcurStandardAccountingExtractDetailLine saeLine) { ConcurBatchReportMissingObjectCodeItem pendingClientItem = new ConcurBatchReportMissingObjectCodeItem( saeLine.getReportId(), saeLine.getEmployeeId(), saeLine.getEmployeeLastName(), saeLine.getEmployeeFirstName(), saeLine.getEmployeeMiddleInitital(), "Line has the \"Pending Client\" object code", saeLine.getPolicy(), saeLine.getExpenseType()); reportData.addPendingClientObjectCodeLine(pendingClientItem); }

Target:
protected void reportPendingClientLine(ConcurStandardAccountingExtractDetailLine saeLine) { ConcurBatchReportMissingObjectCodeItem pendingClientItem = new ConcurBatchReportMissingObjectCodeItem( saeLine.getReportId(), saeLine.getEmployeeId(), saeLine.getEmployeeLastName(), saeLine.getEmployeeFirstName(), saeLine.getEmployeeMiddleInitital(), PENDING_CLIENT_MESSAGE, saeLine.getPolicy(), saeLine.getExpenseType()); reportData.addPendingClientObjectCodeLine(pendingClientItem); }
Source:
public static double calculateSpeedIfSpeedTag(double maxSpeed) { double urbanSpeedFactor = maxSpeed < 51 / 3.6 ? DEFAULT_FREESPEED_FACTOR : 1.0; return maxSpeed * urbanSpeedFactor; }

Target:
public static double calculateSpeedIfSpeedTag(double maxSpeed) { return calculateSpeedIfSpeedTag(maxSpeed, DEFAULT_FREESPEED_FACTOR); }
Source:
public String getWikiCode() { return String.format("[[File:%s|%s]]", filename, filename); }

Target:
public String getWikiCode() { return String.format("[[%s|thumb|%s]]", filename, thumbnailTitle); }
Source:
public void testSubscribeUnsubscribe() throws Exception { startAndCompleteSpan(); Traces.subscribe(subscriber1); Traces.subscribe(subscriber2); Span span = startAndCompleteSpan(); verify(subscriber1).consume(span); verify(subscriber2).consume(span); Mockito.verifyNoMoreInteractions(subscriber1, subscriber2); Traces.unsubscribe(subscriber1); span = startAndCompleteSpan(); verify(subscriber2).consume(span); Mockito.verifyNoMoreInteractions(subscriber1, subscriber2); Traces.unsubscribe(subscriber2); startAndCompleteSpan(); Mockito.verifyNoMoreInteractions(subscriber1, subscriber2); }

Target:
public void testSubscribeUnsubscribe() throws Exception { startAndCompleteSpan(); Traces.subscribe(subscriber1); Traces.subscribe(subscriber2); Span span = startAndCompleteSpan(); verify(subscriber1).consume(span); verify(subscriber2).consume(span); verifyNoMoreInteractions(subscriber1, subscriber2); Traces.unsubscribe(subscriber1); span = startAndCompleteSpan(); verify(subscriber2).consume(span); verifyNoMoreInteractions(subscriber1, subscriber2); Traces.unsubscribe(subscriber2); startAndCompleteSpan(); verifyNoMoreInteractions(subscriber1, subscriber2); }
Source:
protected void killEntityBehindBack(Entity tokill) throws Exception { ManagementContext newManagementContext = null; File tempDir = Os.newTempDir(getClass()); try { ManagementContext managementContext = ((EntityInternal)tokill).getManagementContext(); BrooklynMemento brooklynMemento = MementosGenerators.newBrooklynMemento(managementContext); BrooklynMementoPersisterToMultiFile oldPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader()); oldPersister.checkpoint(brooklynMemento, PersistenceExceptionHandlerImpl.builder().build()); oldPersister.waitForWritesCompleted(30*1000, TimeUnit.MILLISECONDS); BrooklynMementoPersisterToMultiFile newPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader()); newManagementContext = new LocalManagementContextForTests(); newManagementContext.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build()); newManagementContext.getRebindManager().rebind(getClass().getClassLoader(), null, ManagementNodeState.MASTER); newManagementContext.getRebindManager().startPersistence(); SoftwareProcess entity2 = (SoftwareProcess) newManagementContext.getEntityManager().getEntity(tokill.getId()); entity2.stop(); } finally { if (newManagementContext != null) ((ManagementContextInternal)newManagementContext).terminate(); Os.deleteRecursively(tempDir.getAbsolutePath()); } log.info("called to stop in parallel mgmt universe", entity); }

Target:
protected void killEntityBehindBack(Entity tokill) throws Exception { ManagementContext newManagementContext = null; File tempDir = Os.newTempDir(getClass()); try { ManagementContext managementContext = ((EntityInternal)tokill).getManagementContext(); BrooklynMemento brooklynMemento = MementosGenerators.newBrooklynMemento(managementContext); BrooklynMementoPersisterToMultiFile oldPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader()); oldPersister.checkpoint(brooklynMemento, PersistenceExceptionHandlerImpl.builder().build()); oldPersister.waitForWritesCompleted(30*1000, TimeUnit.MILLISECONDS); BrooklynMementoPersisterToMultiFile newPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader()); newManagementContext = new LocalManagementContextForTests(); newManagementContext.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build()); newManagementContext.getRebindManager().rebind(getClass().getClassLoader(), null, ManagementNodeState.MASTER); newManagementContext.getRebindManager().startPersistence(); SoftwareProcess entity2 = (SoftwareProcess) newManagementContext.getEntityManager().getEntity(tokill.getId()); entity2.stop(); } finally { if (newManagementContext != null) ((ManagementContextInternal)newManagementContext).terminate(); Os.deleteRecursively(tempDir.getAbsolutePath()); } LOG.info("called to stop in parallel mgmt universe", entity); }
Source:
public void testRetrieveMODSFromWork() throws Exception { doNothing().when(aclService).assertHasAccess(anyString(), any(PID.class), any(AccessGroupSet.class), eq(viewMetadata)); PID workPid = makePid(); File modsFile = setupWorkWithMODS(workPid); MvcResult result = mvc.perform(get("/description/" + workPid.getUUID())) .andExpect(status().is2xxSuccessful()) .andReturn(); String responseBody = result.getResponse().getContentAsString(); String expectedResponseBody = IOUtils.toString(new FileInputStream(modsFile)); assertEquals(expectedResponseBody, responseBody); }

Target:
public void testRetrieveMODSFromWork() throws Exception { doNothing().when(aclService).assertHasAccess(anyString(), any(PID.class), any(AccessGroupSet.class), eq(viewMetadata)); PID workPid = makePid(); File modsFile = setupWorkWithMODS(workPid); MvcResult result = mvc.perform(get("/description/" + workPid.getUUID())) .andExpect(status().is2xxSuccessful()) .andReturn(); String responseBody = result.getResponse().getContentAsString(); String expectedResponseBody = FileUtils.readFileToString(modsFile, StandardCharsets.UTF_8); assertEquals(expectedResponseBody, responseBody); }
Source:
public List<String> getAliases() { return aliases; }

Target:
public String[] getAliases() { return aliases; }
Source:
public void handleConfigUpdateFailure(StackView stackView, Exception exception) { try { if (stackView.getClusterView() != null) { String errorMessage = clusterCreationService .getErrorMessageFromException(exception); transactionService.required(() -> { clusterService .updateClusterStatusByStackId(stackView.getId(), UPDATE_FAILED, errorMessage); stackUpdater .updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE); }); flowMessageService.fireEventAndLog(stackView.getId(), UPDATE_FAILED.name(), CLUSTER_PILLAR_CONFIG_UPDATE_FAILED, errorMessage); } else { LOGGER.info("Cluster was null. Flow action was not required."); } } catch (TransactionExecutionException e) { throw new TransactionRuntimeExecutionException(e); } }

Target:
public void handleConfigUpdateFailure(StackView stackView, Exception exception) { try { if (stackView.getClusterView() != null) { String errorMessage = clusterCreationService .getErrorMessageFromException(exception); transactionService.required(() -> { clusterService .updateClusterStatusByStackId(stackView.getId(), UPDATE_FAILED, errorMessage); stackUpdater .updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE); }); flowMessageService.fireEventAndLog(stackView.getId(), UPDATE_FAILED.name(), CLUSTER_PILLAR_CONFIG_UPDATE_FAILED, errorMessage); } else { LOGGER.info("Cluster was null. Flow action was not required."); } } catch (TransactionExecutionException e) { LOGGER.warn("Error setting status for Pillar configuration update failure", e); } }
Source:
private void setUpSendEventPage() { WorkflowService eventService = mock(WorkflowService.class); context.putBean("eventService", eventService); context.putBean("ruleManager", mock(RuleManager.class)); context.putBean("auditing", mock(AuditingDomain.class)); List<Class<? extends Event>> eventClasses = Arrays.<Class<? extends Event>> asList(NullEvent.class); tester.startPage(new SendEventPage(eventClasses)); tester.startPage(Index.class); }

Target:
private void setUpSendEventPage() { WorkflowService eventService = mock(WorkflowService.class); context.putBean("eventService", eventService); List<Class<? extends Event>> eventClasses = Arrays.<Class<? extends Event>> asList(NullEvent.class); tester.startPage(new SendEventPage(eventClasses)); tester.startPage(Index.class); }
Source:
private void releaseIfNoOp(@NonNull final ContentProviderOperation operation, @NonNull final Uri uri) { if (!isValidOperation(operation)) { try { locker.release(uri); } catch (NullPointerException e) { } } }

Target:
private void releaseIfNoOp(@NonNull final ContentProviderOperation operation, @NonNull final Uri uri) { if (!isValidOperation(operation)) { try { locker.release(uri); } catch (IllegalStateException e) { Log.w(TAG, "Couldn't release lock!", e); } } }
Source:
private void configureTimeSetting(Preferences preferences) { timeComboBox.setItems(FXCollections.observableArrayList(options)); timeComboBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { newTimeFormatSelected(event); } } ); timeComboBox.setDisable(false); timeComboBox.setFocusTraversable(true); int index; index= getIndexNumberOfFormat(preferences.getChat().getUkTime()); timeComboBox.getSelectionModel().select(index); }

Target:
private void configureTimeSetting(Preferences preferences) { timeComboBox.setButtonCell(new StringListCell<>(timeInfo -> i18n.get(timeInfo.getDisplayNameKey()))); timeComboBox.setCellFactory(param -> new StringListCell<>(timeInfo -> i18n.get(timeInfo.getDisplayNameKey()))); timeComboBox.setItems(FXCollections.observableArrayList(TimeInfo.values())); timeComboBox.setDisable(false); timeComboBox.setFocusTraversable(true); timeComboBox.getSelectionModel().select(preferences.getChat().getTimeFormat()); }
Source:
public void validateField(String name, Object o) { if (o == null) { return; } SimpleTypeValidator.validateField(name, String.class, o); String className = (String) o; try { Class<?> objectClass = Class.forName(className); if (!this.classImplements.isAssignableFrom(objectClass)) { throw new IllegalArgumentException("Field " + name + " with value " + o + " does not implement " + this.classImplements.getName()); } } catch (ClassNotFoundException e) { if (className.startsWith("backtype.storm")) { LOG.error("ClassNotFoundException: {}", className); LOG.warn("Replace backtype.storm with org.apache.storm and try to validate again"); LOG.warn("We loosen some constraints here to support topologies of older version running on the current version"); validateField(name, className.replaceAll("backtype.storm", "org.apache.storm")); } else { throw new RuntimeException(e); } } }

Target:
public void validateField(String name, Object o) { if (o == null) { return; } SimpleTypeValidator.validateField(name, String.class, o); String className = (String) o; try { Class<?> objectClass = Class.forName(className); if (!this.classImplements.isAssignableFrom(objectClass)) { throw new IllegalArgumentException("Field " + name + " with value " + o + " does not implement " + this.classImplements.getName()); } } catch (ClassNotFoundException e) { if (className.startsWith("backtype.storm")) { LOG.error("ClassNotFoundException: {}", className); LOG.warn("Replace backtype.storm with org.apache.storm and try to validate again"); LOG.warn("We loosen some constraints here to support topologies of older version running on the current version"); validateField(name, className.replace("backtype.storm", "org.apache.storm")); } else { throw new RuntimeException(e); } } }
Source:
public void disconnect() { commandProcessor.unsubscribeAndRemoveAll(); commandProcessor.disconnect(); }

Target:
public void disconnect() { commandProcessor.unsubscribeAll(); commandProcessor.disconnect(); }
Source:
protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case VDS_NETWORK_ERROR: case PROVIDER_FAILURE: throw e; default: log.warnFormat("Failed to run VM {0}: {1}", getVmName(), e.getMessage()); } } finally { freeLock(); } setActionReturnValue(status); if (status != null && (status.isRunning() || status == VMStatus.RestoringState)) { getVm().setStopReason(null); getVmDynamicDao().clearStopReason(this.getVm().getId()); setSucceeded(true); } else { log.infoFormat("Trying to rerun VM {0}", getVm().getName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { runningFailed(); } }

Target:
protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case VDS_NETWORK_ERROR: case PROVIDER_FAILURE: throw e; default: log.warnFormat("Failed to run VM {0}: {1}", getVmName(), e.getMessage()); } } finally { freeLock(); } setActionReturnValue(status); if (status != null && (status.isRunning() || status == VMStatus.RestoringState)) { setSucceeded(true); } else { log.infoFormat("Trying to rerun VM {0}", getVm().getName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { runningFailed(); } }
Source:
public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); assertNotEquals(postRemoveBounds, f3.getBounds()); }

Target:
public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); assertNotEquals(postRemoveBounds, f3.getBounds()); assertTrue(postRemoveBounds.contains(f1.getBounds())); assertTrue(postRemoveBounds.contains(f3.getBounds())); }
Source:
private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { throwErrorAt("Annotations are not allowed for NOP padding"); } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }

Target:
private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { throwErrorAt("NOP padding is not allowed within annotation wrappers."); } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }
Source:
public void testReadEmptyFile() { FileResultStorageEngine engine = new FileResultStorageEngine("src/test/resources"); String finalResult = engine.getResultsByID("bb31ca4e-ed8f-4be0-a0f3-12099fb9263e").collect(() -> new StringBuilder(), (resultBuilder, tempResult) -> { if (resultBuilder.length() > 0) { resultBuilder.append(System.getProperty("line.separator")); } resultBuilder.append(tempResult); } ).map(StringBuilder::toString).blockingGet(); assertEquals(finalResult, ""); }

Target:
public void testReadEmptyFile() { String finalResult = readResultsFile(BASE_PATH, "empty_results"); assertEquals(finalResult, ""); }
Source:
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredRegex = "." + desiredEndpoint + "."; String currentRegex = "." + currentEndpoint + "."; if (endpoint.contains(desiredRegex)) { return endpoint; } else { return endpoint.replaceFirst(currentRegex, desiredRegex); } }

Target:
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredStringToMatch = "." + desiredEndpoint + "."; String currentStringToMatch = "." + currentEndpoint + "."; if (endpoint.contains(desiredStringToMatch)) { return endpoint; } else { return endpoint.replaceFirst(currentStringToMatch, desiredStringToMatch); } }
Source:
public int[] getOrderedFieldIndicesForSorting() { Vector<Integer> indices = new Vector<>(); Vector<Integer> cacheAndIndexedIndices = new Vector<>(); outer: for (int i = 0; i < fields.length; ++i) { int order = fields[i].getSortOrder(); if (order == -2) { cacheAndIndexedIndices.addElement(i); } if (order < 1) { continue; } for (int j = 0; j < indices.size(); ++j) { if (order < fields[indices.elementAt(j)].getSortOrder()) { indices.insertElementAt(i, j); continue outer; } } indices.addElement(i); continue; } int resultLength = indices.size() + cacheAndIndexedIndices.size(); int[] ret = new int[resultLength]; int i = 0; for (;i < indices.size(); ++i) { ret[i] = indices.elementAt(i); } for (; i < resultLength; ++i) { ret[i] = cacheAndIndexedIndices.elementAt(i - indices.size()); } return ret; }

Target:
public int[] getOrderedFieldIndicesForSorting() { Vector<Integer> indices = new Vector<>(); Vector<Integer> cacheAndIndexedIndices = new Vector<>(); outer: for (int i = 0; i < fields.length; ++i) { int order = fields[i].getSortOrder(); if (order == -2) { cacheAndIndexedIndices.addElement(i); } if (order < 1) { continue; } for (int j = 0; j < indices.size(); ++j) { if (order < fields[indices.elementAt(j)].getSortOrder()) { indices.insertElementAt(i, j); continue outer; } } indices.addElement(i); continue; } return CollectionUtils.mergeIntegerVectorsInArray(indices, cacheAndIndexedIndices); }
Source:
public void testUpdateExternalStatus() { VdsDynamic before = dao.get(existingVds.getId()); before.setExternalStatus(ExternalStatus.Error); dao.updateExternalStatus(before.getId(), before.getExternalStatus()); VdsDynamic after = dao.get(existingVds.getId()); assertEquals(before, after); }

Target:
public void testUpdateExternalStatus() { VdsDynamic before = dao.get(existingVds.getId()); before.setExternalStatus(ExternalStatus.Error); dao.updateExternalStatus(before.getId(), before.getExternalStatus()); VdsDynamic after = dao.get(existingVds.getId()); assertEquals(before.getExternalStatus(), after.getExternalStatus()); }
Source:
public Optional<Vector3i> moveToChunk(Vector3i chunkCoords, Direction direction, int steps) { if (direction.isSecondaryOrdinal()) { throw new IllegalArgumentException("Secondary cardinal directions can't be used here"); } final Vector3i newChunkCoords = chunkCoords.add(direction.toVector3d().ceil().toInt().mul(steps)); return isValidChunk(newChunkCoords) ? Optional.of(newChunkCoords) : Optional.<Vector3i>absent(); }

Target:
public Optional<Vector3i> moveToChunk(Vector3i chunkCoords, Direction direction, int steps) { Preconditions.checkArgument(!direction.isSecondaryOrdinal(), "Secondary cardinal directions can't be used here"); return addToChunk(chunkCoords, direction.toVector3d().ceil().toInt().mul(steps)); }
Source:
public NitroItemSource<Episode> next() { episode = episodes.next(); ListenableFuture<ImmutableList<Availability>> availabilities; try { availabilities = availabilities(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Broadcast>> broadcasts; try { broadcasts = broadcasts(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Version>> versions; try { versions = versions(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } try { return NitroItemSource.valueOf( episode, availabilities.get(), broadcasts.get(), versions.get() ); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof GlycerinException) { try { throw (GlycerinException) e.getCause(); } catch (GlycerinException e1) { Throwables.propagate(e1); } } throw Throwables.propagate(e); } }

Target:
public NitroItemSource<Episode> next() { Episode episode = episodes.next(); ListenableFuture<ImmutableList<Availability>> availabilities; try { availabilities = availabilities(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Broadcast>> broadcasts; try { broadcasts = broadcasts(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Version>> versions; try { versions = versions(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } try { return NitroItemSource.valueOf( episode, availabilities.get(), broadcasts.get(), versions.get() ); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof GlycerinException) { try { throw (GlycerinException) e.getCause(); } catch (GlycerinException e1) { Throwables.propagate(e1); } } throw Throwables.propagate(e); } }
Source:
public void checkAttributeValue(PerunSessionImpl perunSession, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String vomsGroupName; if(!(attribute.getValue() instanceof String)) { throw new WrongAttributeValueException(attribute, "Wrong type of the attribute. Expected: String"); } vomsGroupName = (String) attribute.getValue(); Matcher matcher = pattern.matcher(vomsGroupName); if(!matcher.matches()) { throw new WrongAttributeValueException(attribute, "Bad format of attribute vomsGroupName. It should not contain '<>&=' characters."); } }

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String vomsGroupName; if(attribute.getValue() == null) { return; } if(!(attribute.getValue() instanceof String)) { throw new WrongAttributeValueException(attribute, "Wrong type of the attribute. Expected: String"); } vomsGroupName = (String) attribute.getValue(); Matcher matcher = pattern.matcher(vomsGroupName); if(!matcher.matches()) { throw new WrongAttributeValueException(attribute, "Bad format of attribute vomsGroupName. It should not contain '<>&=' characters."); } }