auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<String> getDevSupportInfos() { final UserAccount cachedCurrentUser = getUserAccountManager().getCachedCurrentUser(); final String currentUserString = (cachedCurrentUser == null) ? "" : usersToString(cachedCurrentUser); final List<UserAccount> users = getUserAccountManager().getAuthenticatedUsers(); final String usersString = (users == null || users.isEmpty()) ? "" : usersToString(users.toArray(new UserAccount[0])); List<String> devInfos = new ArrayList<>(Arrays.asList( "SDK Version", SDK_VERSION, "App Type", getAppType(), "User Agent", getUserAgent(), "Browser Login Enabled", isBrowserLoginEnabled() + "", "IDP Enabled", isIDPLoginFlowEnabled() + "", "Identity Provider", isIdentityProvider() + "", "Current User", currentUserString, "Authenticated Users", usersString )); devInfos.addAll(getDevInfosFor(BootConfig.getBootConfig(context).asJSON(), "BootConfig")); RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); devInfos.addAll(Arrays.asList("Managed?", runtimeConfig.isManagedApp() + "")); if (runtimeConfig.isManagedApp()) { devInfos.addAll(getDevInfosFor(runtimeConfig.asJSON(), "Managed Pref")); } return devInfos; }

Target:
public List<String> getDevSupportInfos() { List<String> devInfos = new ArrayList<>(Arrays.asList( "SDK Version", SDK_VERSION, "App Type", getAppType(), "User Agent", getUserAgent(), "Browser Login Enabled", isBrowserLoginEnabled() + "", "IDP Enabled", isIDPLoginFlowEnabled() + "", "Identity Provider", isIdentityProvider() + "", "Current User", usersToString(getUserAccountManager().getCachedCurrentUser()), "Authenticated Users", usersToString(getUserAccountManager().getAuthenticatedUsers()) )); devInfos.addAll(getDevInfosFor(BootConfig.getBootConfig(context).asJSON(), "BootConfig")); RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); devInfos.addAll(Arrays.asList("Managed?", runtimeConfig.isManagedApp() + "")); if (runtimeConfig.isManagedApp()) { devInfos.addAll(getDevInfosFor(runtimeConfig.asJSON(), "Managed Pref")); } return devInfos; }
Source:
private void verifyFailureTags(final ArgumentCaptor<Map<String, String>> argumentCaptor, final Throwable throwable) { final Map<String, String> failureTags = MetricsUtils.newFailureTagsMapForException(throwable); Assert.assertTrue(argumentCaptor.getValue().get(MetricsConstants.TagKeys.STATUS). equals(failureTags.get(MetricsConstants.TagKeys.STATUS))); Assert.assertTrue(argumentCaptor.getValue().get(MetricsConstants.TagKeys.EXCEPTION_CLASS). equals(failureTags.get(MetricsConstants.TagKeys.EXCEPTION_CLASS))); verifyCommonTags(argumentCaptor); }

Target:
private void verifyFailureTags(final ArgumentCaptor<Map<String, String>> argumentCaptor, final Throwable throwable) { final Map<String, String> failureTags = MetricsUtils.newFailureTagsMapForException(throwable); Assert.assertEquals(argumentCaptor.getValue().get(MetricsConstants.TagKeys.STATUS), failureTags.get(MetricsConstants.TagKeys.STATUS)); Assert.assertEquals(argumentCaptor.getValue().get(MetricsConstants.TagKeys.EXCEPTION_CLASS), failureTags.get(MetricsConstants.TagKeys.EXCEPTION_CLASS)); verifyCommonTags(argumentCaptor); }
Source:
private void relaunchSimplenote() { final UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.pressHome(); final String launcherPackage = device.getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = ApplicationProvider.getApplicationContext(); final Intent intent = context.getPackageManager() .getLaunchIntentForPackage(SIMPLENOTE_PACKAGE); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); device.wait(Until.hasObject(By.pkg(SIMPLENOTE_PACKAGE).depth(0)), LAUNCH_TIMEOUT); }

Target:
private void relaunchSimplenote() { final UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()); device.pressHome(); final String launcherPackage = device.getLauncherPackageName(); assertThat(launcherPackage, notNullValue()); device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT); Context context = ApplicationProvider.getApplicationContext(); String packageName = context.getPackageName(); final Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); context.startActivity(intent); device.wait(Until.hasObject(By.pkg(packageName).depth(0)), LAUNCH_TIMEOUT); }
Source:
public void removeDataObserver(ChartDataBase dataComponent) { dataSourceObservers.remove(dataComponent); if (dataSourceObservers.isEmpty()) { dataPollService.shutdown(); dataPollService = null; } }

Target:
public synchronized void removeDataObserver(ChartDataBase dataComponent) { dataSourceObservers.remove(dataComponent); if (dataSourceObservers.isEmpty()) { dataPollService.shutdown(); dataPollService = null; } }
Source:
private static void checkDoNotMockAnnotationForType(Class<?> type) { if (type == null) { return; } if (SAFE_DONOTMOCK_ENFORCED_CLASSES.contains(type)) { return; } DO_NOT_MOCK_ENFORCER.checkTypeForDoNotMockViolation(type).ifPresent(message -> { throw new DoNotMockException(message); }); checkDoNotMockAnnotationForType(type.getSuperclass()); Arrays.stream(type.getInterfaces()).forEach(MockitoCore::checkDoNotMockAnnotationForType); SAFE_DONOTMOCK_ENFORCED_CLASSES.add(type); }

Target:
private static void checkDoNotMockAnnotationForType(Class<?> type) { if (type == null) { return; } if (MOCKABLE_CLASSES.contains(type)) { return; } String warning = DO_NOT_MOCK_ENFORCER.checkTypeForDoNotMockViolation(type); if (warning != null) { throw new DoNotMockException(warning); } checkDoNotMockAnnotationForType(type.getSuperclass()); for (Class<?> aClass : type.getInterfaces()) { checkDoNotMockAnnotationForType(aClass); } MOCKABLE_CLASSES.add(type); }
Source:
public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, TmfStrings.cpu(), "0", 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", TmfStrings.cpu(), "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, TmfStrings.cpu(), "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, TmfStrings.cpu(), "..", 42)); }

Target:
public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); TmfCpuAspect cpuAspect = null; for(ITmfEventAspect<?> oaspect : trace.getEventAspects()) { if(oaspect instanceof TmfCpuAspect) { cpuAspect = (TmfCpuAspect) oaspect; } } assertNotNull(cpuAspect); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); String cpu = cpuAspect.getDeviceType(); List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, cpu, "0", 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", cpu, "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, cpu, "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); }
Source:
public static boolean isValidAlarms(final List<Alarm> alarms, final DateTime now, final DateTimeZone timeZone){ final Set<Integer> alarmDays = new HashSet<Integer>(); for(final Alarm alarm: alarms){ if(alarm.isSmart) { if(alarm.isRepeated) { for (final Integer dayOfWeek : alarm.dayOfWeek) { if (alarmDays.contains(dayOfWeek)) { return false; } else { alarmDays.add(dayOfWeek); } } }else{ if (!isValidNoneRepeatedAlarm(alarm)) { return false; } final DateTime expectedRingTime = new DateTime(alarm.year, alarm.month, alarm.day, alarm.hourOfDay, alarm.minuteOfHour, timeZone); if(alarmDays.contains(expectedRingTime.getDayOfWeek())){ return false; }else{ alarmDays.add(expectedRingTime.getDayOfWeek()); } } }else{ if(!alarm.isRepeated) { if (!isValidNoneRepeatedAlarm(alarm)) { return false; } } } } return true; }

Target:
public static boolean isValidAlarms(final List<Alarm> alarms, final DateTime now, final DateTimeZone timeZone){ final Set<Integer> alarmDays = new HashSet<Integer>(); for(final Alarm alarm: alarms){ if(!alarm.isRepeated){ if (!isValidNoneRepeatedAlarm(alarm)) { return false; } if(alarm.isSmart){ final DateTime expectedRingTime = new DateTime(alarm.year, alarm.month, alarm.day, alarm.hourOfDay, alarm.minuteOfHour, timeZone); if(alarmDays.contains(expectedRingTime.getDayOfWeek())){ return false; } alarmDays.add(expectedRingTime.getDayOfWeek()); } }else{ if(!alarm.isSmart) { continue; } for (final Integer dayOfWeek : alarm.dayOfWeek) { if (alarmDays.contains(dayOfWeek)) { return false; } alarmDays.add(dayOfWeek); } } } return true; }
Source:
void imageIncoming(ImageReaderProxy imageReader) { synchronized (mLock) { if (mClosed) { return; } ImageProxy image = null; try { image = imageReader.acquireNextImage(); } catch (IllegalStateException e) { Log.e(TAG, "Failed to acquire latest image.", e); } finally { if (image != null) { Object tag = image.getImageInfo().getTag(); if (tag instanceof List && !((List<Object>) tag).isEmpty()) { for (Integer captureId: mCaptureIdList) { for (Object intObj: (List<Object>) tag) { if ((Integer) intObj == captureId) { mSettableImageProxyBundle.addImageProxy(image, captureId); } } } } else if (tag instanceof Integer) { if (!mCaptureIdList.contains(tag)) { Log.w(TAG, "ImageProxyBundle does not contain this id: " + tag); image.close(); return; } mSettableImageProxyBundle.addImageProxy(image); } else { Log.w(TAG, "ImageProxyBundle does not contain this id: " + tag); image.close(); return; } } } } }

Target:
void imageIncoming(ImageReaderProxy imageReader) { synchronized (mLock) { if (mClosed) { return; } ImageProxy image = null; try { image = imageReader.acquireNextImage(); } catch (IllegalStateException e) { Log.e(TAG, "Failed to acquire latest image.", e); } finally { if (image != null) { Object tag = image.getImageInfo().getTag(); if (tag instanceof List && !((List<Object>) tag).isEmpty()) { for (Integer captureId: mCaptureIdList) { if (((List<Object>) tag).contains(captureId)) { mSettableImageProxyBundle.addImageProxy(image, captureId); } else { image.close(); return; } } } else if (tag instanceof Integer) { if (!mCaptureIdList.contains(tag)) { Log.w(TAG, "ImageProxyBundle does not contain this id: " + tag); image.close(); return; } mSettableImageProxyBundle.addImageProxy(image); } else { Log.w(TAG, "ImageProxyBundle does not contain this id: " + tag); image.close(); return; } } } } }
Source:
public void shouldGenerateVepAnnotations() throws Exception { String databaseName = mongoRule.restoreDumpInTemporaryDatabase(getResourceUrl(MONGO_DUMP)); String outputDirAnnot = temporaryFolderRule.getRoot().getAbsolutePath(); File vepOutput = new File(URLHelper.resolveVepOutput(outputDirAnnot, STUDY_ID, FILE_ID)); JobParameters jobParameters = new EvaJobParameterBuilder() .collectionVariantsName("variants") .databaseName(databaseName) .inputFasta("") .inputStudyId(STUDY_ID) .inputVcfId(FILE_ID) .outputDirAnnotation(outputDirAnnot) .vepCachePath("") .vepCacheSpecies("") .vepCacheVersion("") .vepNumForks("") .vepPath(getResource(MOCKVEP).getPath()) .vepTimeout("60") .toJobParameters(); JobExecution jobExecution = jobLauncherTestUtils .launchStep(BeanNames.GENERATE_VEP_ANNOTATION_STEP, jobParameters); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); assertTrue(vepOutput.exists()); int EXTRA_ANNOTATIONS = 1; assertEquals(300 + EXTRA_ANNOTATIONS, JobTestUtils.getLines(new GZIPInputStream(new FileInputStream(vepOutput)))); }

Target:
public void shouldGenerateVepAnnotations() throws Exception { String databaseName = mongoRule.restoreDumpInTemporaryDatabase(getResourceUrl(MONGO_DUMP)); String outputDirAnnot = temporaryFolderRule.getRoot().getAbsolutePath(); File vepOutput = new File(URLHelper.resolveVepOutput(outputDirAnnot, STUDY_ID, FILE_ID)); JobParameters jobParameters = new EvaJobParameterBuilder() .collectionVariantsName("variants") .databaseName(databaseName) .inputFasta("") .inputStudyId(STUDY_ID) .inputVcfId(FILE_ID) .outputDirAnnotation(outputDirAnnot) .vepCachePath("") .vepCacheSpecies("") .vepCacheVersion("") .vepNumForks("4") .vepPath(getResource(MOCKVEP).getPath()) .vepTimeout("60") .toJobParameters(); JobExecution jobExecution = jobLauncherTestUtils .launchStep(BeanNames.GENERATE_VEP_ANNOTATION_STEP, jobParameters); assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus()); assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus()); assertTrue(vepOutput.exists()); assertEquals(300 + EXTRA_ANNOTATIONS, JobTestUtils.getLines(new GZIPInputStream(new FileInputStream(vepOutput)))); }
Source:
public Boolean getBoolean() { if (byteBuffer.position() + 1 > limit) { throw new LimitReachedException(); } return byteBuffer.get() == 0 ? Boolean.FALSE : Boolean.TRUE; }

Target:
public Boolean getBoolean() { if (byteBuffer.position() + 1 > limit) { throw new LimitReachedException(); } return byteBuffer.get() == (byte) 0 ? Boolean.FALSE : Boolean.TRUE; }
Source:
public AnalysisResult<IRevision> analyze(IRevision revision) { List<IRevisionPair> javaFiles = revision.getChildren(); Map<String, Diff> diffOfFiles = new HashMap<>(); log.info("\n*****\nCommit: " + revision.getName()); for (IRevisionPair<String> fileFromRevision : javaFiles) { String left = fileFromRevision.getPreviousVersion(); String right = fileFromRevision.getNextVersion(); String leftName = fileFromRevision.getPreviousName(); String rightName = fileFromRevision.getName(); Diff diff = compare(left, right, leftName, rightName); if (diff != null) { diffOfFiles.put(fileFromRevision.getName(), diff); } DiffRowGenerator generator = DiffRowGenerator.create() .showInlineDiffs(true) .inlineDiffByWord(true) .oldTag(f -> "~") .newTag(f -> "**") .build(); List<DiffRow> rows = null; try { rows = generator.generateDiffRows( Arrays.asList("This is a test senctence.", "This is the second line.", "And here is the finish."), Arrays.asList("This is a test for diffutils.", "This is the second line.")); } catch (DiffException e) { e.printStackTrace(); } System.out.println("|original|new|"); System.out.println("|--------|---|"); for (DiffRow row : rows) { System.out.println("|" + row.getOldLine() + "|" + row.getNewLine() + "|"); } } return new DiffResult<IRevision, Diff>(revision, diffOfFiles); }

Target:
public AnalysisResult analyze(IRevision revision) { List<IRevisionPair> javaFiles = revision.getChildren(); Map<String, Diff> diffOfFiles = new HashMap<>(); List<DiffRow> rows = null; log.info("\n*****\nCommit: " + revision.getName()); for (IRevisionPair<String> fileFromRevision : javaFiles) { String left = fileFromRevision.getPreviousVersion(); String right = fileFromRevision.getNextVersion(); String leftName = fileFromRevision.getPreviousName(); String rightName = fileFromRevision.getName(); Diff diff = compare(left, right, leftName, rightName); if (diff != null) { diffOfFiles.put(fileFromRevision.getName(), diff); } DiffRowGenerator generator = DiffRowGenerator.create() .showInlineDiffs(false) .inlineDiffByWord(false) .ignoreWhiteSpaces(true) .build(); try { rows = generator.generateDiffRows( Arrays.stream(fileFromRevision.getPreviousVersion().split("\n")).collect(Collectors.toList()), Arrays.stream(fileFromRevision.getNextVersion().split("\n")).collect(Collectors.toList())); } catch (DiffException e) { e.printStackTrace(); } } return (new DiffResult<IRevision, Diff>(revision, diffOfFiles,rows)); }
Source:
private void verifyLowVersionLogsError(String lowVersion) { Logger log = Mockito.mock(Logger.class); String expectedMessage = "The minimum supported version is " + PostgresVersionCheck.MIN_POSTGRES_VERSION; try { PostgresVersionCheck.checkDatabaseVersion(lowVersion, log); Assert.fail("Expected an AssertionError"); } catch (AssertionError error) { Assert.assertTrue("Error did not contain expected message. Actual error: " + error, error.getMessage().contains(expectedMessage)); } Mockito.verify(log).error( eq("Assertion with exception "), contains(expectedMessage), Mockito.any(Exception.class)); Mockito.verifyNoMoreInteractions(log); }

Target:
private void verifyLowVersionLogsError(String lowVersion) { Logger log = mock(Logger.class); String expectedMessage = "The minimum supported version is " + PostgresVersionCheck.MIN_POSTGRES_VERSION; assertThatThrownBy(() -> PostgresVersionCheck.checkDatabaseVersion(lowVersion, log)) .isInstanceOf(AssertionError.class) .hasMessageContaining(expectedMessage); verify(log).error( eq("Assertion with exception "), contains(expectedMessage), Mockito.any(Exception.class)); verifyNoMoreInteractions(log); }
Source:
private SubPlan buildFragment(PlanNode root, FragmentProperties properties, PlanFragmentId fragmentId) { List<PlanNodeId> schedulingOrder = scheduleOrder(root); checkArgument( properties.getPartitionedSources().equals(ImmutableSet.copyOf(schedulingOrder)), "Expected scheduling order (%s) to contain an entry for all partitioned sources (%s)", schedulingOrder, properties.getPartitionedSources()); Map<Symbol, Type> fragmentSymbolTypes = filterKeys(symbolAllocator.getTypes().allTypes(), in(extractOutputSymbols(root))); planSanityChecker.validatePlanFragment(root, session, metadata, sqlParser, TypeProvider.viewOf(fragmentSymbolTypes), warningCollector); Set<PlanNodeId> tableWriterNodeIds = getTableWriterNodeIds(root); boolean outputTableWriterFragment = tableWriterNodeIds.stream().anyMatch(outputTableWriterNodeIds::contains); if (outputTableWriterFragment) { verify( outputTableWriterNodeIds.containsAll(tableWriterNodeIds), "outputTableWriterNodeIds %s must include all tableWriterNodeIds %s", outputTableWriterNodeIds, tableWriterNodeIds); } PlanFragment fragment = new PlanFragment( fragmentId, root, fragmentSymbolTypes, properties.getPartitioningHandle(), schedulingOrder, properties.getPartitioningScheme(), StageExecutionDescriptor.ungroupedExecution(), outputTableWriterFragment, statsAndCosts.getForSubplan(root), Optional.of(jsonFragmentPlan(root, fragmentSymbolTypes, metadata.getFunctionManager(), session))); return new SubPlan(fragment, properties.getChildren()); }

Target:
private SubPlan buildFragment(PlanNode root, FragmentProperties properties, PlanFragmentId fragmentId) { List<PlanNodeId> schedulingOrder = scheduleOrder(root); checkArgument( properties.getPartitionedSources().equals(ImmutableSet.copyOf(schedulingOrder)), "Expected scheduling order (%s) to contain an entry for all partitioned sources (%s)", schedulingOrder, properties.getPartitionedSources()); Map<Symbol, Type> fragmentSymbolTypes = filterKeys(symbolAllocator.getTypes().allTypes(), in(extractOutputSymbols(root))); planSanityChecker.validatePlanFragment(root, session, metadata, sqlParser, TypeProvider.viewOf(fragmentSymbolTypes), warningCollector); Set<PlanNodeId> tableWriterNodeIds = getTableWriterNodeIds(root); boolean outputTableWriterFragment = tableWriterNodeIds.stream().anyMatch(outputTableWriterNodeIds::contains); if (outputTableWriterFragment) { verify( outputTableWriterNodeIds.containsAll(tableWriterNodeIds), "outputTableWriterNodeIds %s must include either all or none of tableWriterNodeIds %s", outputTableWriterNodeIds, tableWriterNodeIds); } PlanFragment fragment = new PlanFragment( fragmentId, root, fragmentSymbolTypes, properties.getPartitioningHandle(), schedulingOrder, properties.getPartitioningScheme(), StageExecutionDescriptor.ungroupedExecution(), outputTableWriterFragment, statsAndCosts.getForSubplan(root), Optional.of(jsonFragmentPlan(root, fragmentSymbolTypes, metadata.getFunctionManager(), session))); return new SubPlan(fragment, properties.getChildren()); }
Source:
public void processEvent(EventSummary summary) { if (this.enabled) { int eventSev = summary.getOccurrence(0).getSeverity().getNumber(); if( eventSev >= this.minSeverity.getNumber()) { this.processEventSummary(summary); } } }

Target:
public void processEvent(EventSummary summary) { if (this.enabled) { EventSeverity sev = summary.getOccurrence(0).getSeverity(); if (sev.compareTo(this.minSeverity) >= 0 ) { this.processEventSummary(summary); } else { this.irrelevantSeverityCounter.inc(); } } }
Source:
protected boolean loadNextFromDisk() { return fromDisk; }

Target:
protected boolean loadNextFromDisk() { return true; }
Source:
private static void refreshBorderedStyle(final StyledFigure styledFigure, final BorderedStyle borderedStyle) { if (borderedStyle.getBorderSize().intValue() == 0) { styledFigure.setBorder(null); } else { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); styledFigure.setBorder(lineBorder); } if (styledFigure instanceof Shape) { ((Shape) styledFigure).setLineWidth(0); } int borderedSize = 0; if (borderedStyle.getBorderSize() != null) { borderedSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderedSize); if (borderedStyle.getBorderColor() != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderedStyle.getBorderColor())); } if (borderedStyle.getBorderSize() != null && borderedStyle.getBorderSize().intValue() == 0) { styledFigure.setBorder(null); } } }

Target:
private static void refreshBorderedStyle(final StyledFigure styledFigure, final BorderedStyle borderedStyle) { if (borderedStyle.getBorderSize().intValue() == 0) { styledFigure.setBorder(null); } else { LineBorder lineBorder = null; if (styledFigure.getBorder() instanceof LineBorder) { lineBorder = (LineBorder) styledFigure.getBorder(); } else { lineBorder = new LineBorder(); styledFigure.setBorder(lineBorder); } if (styledFigure instanceof Shape) { ((Shape) styledFigure).setLineWidth(0); } int borderSize = 0; if (borderedStyle.getBorderSize() != null) { borderSize = borderedStyle.getBorderSize().intValue(); } lineBorder.setWidth(borderSize); if (borderedStyle.getBorderColor() != null) { lineBorder.setColor(VisualBindingManager.getDefault().getColorFromRGBValues(borderedStyle.getBorderColor())); } if (borderedStyle.getBorderSize() != null && borderSize == 0) { styledFigure.setBorder(null); } } }
Source:
public List<Field> getLayoutFieldsToCreateOrUpdate() { try { if (notStrictFieldLayoutRowSyntaxValidator == null) { notStrictFieldLayoutRowSyntaxValidator = new NotStrictFieldLayoutRowSyntaxValidator(this.contentType, this.fields); notStrictFieldLayoutRowSyntaxValidator.validate(); } return notStrictFieldLayoutRowSyntaxValidator.getLayoutFieldsToCreateOrUpdate(); } catch (FieldLayoutValidationException e) { throw new DotRuntimeException(e); } }

Target:
public List<Field> getLayoutFieldsToCreateOrUpdate() { try { if (notStrictFieldLayoutRowSyntaxValidator == null) { notStrictFieldLayoutRowSyntaxValidator = new NotStrictFieldLayoutRowSyntaxValidator(this.contentType, this.fields); notStrictFieldLayoutRowSyntaxValidator.validate(); } return notStrictFieldLayoutRowSyntaxValidator.getLayoutFieldsToCreateOrUpdate(); } catch (FieldLayoutValidationException e) { Logger.error(FieldLayout.class, e.getMessage()); throw new DotRuntimeException(e); } }
Source:
private int copyRecursive(QuantileDigest other, int otherNode) { int node = createNode(other.values[otherNode], other.levels[otherNode], other.counts[otherNode]); if (other.lefts[otherNode] != -1) { int left = copyRecursive(other, other.lefts[otherNode]); lefts[node] = left; } if (other.rights[otherNode] != -1) { int right = copyRecursive(other, other.rights[otherNode]); rights[node] = right; } return node; }

Target:
private int copyRecursive(QuantileDigest other, int otherNode) { checkArgument(otherNode != -1, "otherNode is -1"); int node = createNode(other.values[otherNode], other.levels[otherNode], other.counts[otherNode]); if (other.lefts[otherNode] != -1) { int left = copyRecursive(other, other.lefts[otherNode]); lefts[node] = left; } if (other.rights[otherNode] != -1) { int right = copyRecursive(other, other.rights[otherNode]); rights[node] = right; } return node; }
Source:
public void run() { try (PickledGraphite pickledGraphite = new PickledGraphite( graphiteEmitterConfig.getHostname(), graphiteEmitterConfig.getPort(), graphiteEmitterConfig.getBatchSize() )) { if (!pickledGraphite.isConnected()) { log.info("trying to connect to graphite server"); pickledGraphite.connect(); } while (eventsQueue.size() > 0 && !exec.isShutdown()) { try { final GraphiteEvent graphiteEvent = eventsQueue.poll( graphiteEmitterConfig.getWaitForEventTime(), TimeUnit.MILLISECONDS ); if (graphiteEvent != null) { log.debug( "sent [%s] with value [%s] and time [%s]", graphiteEvent.getEventPath(), graphiteEvent.getValue(), graphiteEvent.getTimestamp() ); pickledGraphite.send( graphiteEvent.getEventPath(), graphiteEvent.getValue(), graphiteEvent.getTimestamp() ); } } catch (InterruptedException | IOException e) { log.error(e, e.getMessage()); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } else if (e instanceof SocketException) { pickledGraphite.close(); log.info("had exception [%s] trying to re-connect to graphite server", e.getMessage()); pickledGraphite.connect(); } } } } catch (Exception e) { log.error(e, e.getMessage()); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } } }

Target:
public void run() { try (PickledGraphite pickledGraphite = new PickledGraphite( graphiteEmitterConfig.getHostname(), graphiteEmitterConfig.getPort(), graphiteEmitterConfig.getBatchSize() )) { if (!pickledGraphite.isConnected()) { log.info("trying to connect to graphite server"); pickledGraphite.connect(); } while (eventsQueue.size() > 0 && !exec.isShutdown()) { try { final GraphiteEvent graphiteEvent = eventsQueue.poll( graphiteEmitterConfig.getWaitForEventTime(), TimeUnit.MILLISECONDS ); if (graphiteEvent != null) { log.debug( "sent [%s] with value [%s] and time [%s]", graphiteEvent.getEventPath(), graphiteEvent.getValue(), graphiteEvent.getTimestamp() ); pickledGraphite.send( graphiteEvent.getEventPath(), graphiteEvent.getValue(), graphiteEvent.getTimestamp() ); } } catch (InterruptedException | IOException e) { log.error(e, e.getMessage()); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); break; } else if (e instanceof SocketException) { pickledGraphite.close(); log.warn("Trying to re-connect to graphite server"); pickledGraphite.connect(); } } } } catch (Exception e) { log.error(e, e.getMessage()); if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); } } }
Source:
protected ITextViewer getTextViewerForTarget(String name) throws Exception { IFile targetFile = project.getFile(name + ".target"); targetFile.create( GenericEditorExtenionTestsPlugin.getBundleContext().getBundle() .getEntry("testing-files/target-files/" + name + ".txt").openStream(), true, new NullProgressMonitor()); IEditorPart editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), targetFile, "org.eclipse.ui.genericeditor.GenericEditor"); return (ITextViewer) editor.getAdapter(ITextOperationTarget.class); }

Target:
protected ITextViewer getTextViewerForTarget(String name) throws Exception { IFile targetFile = project.getFile(name + ".target"); targetFile.create(FrameworkUtil.getBundle(this.getClass()) .getEntry("testing-files/target-files/" + name + ".txt").openStream(), true, new NullProgressMonitor()); IEditorPart editor = IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), targetFile, "org.eclipse.ui.genericeditor.GenericEditor"); return (ITextViewer) editor.getAdapter(ITextOperationTarget.class); }
Source:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(WAP_PUSH_RECEIVED_ACTION)) { String mimeType = intent.getType(); if (mimeType.equals(CONTENT_MIME_TYPE_B_EMN)) { byte[] wbxml = intent.getByteArrayExtra("data"); if (wbxml == null) { return; } String emailAddress = decode(wbxml); if (emailAddress!=null && !TextUtils.isEmpty(emailAddress)) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "CONTENT_MIME_TYPE_B_EMN " + "received for email " + emailAddress); } MailService.actionCheckMail(context, emailAddress); } } } }

Target:
public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(WAP_PUSH_RECEIVED_ACTION)) { String mimeType = intent.getType(); if (mimeType.equals(CONTENT_MIME_TYPE_B_EMN)) { byte[] wbxml = intent.getByteArrayExtra("data"); if (wbxml == null) { return; } String emailAddress = decode(wbxml); if (!TextUtils.isEmpty(emailAddress)) { if (Email.DEBUG) { Log.d(Email.LOG_TAG, "CONTENT_MIME_TYPE_B_EMN " + "received for email " + emailAddress); } MailService.actionCheckMail(context, emailAddress); } } } }
Source:
public void handleStateTransferState(XSiteStatePushCommand cmd) throws Exception { if (local) { LocalInvocation.newInstanceFromCache(cache, cmd).call(); return; } final ClusteringDependentLogic clusteringDependentLogic = cache.getAdvancedCache().getComponentRegistry() .getComponent(ClusteringDependentLogic.class); final Map<Address, List<XSiteState>> primaryOwnersChunks = new HashMap<Address, List<XSiteState>>(); for (XSiteState state : cmd.getChunk()) { final Address primaryOwner = clusteringDependentLogic.getPrimaryOwner(state.key()); List<XSiteState> primaryOwnerList = primaryOwnersChunks.get(primaryOwner); if (primaryOwnerList == null) { primaryOwnerList = new LinkedList<XSiteState>(); primaryOwnersChunks.put(primaryOwner, primaryOwnerList); } primaryOwnerList.add(state); } final List<XSiteState> localChunks = primaryOwnersChunks.remove(clusteringDependentLogic.getAddress()); final List<Future<?>> remoteFutures = new ArrayList<Future<?>>(primaryOwnersChunks.size()); for (Map.Entry<Address, List<XSiteState>> entry : primaryOwnersChunks.entrySet()) { sendStateTo(entry.getKey(), entry.getValue(), remoteFutures); } if (localChunks != null) { LocalInvocation.newInstanceFromCache(cache, newStatePushCommand(localChunks)).call(); localChunks.clear(); } primaryOwnersChunks.clear(); for (Future<?> future : remoteFutures) { future.get(); } }

Target:
public void handleStateTransferState(XSiteStatePushCommand cmd) throws Exception { final ClusteringDependentLogic clusteringDependentLogic = cache.getAdvancedCache().getComponentRegistry() .getComponent(ClusteringDependentLogic.class); final Map<Address, List<XSiteState>> primaryOwnersChunks = new HashMap<Address, List<XSiteState>>(); for (XSiteState state : cmd.getChunk()) { final Address primaryOwner = clusteringDependentLogic.getPrimaryOwner(state.key()); List<XSiteState> primaryOwnerList = primaryOwnersChunks.get(primaryOwner); if (primaryOwnerList == null) { primaryOwnerList = new LinkedList<XSiteState>(); primaryOwnersChunks.put(primaryOwner, primaryOwnerList); } primaryOwnerList.add(state); } final List<XSiteState> localChunks = primaryOwnersChunks.remove(clusteringDependentLogic.getAddress()); final List<Future<?>> remoteFutures = new ArrayList<Future<?>>(primaryOwnersChunks.size()); for (Map.Entry<Address, List<XSiteState>> entry : primaryOwnersChunks.entrySet()) { sendStateTo(entry.getKey(), entry.getValue(), remoteFutures); } if (localChunks != null) { LocalInvocation.newInstanceFromCache(cache, newStatePushCommand(localChunks)).call(); localChunks.clear(); } primaryOwnersChunks.clear(); for (Future<?> future : remoteFutures) { future.get(); } }
Source:
public boolean isDomainController() { Result res = getASConnection().execute(new ReadAttribute(new Address("/"), "process-type")); if (res.isSuccess()) { return res.getResult().toString().equals("Domain Controller"); } return false; }

Target:
public synchronized boolean isDomainController() { return domainController; }
Source:
public void setup() { when(gridWidget.getModel()).thenReturn(gridData); when(gridWidget.getRendererHelper()).thenReturn(baseGridRendererHelperMock); when(baseGridRendererHelperMock.getRenderingInformation()).thenReturn(baseGridRendererInformationMock); when(gridData.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(gridColumn.getIndex()).thenReturn(0); when(gridWidget.getRenderer()).thenReturn(gridRenderer); when(layer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT)); baseKeyboardOperationSpy = spy(new BaseKeyboardOperation(layer) { @Override public int getKeyCode() { return currentKeyCode; } @Override public TriStateBoolean isControlKeyDown() { return super.isControlKeyDown(); } @Override public boolean perform(GridWidget gridWidget, boolean isShiftKeyDown, boolean isControlKeyDown) { return false; } }); }

Target:
public void setup() { when(gridWidget.getModel()).thenReturn(gridData); when(gridWidget.getRendererHelper()).thenReturn(baseGridRendererHelperMock); when(baseGridRendererHelperMock.getRenderingInformation()).thenReturn(baseGridRendererInformationMock); when(gridData.getColumns()).thenReturn(Collections.singletonList(gridColumn)); when(gridColumn.getIndex()).thenReturn(0); when(gridWidget.getRenderer()).thenReturn(gridRenderer); when(layer.getViewport()).thenReturn(viewport); when(layer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT)); transform = spy(new Transform()); when(viewport.getTransform()).thenReturn(transform); baseKeyboardOperationSpy = spy(new BaseKeyboardOperation(layer) { @Override public int getKeyCode() { return currentKeyCode; } @Override public boolean perform(GridWidget gridWidget, boolean isShiftKeyDown, boolean isControlKeyDown) { return false; } }); }
Source:
public FeedbackQuestionAttributes(FeedbackQuestionAttributes other) { this.feedbackQuestionId = other.getId(); this.feedbackSessionName = other.getFeedbackSessionName(); this.courseId = other.getCourseId(); this.creatorEmail = other.getCreatorEmail(); this.questionMetaData = other.getQuestionMetaData(); this.questionNumber = other.getQuestionNumber(); this.questionType = other.getQuestionType(); this.giverType = other.getGiverType(); this.recipientType = other.getRecipientType(); this.numberOfEntitiesToGiveFeedbackTo = other.getNumberOfEntitiesToGiveFeedbackTo(); this.showResponsesTo = new ArrayList<FeedbackParticipantType>(other.getShowResponsesTo()); this.showGiverNameTo = new ArrayList<FeedbackParticipantType>(other.getShowGiverNameTo()); this.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(other.getShowRecipientNameTo()); this.createdAt = other.getCreatedAt(); this.updatedAt = other.getUpdatedAt(); removeIrrelevantVisibilityOptions(); }

Target:
private FeedbackQuestionAttributes(FeedbackQuestionAttributes other) { this.feedbackQuestionId = other.getId(); this.feedbackSessionName = other.getFeedbackSessionName(); this.courseId = other.getCourseId(); this.creatorEmail = other.getCreatorEmail(); this.questionMetaData = other.getQuestionMetaData(); this.questionNumber = other.getQuestionNumber(); this.questionType = other.getQuestionType(); this.giverType = other.getGiverType(); this.recipientType = other.getRecipientType(); this.numberOfEntitiesToGiveFeedbackTo = other.getNumberOfEntitiesToGiveFeedbackTo(); this.showResponsesTo = new ArrayList<FeedbackParticipantType>(other.getShowResponsesTo()); this.showGiverNameTo = new ArrayList<FeedbackParticipantType>(other.getShowGiverNameTo()); this.showRecipientNameTo = new ArrayList<FeedbackParticipantType>(other.getShowRecipientNameTo()); this.createdAt = other.getCreatedAt(); this.updatedAt = other.getUpdatedAt(); removeIrrelevantVisibilityOptions(); }
Source:
@Test public void testForEachStreamCopy() throws IOException, TimeoutException, ExecutionException, InterruptedException { final QueueFile queueFile = new QueueFile(file); queueFile.add(new byte[] {1, 2}); queueFile.add(new byte[] {3, 4, 5}); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buffer = new byte[8]; final QueueFile.ElementReader elementReader = new QueueFile.ElementReader() { @Override public void read(InputStream in, int length) throws IOException { int count; while ((count = in.read(buffer)) != -1) { baos.write(buffer, 0, count); } } }; final ExecutorService executor = Executors.newSingleThreadExecutor(); try { executor.submit(new Callable<Void>() { @Override public Void call() throws Exception { queueFile.forEach(elementReader); return null; } }).get(5, TimeUnit.SECONDS); assertThat(baos.toByteArray()).isEqualTo(new byte[] {1, 2, 3, 4, 5}); } finally { executor.shutdown(); } }

Target:
@Test public void testForEachStreamCopy() throws IOException { final QueueFile queueFile = new QueueFile(file); queueFile.add(new byte[] {1, 2}); queueFile.add(new byte[] {3, 4, 5}); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final byte[] buffer = new byte[8]; final QueueFile.ElementReader elementReader = new QueueFile.ElementReader() { @Override public void read(InputStream in, int length) throws IOException { int count; while ((count = in.read(buffer)) != -1) { if (count == 0) { fail("This test should never receive a result of 0 from InputStream.read(byte[])"); } baos.write(buffer, 0, count); } } }; queueFile.forEach(elementReader); assertThat(baos.toByteArray()).isEqualTo(new byte[] {1, 2, 3, 4, 5}); }
Source:
public List<SurveyQuestionSummary> listByResponse(String questionId, String questionResponse) { String answer = questionResponse; if (answer.length() > Constants.MAX_LENGTH) { answer = answer.substring(0, Constants.MAX_LENGTH); } List<SurveyQuestionSummary> result = null; String cacheKey = null; try { cacheKey = getCacheKey(questionId + "-" + answer); if (MemCacheUtils.containsKey(cache, cacheKey)) { SurveyQuestionSummary sqs = (SurveyQuestionSummary)cache.get(cacheKey); if (sqs != null) { result = new ArrayList<SurveyQuestionSummary>(); result.add(sqs); return result; } } } catch (CacheException e) { log.log(Level.WARNING, e.getMessage()); } PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(SurveyQuestionSummary.class); StringBuilder filterString = new StringBuilder(); StringBuilder paramString = new StringBuilder(); Map<String, Object> paramMap = null; paramMap = new HashMap<String, Object>(); appendNonNullParam("questionId", filterString, paramString, "String", questionId, paramMap); appendNonNullParam("response", filterString, paramString, "String", answer, paramMap); query.setFilter(filterString.toString()); query.declareParameters(paramString.toString()); result = (List<SurveyQuestionSummary>) query.executeWithMap(paramMap); cache(result); return result; }

Target:
public List<SurveyQuestionSummary> listByResponse(String questionId, String questionResponse) { if (questionResponse == null) { return Collections.emptyList(); } String answer = questionResponse; if (answer.length() > Constants.MAX_LENGTH) { answer = answer.substring(0, Constants.MAX_LENGTH); } List<SurveyQuestionSummary> result = null; String cacheKey = null; try { cacheKey = getCacheKey(questionId + "-" + answer); if (MemCacheUtils.containsKey(cache, cacheKey)) { SurveyQuestionSummary sqs = (SurveyQuestionSummary)cache.get(cacheKey); if (sqs != null) { result = new ArrayList<SurveyQuestionSummary>(); result.add(sqs); return result; } } } catch (CacheException e) { log.log(Level.WARNING, e.getMessage()); } PersistenceManager pm = PersistenceFilter.getManager(); javax.jdo.Query query = pm.newQuery(SurveyQuestionSummary.class); StringBuilder filterString = new StringBuilder(); StringBuilder paramString = new StringBuilder(); Map<String, Object> paramMap = null; paramMap = new HashMap<String, Object>(); appendNonNullParam("questionId", filterString, paramString, "String", questionId, paramMap); appendNonNullParam("response", filterString, paramString, "String", answer, paramMap); query.setFilter(filterString.toString()); query.declareParameters(paramString.toString()); result = (List<SurveyQuestionSummary>) query.executeWithMap(paramMap); cache(result); return result; }
Source:
public void testInnerJoinWithFailingSpill(boolean probeHashEnabled, List<WhenSpill> whenSpill, WhenSpillFails whenSpillFails) throws Throwable { DummySpillerFactory buildSpillerFactory = new DummySpillerFactory(); DummySpillerFactory joinSpillerFactory = new DummySpillerFactory(); PartitioningSpillerFactory partitioningSpillerFactory = new GenericPartitioningSpillerFactory(joinSpillerFactory); switch (whenSpillFails) { case SPILL_HBO: buildSpillerFactory.failSpill(); break; case SPILL_LJO: joinSpillerFactory.failSpill(); break; case UNSPILL_HBO: buildSpillerFactory.failUnspill(); break; case UNSPILL_LJO: joinSpillerFactory.failUnspill(); } try { innerJoinWithSpill(probeHashEnabled, whenSpill, buildSpillerFactory, partitioningSpillerFactory); fail("Exception not thrown"); } catch (RuntimeException exception) { String expectedMessage; switch (whenSpillFails) { case SPILL_HBO: case SPILL_LJO: expectedMessage = "Spill failed"; break; default: expectedMessage = "Unspill failed"; } assertEquals(exception.getMessage(), expectedMessage); } }

Target:
public void testInnerJoinWithFailingSpill(boolean probeHashEnabled, List<WhenSpill> whenSpill, WhenSpillFails whenSpillFails) throws Throwable { DummySpillerFactory buildSpillerFactory = new DummySpillerFactory(); DummySpillerFactory joinSpillerFactory = new DummySpillerFactory(); PartitioningSpillerFactory partitioningSpillerFactory = new GenericPartitioningSpillerFactory(joinSpillerFactory); String expectedMessage; switch (whenSpillFails) { case SPILL_BUILD: buildSpillerFactory.failSpill(); expectedMessage = "Spill failed"; break; case SPILL_JOIN: joinSpillerFactory.failSpill(); expectedMessage = "Spill failed"; break; case UNSPILL_BUILD: buildSpillerFactory.failUnspill(); expectedMessage = "Unspill failed"; break; case UNSPILL_JOIN: joinSpillerFactory.failUnspill(); expectedMessage = "Unspill failed"; break; default: throw new IllegalArgumentException(format("Unsupported option: %s", whenSpillFails)); } try { innerJoinWithSpill(probeHashEnabled, whenSpill, buildSpillerFactory, partitioningSpillerFactory); fail("Exception not thrown"); } catch (RuntimeException exception) { assertEquals(exception.getMessage(), expectedMessage); } }
Source:
public void shouldAttemptMethodAndRetry_withExceptionThrownAndRetryEnabledAndMaxAttemptsAdjusted() throws Throwable { final RetryableAspect retryableAspect = new RetryableAspect(); final ProceedingJoinPoint mockProceedingJoinPoint = setupSimpleProceedingJoinPointMock(); final int retryMaxAttempts = randomIntInRange(2, 4); final Retryable mockRetryable = setupMockRetryable(retryMaxAttempts, 2000); RetryableConfiguration.setRetryableEnabled(true); when(mockProceedingJoinPoint.proceed()).thenThrow(new RetryAspectTestException()); RetryAspectTestException actualException = null; try { retryableAspect.attemptMethodAndRetryIfNeeded(mockProceedingJoinPoint, mockRetryable); } catch (final RetryAspectTestException e) { actualException = e; } verify(mockProceedingJoinPoint, times(retryMaxAttempts)).proceed(); assertNotNull(actualException); }

Target:
public void shouldAttemptMethodAndRetry_withExceptionThrownAndRetryEnabledAndMaxAttemptsAdjusted() throws Throwable { final RetryableAspect retryableAspect = new RetryableAspect(); final ProceedingJoinPoint mockProceedingJoinPoint = setupSimpleProceedingJoinPointMock(); final int maxAttempts = randomIntInRange(2, 4); final Retryable mockRetryable = setupMockRetryable(maxAttempts, 2000); RetryableConfiguration.setRetryableEnabled(true); when(mockProceedingJoinPoint.proceed()).thenThrow(new RetryAspectTestException()); RetryAspectTestException actualException = null; try { retryableAspect.attemptMethodAndRetryIfNeeded(mockProceedingJoinPoint, mockRetryable); } catch (final RetryAspectTestException e) { actualException = e; } verify(mockProceedingJoinPoint, times(maxAttempts)).proceed(); assertNotNull(actualException); }
Source:
public static void closeSession(Session session) { if (session != null) { try { session.close(); } catch (Exception e) { LOG.error("Failed to close session: ", e); } } else { LOG.warn("Session is null, cannot close"); } }

Target:
public static void closeSession(Session session) { if (session != null) { try { session.close(); } catch (Exception e) { LOG.error("Failed to close session: ", e); } } }
Source:
public ActivateDeviceResponse activateDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ActivateDeviceRequest request) throws OsgpException { LOGGER.info("Incoming ActivateDeviceRequest for device: {}.", request.getDeviceIdentification()); try { this.deviceManagementService.activateDeviceRequest(organisationIdentification, request.getDeviceIdentification()); } catch (final MethodConstraintViolationException e) { LOGGER.error("Exception: while activating device: for organisation {}.", new Object[] { e.getMessage(), request.getDeviceIdentification(), organisationIdentification }, e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error("Exception: while activating device: for organisation {}.", new Object[] { e.getMessage(), request.getDeviceIdentification(), organisationIdentification }, e); this.handleException(e); } final ActivateDeviceResponse response = new ActivateDeviceResponse(); response.setResult(OsgpResultType.OK); return response; }

Target:
public ActivateDeviceResponse activateDevice(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ActivateDeviceRequest request) throws OsgpException { LOGGER.info("Incoming ActivateDeviceRequest for device: {}.", request.getDeviceIdentification()); try { this.deviceManagementService.activateDeviceRequest(organisationIdentification, request.getDeviceIdentification()); } catch (final MethodConstraintViolationException e) { LOGGER.error("Exception: while activating device: for organisation {}.", new Object[] { e.getMessage(), request.getDeviceIdentification(), organisationIdentification }, e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, COMPONENT_TYPE_WS_ADMIN, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error("Exception: while activating device: for organisation {}.", new Object[] { e.getMessage(), request.getDeviceIdentification(), organisationIdentification }, e); this.handleException(e); } final ActivateDeviceResponse response = new ActivateDeviceResponse(); response.setResult(OsgpResultType.OK); return response; }
Source:
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) { spinnerAdapter.getItem(FORMULA_EDITOR_POSITION).setLookName(getFormulaWithBrickField(BrickField .LOOK).getDisplayString(context)); if (isTouchInDropDownView) { isTouchInDropDownView = false; if (paramInt == 0) { switchToLookFragmentFromScriptFragment(); } else if (paramInt == 1) { isFormulaEnabled = true; showFormulaEditorToEditFormula(view.findViewById(R.id.brick_set_look_formula)); } } return spinnerAdapter.getView(paramInt, paramView, paramViewGroup); }

Target:
public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) { spinnerAdapter.getItem(SPINNER_POSITION_FORMULA_EDITOR).setLookName(getFormulaWithBrickField(BrickField .LOOK).getDisplayString(context)); if (isTouchInDropDownView) { isTouchInDropDownView = false; if (paramInt == SPINNER_POSITION_NEW_LOOK) { switchToLookFragmentFromScriptFragment(); } else if (paramInt == SPINNER_POSITION_FORMULA_EDITOR) { isFormulaEnabled = true; showFormulaEditorToEditFormula(view.findViewById(R.id.brick_set_look_formula)); } } return spinnerAdapter.getView(paramInt, paramView, paramViewGroup); }