javax.servlet.http.HttpSessionContext#java.util.NoSuchElementException源码实例Demo

下面列出了javax.servlet.http.HttpSessionContext#java.util.NoSuchElementException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public Builder set(String propertyName, Object newValue) {
  switch (propertyName.hashCode()) {
    case -1731780257:  // yearFraction
      this.yearFraction = (Double) newValue;
      break;
    case 110246592:  // tenor
      this.tenor = (Double) newValue;
      break;
    case 102727412:  // label
      this.label = (String) newValue;
      break;
    default:
      throw new NoSuchElementException("Unknown property: " + propertyName);
  }
  return this;
}
 
源代码2 项目: Strata   文件: CrossGammaParameterSensitivity.java
@Override
public Object get(String propertyName) {
  switch (propertyName.hashCode()) {
    case 842855857:  // marketDataName
      return marketDataName;
    case -1169106440:  // parameterMetadata
      return parameterMetadata;
    case 106006350:  // order
      return order;
    case 575402001:  // currency
      return currency;
    case 564403871:  // sensitivity
      return sensitivity;
    default:
      throw new NoSuchElementException("Unknown property: " + propertyName);
  }
}
 
源代码3 项目: android_9.0.0_r45   文件: TelephonyRegistry.java
private void remove(IBinder binder) {
    synchronized (mRecords) {
        final int recordCount = mRecords.size();
        for (int i = 0; i < recordCount; i++) {
            Record r = mRecords.get(i);
            if (r.binder == binder) {
                if (DBG) {
                    log("remove: binder=" + binder + " r.callingPackage " + r.callingPackage
                            + " r.callback " + r.callback);
                }

                if (r.deathRecipient != null) {
                    try {
                        binder.unlinkToDeath(r.deathRecipient, 0);
                    } catch (NoSuchElementException e) {
                        if (VDBG) log("UnlinkToDeath NoSuchElementException sending to r="
                                + r + " e=" + e);
                    }
                }

                mRecords.remove(i);
                return;
            }
        }
    }
}
 
源代码4 项目: Strata   文件: KnownAmountBondPaymentPeriod.java
@Override
public Object get(String propertyName) {
  switch (propertyName.hashCode()) {
    case -786681338:  // payment
      return payment;
    case -2129778896:  // startDate
      return startDate;
    case -1607727319:  // endDate
      return endDate;
    case 1457691881:  // unadjustedStartDate
      return unadjustedStartDate;
    case 31758114:  // unadjustedEndDate
      return unadjustedEndDate;
    default:
      throw new NoSuchElementException("Unknown property: " + propertyName);
  }
}
 
源代码5 项目: Strata   文件: EtdContractSpec.java
@Override
public Object get(String propertyName) {
  switch (propertyName.hashCode()) {
    case 3355:  // id
      return id;
    case 3575610:  // type
      return type;
    case 913218206:  // exchangeId
      return exchangeId;
    case -1402840545:  // contractCode
      return contractCode;
    case -1724546052:  // description
      return description;
    case -2126070377:  // priceInfo
      return priceInfo;
    case 405645655:  // attributes
      return attributes;
    default:
      throw new NoSuchElementException("Unknown property: " + propertyName);
  }
}
 
源代码6 项目: nextcloud-notes   文件: LocalAccount.java
/**
 * @param availableApiVersions <code>["0.2", "1.0", ...]</code>
 */
public void setPreferredApiVersion(@Nullable String availableApiVersions) {
    // TODO move this logic to NotesClient?
    try {
        if (availableApiVersions == null) {
            this.preferredApiVersion = null;
            return;
        }
        JSONArray versionsArray = new JSONArray(availableApiVersions);
        Collection<ApiVersion> supportedApiVersions = new HashSet<>(versionsArray.length());
        for (int i = 0; i < versionsArray.length(); i++) {
            ApiVersion parsedApiVersion = ApiVersion.of(versionsArray.getString(i));
            for (ApiVersion temp : NotesClient.SUPPORTED_API_VERSIONS) {
                if (temp.compareTo(parsedApiVersion) == 0) {
                    supportedApiVersions.add(parsedApiVersion);
                    break;
                }
            }
        }
        this.preferredApiVersion = Collections.max(supportedApiVersions);
    } catch (JSONException | NoSuchElementException e) {
        e.printStackTrace();
        this.preferredApiVersion = null;
    }
}
 
源代码7 项目: SJS   文件: GreedyFixingSetFinder.java
@Override
public FixingSetListener.Action currentFixingSet(Collection<T> out, FixingSetListener<T, ?> listener) {

    Collection<Collection<T>> cores = new LinkedList<>(this.cores);
    while (!cores.isEmpty()) {
        // At each iteration, pick the constraint that appears in the
        // greatest number of uncovered cores.

        Map<T, Integer> counts = cores.stream()
            .flatMap(Collection::stream)
            .collect(Collectors.toMap(
                c -> c,
                c -> 1,
                (v1, v2) -> v1 + v2));

        T constraint = allConstraints.stream()
            .filter(counts::containsKey)
            .max((c1, c2) -> counts.get(c1) - counts.get(c2))
            .orElseThrow(NoSuchElementException::new);
        out.add(constraint);
        cores.removeIf(core -> core.contains(constraint));
    }

    return FixingSetListener.Action.CONTINUE;
}
 
@Test
public void testStructure_NonamedArray_Spaces() {
  final JBBPTokenizer parser = new JBBPTokenizer("    [ 333 ]  { ");

  final Iterator<JBBPToken> iterator = parser.iterator();

  final JBBPToken item = iterator.next();

  assertEquals(JBBPTokenType.STRUCT_START, item.getType());
  assertNull(item.getFieldName());
  assertNull(item.getFieldTypeParameters());
  assertTrue(item.isArray());
  assertEquals(333, item.getArraySizeAsInt().intValue());
  assertEquals(4, item.getPosition());

  try {
    iterator.next();
    fail("Must throw NSEE");
  } catch (NoSuchElementException ex) {

  }
}
 
源代码9 项目: monsoon   文件: ForwardIterator.java
/**
 * Advance along the chain.
 * @return The next chain element, or null if no more elements are available.
 */
public synchronized Chain<T> advance() {
    if (next_ == null) {
        if (!forward_.hasNext()) throw new NoSuchElementException();
        next_ = new Chain<>(forward_.next(), forward_);
        forward_ = null;
    }
    return next_;
}
 
源代码10 项目: dhis2-core   文件: DefaultFileResourceService.java
@Override
@Transactional( readOnly = true )
public void copyFileResourceContent( FileResource fileResource, OutputStream outputStream )
    throws IOException, NoSuchElementException
{
    fileResourceContentStore.copyContent( fileResource.getStorageKey(), outputStream );
}
 
源代码11 项目: pippo   文件: Stack.java
/**
 * Removes the top item from the stack and returns it.
 * Returns {@code null} if the stack is empty.
 */
public E pop() {
    try {
        return list.removeFirst();
    } catch (NoSuchElementException e) {
        return null;
    }
}
 
源代码12 项目: armeria   文件: HttpClientContextCaptorTest.java
@Test
void badPath() {
    try (ClientRequestContextCaptor ctxCaptor = Clients.newContextCaptor()) {
        // Send a request with a bad path.
        // Note: A colon cannot come in the first path component.
        final HttpResponse res = WebClient.of().get("http://127.0.0.1:1/:");
        assertThatThrownBy(ctxCaptor::get).isInstanceOf(NoSuchElementException.class)
                                          .hasMessageContaining("no request was made");
        res.aggregate();
    }
}
 
源代码13 项目: openjdk-jdk9   文件: InsnList.java
public Object next() {
    if (next == null) {
        throw new NoSuchElementException();
    }
    AbstractInsnNode result = next;
    prev = result;
    next = result.next;
    remove = result;
    return result;
}
 
源代码14 项目: CloverETL-Engine   文件: StreamedPortDataBase.java
@Override
public DataRecord peek() {
	if (current != null) {
		return current;
	}
	throw new NoSuchElementException();
}
 
源代码15 项目: Lightweight-Stream-API   文件: OptionalIntTest.java
@Test(expected = NoSuchElementException.class)
public void testOrElseThrow2() {
    assertEquals(25, OptionalInt.empty().orElseThrow(new Supplier<NoSuchElementException>() {
        @Override
        public NoSuchElementException get() {
            return new NoSuchElementException();
        }
    }));
}
 
源代码16 项目: fenixedu-academic   文件: PhdMigrationGuiding.java
public void parse() {
    try {
        String[] compounds = getData().split("\\t");

        this.phdStudentNumber = Integer.parseInt(compounds[0].trim());
        this.teacherId = compounds[2].trim();
        this.institutionCode = compounds[3].trim();
        this.name = compounds[4].trim();
    } catch (NoSuchElementException e) {
        throw new IncompleteFieldsException();
    }
}
 
源代码17 项目: jdk8u60   文件: SunFontManager.java
private void registerFontsOnPath(String pathName,
                                 boolean useJavaRasterizer, int fontRank,
                                 boolean defer, boolean resolveSymLinks) {

    StringTokenizer parser = new StringTokenizer(pathName,
            File.pathSeparator);
    try {
        while (parser.hasMoreTokens()) {
            registerFontsInDir(parser.nextToken(),
                    useJavaRasterizer, fontRank,
                    defer, resolveSymLinks);
        }
    } catch (NoSuchElementException e) {
    }
}
 
源代码18 项目: PowerSwitch_Android   文件: Room.java
/**
 * Gets a specific Receiver in this Room, ignoring case
 *
 * @param name Name of Receiver
 * @return Receiver
 * @throws NoSuchElementException if no element was not found
 */
@NonNull
public Receiver getReceiverCaseInsensitive(@Nullable String name) {
    for (Receiver receiver : receivers) {
        if (receiver.getName().equalsIgnoreCase(name)) {
            return receiver;
        }
    }
    throw new NoSuchElementException("Receiver \"" + name + "\" not found");
}
 
源代码19 项目: j2cache   文件: DefaultCache.java
@Override
public Iterator<V> iterator() {
    return new Iterator<V>() {
        private final Iterator<DefaultCache.CacheWapper<V>> it = cachedObjects.iterator();

        @Override
        public boolean hasNext() {
            return it.hasNext();
        }

        @Override
        public V next() {
            if(it.hasNext()) {
                DefaultCache.CacheWapper<V> object = it.next();
                if(object == null) {
                    return null;
                } else {
                    return object.object;
                }
            }
            else {
                throw new NoSuchElementException();
            }
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
 
源代码20 项目: netbeans   文件: NewWebProjectWizardIterator.java
public void nextPanel() {
    // To be able to trace #240974 a bit better, adding actual values
    if (!hasNext()) {
        StringBuilder sb = new StringBuilder();
        sb.append("panelsCount: ");
        sb.append(panelsCount);
        sb.append("\n panels size: ");
        sb.append(panels.length);
        throw new NoSuchElementException(sb.toString());
    }
    index++;
}
 
源代码21 项目: astor   文件: StrTokenizer.java
/**
 * Gets the next token.
 *
 * @return the next String token
 * @throws NoSuchElementException if there are no more elements
 */
@Override
public String next() {
    if (hasNext()) {
        return tokens[tokenPos++];
    }
    throw new NoSuchElementException();
}
 
@Test
@DisplayName("return a value either from non-empty Optional or throw Exception")
@Tag("TODO")
@Order(4)
public void orElseThrowReplacesOptionalGet() {

    /*
     * NOTE: Refer to the bug: https://bugs.openjdk.java.net/browse/JDK-8140281
     *
     * This is a deliberate API addition to "replace" or "deprecate" the get()
     * get() brings about an ambiguity, when used without an ifPresent().
     *
     * Bug for get() deprecation: https://bugs.openjdk.java.net/browse/JDK-8160606
     */

    Optional<String> anOptional = Optional.empty();

    /*
     * TODO:
     *  Replace the below to use an orElseThrow() - instead of - the get()
     *  Check API: java.util.Optional.orElseThrow()
     */
    assertThrows(NoSuchElementException.class, () -> {
        String nonNullString = null;
    });

}
 
源代码23 项目: ezdb   文件: TestEzBytesTreeMapDb.java
@Test
public void range2ReverseMinus() {
	final TableIterator<String, Date, Integer> range = reverseRangeTable.rangeReverse(HASHKEY_ONE, twoDateMinus);
	Assert.assertEquals(1, (int) range.next().getValue());
	Assert.assertFalse(range.hasNext());
	try {
		range.next();
		Assert.fail("Exception expected!");
	} catch (final NoSuchElementException e) {
		Assert.assertNotNull(e);
	}
}
 
源代码24 项目: grappa   文件: ArrayValueStack.java
@Override
public T next()
{
    if (!hasNext())
        throw new NoSuchElementException();
    return array[index++];
}
 
源代码25 项目: gemfirexd-oss   文件: OptionSpecTokenizer.java
AbstractOptionSpec<?> next() {
    if ( !hasMore() )
        throw new NoSuchElementException();


    String optionCandidate = String.valueOf( specification.charAt( index ) );
    index++;

    AbstractOptionSpec<?> spec;
    if ( RESERVED_FOR_EXTENSIONS.equals( optionCandidate ) ) {
        spec = handleReservedForExtensionsToken();

        if ( spec != null )
            return spec;
    }

    ensureLegalOption( optionCandidate );

    if ( hasMore() ) {
        boolean forHelp = false;
        if ( specification.charAt( index ) == HELP_MARKER ) {
            forHelp = true;
            ++index;
        }
        spec = hasMore() && specification.charAt( index ) == ':'
            ? handleArgumentAcceptingOption( optionCandidate )
            : new NoArgumentOptionSpec( optionCandidate );
        if ( forHelp )
            spec.forHelp();
    } else
        spec = new NoArgumentOptionSpec( optionCandidate );

    return spec;
}
 
源代码26 项目: ezdb   文件: TestEzLmDbJni.java
@Override
@Test
public void range32ReversePlus() {
	final TableIterator<String, Date, Integer> range = reverseRangeTable.rangeReverse(HASHKEY_ONE, threeDatePlus,
			twoDatePlus);
	Assert.assertEquals(3, (int) range.next().getValue());
	Assert.assertFalse(range.hasNext());
	try {
		range.next();
		Assert.fail("Exception expected!");
	} catch (final NoSuchElementException e) {
		Assert.assertNotNull(e);
	}
}
 
源代码27 项目: SourcererCC   文件: CloneReporter.java
@Override
public void run() {
    try {
        this.reportClone(this.cp);
    } catch (NoSuchElementException e) {
        e.printStackTrace();
    }
}
 
源代码28 项目: org.alloytools.alloy   文件: IntBitSet.java
@Override
public int next() {
    if (!hasNext())
        throw new NoSuchElementException();
    final long lastReturnedMask = Long.highestOneBit(unseen);
    unseen -= lastReturnedMask;
    lastReturned = (unseenIndex << 6) + 63 - Long.numberOfLeadingZeros(lastReturnedMask);
    return lastReturned;
}
 
@Test(expected = NoSuchElementException.class)
public void testGetCurrentWhenNotAdvancable() {
    try {
        properties.peekMessages.setValue(true);

        AzureStorageQueueSource source = new AzureStorageQueueSource();
        ValidationResult vr = source.initialize(getDummyRuntimeContiner(), properties);
        assertNotNull(vr);
        assertEquals(ValidationResult.OK.getStatus(), vr.getStatus());

        reader = (AzureStorageQueueInputReader) source.createReader(getDummyRuntimeContiner());
        reader.queueService = queueService; // inject mocked service

        final List<CloudQueueMessage> messages = new ArrayList<>();
        messages.add(new CloudQueueMessage("message-1"));
        when(queueService.peekMessages(anyString(), anyInt())).thenReturn(new Iterable<CloudQueueMessage>() {

            @Override
            public Iterator<CloudQueueMessage> iterator() {
                return new DummyCloudQueueMessageIterator(messages);
            }
        });
        boolean startable = reader.start();
        assertTrue(startable);
        assertNotNull(reader.getCurrent());
        boolean advancable = reader.advance();
        assertFalse(advancable);
        reader.getCurrent(); // should throw NoSuchElementException

    } catch (IOException | InvalidKeyException | URISyntaxException | StorageException e) {
        fail("sould not throw " + e.getMessage());
    }
}
 
源代码30 项目: kafka-workers   文件: RandomAccessArrayDeque.java
public final E next() {
    if (remaining <= 0)
        throw new NoSuchElementException();
    final Object[] es = elements;
    E e = nonNullElementAt(es, cursor);
    cursor = dec(lastRet = cursor, es.length);
    remaining--;
    return e;
}