auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SdcClientConfigImp() { hostnameVerifier = new HostnameVerifier() { public boolean verify(String arg0, SSLSession arg1) { return true; } }; javax.net.ssl.TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; try { stx = SSLContext.getInstance("TLS"); stx.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(stx.getSocketFactory()); } catch (Exception e) { System.out.println("SdcClientConfigImp:" + e); } }

Target:
public SdcClientConfigImp() { hostnameVerifier = new HostnameVerifier() { public boolean verify(String arg0, SSLSession arg1) { return true; } }; javax.net.ssl.TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; try { stx = SSLContext.getInstance("TLS"); stx.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(stx.getSocketFactory()); } catch (Exception e) { log.error("Error configuring SSL:" + e); } }
Source:
public void testUnoccludeRotationChange() throws Exception { if (!isHandheld() || isUiModeLockedToVrHeadset()) { return; } gotoKeyguard(); mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice); assertShowingAndNotOccluded(); executeShellCommand(getAmStartCmd("ShowWhenLockedActivity")); mAmWmState.computeState(mDevice, new String[] { "ShowWhenLockedActivity" }); mAmWmState.assertVisibility("ShowWhenLockedActivity", true); setDeviceRotation(1); pressHomeButton(); mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice); mAmWmState.waitForDisplayUnfrozen(mDevice); mAmWmState.assertSanity(); if (!noHomeScreen()) { mAmWmState.assertHomeActivityVisible(false); } assertShowingAndNotOccluded(); mAmWmState.assertVisibility("ShowWhenLockedActivity", false); }

Target:
public void testUnoccludeRotationChange() throws Exception { if (!isHandheld() || isUiModeLockedToVrHeadset()) { return; } gotoKeyguard(); mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice); assertShowingAndNotOccluded(); executeShellCommand(getAmStartCmd("ShowWhenLockedActivity")); mAmWmState.computeState(mDevice, new String[] { "ShowWhenLockedActivity" }); mAmWmState.assertVisibility("ShowWhenLockedActivity", true); setDeviceRotation(1); pressHomeButton(); mAmWmState.waitForKeyguardShowingAndNotOccluded(mDevice); mAmWmState.waitForDisplayUnfrozen(mDevice); mAmWmState.assertSanity(); mAmWmState.assertHomeActivityVisible(false); assertShowingAndNotOccluded(); mAmWmState.assertVisibility("ShowWhenLockedActivity", false); }
Source:
public void testGetResultsByID() { String id = "id"; AsyncQueryResultStorage n = new AsyncQueryResultStorage(); n.setId(id); n.setResult(null); Object loaded = n; when(tx.loadObject(any(), any(), any())).thenReturn(loaded); defaultResultStorageEngine.getResultsByID(n.getId()); verify(tx, times(1)).loadObject(any(), any(), any()); }

Target:
public void testGetResultsByID() throws SerialException, SQLException { String id = "id"; String test = "test"; AsyncQuery query = new AsyncQuery(); AsyncQueryResult result = new AsyncQueryResult(); query.setId(id); result.setAttachment(new SerialBlob(test.getBytes())); query.setResult(result); when(tx.loadObject(any(), any(), any())).thenReturn(query); byte[] blob = defaultResultStorageEngine.getResultsByID(id); assertEquals(new String(blob), test); verify(tx, times(1)).loadObject(any(), any(), any()); }
Source:
int unsafeCompareTo( Value other ) { ZonedDateTime that = ((DateTimeValue) other).value; int cmp = Long.compare( value.toEpochSecond(), that.toEpochSecond() ); if ( cmp == 0 ) { cmp = value.toLocalTime().getNano() - that.toLocalTime().getNano(); if ( cmp == 0 ) { cmp = value.toLocalDateTime().compareTo( that.toLocalDateTime() ); if ( cmp == 0 ) { ZoneId thisZone = value.getZone(); ZoneId thatZone = that.getZone(); boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; cmp = Boolean.compare( thatIsOffset, thisIsOffset ); if ( cmp == 0 && (thisIsOffset || !areSameZone( thisZone, thatZone ) ) ) { cmp = thisZone.getId().compareTo( thatZone.getId() ); } if ( cmp == 0 ) { cmp = value.getChronology().compareTo( that.getChronology() ); } } } } return cmp; }

Target:
int unsafeCompareTo( Value other ) { ZonedDateTime that = ((DateTimeValue) other).value; int cmp = Long.compare( value.toEpochSecond(), that.toEpochSecond() ); if ( cmp == 0 ) { cmp = value.toLocalTime().getNano() - that.toLocalTime().getNano(); if ( cmp == 0 ) { cmp = value.toLocalDateTime().compareTo( that.toLocalDateTime() ); if ( cmp == 0 ) { ZoneId thisZone = value.getZone(); ZoneId thatZone = that.getZone(); boolean thisIsOffset = thisZone instanceof ZoneOffset; boolean thatIsOffset = thatZone instanceof ZoneOffset; cmp = Boolean.compare( thatIsOffset, thisIsOffset ); if ( cmp == 0 && (thisIsOffset || !areSameZone( thisZone, thatZone, thisIsOffset, thatIsOffset ) ) ) { cmp = thisZone.getId().compareTo( thatZone.getId() ); } if ( cmp == 0 ) { cmp = value.getChronology().compareTo( that.getChronology() ); } } } } return cmp; }
Source:
private void updateTable() { fTree.setItemCount(0); if (fTrace == null) { return; } ITmfTrace[] traces; if (fTrace instanceof TmfExperiment) { TmfExperiment experiment = (TmfExperiment) fTrace; traces = experiment.getTraces(); } else { traces = new ITmfTrace[] { fTrace }; } for (ITmfTrace trace : traces) { if (trace instanceof CtfTmfTrace) { TreeItem item = new TreeItem(fTree, SWT.NONE); item.setText(0, trace.getName()); CtfTmfTrace ctfTrace = (CtfTmfTrace) trace; for (String varName : ctfTrace.getEnvNames()) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(0, varName); subItem.setText(1, ctfTrace.getEnvValue(varName)); } } } for (TreeColumn column : fTree.getColumns()) { column.pack(); } for (int i = 0; i < fTree.getItemCount(); i++) { fTree.getItem(i).setExpanded(true); } }

Target:
private void updateTable() { fTree.setItemCount(0); if (fTrace == null) { return; } ITmfTrace[] traces; if (fTrace instanceof TmfExperiment) { TmfExperiment experiment = (TmfExperiment) fTrace; traces = experiment.getTraces(); } else { traces = new ITmfTrace[] { fTrace }; } for (ITmfTrace trace : traces) { if (trace instanceof CtfTmfTrace) { TreeItem item = new TreeItem(fTree, SWT.NONE); item.setText(0, trace.getName()); CtfTmfTrace ctfTrace = (CtfTmfTrace) trace; for (String varName : ctfTrace.getEnvNames()) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText(0, varName); subItem.setText(1, ctfTrace.getEnvValue(varName)); } } } for (int i = 0; i < fTree.getItemCount(); i++) { fTree.getItem(i).setExpanded(true); } for (TreeColumn column : fTree.getColumns()) { column.pack(); } }
Source:
protected Map<String, Object> updateIntroduction(ParameterParser params, SessionState state) { Map<String, Object> results = new HashMap<String, Object>(); String message; try { String resourceUuid = params.getString("resourceUuid"); String resourceId = this.getContentService().resolveUuid(resourceUuid); String introduction = params.get("addSectionHTML"); introduction = getFormattedText().processFormattedText(introduction, new StringBuilder(), true, true); introduction = introduction.replaceAll("'", "&apos;"); getContentService().addProperty(resourceId, ResourceProperties.PROP_INTRODUCTION, introduction); message = "Resource updated"; state.setAttribute(STATE_CITATION_COLLECTION, null); } catch (IdUnusedException e) { message = e.getMessage(); logger.warn("IdUnusedException in updateCitationList() " + e); } catch (TypeException e) { message = e.getMessage(); logger.warn("TypeException in updateCitationList() " + e); } catch (InUseException e) { message = e.getMessage(); logger.warn("InUseException in updateCitationList() " + e); } catch (PermissionException e) { message = e.getMessage(); logger.warn("PermissionException in updateCitationList() " + e); } catch (ServerOverloadException e) { message = e.getMessage(); logger.warn("ServerOverloadException in updateCitationList() " + e); } catch (VirusFoundException e) { message = e.getMessage(); logger.warn("VirusFoundException in updateCitationList() " + e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }

Target:
protected Map<String, Object> updateIntroduction(ParameterParser params, SessionState state) { Map<String, Object> results = new HashMap<String, Object>(); String message = null; String resourceUuid = params.getString("resourceUuid"); try { String resourceId = this.getContentService().resolveUuid(resourceUuid); String introduction = params.get("addSectionHTML"); introduction = getFormattedText().processFormattedText(introduction, new StringBuilder(), true, true); introduction = introduction.replaceAll("'", "&apos;"); getContentService().addProperty(resourceId, CitationService.PROP_INTRODUCTION, introduction); message = rb.getString("resource.updated"); state.setAttribute(STATE_CITATION_COLLECTION, null); } catch (SakaiException e) { logger.warn("SakaiException in updateIntroduction() for resource UUID: " + resourceUuid, e); } if(message != null && ! message.trim().equals("")) { results.put("message", message); } return results; }
Source:
public void testAllNulState() throws IOException { TmpPath tmp_dir = new TmpPath(); String dir = tmp_dir.getPath(); LocalState ls = new LocalState(dir, true); GlobalStreamId gs_a = new GlobalStreamId("a", "a"); FileOutputStream data = FileUtils.openOutputStream(new File(dir, "12345")); FileOutputStream version = FileUtils.openOutputStream(new File(dir, "12345.version")); Assert.assertNull(ls.get("c")); data.write(new byte[100]); ls.put("a", gs_a); Assert.assertEquals(gs_a, ls.get("a")); }

Target:
public void testAllNulState() throws IOException { try (TmpPath tmp_dir = new TmpPath()) { GlobalStreamId globalStreamId_a = new GlobalStreamId("a", "a"); String dir = tmp_dir.getPath(); LocalState ls = new LocalState(dir, true); FileUtils.touch(new File(dir, "12345.version")); try (FileOutputStream data = FileUtils.openOutputStream(new File(dir, "12345"))) { Assert.assertNull(ls.get("c")); data.write(new byte[100]); ls.put("a", globalStreamId_a); Assert.assertEquals(globalStreamId_a, ls.get("a")); } } }
Source:
public void testValidatesFirstStrandNotLonger() throws IllegalArgumentException { thrown.expect(IllegalArgumentException.class); Hamming.compute("AAAG", "AAA"); }

Target:
public void testValidatesFirstStrandNotLonger() { thrown.expect(IllegalArgumentException.class); Hamming.compute("AAAG", "AAA"); }
Source:
public void blockAllServicesOnDestination(PerunSession sess, int destinationId) throws InternalErrorException, PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManager().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "blockAllServicesOnDestination"); } getServicesManagerBl().blockAllServicesOnDestination(sess, destinationId); }

Target:
public void blockAllServicesOnDestination(PerunSession sess, int destinationId) throws InternalErrorException, PrivilegeException, DestinationNotExistsException, FacilityNotExistsException { Destination destination = getServicesManagerBl().getDestinationById(sess, destinationId); List<Facility> destinationFacilities = perunBl.getFacilitiesManagerBl().getFacilitiesByDestination(sess, destination.getDestination()); boolean isFacilityAdminAtLeastOnce = false; for (Facility facility : destinationFacilities) { if (AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { isFacilityAdminAtLeastOnce = true; } } if (!isFacilityAdminAtLeastOnce && !AuthzResolver.isAuthorized(sess, Role.PERUNADMIN)) { throw new PrivilegeException(sess, "blockAllServicesOnDestination"); } getServicesManagerBl().blockAllServicesOnDestination(sess, destinationId); }
Source:
public static String replaceMediaFileWithUrl(Context context, @NonNull String postContent, String localMediaId, MediaFile mediaFile) { if (mediaFile != null) { String remoteUrl = Utils.escapeQuotes(mediaFile.getFileURL()); if (!mediaFile.isVideo()) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "src", "src", "string", remoteUrl); AztecText content = new AztecText(context); content.fromHtml(postContent); content.clearOverlays(AztecEditorFragment.ImagePredicate.localMediaIdPredicate(localMediaId), attrs); content.refreshText(); postContent = content.toHtml(false); } else { } } return postContent; }

Target:
public static String replaceMediaFileWithUrl(Context context, @NonNull String postContent, String localMediaId, MediaFile mediaFile) { if (mediaFile != null) { String remoteUrl = Utils.escapeQuotes(mediaFile.getFileURL()); if (!mediaFile.isVideo()) { AttributesImpl attrs = new AttributesImpl(); attrs.addAttribute("", "src", "src", "string", remoteUrl); AztecText content = new AztecText(context); content.fromHtml(postContent); content.clearOverlays(ImagePredicate.localMediaIdPredicate(localMediaId), attrs); content.refreshText(); postContent = content.toHtml(false); } else { } } return postContent; }
Source:
public void testStoreReconnect() { PersistenceAvailabilityListener pal = new PersistenceAvailabilityListener(); Cache<Object, Object> cache = createManagerAndGetCache(0); cache.addListener(pal); assertEquals(0, pal.availableCount.get()); assertEquals(0, pal.unavailableCount.get()); cache.put(1, 1); PersistenceManager pm = TestingUtil.extractComponent(cache, PersistenceManager.class); assertTrue(pm.isAvailable()); DummyInMemoryStore dims = TestingUtil.getFirstWriter(cache); dims.setAvailable(false); eventually(() -> !pm.isAvailable()); eventuallyEquals(1, () -> pal.unavailableCount.get()); try { cache.put(1, 2); fail("Expected " + StoreUnavailableException.class.getSimpleName()); } catch (PersistenceException ignore) { } dims.setAvailable(true); eventually(pm::isAvailable); eventuallyEquals(1, () -> pal.availableCount.get()); cache.put(1, 3); assertEquals(3, cache.get(1)); }

Target:
public void testStoreReconnect() { PersistenceAvailabilityListener pal = new PersistenceAvailabilityListener(); Cache<Object, Object> cache = createManagerAndGetCache(0); cache.addListener(pal); assertEquals(0, pal.availableCount.get()); assertEquals(0, pal.unavailableCount.get()); cache.put(1, 1); PersistenceManager pm = TestingUtil.extractComponent(cache, PersistenceManager.class); assertTrue(pm.isAvailable()); DummyInMemoryStore dims = TestingUtil.getFirstWriter(cache); dims.setAvailable(false); eventually(() -> !pm.isAvailable()); eventuallyEquals(1, () -> pal.unavailableCount.get()); try { cache.put(1, 2); fail("Expected " + StoreUnavailableException.class.getSimpleName()); } catch (PersistenceException ignore) { } dims.setAvailable(true); eventuallyEquals(1, () -> pal.availableCount.get()); assertTrue(pm.isAvailable()); cache.put(1, 3); assertEquals(3, cache.get(1)); }
Source:
public ModelAndView removeByFName(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname", required = true) String fname) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); IPerson per = getPerson(ui, response); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUserLayoutManager ulm = upm.getUserLayoutManager(); try { String elementId = ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname)); if (elementId != null && elementId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX) && ulm.getNode(elementId) instanceof org.apereo.portal.layout.node.UserLayoutFolderDescription) { removeSubscription(per, elementId, ulm); } else { if (!ulm.deleteNode(elementId)) { logger.info( "Failed to remove element ID from layout root folder ID {}, delete node returned false", elementId, ulm.getRootFolderId()); response.sendError(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView( "jsonView", Collections.singletonMap( "error", getMessage( "error.element.update", "Unable to update element", RequestContextUtils.getLocale(request)))); } } ulm.saveUserLayout(); return new ModelAndView("jsonView", Collections.EMPTY_MAP); } catch (PortalException e) { return handlePersistError(request, response, e); } }

Target:
public ModelAndView removeByFName( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname", required = true) String fname ) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); IPerson per = getPerson(ui, response); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUserLayoutManager ulm = upm.getUserLayoutManager(); try { String elementId = ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname)); if (elementId != null && elementId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX) && ulm.getNode(elementId) instanceof org.apereo.portal.layout.node.UserLayoutFolderDescription) { removeSubscription(per, elementId, ulm); } else if (elementId != null) { if (!ulm.deleteNode(elementId)) { logger.info( "Failed to remove element ID from layout root folder ID {}, delete node returned false", elementId, ulm.getRootFolderId()); response.setStatus(HttpServletResponse.SC_FORBIDDEN); return new ModelAndView( "jsonView", Collections.singletonMap( "error", getMessage( "error.element.update", "Unable to update element", RequestContextUtils.getLocale(request)))); } } else { response.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } ulm.saveUserLayout(); return new ModelAndView("jsonView", Collections.EMPTY_MAP); } catch (PortalException e) { return handlePersistError(request, response, e); } }
Source:
public void removeExpiredAlerts(){ LocalDateTime expiredDate = DatabaseUtilities.getCurrentDateTime(); String sql = "DELETE FROM sms_alerts WHERE court_date < '"+DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(expiredDate.plusDays(2))+"'"; jdbcTemplate.execute(sql, new PreparedStatementCallback<Boolean>(){ @Override public Boolean doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException { return ps.execute(); } }); }

Target:
public void removeExpiredAlerts(){ LocalDateTime expiredDate = DatabaseUtilities.getCurrentDateTime().plusDays(2); Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put("expiredDate", DatabaseUtilities.convertLocalDateTimeToDatabaseDateString(expiredDate)); try{ jdbcTemplate.update(getSql("SMSAlert/remove-expired-SMSAlerts.sql"), parameterMap); }catch(Exception e){ LogSystem.LogDBException(e); } }
Source:
public void start() { this.counter = Counter.build().name(COUNTER_NAME) .help("Log4j log statements at various log levels") .labelNames("level") .register(registry); trace = counter.labels("trace"); debug = counter.labels("debug"); info = counter.labels("info"); warn = counter.labels("warn"); error = counter.labels("error"); super.start(); }

Target:
public void start() { super.start(); }
Source:
public void should_pass_if_size_of_actual_is_equal_to_expected_size() { strings.assertHasSizeLessThanOrEqualTo(someInfo(), "Han", 3); }

Target:
public void should_pass_if_size_of_actual_is_equal_to_expected_size() { strings.assertHasSizeGreaterThanOrEqualTo(someInfo(), "Han", 3); }
Source:
public Map<KOut, VOut> execute() throws CacheException { if (mapper == null) throw new NullPointerException("A valid reference of Mapper is not set " + mapper); if (reducer == null) throw new NullPointerException("A valid reference of Reducer is not set " + reducer); if(!isLocalOnly && distributeReducePhase()){ boolean useCompositeKeys = useIntermediateSharedCache(); String intermediateCacheName = DEFAULT_TMP_CACHE_CONFIGURATION_NAME; if (useIntermediatePerTaskCache()) { intermediateCacheName = taskId.toString(); } try { executeTaskInit(intermediateCacheName); Set<KOut> allMapPhasesResponses = executeMapPhase(useCompositeKeys); return executeReducePhase(allMapPhasesResponses, useCompositeKeys); } catch (Exception cause){ throw new CacheException(cause); } finally { if(useIntermediatePerTaskCache()){ EmbeddedCacheManager cm = cache.getCacheManager(); cm.getCache(intermediateCacheName).getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL).clear(); cm.removeCache(intermediateCacheName); } } } else { try { return executeMapPhaseWithLocalReduction(); } catch (Exception cause){ throw new CacheException(cause); } } }

Target:
public Map<KOut, VOut> execute() throws CacheException { if (mapper == null) throw new NullPointerException("A valid reference of Mapper is not set " + mapper); if (reducer == null) throw new NullPointerException("A valid reference of Reducer is not set " + reducer); if(!isLocalOnly && distributeReducePhase()){ boolean useCompositeKeys = useIntermediateSharedCache(); String intermediateCacheName = DEFAULT_TMP_CACHE_CONFIGURATION_NAME; if (useIntermediatePerTaskCache()) { intermediateCacheName = taskId.toString(); } try { executeTaskInit(intermediateCacheName); Set<KOut> allMapPhasesResponses = executeMapPhase(useCompositeKeys); return executeReducePhase(allMapPhasesResponses, useCompositeKeys); } catch (Exception cause){ throw new CacheException(cause); } finally { if(useIntermediatePerTaskCache()){ EmbeddedCacheManager cm = cache.getCacheManager(); cm.removeCache(intermediateCacheName); } } } else { try { return executeMapPhaseWithLocalReduction(); } catch (Exception cause){ throw new CacheException(cause); } } }
Source:
public void testProcessNonJavaFiles() throws Exception { final List<String> lines = new ArrayList<>(Arrays.asList("package com.puppycrawl.tools.checkstyle;", "", "error public class InputTreeWalkerFileWithViolation {}")); final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); treeWalker.setModuleFactory(factory); treeWalker.configure(new DefaultConfiguration("default config")); final DefaultConfiguration childConfig = createCheckConfig(JavadocParagraphCheck.class); treeWalker.setupChild(childConfig); try { treeWalker.processFiltered(new File("input.java"), lines); fail("Exception expected"); } catch (CheckstyleException ex) { assertEquals("Invalid exception message", "MismatchedTokenException occurred during the analysis of file input.java.", ex.getMessage()); } try { treeWalker.processFiltered(new File("input.txt"), lines); } catch (CheckstyleException ex) { fail("Exception is not expected, file with txt extension should not be processed"); } }

Target:
public void testProcessNonJavaFiles() throws Exception { final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); treeWalker.setModuleFactory(factory); treeWalker.configure(new DefaultConfiguration("default config")); final DefaultConfiguration childConfig = createCheckConfig(JavadocParagraphCheck.class); treeWalker.setupChild(childConfig); final List<String> lines = new ArrayList<>(Arrays.asList("package com.puppycrawl.tools.checkstyle;", "", "error public class InputTreeWalkerFileWithViolation {}")); try { treeWalker.processFiltered(new File("input.java"), lines); fail("Exception expected"); } catch (CheckstyleException ex) { assertEquals("Invalid exception message", "MismatchedTokenException occurred during the analysis of file input.java.", ex.getMessage()); } treeWalker.processFiltered(new File("input.txt"), lines); }
Source:
private LastDataPointMessage buildLastDataPointResponse( final String metricName, final RollupPeriod period, final ImmutableSet<String> tags, final MetricsQueryResponse response, @Nullable final Throwable failure) { final LastDataPointMessage.Builder builder = new LastDataPointMessage.Builder() .setMetricName(metricName) .setPeriod(period); if (failure != null) { builder.setFailure(true); builder.setThrowable(failure); } else { builder.setFailure(false); builder.setTags(tags); builder.setLastDataPointTime(response.getQueries().get(0).getResults().get(0).getValues().get(0).getTime()); } return builder.build(); }

Target:
private LastDataPointMessage buildLastDataPointResponse( final String metricName, final RollupPeriod period, final ImmutableSet<String> tags, final MetricsQueryResponse response, @Nullable final Throwable failure) { final LastDataPointMessage.Builder builder = new LastDataPointMessage.Builder() .setMetricName(metricName) .setPeriod(period) .setTags(tags); if (failure != null) { builder.setFailure(failure); } else { if (response.getQueries().isEmpty() || response.getQueries().get(0).getResults().isEmpty()) { builder.setFailure(new Exception("Unexpected query results.")); } else if (response.getQueries().get(0).getResults().get(0).getValues().isEmpty()) { builder.setLastDataPointTime(null); } else { builder.setLastDataPointTime(response.getQueries().get(0).getResults().get(0).getValues().get(0).getTime()); } } return builder.build(); }
Source:
protected static <TClass, TAnnotation extends Annotation> void scanClass(String className, Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { if (requirePackage != null && !className.startsWith(requirePackage)) return; Class<?> clazz; try { System.setErr(NULL_PRINT_STREAM); clazz = Class.forName(className); System.setErr(ERR_PRINT_STREAM); } catch (Throwable t) { log.trace("Cannot load class " + className); return; } TAnnotation annotation = clazz.getAnnotation(annotationClass); if (annotation != null) { if (!superClass.isAssignableFrom(clazz)) { return; } consumer.accept((Class<? extends TClass>) clazz); } }

Target:
protected static <TClass, TAnnotation extends Annotation> void scanClass(String className, Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { if (requirePackage != null && !className.startsWith(requirePackage)) return; Class<?> clazz; try { System.setErr(NULL_PRINT_STREAM); clazz = Class.forName(className); System.setErr(ERR_PRINT_STREAM); } catch (ClassNotFoundException e) { log.trace("Cannot load class " + className, e); return; } catch (NoClassDefFoundError e) { log.trace("Cannot load class " + className, e); return; } catch (LinkageError e) { log.trace("Cannot load class " + className, e); return; } TAnnotation annotation = clazz.getAnnotation(annotationClass); if (annotation != null) { if (!superClass.isAssignableFrom(clazz)) { return; } consumer.accept((Class<? extends TClass>) clazz); } }
Source:
public MissingMethodException(String method, Class type, Object[] arguments, boolean isStatic) { super(); this.method = method; this.type = type; this.isStatic = isStatic; this.arguments = arguments == null ? new Object[0] : arguments; }

Target:
public MissingMethodException(String method, Class type, Object[] arguments, boolean isStatic) { super(); this.method = method; this.type = type; this.isStatic = isStatic; this.arguments = arguments == null ? EMPTY_OBJECT_ARRAY : arguments; }
Source:
public void testIsDrawable_InvalidReusableSubprocess() throws Exception { testIsDrawable(CaseManagementDiagram.class, ReusableSubprocess.class, false); }

Target:
public void testIsDrawable_InvalidReusableSubprocess() { testIsDrawable(CaseManagementDiagram.class, ReusableSubprocess.class, false); }
Source:
public NutchDocument filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks) throws IndexingException { Outlink[] outlinks = parse.getData().getOutlinks(); try { if (outlinks != null) { Set<String> hosts = new HashSet<String>(); for (Outlink outlink : outlinks) { String linkUrl = outlink.getToUrl(); String outHost = new URL(linkUrl).getHost(); if (indexHost) { linkUrl = new URL(outlink.getToUrl()).getHost(); if (hosts.contains(linkUrl)) continue; hosts.add(linkUrl); } addFilteredLink("outlinks", url.toString(), linkUrl, outHost, filterOutlinks, doc); } } } catch (MalformedURLException e) { LOG.error("Malformed URL in {}: {}", url, e.getMessage()); } if (null != inlinks) { Iterator<Inlink> iterator = inlinks.iterator(); Set<String> inlinkHosts = new HashSet<String>(); try { while (iterator.hasNext()) { Inlink link = iterator.next(); String linkUrl = link.getFromUrl(); String inHost = new URL(link.getFromUrl()).getHost(); if (indexHost) { linkUrl = new URL(link.getFromUrl()).getHost(); if (inlinkHosts.contains(linkUrl)) continue; inlinkHosts.add(linkUrl); } addFilteredLink("inlinks", url.toString(), linkUrl, inHost, filterInlinks, doc); } } catch (MalformedURLException e) { LOG.error("Malformed URL in {}: {}", url, e.getMessage()); } } return doc; }

Target:
public NutchDocument filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks) throws IndexingException { Outlink[] outlinks = parse.getData().getOutlinks(); if (outlinks != null) { Set<String> hosts = new HashSet<String>(); for (Outlink outlink : outlinks) { try { String linkUrl = outlink.getToUrl(); String outHost = new URL(linkUrl).getHost().toLowerCase(); if (indexHost) { linkUrl = outHost; if (hosts.contains(linkUrl)) continue; hosts.add(linkUrl); } addFilteredLink("outlinks", url.toString(), linkUrl, outHost, filterOutlinks, doc); } catch (MalformedURLException e) { LOG.error("Malformed URL in {}: {}", url, e.getMessage()); } } } if (null != inlinks) { Iterator<Inlink> iterator = inlinks.iterator(); Set<String> inlinkHosts = new HashSet<String>(); while (iterator.hasNext()) { try { Inlink link = iterator.next(); String linkUrl = link.getFromUrl(); String inHost = new URL(linkUrl).getHost().toLowerCase(); if (indexHost) { linkUrl = inHost; if (inlinkHosts.contains(linkUrl)) continue; inlinkHosts.add(linkUrl); } addFilteredLink("inlinks", url.toString(), linkUrl, inHost, filterInlinks, doc); } catch (MalformedURLException e) { LOG.error("Malformed URL in {}: {}", url, e.getMessage()); } } } return doc; }
Source:
private void addMemberToGroupsFromTriggerAttribute(PerunSession sess, Group group, Member member) { ArrayList<String> groupsForAddition; try { groupsForAddition = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF+":groupTrigger").valueAsList(); } catch (InternalErrorException | WrongAttributeAssignmentException | AttributeNotExistsException | NumberFormatException e) { log.error("Error while getting groupTrigger attribute, Exception message: " + e.toString()); return; } if (groupsForAddition == null) return; for (String groupId : groupsForAddition) { try { Group one = getGroupById(sess, Integer.parseInt(groupId)); addDirectMember(sess, one, member); } catch (InternalErrorException | WrongReferenceAttributeValueException | AlreadyMemberException | WrongAttributeValueException | GroupNotExistsException e) { log.error("Member could not be added to the group, Exception message: " + e.toString()); } } }

Target:
private void addMemberToGroupsFromTriggerAttribute(PerunSession sess, Group group, Member member) { ArrayList<String> groupsForAddition; try { groupsForAddition = getPerunBl().getAttributesManagerBl().getAttribute(sess, group, AttributesManager.NS_GROUP_ATTR_DEF+":groupTrigger").valueAsList(); } catch (InternalErrorException | WrongAttributeAssignmentException | AttributeNotExistsException | NumberFormatException e) { log.error("Error while getting groupTrigger attribute, Exception message: " + e.toString()); return; } if (groupsForAddition == null) return; for (String groupId : groupsForAddition) { try { Group groupForAddition = getGroupById(sess, Integer.parseInt(groupId)); addDirectMember(sess, groupForAddition, member); } catch (InternalErrorException | WrongReferenceAttributeValueException | AlreadyMemberException | WrongAttributeValueException | GroupNotExistsException e) { log.error("Member could not be added to the group, Exception message: " + e.toString()); } } }
Source:
public int getActivePartitionCount() { InetSocketAddress thisAddress = hazelcastInstance.getCluster().getLocalMember().getSocketAddress(MEMBER); return managedObject.getMemberPartitionsIfAssigned(new Address(thisAddress)).size(); }

Target:
public int getActivePartitionCount() { InetSocketAddress thisAddress = hazelcastInstance.getCluster().getLocalMember().getSocketAddress(); return managedObject.getMemberPartitionsIfAssigned(new Address(thisAddress)).size(); }
Source:
private void putMetadataWithoutChangingSettings(final TableReference tableRef, final byte[] meta) { long ts = System.currentTimeMillis(); try { cellValuePutter.put("put", AtlasDbConstants.DEFAULT_METADATA_TABLE, KeyValueServices.toConstantTimestampValues( ImmutableMap.of(CassandraKeyValueServices.getMetadataCell(tableRef), meta).entrySet(), ts)); } catch (Exception e) { throw QosAwareThrowables.unwrapAndThrowRateLimitExceededOrAtlasDbDependencyException(e); } try { new CellRangeDeleter(clientPool, wrappingQueryRunner, deleteConsistency, no -> System.currentTimeMillis()) .deleteAllTimestamps(AtlasDbConstants.DEFAULT_METADATA_TABLE, ImmutableMap.of(CassandraKeyValueServices.getMetadataCell(tableRef), ts), true); } catch (AtlasDbDependencyException e) { log.info("Failed to delete old table metadata for table because not all Cassandra nodes are up. However," + "the table has been dropped and the table metadata reflecting this has been successfully " + "persisted.", LoggingArgs.tableRef(tableRef), e); } }

Target:
private void putMetadataWithoutChangingSettings(final TableReference tableRef, final byte[] meta) { long ts = System.currentTimeMillis(); try { cellValuePutter.put("put", AtlasDbConstants.DEFAULT_METADATA_TABLE, KeyValueServices.toConstantTimestampValues( ImmutableMap.of(CassandraKeyValueServices.getMetadataCell(tableRef), meta).entrySet(), ts)); } catch (Exception e) { throw Throwables.unwrapAndThrowAtlasDbDependencyException(e); } try { new CellRangeDeleter(clientPool, wrappingQueryRunner, deleteConsistency, no -> System.currentTimeMillis()) .deleteAllTimestamps(AtlasDbConstants.DEFAULT_METADATA_TABLE, ImmutableMap.of(CassandraKeyValueServices.getMetadataCell(tableRef), ts), false); } catch (AtlasDbDependencyException e) { log.info("Failed to delete old table metadata for table because not all Cassandra nodes are up. However," + "the table has been dropped and the table metadata reflecting this has been successfully " + "persisted.", LoggingArgs.tableRef(tableRef), e); } }
Source:
public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); ChangeUtil.bumpRowVersionNotLastUpdatedOn(req.getChange().getId(), db.get()); return Response.ok(hashtags); }

Target:
public Response<Set<String>> apply(ChangeResource req, Input input) throws AuthException, OrmException, IOException, BadRequestException { if (input == null || Strings.isNullOrEmpty(input.hashtags)) { throw new BadRequestException("Hashtags are required"); } ChangeControl control = req.getControl(); if(!control.canEditHashtags()){ throw new AuthException("Editing hashtags not permitted"); } ChangeUpdate update = updateFactory.create(control); ChangeNotes notes = control.getNotes().load(); Set<String> hashtags = new HashSet<String>(); Set<String> oldHashtags = notes.getHashtags(); if (oldHashtags != null) { hashtags.addAll(oldHashtags); } hashtags.removeAll(Arrays.asList(input.hashtags.split(","))); update.setHashtags(hashtags); update.commit(); ChangeUtil.bumpRowVersionNotLastUpdatedOn(req.getChange().getId(), db.get()); return Response.ok(hashtags); }
Source:
private String colorizeMessage(String message, String outcome) { if (!"".equals(outcome.toLowerCase())) { switch (outcome) { case "success": return Util.formatSuccessMessage(message); case "fail": case "failed": case "failure": case "error": return Util.formatErrorMessage(message); case "cancelled": case "warn": case "warning": return Util.formatWarnMessage(message); } } return message; }

Target:
private String colorizeMessage(String message, String outcome) { if (outcome != null && !outcome.isEmpty()) { switch (outcome) { case "success": return Util.formatSuccessMessage(message); case "fail": case "failed": case "failure": case "error": return Util.formatErrorMessage(message); case "cancelled": case "warn": case "warning": return Util.formatWarnMessage(message); } } return message; }
Source:
public AsyncFuture<ModelNode> executeAsync(ModelNode modelNode, OperationMessageHandler handler) { ExecutorService executor = Executors.newSingleThreadExecutor(); Future<ModelNode> submit = executor.submit(new ModelNodeFromModelNodeCallable(modelNode)); ModelNode result = getFutureResult(submit); return new HttpModelControllerClientAsyncFutureTask(executor, result); }

Target:
public AsyncFuture<ModelNode> executeAsync(ModelNode modelNode, OperationMessageHandler handler) { ExecutorService executor = obtainExecutorService(); Future<ModelNode> submit = executor.submit(new ModelNodeFromModelNodeCallable(modelNode)); ModelNode result = getFutureResult(submit); return new HttpModelControllerClientAsyncFutureTask(executor, result); }
Source:
private String removeAbstract(String line) { String tmp = line; if (isAbstractClassLine(tmp)) { logging.info("Found abstract class. Convert it to a interface"); tmp = tmp.replace(ABSTRACT_CLASS_SIGNITURE + " ", "interface I"); if (tmp.contains(":")) { tmp = tmp.substring(0, tmp.indexOf(":")) + "{"; } tmp = tmp.replace(" {", "SoapBinding {"); } else { if (tmp.contains("abstract")) { logging.info("Found abstract method. Convert it"); tmp = tmp.replace("abstract", ""); tmp = tmp.replace("public", ""); tmp = tmp.replace("private", ""); tmp = tmp.replace("protected", ""); } } return tmp; }

Target:
private String removeAbstract(String line) { String tmpLine = line; if (isAbstractClassLine(tmpLine)) { logging.info("Found abstract class. Convert it to a interface"); tmpLine = tmpLine.replace(ABSTRACT_CLASS_SIGNITURE + " ", "interface I"); if (tmpLine.contains(":")) { tmpLine = tmpLine.substring(0, tmpLine.indexOf(":")) + "{"; } tmpLine = tmpLine.replace(" {", "SoapBinding {"); } else { if (tmpLine.contains("abstract")) { logging.info("Found abstract method. Convert it"); tmpLine = tmpLine.replace("abstract", ""); tmpLine = tmpLine.replace("public", ""); tmpLine = tmpLine.replace("private", ""); tmpLine = tmpLine.replace("protected", ""); } } return tmpLine; }
Source:
public void InteractiveMaps_037_VerifyEmbedMapAddPinType() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = new ArticlePageObject(driver); article.openArticleByName(wikiURL, InteractiveMapsContent.embedMapArticleName); EmbedMapComponentObject embedMapDialog = article.clickViewEmbedMap(); embedMapDialog.clickEditPinTypesButton(); CreatePinTypesComponentObject pinTypesDialog = new CreatePinTypesComponentObject(driver); pinTypesDialog.verifyPinTypesDialog(); pinTypesDialog.typeManyPinTypeTitle(InteractiveMapsContent.pinTypeName, 4); pinTypesDialog.clickSave(); embedMapDialog.verifyPinTypeExist(InteractiveMapsContent.pinTypeName); }

Target:
public void InteractiveMaps_037_VerifyEmbedMapAddPinType() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userName, credentials.password, wikiURL); ArticlePageObject article = new ArticlePageObject(driver); article.openArticleByName(wikiURL, InteractiveMapsContent.embedMapArticleName); EmbedMapComponentObject embedMapDialog = article.clickViewEmbedMap(); CreatePinTypesComponentObject pinTypesDialog = embedMapDialog.clickEditPinTypesButton(); pinTypesDialog.verifyPinTypesDialog(); pinTypesDialog.deletePinTypes(); pinTypesDialog.typeManyPinTypeTitle(InteractiveMapsContent.pinTypeName, 4); pinTypesDialog.clickSave(); embedMapDialog.verifyPinTypeExist(InteractiveMapsContent.pinTypeName); }
Source:
public void compressJar(String pluginKey, Path sourceDir, Path targetJarFile) { if (configuration.getBoolean(PROPERTY_PLUGIN_COMPRESSION_ENABLE).orElse(false)) { Path targetPack200Path = FileUtils.getPack200FilePath(targetJarFile); Path sourcePack200Path = sourceDir.resolve(targetPack200Path.getFileName()); if (Files.isRegularFile(sourcePack200Path)) { try { LOG.debug("Found pack200: " + sourcePack200Path); Files.copy(sourcePack200Path, targetPack200Path); } catch (IOException e) { LOG.error("Failed to copy pack200 file from " + sourcePack200Path + " to " + targetPack200Path); return; } } else { pack200(targetJarFile, targetPack200Path, pluginKey); } String hash = calculateMd5(targetPack200Path); RemotePluginFile compressedPlugin = new RemotePluginFile(targetPack200Path.getFileName().toString(), hash); compressedPlugins.put(pluginKey, compressedPlugin); } }

Target:
public void compressJar(String pluginKey, Path sourceDir, Path targetJarFile) { if (configuration.getBoolean(PROPERTY_PLUGIN_COMPRESSION_ENABLE).orElse(false)) { Path targetPack200Path = FileUtils.getPack200FilePath(targetJarFile); Path sourcePack200Path = sourceDir.resolve(targetPack200Path.getFileName()); if (Files.isRegularFile(sourcePack200Path)) { try { LOG.debug("Found pack200: " + sourcePack200Path); Files.copy(sourcePack200Path, targetPack200Path); } catch (IOException e) { throw new IllegalStateException("Failed to copy pack200 file from " + sourcePack200Path + " to " + targetPack200Path, e); } } else { pack200(targetJarFile, targetPack200Path, pluginKey); } String hash = calculateMd5(targetPack200Path); RemotePluginFile compressedPlugin = new RemotePluginFile(targetPack200Path.getFileName().toString(), hash); compressedPlugins.put(pluginKey, compressedPlugin); } }
Source:
public void refreshGlusterServices() { if (getServiceNameMap().isEmpty()) { populateServiceMap(); } List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (supportsGlusterServicesFeature(cluster)) { try { List<VDS> serversList = getClusterUtils().getAllServers(cluster.getId()); if(serversList != null && serversList.size() == 0) { Map<ServiceType, GlusterServiceStatus> statusMap = new HashMap<>(); for(ServiceType type : getClusterServiceMap(cluster).keySet()) { statusMap.put(type, GlusterServiceStatus.UNKNOWN); } addOrUpdateClusterServices(cluster, statusMap); continue; } List<Callable<Map<String, GlusterServiceStatus>>> taskList = createTaskList(serversList); if (taskList != null && taskList.size() > 0) { refreshClusterServices(cluster, ThreadPoolUtil.invokeAll(taskList)); } } catch (Exception e) { log.errorFormat("Error while refreshing service statuses of cluster {0}!", cluster.getName(), e); } } } }

Target:
public void refreshGlusterServices() { if (getServiceNameMap().isEmpty()) { populateServiceMap(); } List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (supportsGlusterServicesFeature(cluster)) { try { List<VDS> serversList = getClusterUtils().getAllServers(cluster.getId()); if (serversList.isEmpty()) { Map<ServiceType, GlusterServiceStatus> statusMap = new HashMap<>(); for (ServiceType type : getClusterServiceMap(cluster).keySet()) { statusMap.put(type, GlusterServiceStatus.UNKNOWN); } addOrUpdateClusterServices(cluster, statusMap); } else { List<Callable<Map<String, GlusterServiceStatus>>> taskList = createTaskList(serversList); if (taskList != null && taskList.size() > 0) { refreshClusterServices(cluster, ThreadPoolUtil.invokeAll(taskList)); } } } catch (Exception e) { log.errorFormat("Error while refreshing service statuses of cluster {0}!", cluster.getName(), e); } } } }
Source:
private boolean containsNull() { return nullsBufferContainsNull || remainingNullsContainsNulls(); }

Target:
private boolean containsNull() { if (nullsBufferContainsNull) { return true; } for (int i = 0; i < remainingNullsCount; i++) { if (remainingNullsFromLastBatch[i]) { return true; } } return false; }
Source:
private void inferReturnTypeFromInferedArgs(MethodInvocationTree tree, Resolve.Env methodEnv, List<JavaType> argTypes, List<JavaType> typeParamTypes, JavaType returnType, TypeSubstitution typeSubstitution) { List<JavaType> parameterTypes = getParameterTypes(tree.arguments()); if(!parameterTypes.equals(argTypes)) { IdentifierTree identifier = null; Resolution resolution = null; Tree methodSelect = tree.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mset = (MemberSelectExpressionTree) methodSelect; JavaType type = getType(mset.expression()); if(type.isTagged(JavaType.DEFERRED)) { throw new IllegalStateException("type of arg should not be defered anymore ??"); } identifier = mset.identifier(); resolution = resolve.findMethod(methodEnv, type, identifier.name(), parameterTypes, typeParamTypes); } else if (methodSelect.is(Tree.Kind.IDENTIFIER)) { identifier = (IdentifierTree) methodSelect; resolution = resolve.findMethod(methodEnv, identifier.name(), parameterTypes, typeParamTypes); } if(resolution != null && returnType != resolution.type() && resolution.symbol().isMethodSymbol()) { MethodJavaType methodType = (MethodJavaType) resolution.type(); if(!methodType.resultType.isTagged(JavaType.DEFERRED)) { registerType(tree, resolve.applySubstitution(methodType.resultType, typeSubstitution)); registerType(identifier, resolution.type()); } } } else { registerType(tree, resolve.applySubstitution(returnType, typeSubstitution)); } }

Target:
private void inferReturnTypeFromInferedArgs(MethodInvocationTree tree, Resolve.Env methodEnv, List<JavaType> argTypes, List<JavaType> typeParamTypes, JavaType returnType, TypeSubstitution typeSubstitution) { List<JavaType> parameterTypes = getParameterTypes(tree.arguments()); if(!parameterTypes.equals(argTypes)) { IdentifierTree identifier = null; Resolution resolution = null; Tree methodSelect = tree.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { MemberSelectExpressionTree mset = (MemberSelectExpressionTree) methodSelect; JavaType type = getType(mset.expression()); if(type.isTagged(JavaType.DEFERRED)) { throw new IllegalStateException("type of arg should not be defered anymore ??"); } identifier = mset.identifier(); resolution = resolve.findMethod(methodEnv, type, identifier.name(), parameterTypes, typeParamTypes); } else if (methodSelect.is(Tree.Kind.IDENTIFIER)) { identifier = (IdentifierTree) methodSelect; resolution = resolve.findMethod(methodEnv, identifier.name(), parameterTypes, typeParamTypes); } if(resolution != null && returnType != resolution.type() && resolution.symbol().isMethodSymbol()) { MethodJavaType methodType = (MethodJavaType) resolution.type(); if(!methodType.resultType.isTagged(JavaType.DEFERRED)) { registerType(tree, resolve.applySubstitution(methodType.resultType, typeSubstitution)); registerType(identifier, methodType); } } } else { registerType(tree, resolve.applySubstitution(returnType, typeSubstitution)); } }
Source:
public void putMonitoredEntity(String entityName, String entityType) throws FalconException{ MonitoredEntityBean monitoredEntityBean = new MonitoredEntityBean(); monitoredEntityBean.setEntityName(entityName); monitoredEntityBean.setEntityType(entityType.toLowerCase()); EntityManager entityManager = getEntityManager(); try { beginTransaction(entityManager); entityManager.persist(monitoredEntityBean); } finally { commitAndCloseTransaction(entityManager); } }

Target:
public void putMonitoredEntity(String entityName, String entityType) throws FalconException{ MonitoredEntityBean monitoredEntityBean = new MonitoredEntityBean(); monitoredEntityBean.setEntityName(entityName); monitoredEntityBean.setEntityType(entityType); EntityManager entityManager = getEntityManager(); try { beginTransaction(entityManager); entityManager.persist(monitoredEntityBean); } finally { commitAndCloseTransaction(entityManager); } }