auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected ProjectDataModelOracle getProjectDataModelOracle(final Path path ) { final ProjectDataModelOracle dmo = new ProjectDataModelOracleImpl(); dmo.addProjectModelFields( new HashMap<String, ModelField[]>() {{ put( "org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Applicant", new ModelField[]{ new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER ) } ); put( "org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Mortgage", new ModelField[]{ new ModelField( "amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER ), new ModelField( "applicant", "org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.guided.dtable.backend.server.indexing.classes.Applicant" ) } ); }} ); return dmo; }

Target:
protected ProjectDataModelOracle getProjectDataModelOracle(final Path path) { final ProjectDataModelOracle dmo = new ProjectDataModelOracleImpl(); dmo.addProjectModelFields(new HashMap<String, ModelField[]>() {{ put(Applicant.class.getCanonicalName(), new ModelField[]{ new ModelField("age", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER)}); put(Mortgage.class.getCanonicalName(), new ModelField[]{ new ModelField("amount", Integer.class.getName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", Applicant.class.getCanonicalName(), ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, Applicant.class.getCanonicalName())}); }}); return dmo; }
Source:
protected void pulsePhysics() { Location velLoc = location.clone().add(velocity); velocity.setY(airDrag * (velocity.getY() + getGravityAccel().getY())); velocity.setX(velocity.getX() * 0.95); velocity.setZ(velocity.getZ() * 0.95); setRawLocation(velLoc); if(!isTouchingMaterial(Material.AIR) && !isTouchingMaterial(Material.WATER) && !isTouchingMaterial(Material.LAVA) && !isTouchingMaterial(Material.STATIONARY_WATER) && !isTouchingMaterial(Material.STATIONARY_LAVA)) { System.out.println(world.getBlockTypeIdAt(location)); ((GlowPlayer) shooter).teleport(location); this.remove(); } }

Target:
protected void pulsePhysics() { Location velLoc = location.clone().add(velocity); velocity.setY(airDrag * (velocity.getY() + getGravityAccel().getY())); velocity.setX(velocity.getX() * 0.95); velocity.setZ(velocity.getZ() * 0.95); setRawLocation(velLoc); if(!location.getBlock().isLiquid() && !location.getBlock().isEmpty()){ ((Entity) shooter).teleport(location); this.remove(); } }
Source:
private static PhongMaterial chooseMaterial() { double random = Math.random(); double alpha = 0.5; double beta = 0.75; if (random < alpha) { return Style.BRICK; } else if (random > alpha && random < beta) { return Style.CRACK; } else { return Style.MOSS; } }

Target:
private static PhongMaterial chooseMaterial() { final double random = Math.random(); final double alpha = 0.5; final double beta = 0.75; if (random < alpha) { return Style.BRICK; } else if (random > alpha && random < beta) { return Style.CRACK; } else { return Style.MOSS; } }
Source:
public static Iterable<Object[]> data() { Method[] methods = Look.class.getDeclaredMethods(); ArrayList<Object[]> parameterList = new ArrayList<>(); for (Method method : methods) { if (method.getParameterCount() == 0 && method.getReturnType() != void.class && !method.getName().equals("getCurrentCollisionPolygon")) { parameterList.add(new Object[]{method.getName(), method}); } } return parameterList; }

Target:
public static Iterable<Object[]> data() { Method[] methods = Look.class.getDeclaredMethods(); ArrayList<Object[]> parameterList = new ArrayList<>(); for (Method method : methods) { if (method.getParameterCount() == 0 && method.getReturnType() != void.class && !method.getName().equals("getCurrentCollisionPolygon") && !method.getName().startsWith("$")) { parameterList.add(new Object[]{method.getName(), method}); } } return parameterList; }
Source:
protected boolean isValueNotSet(Descriptors.EnumValueDescriptor value) { return value.getNumber() == 0; }

Target:
protected boolean isValueNotSet(Descriptors.EnumValueDescriptor value) { final int intValue = value.getNumber(); final boolean result = intValue == 0; return result; }
Source:
private static void tryOverride(Config hzConfig, HazelcastProperty property, Consumer<String> setterFn, Supplier<String> getterFn, String configOverridden) { String propertyValue = hzConfig.getProperty(property.getName()); try { if (propertyValue != null) { setterFn.accept(propertyValue); LOGGER.warning(String.format("Overridden metrics configuration with system property '%s'='%s' -> '%s'='%s'", property, propertyValue, configOverridden, getterFn.get())); } } catch (Exception ex) { LOGGER.warning(String.format("Failed to override metrics configuration with system property '%s'='%s'. Kept " + "'%s'='%s'", property.getName(), propertyValue, configOverridden, getterFn.get()), ex); } }

Target:
private static void tryOverride(Config hzConfig, HazelcastProperty property, Consumer<String> setterFn, Supplier<String> getterFn, String configOverridden) { String propertyValue = hzConfig.getProperty(property.getName()); try { if (propertyValue != null) { setterFn.accept(propertyValue); LOGGER.info(String.format("Overridden metrics configuration with system property '%s'='%s' -> '%s'='%s'", property, propertyValue, configOverridden, getterFn.get())); } } catch (Exception ex) { LOGGER.warning(String.format("Failed to override metrics configuration with system property '%s'='%s'. Kept " + "'%s'='%s'", property.getName(), propertyValue, configOverridden, getterFn.get()), ex); } }
Source:
public void runL1UpdateIfPossible(Object value, GetKeyValueCommand command) { try { InternalCacheEntry ice; if ((ice = command.getRemotelyFetchedValue()) != null) { Object key; if (sync.attemptUpdateToRunning() && !dc.containsKey((key = command.getKey()))) { stateTransferLock.acquireSharedTopologyLock(); try { if (!dc.containsKey(key)) { log.tracef("Caching remotely retrieved entry for key %s in L1", key); try { long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan); Metadata newMetadata = ice.getMetadata().builder() .lifespan(lifespan).maxIdle(-1).build(); dc.put(key, ice.getValue(), newMetadata); } catch (Exception e) { log.infof("Unable to store entry %s in L1 cache", command.getKey()); log.debug("Inability to store in L1 caused by", e); } } else { log.tracef("Data container contained value after rehash for key %s", key); } } finally { stateTransferLock.releaseSharedTopologyLock(); } } } } finally { sync.innerSet(value); } }

Target:
public void runL1UpdateIfPossible(Object value, GetKeyValueCommand command) { try { InternalCacheEntry ice; if ((ice = command.getRemotelyFetchedValue()) != null) { Object key; if (sync.attemptUpdateToRunning() && !dc.containsKey((key = command.getKey()))) { stateTransferLock.acquireSharedTopologyLock(); try { if (!dc.containsKey(key) && !cdl.localNodeIsOwner(key)) { log.tracef("Caching remotely retrieved entry for key %s in L1", key); long lifespan = ice.getLifespan() < 0 ? l1Lifespan : Math.min(ice.getLifespan(), l1Lifespan); Metadata newMetadata = ice.getMetadata().builder() .lifespan(lifespan).maxIdle(-1).build(); dc.put(key, ice.getValue(), newMetadata); } else { log.tracef("Data container contained value after rehash for key %s", key); } } finally { stateTransferLock.releaseSharedTopologyLock(); } } } } finally { sync.innerSet(value); } }
Source:
public void addToArchive( Path archiveDestination, DiagnosticsReporterProgressCallback monitor ) throws IOException { String message = messageSupplier.get(); Files.write( archiveDestination, message.getBytes( Charset.forName( "UTF8" ) ), StandardOpenOption.CREATE, StandardOpenOption.APPEND ); }

Target:
public void addToArchive( Path archiveDestination, DiagnosticsReporterProgressCallback monitor ) throws IOException { String message = messageSupplier.get(); Files.write( archiveDestination, message.getBytes( StandardCharsets.UTF_8 ), StandardOpenOption.CREATE, StandardOpenOption.APPEND ); }
Source:
public void testContextListenerIsSet() throws Exception { try (WizardCommandController tester = testHarness.createWizardController(MyFirstWizard.class)) { tester.initialize(); Assert.assertTrue("Wizard is not on a valid state", tester.isValid()); Assert.assertTrue("Listener is not set", listener.isContextInitialized()); tester.execute(); Assert.assertFalse("Listener is still set", listener.isContextInitialized()); } }

Target:
public void testContextListenerIsSet() throws Exception { try (WizardCommandController tester = testHarness.createWizardController(MyFirstWizard.class)) { tester.initialize(); Assert.assertTrue("Wizard is not on a valid state", tester.isValid()); Assert.assertTrue("Listener is not set", listener.isContextInitialized()); tester.execute(); } Assert.assertFalse("Listener is still set", listener.isContextInitialized()); }
Source:
public static Optional<ClassLoader> loadDependenciesClassloaderFromProject(String prjPath, String localRepo) { List<String> poms = new ArrayList<>(); MavenUtils.searchPoms(Paths.get(URI.create(FILE_URI + prjPath)), poms); List<URL> urls = getDependenciesURL(poms, localRepo); return buildResult(urls); }

Target:
public static Optional<ClassLoader> loadDependenciesClassloaderFromProject(String prjPath, String localRepo) { List<String> poms = MavenUtils.searchPoms(Paths.get(URI.create(FILE_URI + prjPath))); List<URL> urls = getDependenciesURL(poms, localRepo); return buildResult(urls); }
Source:
public BloomFilter union(BloomFilter bloomFilter) { if (bloomFilter instanceof BlockSplitBloomFilter) { BlockSplitBloomFilter that = (BlockSplitBloomFilter) bloomFilter; if (!checkCompatibility(that)) { throw new RuntimeException("Bloom filters are not compatible! Please check" + "if they have the same maximum Bytes, hash strategy and algorithm."); } for (int i = 0; i < this.bitset.length; i++) { this.bitset[i] |= that.bitset[i]; } return new BlockSplitBloomFilter(this.bitset); } else { throw new RuntimeException("Bloom filter should be BlockSplitFilter"); } }

Target:
public BloomFilter union(BloomFilter bloomFilter) { if (bloomFilter instanceof BlockSplitBloomFilter) { BlockSplitBloomFilter that = (BlockSplitBloomFilter) bloomFilter; if (!checkCompatibility(that)) { throw new IllegalArgumentException("Bloom filter is not compatible! " + "Bitset size = " + that.getBitsetSize() + ", hash strategy = " + that.hashStrategy + ", algorithm = " + that.getAlgorithm()); } for (int i = 0; i < this.bitset.length; i++) { this.bitset[i] |= that.bitset[i]; } return new BlockSplitBloomFilter(this.bitset); } else { throw new IllegalArgumentException("Unsupported BloomFilter implementation to union with: " + bloomFilter.getClass()); } }
Source:
public DocumentModel getThreadForComment(DocumentModel comment) { CoreSession session = comment.getCoreSession(); DocumentModel parent = session.getDocument(new IdRef((String) comment.getPropertyValue(COMMENT_PARENT_ID))); if (!COMMENT_DOC_TYPE.equals(parent.getType())) { return comment; } return getThreadForComment(parent); }

Target:
public DocumentModel getThreadForComment(DocumentModel comment) { CoreSession session = comment.getCoreSession(); DocumentModel parent = session.getDocument(new IdRef((String) comment.getPropertyValue(COMMENT_PARENT_ID))); if (COMMENT_DOC_TYPE.equals(parent.getType())) { return getThreadForComment(parent); } return comment; }
Source:
Move[] getMoves() { return null; }

Target:
public Move[] getMoves() { return null; }
Source:
public void addCertificate() { AddCertificates addCert = new AddCertificates(); Certificate certificate = new Certificate(); if (certFile != null) { certificate.setData(certFile.getContents()); } certificate.setStatus(EntityStatus.NEW); addCert.getCerts().add(certificate); directService.addCertificate(addCert); refreshCertificates(); }

Target:
public void addCertificate() { if (certFile != null) { AddCertificates addCert = new AddCertificates(); Certificate certificate = new Certificate(); certificate.setData(certFile.getContents()); certificate.setStatus(EntityStatus.NEW); addCert.getCerts().add(certificate); directService.addCertificate(addCert); refreshCertificates(); } else { FacesContext.getCurrentInstance().addMessage("certificateAddError", new FacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR", "Choose and upload a certificate before submitting.")); } }
Source:
private void visitAudioOpenAnswer(OpenAnswerDefinitionAudio audio, Builder builder) { builder.mimeType("audio/webm"); }

Target:
private void visitAudioOpenAnswer(OpenAnswerDefinitionAudio audio, Builder builder) { builder.mimeType("audio/x-wav"); }
Source:
public Double percentile(String eventCollection, String targetProperty, Double percentile, Timeframe timeframe) throws IOException { Query queryParams = new Query.QueryBuilder(QueryType.PERCENTILE_RESOURCE) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withPercentile(percentile) .build(); QueryResult result = execute(queryParams, timeframe); return queryResultToDouble(result); }

Target:
public double percentile(String eventCollection, String targetProperty, Double percentile, Timeframe timeframe) throws IOException { Query queryParams = new Query.Builder(QueryType.PERCENTILE) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withPercentile(percentile) .withTimeframe(timeframe) .build(); QueryResult result = execute(queryParams); return queryResultToDouble(result); }
Source:
private InputStream createInputStream() throws AudioException { String outputFile = generateOutputFilename(); String command = getCommand(outputFile); try { Process process = Runtime.getRuntime().exec(command); process.waitFor(); file = new File(outputFile); if (file != null) { this.length = file.length(); } return getFileInputStream(file); } catch (IOException e) { throw new AudioException("Error while executing '" + command + "'", e); } catch (InterruptedException e) { throw new AudioException("The '" + command + "' has been interrupted", e); } }

Target:
private InputStream createInputStream() throws AudioException { String outputFile = generateOutputFilename(); String command = getCommand(outputFile); try { Process process = Runtime.getRuntime().exec(command); process.waitFor(); file = new File(outputFile); this.length = file.length(); return getFileInputStream(file); } catch (IOException e) { throw new AudioException("Error while executing '" + command + "'", e); } catch (InterruptedException e) { throw new AudioException("The '" + command + "' has been interrupted", e); } }
Source:
protected Optional<Boolean> getVal(Entity entity) { return Optional.of(!entity.getNBTTagCompound().getBoolean("NoGravity")); }

Target:
protected Optional<Boolean> getVal(Entity entity) { return OptBool.of(!entity.hasNoGravity()); }
Source:
public List<ActionEventRequest> buildActions() { List<ActionEventRequest> actions = new ArrayList<>(); for (Config config : configService.getConfigs().getConfigs()) { String configName = config.getName(); actions.add(buildCreateEncounterAction(configName)); actions.add(buildCreatePatientAction(configName)); actions.add(buildUpdatePatientAction(configName)); if(config.getOpenMrsVersion().equals(OPENMRS_V1_12)) { actions.add(buildCreateProgramEnrollmentAction(configName)); actions.add(buildChangeStateOfProgramEnrollmentAction(configName)); } actions.add(buildUpdatePatientIdentifiersAction(configName)); } return actions; }

Target:
public List<ActionEventRequest> buildActions() { List<ActionEventRequest> actions = new ArrayList<>(); for (Config config : configService.getConfigs().getConfigs()) { String configName = config.getName(); actions.add(buildCreateEncounterAction(configName)); actions.add(buildCreatePatientAction(configName)); actions.add(buildUpdatePatientAction(configName)); actions.add(buildUpdatePatientIdentifiersAction(configName)); buildActionsForVersionGreaterThan19(config, configName, actions); } return actions; }
Source:
@Test public void withType() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); FieldWriter listField = classWriter.addField(ParameterizedTypeName.create(List.class, WildcardName.create()), "list"); AnonymousClassWriter listWriter = AnonymousClassWriter.forClassName(ClassName.fromClass(ArrayList.class)); listWriter.addType(ParameterizedTypeName.create(Map.class, ClassName.fromClass(String.class), ClassName.fromClass(Integer.class))); MethodWriter listSizeMethod = listWriter.addMethod(int.class, "size"); listSizeMethod.annotate(Override.class); listSizeMethod.addModifiers(PUBLIC); listSizeMethod.body().addSnippet("return 1;"); listField.setInitializer("%s", listWriter); List<?> list = new ArrayList<Map<String, Integer>>() { @Override public int size() { return 1; } }; StringBuilder stringBuilder = new StringBuilder(); assertThat(classWriter.writeTypeToAppendable(stringBuilder).toString()).isEqualTo("" + "package com.foo;\n" + "\n" + "import java.util.ArrayList;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "\n" + "class Bar {\n" + " List<?> list = new ArrayList<Map<String, Integer>> () {\n" + " @Override\n" + " public int size() {\n" + " return 1;\n" + " }\n" + " };\n" + "}\n"); }

Target:
@Test public void withType() throws IOException { ClassWriter classWriter = ClassWriter.forClassName(className); FieldWriter listField = classWriter.addField(ParameterizedTypeName.create(List.class, WildcardName.create()), "list"); AnonymousClassWriter listWriter = AnonymousClassWriter.forClassName(ClassName.fromClass(ArrayList.class)); listWriter.addTypeVariable( ParameterizedTypeName.create(Map.class, ClassName.fromClass(String.class), ClassName.fromClass(Integer.class))); MethodWriter listSizeMethod = listWriter.addMethod(int.class, "size"); listSizeMethod.annotate(Override.class); listSizeMethod.addModifiers(PUBLIC); listSizeMethod.body().addSnippet("return 1;"); listField.setInitializer("%s", listWriter); assertThat(classWriter.toString()).isEqualTo("" + "package com.foo;\n" + "\n" + "import java.util.ArrayList;\n" + "import java.util.List;\n" + "import java.util.Map;\n" + "\n" + "class Bar {\n" + " List<?> list = new ArrayList<Map<String, Integer>>() {\n" + " @Override\n" + " public int size() {\n" + " return 1;\n" + " }\n" + " };\n" + "}\n"); }
Source:
public void reportResultSummary( ImmutableList.Builder<String> addTo, TestResultSummary testResult) { addTo.add( String.format( locale, "%s %s %s: %s", testResult.getType().toString(), testResult.getTestCaseName(), testResult.getTestName(), testResult.getMessage())); if (testResult.getStacktrace() != null) { for (String line : Splitter.on("\n").split(testResult.getStacktrace())) { if (line.contains(testResult.getTestCaseName())) { addTo.add(ansi.asErrorText(line)); } else { addTo.add(line); } } } if (summaryVerbosity.getIncludeStdOut() && testResult.getStdOut() != null && testResult.getStdOut().length() > 0) { addTo.add("====STANDARD OUT====", testResult.getStdOut()); } if (summaryVerbosity.getIncludeStdErr() && testResult.getStdErr() != null && testResult.getStdErr().length() > 0) { addTo.add("====STANDARD ERR====", testResult.getStdErr()); } }

Target:
public void reportResultSummary( ImmutableList.Builder<String> addTo, TestResultSummary testResult) { addTo.add( String.format( locale, "%s %s %s: %s", testResult.getType().toString(), testResult.getTestCaseName(), testResult.getTestName(), testResult.getMessage())); if (testResult.getStacktrace() != null) { for (String line : Splitter.on("\n").split(testResult.getStacktrace())) { if (line.contains(testResult.getTestCaseName())) { addTo.add(ansi.asErrorText(line)); } else { addTo.add(line); } } } if (summaryVerbosity.getIncludeStdOut() && !Strings.isNullOrEmpty(testResult.getStdOut())) { addTo.add("====STANDARD OUT====", testResult.getStdOut()); } if (summaryVerbosity.getIncludeStdErr() && !Strings.isNullOrEmpty(testResult.getStdErr())) { addTo.add("====STANDARD ERR====", testResult.getStdErr()); } if (Strings.isNullOrEmpty(testResult.getMessage()) && Strings.isNullOrEmpty(testResult.getStacktrace()) && Strings.isNullOrEmpty(testResult.getStdOut()) && Strings.isNullOrEmpty(testResult.getStdErr())) { addTo.add("Test did not produce any output."); } }
Source:
public void testTooLittleRepositoriesReturnThoseRepositories() throws Exception { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3)) .subscribe(observer); observer.awaitTerminalEvent(); assertEquals("Invalid number of repositories", 3, observer.getEvents().get(0).size()); }

Target:
public void testTooLittleRepositoriesReturnThoseRepositories() throws Exception { TestSubscriber<List<GitHubRepository>> observer = new TestSubscriber<>(); viewModel.toGitHubRepositoryList() .apply(Arrays.asList(1, 2, 3, 4, 5)) .subscribe(observer); assertEquals("Invalid number of repositories", 5, ((List)observer.getEvents().get(0).get(0)).size()); }
Source:
public void validLoginTest() throws InterruptedException { TextField repoOwnerField = GuiTest.find(IdGenerator.getLoginDialogOwnerFieldIdReference()); clickOn(repoOwnerField); selectAll(); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); clickOn("Sign in"); awaitCondition(() -> "test/test (none)".equals(TestController.getUI().getTitle()), 10); }

Target:
public void validLoginTest() { TextField repoOwnerField = GuiTest.find(IdGenerator.getLoginDialogOwnerFieldIdReference()); clickOn(repoOwnerField); selectAll(); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); clickOn("Sign in"); awaitCondition(() -> "test/test (none)".equals(TestController.getUI().getTitle()), 10); }
Source:
public void shouldDeriveStartTransactionResponseFromBatchedResponse_singleTransaction() { StartTransactionResponseV5 startTransactionResponse = getStartTransactionResponse(12, 1); when(lockLeaseService.startTransactionsWithWatches(OptionalLong.empty(), 1)) .thenReturn(startTransactionResponse); StartIdentifiedAtlasDbTransactionResponse response = transactionStarter.startIdentifiedAtlasDbTransaction(); assertDerivableFromBatchedResponse(response, startTransactionResponse); }

Target:
public void shouldDeriveStartTransactionResponseFromBatchedResponse_singleTransaction() { ConjureStartTransactionsResponse startTransactionResponse = getStartTransactionResponse(12, 1); when(lockLeaseService.startTransactionsWithWatches(Optional.empty(), 1)) .thenReturn(startTransactionResponse); StartIdentifiedAtlasDbTransactionResponse response = transactionStarter.startIdentifiedAtlasDbTransaction(); assertDerivableFromBatchedResponse(response, startTransactionResponse); }
Source:
public List<InputSplit> generateSplits(List<ViewInfoWritable> views, Configuration configuration) { int numViewsInSplit = PhoenixConfigurationUtil.getMultiViewSplitSize(configuration); if (numViewsInSplit < 1) { numViewsInSplit = DEFAULT_MAPPER_SPLIT_SIZE; } int numberOfMappers = views.size() / numViewsInSplit; if (Math.ceil(views.size() % numViewsInSplit) > 0) { numberOfMappers++; } final List<InputSplit> psplits = Lists.newArrayListWithExpectedSize(numberOfMappers); for (int i = 0; i < numberOfMappers; i++) { psplits.add(new PhoenixMultiViewInputSplit(views.subList( i * numViewsInSplit, getUpperBound(numViewsInSplit, i, views.size())))); } return psplits; }

Target:
public List<InputSplit> generateSplits(List<ViewInfoWritable> views, Configuration configuration) { int numViewsInSplit = PhoenixConfigurationUtil.getMultiViewSplitSize(configuration); if (numViewsInSplit < 1) { numViewsInSplit = DEFAULT_MAPPER_SPLIT_SIZE; } int numberOfMappers = getNumberOfMappers(views.size(),numViewsInSplit); final List<InputSplit> pSplits = Lists.newArrayListWithExpectedSize(numberOfMappers); for (int i = 0; i < numberOfMappers; i++) { pSplits.add(new PhoenixMultiViewInputSplit(views.subList( i * numViewsInSplit, getUpperBound(numViewsInSplit, i, views.size())))); } return pSplits; }
Source:
private MetacardMapper getMetacardMapper(final QName featureTypeName) { return metacardMappers .stream() .filter(mapper -> mapper.getFeatureType().equals(featureTypeName.toString())) .findAny() .orElseGet( () -> { LOGGER.debug( "Could not find MetacardMapper for featureType {}. Returning a default implementation.", featureTypeName); return new MetacardMapperImpl(); }); }

Target:
private MetacardMapper getMetacardMapper(final QName featureTypeName) { final Predicate<MetacardMapper> matchesFeatureType = mapper -> mapper.getFeatureType().equals(featureTypeName.toString()); return metacardMappers .stream() .filter(matchesFeatureType) .findAny() .orElseGet( () -> { LOGGER.debug( "Could not find a MetacardMapper for featureType {}. Returning a default implementation.", featureTypeName); return new MetacardMapperImpl(); }); }
Source:
private static void assertExperimentTraces(TmfTraceElement[] expectedTraces, List<TmfTraceElement> actualTraces) { for (TmfTraceElement experimentTraceElement : actualTraces) { boolean contain = false; for (TmfTraceElement traceElement : expectedTraces) { contain = equalTraceElement(experimentTraceElement, traceElement); if (contain) { break; } } assertTrue(contain); } }

Target:
private static void assertExperimentTraces(TmfTraceElement[] expectedTraces, List<TmfTraceElement> actualTraces) { Map<Pair<String, URI>, TmfTraceElement> expectedTracesMap = new HashMap<>(); for (TmfTraceElement traceElement : expectedTraces) { expectedTracesMap.put(new Pair<>(traceElement.getName(), traceElement.getLocation()), traceElement); } actualTraces.forEach(actualTraceElement -> assertNotNull(expectedTracesMap.get(new Pair<>(actualTraceElement.getName(), actualTraceElement.getLocation())))); }
Source:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { changeDiagramUIPreference(SiriusDiagramUiPreferencesKeys.PREF_OLD_UI.name(), false); sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); localSession.changeViewpointSelection(Sets.newHashSet(VIEWPOINT_NAME), Sets.<String> newHashSet()); diagram = localSession.getLocalSessionBrowser().perCategory().selectViewpoint(VIEWPOINT_NAME).selectRepresentation(REPRESENTATION_DESCRIPTION_NAME).selectDiagramInstance(REPRESENTATION_NAME) .open(); representationContainer = diagram.getDRepresentation().eContainer(); semanticModel = new UIResource(designerProject, FILE_DIR, MODEL); }

Target:
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); localSession = designerPerspective.openSessionFromFile(sessionAirdResource); localSession.changeViewpointSelection(Sets.newHashSet(VIEWPOINT_NAME), Sets.<String> newHashSet()); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, REPRESENTATION_NAME, DDiagram.class); representationContainer = editor.getDRepresentation().eContainer(); semanticModel = new UIResource(designerProject, FILE_DIR, MODEL); }
Source:
public void handleTimeout(ServiceEndpointHealthPollerObject clusterProxyHealthPollerObject) { String clusterIdentifer = clusterProxyHealthPollerObject.getClusterIdentifier(); String errorMessage; try { ClusterProxyRegistrationClient client = clusterProxyHealthPollerObject.getClient(); errorMessage = client.readConfig(clusterIdentifer).toString(); } catch (Exception e) { errorMessage = String.format("Failed to check cluster proxy endpoint health for %s, error: %s", clusterIdentifer, e.getMessage()); LOGGER.debug(errorMessage); } throw new CloudbreakServiceException("Operation timed out. Failed to check cluster proxy endpoint health. " + errorMessage); }

Target:
public void handleTimeout(ServiceEndpointHealthPollerObject clusterProxyHealthPollerObject) { String clusterIdentifer = clusterProxyHealthPollerObject.getClusterIdentifier(); String errorMessage; try { ClusterProxyRegistrationClient client = clusterProxyHealthPollerObject.getClient(); errorMessage = client.readConfig(clusterIdentifer).toString(); } catch (Exception e) { errorMessage = String.format("Failed to check cluster proxy endpoint health for %s, error: %s", clusterIdentifer, e.getMessage()); LOGGER.error(errorMessage); } throw new CloudbreakServiceException("Operation timed out. Failed to check cluster proxy endpoint health. " + errorMessage); }
Source:
public void keyPressed() { Iterable<Node> pNodes = aSelectionModel.getSelectedNodes(); if(aDiagramBuilder.canAttachToPackage(pNodes)) { aProcessor.executeNewOperation(aDiagramBuilder.createAttachToPackageOperation(pNodes)); } else if(aDiagramBuilder.canDetachFromPackage(pNodes)) { aProcessor.executeNewOperation(aDiagramBuilder.createDetachFromPackageOperation(pNodes)); } pNodes.forEach(pNode -> aCanvas.getDiagram().placeOnTop(pNode)); aCanvas.paintPanel(); }

Target:
public void keyPressed() { if(aCanvas.getDiagram().getType() != DiagramType.CLASS) { return; } List<Node> selectedNodes = aSelectionModel.getSelectedNodes(); if(((ClassDiagramBuilder)aDiagramBuilder).canAttachToPackage(selectedNodes)) { aProcessor.executeNewOperation(((ClassDiagramBuilder)aDiagramBuilder).createAttachToPackageOperation(selectedNodes)); } else if(((ClassDiagramBuilder)aDiagramBuilder).canDetachFromPackage(selectedNodes)) { aProcessor.executeNewOperation(((ClassDiagramBuilder)aDiagramBuilder).createDetachFromPackageOperation(selectedNodes)); } selectedNodes.forEach(node -> aCanvas.getDiagram().placeOnTop(node)); aCanvas.paintPanel(); }
Source:
public void run() { try { if (sourceAggregator.queryPromise.isDone()) { return; } if (!sourceAggregator.channelWritable) { sourceAggregator.needScheduling = true; return; } List<QueryTaskSource> taskSources = taskSourceProvider.get(); int bundlesProcessed = readFrame(taskSources, AggregateConfig.FRAME_READER_READS); if (bundlesProcessed > 0) { sourceAggregator.queryPromise.tryProgress(0, bundlesProcessed); } if (sourceAggregator.completed == sourceAggregator.totalTasks) { if (!sourceAggregator.queryPromise.trySuccess()) { log.warn("Tried to complete queryPromise , but failed", sourceAggregator.queryPromise); } } else { if (bundlesProcessed > 0) { pollFailures = 0; sourceAggregator.executor.execute(this); } else { pollFailures += 1; rescheduleSelfWithBackoff(); } } } catch (Throwable e) { if (!sourceAggregator.queryPromise.tryFailure(e)) { log.warn("Tried to fail queryPromise , but failed", sourceAggregator.queryPromise, e); } } }

Target:
public void run() { try { if (sourceAggregator.queryPromise.isDone()) { return; } if (!sourceAggregator.channelWritable) { sourceAggregator.needScheduling = true; return; } List<QueryTaskSource> taskSources = queryTaskSourceSupplier.get(); int bundlesProcessed = readBundles(taskSources, AggregateConfig.FRAME_READER_READS); if (bundlesProcessed > 0) { sourceAggregator.queryPromise.tryProgress(0, bundlesProcessed); } if (sourceAggregator.completed == sourceAggregator.totalTasks) { if (!sourceAggregator.queryPromise.trySuccess()) { log.warn("Tried to complete queryPromise , but failed", sourceAggregator.queryPromise); } } else { if (bundlesProcessed > 0) { pollFailures = 0; sourceAggregator.executor.execute(this); } else { pollFailures += 1; rescheduleSelfWithBackoff(); } } } catch (Throwable e) { if (!sourceAggregator.queryPromise.tryFailure(e)) { log.warn("Tried to fail queryPromise , but failed", sourceAggregator.queryPromise, e); } } }
Source:
private static void setScreenshotBitmaps(View fragmentView) { SnackbarUtil.hideActiveSnack(); View screenShotView = fragmentView.getRootView(); screenShotView.setDrawingCacheEnabled(true); screenShotView.layout(0, 0, screenShotView.getMeasuredWidth(), screenShotView.getMeasuredHeight()); screenshot = Bitmap.createBitmap(screenShotView.getMeasuredWidth(), screenShotView .getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(screenshot); screenShotView.draw(canvas); screenShotView.setDrawingCacheEnabled(false); screenshotDark = screenshot.copy(Bitmap.Config.ARGB_8888, true); canvas = new Canvas(screenshotDark); Paint paint = new Paint(Color.WHITE); ColorFilter filter = new LightingColorFilter(0xFF5F5F5F, 0x00000000); paint.setColorFilter(filter); canvas.drawBitmap(screenshotDark, new Matrix(), paint); ImageView introImageView = (ImageView) introWindow.getContentView().findViewById(R.id.intro_background_image); introImageView.setImageBitmap(screenshotDark); SnackbarUtil.showActiveSnack(); }

Target:
private static void setScreenshotBitmaps(View fragmentView) { SnackbarUtil.hideActiveSnack(); View screenShotView = fragmentView.getRootView(); screenShotView.setDrawingCacheEnabled(true); screenShotView.layout(0, 0, screenShotView.getMeasuredWidth(), screenShotView.getMeasuredHeight()); screenshot = Bitmap.createBitmap(screenShotView.getMeasuredWidth(), screenShotView .getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(screenshot); screenShotView.draw(canvas); screenShotView.setDrawingCacheEnabled(false); screenshotDark = screenshot.copy(Bitmap.Config.ARGB_8888, true); canvas = new Canvas(screenshotDark); Paint paint = new Paint(Color.WHITE); ColorFilter filter = new LightingColorFilter(COLOR_MULTIPLY, COLOR_ADD); paint.setColorFilter(filter); canvas.drawBitmap(screenshotDark, new Matrix(), paint); ImageView introImageView = (ImageView) introWindow.getContentView().findViewById(R.id.intro_background_image); introImageView.setImageBitmap(screenshotDark); SnackbarUtil.showActiveSnack(); }
Source:
public void stopGracefully() { log.info("Stopping gracefully (status: [%s])", status); stopRequested = true; if (status == Status.PUBLISHING) { runThread.interrupt(); return; } try { if (pauseLock.tryLock(15, TimeUnit.SECONDS)) { try { if (pauseRequested) { pauseRequested = false; shouldResume.signalAll(); } } finally { pauseLock.unlock(); } } else { log.warn("While stopping: failed to acquire pauseLock before timeout, interrupting run thread"); runThread.interrupt(); return; } if (pollRetryLock.tryLock(15, TimeUnit.SECONDS)) { try { isAwaitingRetry.signalAll(); } finally { pollRetryLock.unlock(); } } else { log.warn("While stopping: failed to acquire pollRetryLock before timeout, interrupting run thread"); runThread.interrupt(); } } catch (Exception e) { Throwables.propagate(e); } }

Target:
public void stopGracefully() { log.info("Stopping gracefully (status: [%s])", status); stopRequested = true; synchronized (statusLock) { if (status == Status.PUBLISHING) { runThread.interrupt(); return; } } try { if (pauseLock.tryLock(LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { try { if (pauseRequested) { pauseRequested = false; shouldResume.signalAll(); } } finally { pauseLock.unlock(); } } else { log.warn("While stopping: failed to acquire pauseLock before timeout, interrupting run thread"); runThread.interrupt(); return; } if (pollRetryLock.tryLock(LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { try { isAwaitingRetry.signalAll(); } finally { pollRetryLock.unlock(); } } else { log.warn("While stopping: failed to acquire pollRetryLock before timeout, interrupting run thread"); runThread.interrupt(); } } catch (Exception e) { Throwables.propagate(e); } }
Source:
private void prepareHeadersForTeamPanelsInSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel) { switch (viewType) { case GIVER_QUESTION_RECIPIENT: sectionPanel.setStatisticsHeaderText("Statistics for Given Responses"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; case RECIPIENT_QUESTION_GIVER: sectionPanel.setStatisticsHeaderText("Received Responses Statistics"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; default: sectionPanel.setDetailedResponsesHeaderText(""); } }

Target:
private void prepareHeadersForTeamPanelsInSectionPanel( InstructorFeedbackResultsSectionPanel sectionPanel) { switch (viewType) { case GIVER_QUESTION_RECIPIENT: sectionPanel.setStatisticsHeaderText("Statistics for Given Responses"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; case RECIPIENT_QUESTION_GIVER: sectionPanel.setStatisticsHeaderText("Received Responses Statistics"); sectionPanel.setDetailedResponsesHeaderText("Detailed Responses"); break; default: Assumption.fail("There should be no headers for the view type"); } }
Source:
public MetadataStore getMetadataStore(String namespace, Config config, MetricsRegistry metricsRegistry) { return new ZkMetadataStore(config, metricsRegistry, getZookeeperNamespace(namespace, config)); }

Target:
public MetadataStore getMetadataStore(String namespace, Config config, MetricsRegistry metricsRegistry) { return new ZkMetadataStore(namespace, config, metricsRegistry); }
Source:
public void setup(Context.OperatorContext context) { currentWindowRecoveryState = Lists.newLinkedList(); referenceTimes = Maps.newHashMap(); sleepMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); scanner.setup(context); windowDataManager.setup(context); super.setup(context); long largestRecoveryWindow = windowDataManager.getLargestRecoveryWindow(); if (largestRecoveryWindow == Stateless.WINDOW_ID || context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) > largestRecoveryWindow) { scanner.startScanning(Collections.unmodifiableMap(referenceTimes)); } }

Target:
public void setup(Context.OperatorContext context) { currentWindowRecoveryState = Lists.newLinkedList(); if (referenceTimes == null) { referenceTimes = Maps.newHashMap(); } sleepMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); scanner.setup(context); windowDataManager.setup(context); super.setup(context); long largestRecoveryWindow = windowDataManager.getLargestRecoveryWindow(); if (largestRecoveryWindow == Stateless.WINDOW_ID || context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID) > largestRecoveryWindow) { scanner.startScanning(Collections.unmodifiableMap(referenceTimes)); } }
Source:
protected FeignException(int status, String message, Request request, Throwable cause, byte[] content) { super(message, cause); this.status = status; this.content = content; this.request = checkNotNull(request, "request"); }

Target:
protected FeignException(int status, String message, Request request, Throwable cause, byte[] content) { super(message, cause); this.status = status; this.content = content; this.request = checkRequestNotNull(request); }
Source:
public void treatFailedCachedActionAsCacheMiss_local() throws Exception { RemoteOptions options = Options.getDefaults(RemoteOptions.class); ActionResult failedAction = ActionResult.newBuilder().setExitCode(1).build(); when(cache.getCachedActionResult(any(ActionKey.class))).thenReturn(failedAction); RemoteSpawnRunner runner = spy( new RemoteSpawnRunner( execRoot, options, Options.getDefaults(ExecutionOptions.class), new AtomicReference<>(localRunner), true, null, "build-req-id", "command-id", cache, null, retrier, digestUtil, logDir)); Spawn spawn = newSimpleSpawn(); SpawnExecutionContext policy = new FakeSpawnExecutionContext(spawn); SpawnResult res = Mockito.mock(SpawnResult.class); when(res.exitCode()).thenReturn(1); when(res.status()).thenReturn(Status.EXECUTION_FAILED); when(localRunner.exec(eq(spawn), eq(policy))).thenReturn(res); runner.exec(spawn, policy); verify(localRunner).exec(eq(spawn), eq(policy)); verify(runner) .execLocallyAndUpload( eq(spawn), eq(policy), any(SortedMap.class), eq(cache), any(ActionKey.class), any(Action.class), any(Command.class), eq(true)); verify(cache, never()) .upload( any(ActionKey.class), any(Action.class), any(Command.class), any(Path.class), any(Collection.class), any(FileOutErr.class)); verify(cache, never()) .download( any(ActionResult.class), any(Path.class), eq(outErr)); }

Target:
public void treatFailedCachedActionAsCacheMiss_local() throws Exception { RemoteOptions options = Options.getDefaults(RemoteOptions.class); ActionResult failedAction = ActionResult.newBuilder().setExitCode(1).build(); when(cache.getCachedActionResult(any(ActionKey.class))).thenReturn(failedAction); RemoteSpawnRunner runner = spy( new RemoteSpawnRunner( execRoot, options, Options.getDefaults(ExecutionOptions.class), new AtomicReference<>(localRunner), true, null, "build-req-id", "command-id", cache, null, retrier, digestUtil, logDir)); Spawn spawn = newSimpleSpawn(); SpawnExecutionContext policy = new FakeSpawnExecutionContext(spawn); SpawnResult succeeded = new SpawnResult.Builder() .setStatus(Status.SUCCESS) .setExitCode(0) .setRunnerName("test") .build(); when(localRunner.exec(eq(spawn), eq(policy))).thenReturn(succeeded); runner.exec(spawn, policy); verify(localRunner).exec(eq(spawn), eq(policy)); verify(runner) .execLocallyAndUpload( eq(spawn), eq(policy), any(SortedMap.class), eq(cache), any(ActionKey.class), any(Action.class), any(Command.class), eq(true)); verify(cache) .upload( any(ActionKey.class), any(Action.class), any(Command.class), any(Path.class), any(Collection.class), any(FileOutErr.class)); verify(cache, never()) .download( any(ActionResult.class), any(Path.class), eq(outErr)); }
Source:
protected Number calculateVerticalDiff(final ILayerCell cell, final int toColumn, final IConfigRegistry configRegistry) { Number diff = super.calculateVerticalDiff(cell, toColumn, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { if ((command.direction == MoveDirectionEnum.LEFT && !((PapyrusFillHandlePasteCommand) command).isIncrement()) || (command.direction == MoveDirectionEnum.RIGHT && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }

Target:
protected Number calculateVerticalDiff(final ILayerCell cell, final int toColumn, final IConfigRegistry configRegistry) { Number diff = super.calculateVerticalDiff(cell, toColumn, configRegistry); if (command instanceof PapyrusFillHandlePasteCommand) { if ((MoveDirectionEnum.LEFT == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement()) || (MoveDirectionEnum.RIGHT == command.direction && !((PapyrusFillHandlePasteCommand) command).isIncrement())) { if (diff instanceof Byte) { diff = 0 - diff.byteValue(); } else if (diff instanceof Short) { diff = 0 - diff.shortValue(); } else if (diff instanceof Integer) { diff = 0 - diff.intValue(); } else if (diff instanceof Long) { diff = 0 - diff.longValue(); } else if (diff instanceof Float) { diff = 0 - diff.floatValue(); } else if (diff instanceof Double) { diff = 0 - diff.doubleValue(); } else if (diff instanceof BigInteger) { diff = BigInteger.ZERO.subtract((BigInteger) diff); } else if (diff instanceof BigDecimal) { diff = BigDecimal.ZERO.subtract((BigDecimal) diff); } } } return diff; }
Source:
private static String buildQueryString(final Map<String, List<String>> queryString) { return queryString.entrySet().stream() .map(parameter -> buildQueryStringOfParameter(parameter.getKey(), parameter.getValue())) .filter(keyValue -> !keyValue.isEmpty()) .collect(joining("&")); }

Target:
public static String buildQueryString(final Map<String, List<String>> queryString) { return queryString.entrySet().stream() .map(parameter -> buildQueryStringOfParameter(parameter.getKey(), parameter.getValue())) .filter(keyValue -> !keyValue.isEmpty()) .collect(joining("&")); }
Source:
private String calculateCommitMessage() { if(commitMessage != null) { return commitMessage; } if (amending) { return previousCommitMessage; } String calculatedCommitMessage = null; Set<IResource> resources = new HashSet<IResource>(); for (CommitItem item : items) { IResource resource = item.file.getProject(); resources.add(resource); } try { ICommitMessageProvider messageProvider = getCommitMessageProvider(); if(messageProvider != null) { IResource[] resourcesArray = resources.toArray(new IResource[0]); if (messageProvider.getMessage(resourcesArray) != null) { calculatedCommitMessage = messageProvider.getMessage(resourcesArray); } else { calculatedCommitMessage = ""; } } } catch (CoreException coreException) { Activator.error(coreException.getLocalizedMessage(), coreException); } return calculatedCommitMessage; }

Target:
private String calculateCommitMessage() { if(commitMessage != null) { return commitMessage; } if (amending) return previousCommitMessage; String calculatedCommitMessage = null; Set<IResource> resources = new HashSet<IResource>(); for (CommitItem item : items) { IResource resource = item.file.getProject(); resources.add(resource); } try { ICommitMessageProvider messageProvider = getCommitMessageProvider(); if(messageProvider != null) { IResource[] resourcesArray = resources.toArray(new IResource[0]); calculatedCommitMessage = messageProvider.getMessage(resourcesArray); } } catch (CoreException coreException) { Activator.error(coreException.getLocalizedMessage(), coreException); } if (calculatedCommitMessage != null) return calculatedCommitMessage; else return ""; }
Source:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { actionName = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); image = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); }

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { displayName = ExtUtil.readString(in); actionName = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); image = (String)ExtUtil.read(in, new ExtWrapNullable(String.class)); extras = (Hashtable<String, String>) ExtUtil.read(in, new ExtWrapMap(String.class, String.class)); responses = (Vector<String>)ExtUtil.read(in, new ExtWrapList(String.class), pf); }
Source:
public void configure(ResourceInfo resourceInfo, FeatureContext context) { final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); final Annotation[][] parameterAnnotations = am.getParameterAnnotations(); final Class<?>[] parameterTypes = am.getParameterTypes(); final Type[] parameterGenericTypes = am.getGenericParameterTypes(); for (int i = 0; i < parameterAnnotations.length; i++) { for (final Annotation annotation : parameterAnnotations[i]) { final Type paramType = (parameterTypes[i].equals(Optional.class)) ? ((ParameterizedType) parameterGenericTypes[i]).getActualTypeArguments()[0] : parameterTypes[i]; if (annotation instanceof Auth && authFilterMap.containsKey(paramType)) { if (parameterTypes[i].equals(Optional.class)) { context.register(new WebApplicationExceptionCatchingFilter(authFilterMap.get(paramType))); return; } else { context.register(authFilterMap.get(parameterTypes[i])); return; } } } } }

Target:
public void configure(ResourceInfo resourceInfo, FeatureContext context) { final AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); final Annotation[][] parameterAnnotations = am.getParameterAnnotations(); final Class<?>[] parameterTypes = am.getParameterTypes(); final Type[] parameterGenericTypes = am.getGenericParameterTypes(); for (int i = 0; i < parameterAnnotations.length; i++) { final Class<?> type = parameterTypes[i]; final Type paramType = type == Optional.class ? ((ParameterizedType) parameterGenericTypes[i]).getActualTypeArguments()[0] : type; for (final Annotation annotation : parameterAnnotations[i]) { if (annotation instanceof Auth && authFilterMap.containsKey(paramType)) { if (type == Optional.class) { final ContainerRequestFilter filter = authFilterMap.get(paramType); context.register(new WebApplicationExceptionCatchingFilter(filter)); return; } else { context.register(authFilterMap.get(type)); return; } } } } }