auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, CAS aCas, VID aSelectedAnnotation) throws IOException, AnnotationException { Optional<Offsets> optUserSelectedSpan = getOffsetsFromRequest(request, aCas, aSelectedAnnotation); if (!optUserSelectedSpan.isPresent()) { return new SpanAnnotationResponse(); } Offsets userSelectedSpan = optUserSelectedSpan.get(); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); if (state.isSlotArmed()) { getActionHandler().actionFillSlot(aTarget, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd(), aSelectedAnnotation); } else { if (!aSelectedAnnotation.isSynthetic()) { selection.selectSpan(aSelectedAnnotation, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd()); if (selection.getAnnotation().isNotSet()) { getActionHandler().actionCreateOrUpdate(aTarget, aCas); } else { getActionHandler().actionSelect(aTarget, aCas); } } } return new SpanAnnotationResponse(); }

Target:
private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, CAS aCas, VID aSelectedAnnotation) throws IOException, AnnotationException { Offsets optUserSelectedSpan = getOffsetsFromRequest(request, aCas, aSelectedAnnotation); Offsets userSelectedSpan = optUserSelectedSpan; AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); if (state.isSlotArmed()) { getActionHandler().actionFillSlot(aTarget, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd(), aSelectedAnnotation); } else { if (!aSelectedAnnotation.isSynthetic()) { selection.selectSpan(aSelectedAnnotation, aCas, userSelectedSpan.getBegin(), userSelectedSpan.getEnd()); if (selection.getAnnotation().isNotSet()) { getActionHandler().actionCreateOrUpdate(aTarget, aCas); } else { getActionHandler().actionSelect(aTarget, aCas); } } } return new SpanAnnotationResponse(); }
Source:
private void emitConstructor(TypeSpec.Builder intentBuilderTypeBuilder) { MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC) .addParameter(ClassName.get("android.content", "Context"), "context"); if(usesReflection) { constructorBuilder.addStatement("try { intent = new Intent(context, Class.forName($S)); } catch(Exception ex)" + " { throw new RuntimeException(ex); }", target.getFqcn()); } else { constructorBuilder.addStatement("intent = new Intent(context, $L.class);", target.className); } intentBuilderTypeBuilder.addMethod(constructorBuilder.build()); }

Target:
private void emitConstructor(TypeSpec.Builder intentBuilderTypeBuilder) { MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC) .addParameter(get("android.content", "Context"), "context"); if (usesReflection) { emitGetClassDynamically(intentBuilderTypeBuilder); constructorBuilder.addStatement("intent = new Intent(context, getClassDynamically($S))", target.getFqcn()); } else { constructorBuilder.addStatement("intent = new Intent(context, $L.class)", target.className); } intentBuilderTypeBuilder.addMethod(constructorBuilder.build()); }
Source:
private boolean compareCurrentToken() { byte[] arr2 = currentHead.path; int off2 = currentHead.pathOffset; int end2 = currentHead.pathLen; if (!hasCurrent) { throw new IllegalStateException("No current token"); } if (end - pos != end2 - off2) { return false; } int len = end - pos; for (int curPos = 0; curPos < len; curPos++) { if (bytes[pos + curPos] != arr2[off2 + curPos]) { return false; } } return true; }

Target:
private boolean compareCurrentToken() { byte[] path2 = currentHead.path; int pathOffset2 = currentHead.pathOffset; int pathLen2 = currentHead.pathLen; if (!hasCurrent) throw new IllegalStateException("No current token"); if (pathEnd - pathOffset != pathLen2 - pathOffset2) return false; int len = pathEnd - pathOffset; for (int offset = 0; offset < len; offset++) { if (path[pathOffset + offset] != path2[pathOffset2 + offset]) { return false; } } return true; }
Source:
protected void update(String secretConfig) { String[] keyValues = secretConfig.split("!"); for (int i=0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format"); } if (i == 0){ this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } }

Target:
protected void update(String secretConfig) { String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format, must have at least one parameter"); } for (int i=0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException("Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } }
Source:
protected static Work.State getState(String workId) { KeyValueStore kvStore = Framework.getService(KeyValueService.class).getKeyValueStore(KV_NAME); String stringState = kvStore.getString(workId + STATE_SUFFIX); return stringState == null || CANCELED.equals(stringState) ? null : Work.State.valueOf(stringState); }

Target:
protected static Work.State getState(String workId) { String stringState = getKeyValueStore().getString(getStateKey(workId)); return stringState == null || CANCELED.equals(stringState) ? null : Work.State.valueOf(stringState); }
Source:
public void testCreatePurchaseWithExternalKeyOverLimit() throws PaymentApiException, InvoiceApiException, EventBusException { final BigDecimal requestedAmount = BigDecimal.TEN; final UUID subscriptionId = UUID.randomUUID(); final UUID bundleId = UUID.randomUUID(); final LocalDate now = clock.getUTCToday(); final Invoice invoice = testHelper.createTestInvoice(account, now, Currency.USD); final String paymentExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; final String transactionExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; invoice.addInvoiceItem(new MockRecurringInvoiceItem(invoice.getId(), account.getId(), subscriptionId, bundleId, "test plan", "test phase", null, now, now.plusMonths(1), requestedAmount, new BigDecimal("1.0"), Currency.USD)); try { paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); } catch (final PaymentApiException e) { assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode()); } }

Target:
public void testCreatePurchaseWithExternalKeyOverLimit() throws PaymentApiException, InvoiceApiException, EventBusException { final BigDecimal requestedAmount = BigDecimal.TEN; final LocalDate now = clock.getUTCToday(); final Invoice invoice = testHelper.createTestInvoice(account, now, Currency.USD); final String paymentExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; final String transactionExternalKey = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis,."; try { paymentApi.createPurchaseWithPaymentControl(account, account.getPaymentMethodId(), null, requestedAmount, Currency.USD, paymentExternalKey, transactionExternalKey, createPropertiesForInvoice(invoice), INVOICE_PAYMENT, callContext); Assert.fail(); } catch (final PaymentApiException e) { assertEquals(e.getCode(), ErrorCode.EXTERNAL_KEY_LIMIT_EXCEEDED.getCode()); } }
Source:
public void sendError() throws IOException { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.sendError(101, "Custom error message"); MatcherAssert.assertThat( "Can't send a error in servlet response", sresp.getHeaders("HTTP/1.1"), Matchers.hasItem("HTTP/1.1 101 Custom error message") ); }

Target:
public void sendError() throws IOException { final HttpServletResponse sresp = new HttpServletResponseFake( new RsEmpty() ); sresp.sendError(101, "Switching Protocol"); new Assertion<>( "Can't send a error in servlet response", sresp.getHeaders(HttpServletResponseFakeTest.VERSION), new HasValues<>( HttpServletResponseFakeTest.INFO ) ).affirm(); }
Source:
protected INDArray createGain(long nOut, double gainInit, INDArray gainParamView, boolean initializeParameters) { if (initializeParameters) { INDArray ret = Nd4j.valueArrayOf(new long[] {1, nOut}, gainInit); gainParamView.assign(ret); } return gainParamView; }

Target:
protected INDArray createGain(long nOut, double gainInit, INDArray gainParamView, boolean initializeParameters) { if (initializeParameters) { gainParamView.assign(gainInit); } return gainParamView; }
Source:
public ClientResponseHandler generateHandlers(@NonNull final MethodHandles.Lookup caller, @NonNull final Object o) { Arrays.stream(o.getClass().getDeclaredMethods()) .filter(method -> method.isAnnotationPresent(ResponseHandler.class)) .forEach(method -> { ResponseHandler handler = method.getAnnotation(ResponseHandler.class); if (!method.getParameterTypes()[0] .isAssignableFrom(ResponseMsg.class)) { throw new RuntimeException("Incorrect message type, expected " + ResponseMsg.class + " but provided " + method.getParameterTypes()[0]); } if (handlerMap.containsKey(handler.type())) { throw new RuntimeException("Handler for " + handler.type() + " already registered!"); } try { if (Modifier.isStatic(method.getModifiers())) { MethodHandle mh = caller.unreflect(method); handlerMap.put(handler.type(), (Handler) LambdaMetafactory .metafactory(caller, "handle", MethodType.methodType(Handler.class), mh.type(), mh, mh.type()) .getTarget().invokeExact()); } else { MethodType mt = MethodType .methodType(method.getReturnType(), method.getParameterTypes()); MethodHandle mh = caller.findVirtual(o.getClass(), method.getName(), mt); MethodType mtGeneric = mh.type() .changeReturnType(Object.class); handlerMap.put(handler.type(), (Handler) LambdaMetafactory .metafactory(caller, "handle", MethodType.methodType(Handler.class, o.getClass()), mtGeneric.dropParameterTypes(0, 1), mh, mh.type() .dropParameterTypes(0, 1)) .getTarget().bindTo(o).invoke()); } } catch (Throwable e) { log.error("Exception during incoming message handling", e); throw new RuntimeException(e); } }); return this; }

Target:
public ClientResponseHandler generateHandlers(@NonNull final MethodHandles.Lookup caller, @NonNull final Object o) { Arrays.stream(o.getClass().getDeclaredMethods()) .filter(method -> method.isAnnotationPresent(ResponseHandler.class)) .forEach(method -> { ResponseHandler handler = method.getAnnotation(ResponseHandler.class); if (!method.getParameterTypes()[0] .isAssignableFrom(ResponseMsg.class)) { throw new RuntimeException("Incorrect message type, expected " + ResponseMsg.class + " but provided " + method.getParameterTypes()[0]); } if (handlerMap.containsKey(handler.type())) { throw new RuntimeException("Handler for " + handler.type() + " already registered!"); } try { if (Modifier.isStatic(method.getModifiers())) { MethodHandle mh = caller.unreflect(method); handlerMap.put(handler.type(), (Handler) LambdaMetafactory .metafactory(caller, "handle", MethodType.methodType(Handler.class), mh.type(), mh, mh.type()) .getTarget().invokeExact()); } else { MethodType mt = MethodType .methodType(method.getReturnType(), method.getParameterTypes()); MethodHandle mh = caller.findVirtual(o.getClass(), method.getName(), mt); MethodType mtGeneric = mh.type() .changeReturnType(Object.class); handlerMap.put(handler.type(), (Handler) LambdaMetafactory .metafactory(caller, "handle", MethodType.methodType(Handler.class, o.getClass()), mtGeneric.dropParameterTypes(0, 1), mh, mh.type() .dropParameterTypes(0, 1)) .getTarget().bindTo(o).invoke()); } } catch (Throwable e) { throw new RuntimeException("Exception while generating ClientResponseHandler", e); } }); return this; }
Source:
private void init() { if (jp == null) { try { if (inputStream == null) { throw new UnsupportedOperationException(); } else { jp = objectMapper.getFactory().createParser(inputStream); } objectCodec = jp.getCodec(); jp.nextToken(); } catch (IOException e) { throw new RuntimeException(e); } } }

Target:
private void init() { try { if (inputStream == null) { throw new UnsupportedOperationException(); } else { jp = objectMapper.getFactory().createParser(inputStream); } final JsonToken nextToken = jp.nextToken(); if (nextToken != JsonToken.START_ARRAY) { throw new IAE("First token should be START_ARRAY", jp.getCurrentToken()); } else { jp.nextToken(); objectCodec = jp.getCodec(); } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
protected Object parseSourceValue(Object value) { return value.toString(); }

Target:
protected String parseSourceValue(Object value) { return value.toString(); }
Source:
public static <V> ListenableFuture<V> toListenableFuture(CompletableFuture<V> completableFuture) { requireNonNull(completableFuture, "completableFuture is null"); SettableFuture<V> future = SettableFuture.create(); completableFuture.whenComplete((value, exception) -> { if (exception != null) { future.setException(exception); } else { future.set(value); } }); return future; }

Target:
public static <V> ListenableFuture<V> toListenableFuture(CompletableFuture<V> completableFuture) { requireNonNull(completableFuture, "completableFuture is null"); SettableFuture<V> future = SettableFuture.create(); Futures.addCallback(future, new FutureCallback<V>() { @Override public void onSuccess(V result) { } @Override public void onFailure(Throwable t) { completableFuture.completeExceptionally(t); } }); completableFuture.whenComplete((value, exception) -> { if (exception != null) { future.setException(exception); } else { future.set(value); } }); return future; }
Source:
default SortedSet<T> toSortedSet() throws ClassCastException { final Comparator<T> comparator; if (this instanceof TreeSet<?>) { return (TreeSet<T>) this; } else if (this instanceof Ordered<?>) { comparator = ((Ordered<T>) this).comparator(); } else { comparator = (Comparator<T> & Serializable) (o1, o2) -> ((Comparable<T>) o1).compareTo(o2); } return toSortedSet(comparator); }

Target:
default SortedSet<T> toSortedSet() throws ClassCastException { if (this instanceof TreeSet<?>) { return (TreeSet<T>) this; } else { final Comparator<T> comparator = (this instanceof Ordered<?>) ? ((Ordered<T>) this).comparator() : (Comparator<T> & Serializable) (o1, o2) -> ((Comparable<T>) o1).compareTo(o2); return toSortedSet(comparator); } }
Source:
protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); List<String> macAddresses = ListUtils.EMPTY_LIST; if (getParameters().isImportAsNewEntity()) { macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); } for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); if (getParameters().isImportAsNewEntity()) { iface.setMacAddress(macAddresses.get(i)); } vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }

Target:
protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); if (getParameters().isImportAsNewEntity()) { List<String> macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); iface.setMacAddress(macAddresses.get(i)); } } for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }
Source:
public void compute1(final RectangleNeighborhood<I> input, final DoubleType output) { final IntegralCursor<I> cursor = new IntegralCursor<>(input); int dimensions = input.numDimensions(); final DoubleType sum = new DoubleType(); sum.setZero(); final Converter<I, DoubleType> conv = new RealDoubleConverter<>(); while ( cursor.hasNext() ) { int cornerInteger = cursor.getCornerRepresentation(); final I value = cursor.next().copy(); final DoubleType valueAsDoubleType = new DoubleType(); conv.convert(value, valueAsDoubleType); DoubleType factor = new DoubleType(Math.pow(-1.0d, dimensions - norm(cornerInteger))); valueAsDoubleType.mul(factor); sum.add(valueAsDoubleType); } output.set(sum); }

Target:
public void compute1(final RectangleNeighborhood<I> input, final DoubleType output) { final IntegralCursor<I> cursor = new IntegralCursor<>(input); final int dimensions = input.numDimensions(); final DoubleType sum = new DoubleType(); sum.setZero(); final Converter<I, DoubleType> conv = new RealDoubleConverter<>(); final DoubleType valueAsDoubleType = new DoubleType(); while (cursor.hasNext()) { final I value = cursor.next().copy(); conv.convert(value, valueAsDoubleType); final int cornerInteger = cursor.getCornerRepresentation(); final DoubleType factor = new DoubleType(Math.pow(-1.0d, dimensions - IntegralMean.norm(cornerInteger))); valueAsDoubleType.mul(factor); sum.add(valueAsDoubleType); } output.set(sum); }
Source:
private void validate() { if (fxReset != null) { if (fxReset.getReferenceCurrency().equals(currency)) { throw new IllegalArgumentException( Messages.format("Currency must not equal FxReset reference currency: {}", currency, fxReset.getReferenceCurrency())); } if (!fxReset.getIndex().getCurrencyPair().contains(currency)) { throw new IllegalArgumentException( Messages.format("Currency must be one of those in the FxReset index: {}", currency, fxReset.getIndex())); } } }

Target:
private void validate() { if (fxReset != null) { if (fxReset.getReferenceCurrency().equals(currency)) { throw new IllegalArgumentException( Messages.format("Currency must not equal FxReset reference currency {}", currency, fxReset.getReferenceCurrency())); } if (!fxReset.getIndex().getCurrencyPair().contains(currency)) { throw new IllegalArgumentException( Messages.format("Currency must be one of those in the FxReset index {}", currency, fxReset.getIndex())); } } }
Source:
public void notifyChanged(final Notification notification) { super.notifyChanged(notification); final Object object = notification.getNotifier(); final Property property = getUMLElement(); if (object.equals(property)) { switch (notification.getFeatureID(Property.class)) { case UMLPackage.PROPERTY__LOWER_VALUE: case UMLPackage.PROPERTY__UPPER_VALUE: addAdditionalListeners(); } } }

Target:
public void notifyChanged(final Notification notification) { super.notifyChanged(notification); final Object notifier = notification.getNotifier(); final Property property = getUMLElement(); if (notifier.equals(property)) { switch (notification.getFeatureID(Property.class)) { case UMLPackage.PROPERTY__LOWER_VALUE: case UMLPackage.PROPERTY__UPPER_VALUE: addAdditionalListeners(); } } }
Source:
public StoreCopier.Message transform(StoreCopier.Message message) throws Exception { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey; if (cacheMap == null) { List<StoreKey> list = Collections.singletonList(oldStoreKey); Map<StoreKey, StoreKey> storeKeyToStoreKey = storeKeyConverter.convert(list); newStoreKey = storeKeyToStoreKey.get(oldStoreKey); } else { newStoreKey = cacheMap.get(oldStoreKey); } if (newStoreKey == null) { return null; } return newMessage(message.getStream(), newStoreKey); }

Target:
public StoreCopier.Message transform(StoreCopier.Message message) throws Exception { Objects.requireNonNull(message, "message must not be null"); Objects.requireNonNull(message.getMessageInfo(), "message's messageInfo must not be null"); Objects.requireNonNull(message.getStream(), "message's inputStream must not be null"); StoreKey oldStoreKey = message.getMessageInfo().getStoreKey(); StoreKey newStoreKey; List<StoreKey> list = Collections.singletonList(oldStoreKey); Map<StoreKey, StoreKey> storeKeyToStoreKey = storeKeyConverter.convert(list); newStoreKey = storeKeyToStoreKey.get(oldStoreKey); if (newStoreKey == null) { return null; } return newMessage(message.getStream(), newStoreKey); }
Source:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("name", name).add("networkId", networkId).add("gatewayIp", gatewayIp).add("ipVersion", ipVersion) .add("cidr", cidr).add("enableDhcp", enableDhcp); }

Target:
protected Objects.ToStringHelper string() { return Objects.toStringHelper(this) .add("name", name).add("networkId", networkId).add("gatewayIp", gatewayIp).add("ipVersion", ipVersion) .add("cidr", cidr).add("enableDhcp", enableDhcp).add("allocationPools", allocationPools) .add("dnsNameServers", dnsNameServers).add("hostRoutes", hostRoutes); }
Source:
public ResponseEntity<?> update( @PathVariable("name") final String name, @RequestBody @Valid final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicConfigException, InconsistentStateException, NakadiRuntimeException, ServiceTemporarilyUnavailableException, UnableProcessException { ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } eventTypeService.update(name, eventType); final HttpHeaders headers = new HttpHeaders(); if (!nakadiSettings.getWarnAllDataAccessMessage().isEmpty()) { headers.add(HttpHeaders.WARNING, nakadiSettings.getWarnAllDataAccessMessage()); } return ResponseEntity.status(HttpStatus.OK).headers(headers).build(); }

Target:
public ResponseEntity<?> update( @PathVariable("name") final String name, @RequestBody @Valid final EventTypeBase eventType, final Errors errors, final NativeWebRequest request) throws TopicConfigException, InconsistentStateException, NakadiRuntimeException, ServiceTemporarilyUnavailableException, UnableProcessException { ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } eventTypeService.update(name, eventType); return status(HttpStatus.OK).headers(generateWarningHeaders()).build(); }
Source:
private void enableMenuItem(Menu menu, int rID) { MenuItem item = menu.findItem(rID); item.setEnabled(true); item.setVisible(true); }

Target:
private void enableMenuItem(Menu menu, int rID) { MenuItem item = menu.findItem(rID); if(item == null) { menu.add(rID); } item.setEnabled(true); item.setVisible(true); }
Source:
static void fixConfigGroupServiceNames() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (!MapUtils.isEmpty(configGroupMap)) { for (Map.Entry<Long, ConfigGroup> configGroupEntry : configGroupMap.entrySet()) { Long id = configGroupEntry.getKey(); ConfigGroup configGroup = configGroupEntry.getValue(); LOG.info("Setting service name of config group with id to {}", configGroup.getName(), id, configGroup.getTag()); configGroup.setServiceName(configGroup.getTag()); } } }

Target:
static void fixConfigGroupServiceNames() { Map<Long, ConfigGroup> configGroupMap = collectConfigGroupsWithoutServiceName(); if (MapUtils.isEmpty(configGroupMap)) return; Clusters clusters = injector.getInstance(Clusters.class); for (Map.Entry<Long, ConfigGroup> configGroupEntry : configGroupMap.entrySet()) { ConfigGroup configGroup = configGroupEntry.getValue(); try { Cluster cluster = clusters.getCluster(configGroup.getClusterName()); Map<String, Service> serviceMap = cluster.getServices(); if (serviceMap.containsKey(configGroup.getTag())) { LOG.info("Setting service name of config group with id to {}", configGroup.getName(), configGroupEntry.getKey(), configGroup.getTag()); configGroup.setServiceName(configGroup.getTag()); } } catch (AmbariException e) { } } }
Source:
protected <V> RunnableScheduledFuture<V> decorateTask( final Runnable runnable, RunnableScheduledFuture<V> r) { r = super.decorateTask(runnable, r); for (;;) { final int id = idGenerator.next(); Task<V> task = null; if (runnable instanceof ProjectRunnable) { task = new ProjectTask<V>((ProjectRunnable)runnable, r, this, id); } else { task = new Task<V>(runnable, r, this, id); } if (all.putIfAbsent(task.getTaskId(), task) == null) { return task; } } }

Target:
protected <V> RunnableScheduledFuture<V> decorateTask( final Runnable runnable, RunnableScheduledFuture<V> r) { r = super.decorateTask(runnable, r); for (;;) { final int id = idGenerator.next(); Task<V> task; if (runnable instanceof ProjectRunnable) { task = new ProjectTask<V>((ProjectRunnable)runnable, r, this, id); } else { task = new Task<V>(runnable, r, this, id); } if (all.putIfAbsent(task.getTaskId(), task) == null) { return task; } } }
Source:
private static boolean parseError(WSTrustResponse responseValue, Document xmlDocument, XPath xPath) throws Exception { boolean errorFound = false; NodeList faultNodes = (NodeList) xPath.compile( " XPathConstants.NODESET); if (faultNodes.getLength() > 0) { responseValue.faultMessage = faultNodes.item(0).getTextContent(); if (StringHelper.isBlank(responseValue.faultMessage)) { responseValue.errorFound = true; } } NodeList subcodeNodes = (NodeList) xPath.compile( " .evaluate(xmlDocument, XPathConstants.NODESET); if (subcodeNodes.getLength() > 1) { throw new Exception("Found too many fault code values:" + subcodeNodes.getLength()); } if (subcodeNodes.getLength() == 1) { responseValue.errorCode = subcodeNodes.item(0).getChildNodes() .item(0).getTextContent(); responseValue.errorCode = responseValue.errorCode.split(":")[1]; errorFound = true; } return errorFound; }

Target:
private static boolean parseError(WSTrustResponse responseValue, Document xmlDocument, XPath xPath) throws Exception { boolean errorFound = false; NodeList faultNodes = (NodeList) xPath.compile( " XPathConstants.NODESET); if (faultNodes.getLength() > 0) { responseValue.faultMessage = faultNodes.item(0).getTextContent(); if (!StringHelper.isBlank(responseValue.faultMessage)) { responseValue.errorFound = true; } } NodeList subcodeNodes = (NodeList) xPath.compile( " .evaluate(xmlDocument, XPathConstants.NODESET); if (subcodeNodes.getLength() > 1) { throw new Exception("Found too many fault code values:" + subcodeNodes.getLength()); } if (subcodeNodes.getLength() == 1) { responseValue.errorCode = subcodeNodes.item(0).getChildNodes() .item(0).getTextContent(); responseValue.errorCode = responseValue.errorCode.split(":")[1]; errorFound = true; } return errorFound; }
Source:
public void appendColumn( final AttributeCol52 column ) { assertNotReadOnly(); try { synchronizer.appendColumn( column ); view.getLayer().draw(); model.getAuditLog().add( new InsertColumnAuditLogEntry( identity.getIdentifier(), column ) ); refreshAttributesPanelEvent.fire( new RefreshAttributesPanelEvent( this, model.getAttributeCols() ) ); } catch ( ModelSynchronizer.MoveColumnVetoException e ) { } }

Target:
public void appendColumn( final AttributeCol52 column ) { doAppendColumn( column, () -> synchronizer.appendColumn( column ), () -> refreshAttributesPanelEvent.fire( new RefreshAttributesPanelEvent( this, model.getAttributeCols() ) ) ); }
Source:
private String generateAndRetrieveJWTToken(String tokenSignature, JWTInfoDto jwtInfoDto) throws APISecurityException { String endUserToken; if (isGatewayTokenCacheEnabled) { Object token = getGatewayJWTTokenCache().get(tokenSignature); if (token != null){ endUserToken = (String) token; }else{ try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); getGatewayJWTTokenCache().put(tokenSignature,endUserToken); } catch (APIManagementException e) { throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } } else { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); } catch (APIManagementException e) { throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } return endUserToken; }

Target:
private String generateAndRetrieveJWTToken(String tokenSignature, JWTInfoDto jwtInfoDto) throws APISecurityException { String endUserToken = null; boolean valid = false; if (isGatewayTokenCacheEnabled) { Object token = getGatewayJWTTokenCache().get(tokenSignature); if (token != null) { endUserToken = (String) token; String[] splitToken = ((String) token).split("\\."); JSONObject payload = new JSONObject(new String(Base64.getUrlDecoder().decode(splitToken[1]))); long exp = payload.getLong("exp"); long timestampSkew = OAuthServerConfiguration.getInstance().getTimeStampSkewInSeconds() * 1000; valid = (exp - System.currentTimeMillis() > timestampSkew); } if (StringUtils.isEmpty(endUserToken) || !valid) { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); getGatewayJWTTokenCache().put(tokenSignature, endUserToken); } catch (APIManagementException e) { log.error("Error while Generating Backend JWT", e); throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } } else { try { endUserToken = apiMgtGatewayJWTGenerator.generateToken(jwtInfoDto); } catch (APIManagementException e) { log.error("Error while Generating Backend JWT", e); throw new APISecurityException(APISecurityConstants.API_AUTH_GENERAL_ERROR, APISecurityConstants.API_AUTH_GENERAL_ERROR_MESSAGE, e); } } return endUserToken; }
Source:
public void readIntoDirectly(byte[] byteArray, long position, int length) throws IOException { long sizeInBytes = sizeInBytes(); if (position < startOffset || position >= sizeInBytes) { throw new IndexOutOfBoundsException( "Provided position [" + position + "] is out of bounds for the segment [" + file.getAbsolutePath() + "] with size [" + sizeInBytes + "]"); } if (position + length > sizeInBytes) { metrics.overflowReadError.inc(); throw new IndexOutOfBoundsException( "Cannot read from segment [" + file.getAbsolutePath() + "] from position [" + position + "] for size [" + length + "] because it exceeds the size [" + sizeInBytes + "]"); } DirectRandomAccessFile directFile = new DirectRandomAccessFile(file, "r", 2 * 1024 * 1024); directFile.seek(position); directFile.read(byteArray, 0, length); directFile.close(); }

Target:
void readIntoDirectly(byte[] byteArray, long position, int length) throws IOException { validateReadRange(position, length); try (DirectRandomAccessFile directFile = new DirectRandomAccessFile(file, "r", 2 * 1024 * 1024)) { directFile.seek(position); directFile.read(byteArray, 0, length); } }
Source:
public void cleanup() { memoryStore.putLocal(Centroids.class.getName(), initialCentroids); }

Target:
public void cleanup() { memoryStore.putLocal(KEY_CENTROIDS, initialCentroids); }
Source:
private void propagate(RuntimeLayout runtimeLayout, long globalAddress, @Nullable ILogData data) { int numUnits = runtimeLayout.getLayout().getSegmentLength(globalAddress); for (int i = 1; i < numUnits; i++) { log.trace("Propogate[{}]: chain {}/{}", Token.of(runtimeLayout.getLayout().getEpoch(), globalAddress), i + 1, numUnits); try { if (data != null) { CFUtils.getUninterruptibly( runtimeLayout.getLogUnitClient(globalAddress, i) .write(data), OverwriteException.class); } else { Token token = new Token(runtimeLayout.getLayout().getEpoch(), globalAddress); CFUtils.getUninterruptibly(runtimeLayout .getLogUnitClient(globalAddress, i) .fillHole(token), OverwriteException.class); } } catch (OverwriteException oe) { log.trace("Propogate[{}]: Completed by other writer", globalAddress); } } }

Target:
private void propagate(RuntimeLayout runtimeLayout, long globalAddress, @Nullable ILogData data) { int numUnits = runtimeLayout.getLayout().getSegmentLength(globalAddress); for (int i = 1; i < numUnits; i++) { log.trace("Propagate[{}]: chain {}/{}", Token.of(runtimeLayout.getLayout().getEpoch(), globalAddress), i + 1, numUnits); try { if (data != null) { CFUtils.getUninterruptibly( runtimeLayout.getLogUnitClient(globalAddress, i) .write(data), OverwriteException.class); } else { Token token = new Token(runtimeLayout.getLayout().getEpoch(), globalAddress); CFUtils.getUninterruptibly(runtimeLayout .getLogUnitClient(globalAddress, i) .fillHole(token), OverwriteException.class); } } catch (OverwriteException oe) { log.info("Propagate[{}]: Completed by other writer", globalAddress); } } }
Source:
public Response add(GlusterVolume volume) { validateParameters(volume, "name", "volumeType", "glusterBricks"); GlusterVolumeEntity volumeEntity = getMapper(GlusterVolume.class, GlusterVolumeEntity.class).map(volume, null); volumeEntity.setClusterId(asGuid(clusterId)); return performCreation(VdcActionType.CreateGlusterVolume, new CreateGlusterVolumeParameters(volumeEntity), new QueryIdResolver(VdcQueryType.GetGlusterVolumeById, GetGlusterVolumeByIdQueryParameters.class), true); }

Target:
public Response add(GlusterVolume volume) { validateParameters(volume, "name", "volumeType", "bricks"); GlusterVolumeEntity volumeEntity = getMapper(GlusterVolume.class, GlusterVolumeEntity.class).map(volume, null); volumeEntity.setClusterId(asGuid(cluster.getId())); mapBricks(volume, volumeEntity); return performCreation(VdcActionType.CreateGlusterVolume, new CreateGlusterVolumeParameters(volumeEntity), new QueryIdResolver(VdcQueryType.GetGlusterVolumeById, GetGlusterVolumeByIdQueryParameters.class), true); }
Source:
public void setAttributesAsText(Object element, String text) { Descriptor descriptor = mDescriptorMap.get(element.getClass()); if (descriptor != null && descriptor instanceof TextViewDescriptor) { TextViewDescriptor textViewDescriptor = (TextViewDescriptor) descriptor; textViewDescriptor.setAttributeAsText((TextView) element, text); } }

Target:
public void setAttributesAsText(Object element, String text) { verifyThreadAccess(); Descriptor descriptor = mDescriptorMap.get(element.getClass()); if (descriptor != null) { descriptor.setAttributesAsText(element, text); } }
Source:
public static ExchangeException adapt(LatokenException e) { String message = e.getMessage(); if (StringUtils.isEmpty(message)) { message = "Operation failed without any error message"; } switch (e.getHttpStatusCode()) { case HttpURLConnection.HTTP_BAD_REQUEST: case HttpURLConnection.HTTP_UNAUTHORIZED: return new ExchangeException(message, e); case 428: return new RateLimitExceededException(message, e); } return new ExchangeException(message, e); }

Target:
public static ExchangeException adapt(LatokenException e) { String message = e.getMessage(); if (StringUtils.isEmpty(message)) { message = "Operation failed without any error message"; } switch (e.getHttpStatusCode()) { case HttpURLConnection.HTTP_BAD_REQUEST: return new ExchangeException(message, e); case HttpURLConnection.HTTP_UNAUTHORIZED: return new ExchangeSecurityException(message, e); case 428: return new RateLimitExceededException(message, e); } return new ExchangeException(message, e); }
Source:
public ZonedNanoTimeStamp(long epoch_millis, ZoneId zone) { if (zone == null) { throw new IllegalArgumentException("Zone cannot be null."); } timestamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(epoch_millis), zone); epoch = Instant.from(timestamp).getEpochSecond(); nanos = Instant.from(timestamp).getNano(); }

Target:
public ZonedNanoTimeStamp(long epoch_millis, ZoneId zone) { if (zone == null) { throw new IllegalArgumentException("Zone cannot be null."); } timestamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(epoch_millis), zone); epoch = timestamp.toEpochSecond(); nanos = timestamp.getNano(); }
Source:
public void testFetchWithBlobNoneFilter() throws Exception { InMemoryRepository server2 = newRepo("server2"); try (TestRepository<InMemoryRepository> remote2 = new TestRepository<>( server2)) { RevBlob blob1 = remote2.blob("foobar"); RevBlob blob2 = remote2.blob("fooba"); RevTree tree = remote2.tree(remote2.file("1", blob1), remote2.file("2", blob2)); RevCommit commit = remote2.commit(tree); remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", true); testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { @Override public UploadPack create(Object req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { UploadPack up = new UploadPack(db); return up; } }, null); uri = testProtocol.register(ctx, server2); try (Transport tn = testProtocol.open(uri, client, "server2")) { tn.setFilterSpec(FilterSpec.withBlobLimit((0))); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(commit.name()))); assertTrue(client.getObjectDatabase().has(tree.toObjectId())); assertFalse(client.getObjectDatabase().has(blob1.toObjectId())); assertFalse(client.getObjectDatabase().has(blob2.toObjectId())); } } }

Target:
public void testFetchWithBlobNoneFilter() throws Exception { InMemoryRepository server2 = newRepo("server2"); try (TestRepository<InMemoryRepository> remote2 = new TestRepository<>( server2)) { RevBlob blob1 = remote2.blob("foobar"); RevBlob blob2 = remote2.blob("fooba"); RevTree tree = remote2.tree(remote2.file("1", blob1), remote2.file("2", blob2)); RevCommit commit = remote2.commit(tree); remote2.update("master", commit); server2.getConfig().setBoolean("uploadpack", null, "allowfilter", true); testProtocol = new TestProtocol<>(new UploadPackFactory<Object>() { @Override public UploadPack create(Object req, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException { UploadPack up = new UploadPack(db); return up; } }, null); uri = testProtocol.register(ctx, server2); try (Transport tn = testProtocol.open(uri, client, "server2")) { tn.setFilterSpec(FilterSpec.withBlobLimit(0)); tn.fetch(NullProgressMonitor.INSTANCE, Collections.singletonList(new RefSpec(commit.name()))); assertTrue(client.getObjectDatabase().has(tree.toObjectId())); assertFalse(client.getObjectDatabase().has(blob1.toObjectId())); assertFalse(client.getObjectDatabase().has(blob2.toObjectId())); } } }
Source:
public void onReceive(final Object o) throws Exception { String eventTypeForLogging = "unknown"; Optional<String> uriForLogging = Optional.empty(); try { if (o instanceof NeedEvent) { eventTypeForLogging = "NeedEvent"; NeedEvent needEvent = (NeedEvent) o; uriForLogging = Optional.ofNullable(needEvent.getUri()); if (needEvent.getEventType().equals(NeedEvent.TYPE.ACTIVE)) { processActiveNeedEvent(needEvent); } else if (needEvent.getEventType().equals(NeedEvent.TYPE.INACTIVE)) { processInactiveNeedEvent(needEvent); } else { unhandled(o); } } else if (o instanceof BulkNeedEvent) { eventTypeForLogging = "BulkNeedEvent"; log.info("received bulk need event, processing need events ...", ((BulkNeedEvent) o).getNeedEvents().size()); for (NeedEvent event : ((BulkNeedEvent) o).getNeedEvents()) { processActiveNeedEvent(event); } } else { eventTypeForLogging = "unhandled"; unhandled(o); } } catch (Exception e) { log.info(String.format("Caught exception when processing %s event %s. More info on loglevel 'debug'", eventTypeForLogging, uriForLogging.orElse("[no uri available]"))); log.debug("caught exception", e); e.printStackTrace(); } }

Target:
public void onReceive(final Object o) throws Exception { String eventTypeForLogging = "unknown"; Optional<String> uriForLogging = Optional.empty(); try { if (o instanceof NeedEvent) { eventTypeForLogging = "NeedEvent"; NeedEvent needEvent = (NeedEvent) o; uriForLogging = Optional.ofNullable(needEvent.getUri()); if (needEvent.getEventType().equals(NeedEvent.TYPE.ACTIVE)) { processActiveNeedEvent(needEvent); } else if (needEvent.getEventType().equals(NeedEvent.TYPE.INACTIVE)) { processInactiveNeedEvent(needEvent); } else { unhandled(o); } } else if (o instanceof BulkNeedEvent) { eventTypeForLogging = "BulkNeedEvent"; log.info("received bulk need event, processing need events ...", ((BulkNeedEvent) o).getNeedEvents().size()); for (NeedEvent event : ((BulkNeedEvent) o).getNeedEvents()) { processActiveNeedEvent(event); } } else { eventTypeForLogging = "unhandled"; unhandled(o); } } catch (Exception e) { log.info(String.format("Caught exception when processing %s event %s. More info on loglevel 'debug'", eventTypeForLogging, uriForLogging.orElse("[no uri available]"))); log.debug("caught exception", e); if(log.isDebugEnabled()){ e.printStackTrace(); } } }
Source:
public void onConnect(String room, String serverAddress) { debugView.showPermanently(getString(R.string.connected)); switchableView.setDisplayedChild(1); lastServerPreferences.saveLastConnectedServer(serverAddress); joinHangoutRoom(room); }

Target:
public void onConnect(String room, String serverAddress) { debugView.showPermanently(getString(R.string.connected)); switchableView.setDisplayedChild(1); joinHangoutRoom(room); }
Source:
private Observable<ContentProviderOperation> createOperation(@NonNull final U item, @NonNull final Uri uri) { return Observable .fromCallable(() -> { try { locker.acquire(uri); Log.v(TAG, "Locked URI " + uri); } catch (InterruptedException e) { Log.e(TAG, "Thread interrupted", e); return NO_OPERATION; } final Cursor cursor = contentResolver.query(uri, getProjection(), null, null, null); U newItem = item; if (cursor == null || !cursor.moveToFirst()) { if (cursor != null) { cursor.close(); } Log.v(TAG, "Create insertion operation for " + uri); return ContentProviderOperation.newInsert(uri) .withValues(getContentValuesForItem(newItem)) .build(); } final U currentItem = read(cursor); boolean valuesEqual = newItem.equals(currentItem); if (!valuesEqual) { Log.v(TAG, "Merging values at " + uri); newItem = mergeValues(currentItem, newItem); valuesEqual = newItem.equals(currentItem); } cursor.close(); if (valuesEqual) { Log.v(TAG, "Data already up to date at " + uri); locker.release(uri); return NO_OPERATION; } Log.v(TAG, "Create update operation for " + uri); return ContentProviderOperation.newUpdate(uri) .withValues(getContentValuesForItem(newItem)) .build(); }) .filter(operation -> !NO_OPERATION.equals(operation)) .subscribeOn(Schedulers.io()); }

Target:
private Observable<ContentProviderOperation> createOperation(@NonNull final U item, @NonNull final Uri uri) { return Observable .fromCallable(() -> { locker.acquire(uri); final Cursor cursor = contentResolver.query(uri, getProjection(), null, null, null); if (cursor == null || !cursor.moveToFirst()) { if (cursor != null) { cursor.close(); } Log.v(TAG, "Create insertion operation for " + uri); return ContentProviderOperation.newInsert(uri) .withValues(getContentValuesForItem(item)) .build(); } final U currentItem = read(cursor); final U newItem = mergedItem(currentItem, item); cursor.close(); if (!newItem.equals(currentItem)) { Log.v(TAG, "Create update operation for " + uri); return ContentProviderOperation.newUpdate(uri) .withValues(getContentValuesForItem(newItem)) .build(); } Log.v(TAG, "Data already up to date at " + uri); return NO_OPERATION; }) .onErrorReturn(e -> NO_OPERATION) .doOnNext(operation -> releaseIfNoOp(operation, uri)) .filter(ContentProviderStoreCoreBase::isValidOperation); }
Source:
public Attribute getAttribute(PerunSession sess, Member member, Group group, String attributeName) throws InternalErrorException, AttributeNotExistsException { try { return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem") + " from attr_names " + "left join member_group_attr_values mem on id=mem.attr_id and mem.group_id=? and member_id=? " + "where attr_name=?", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), attributeName); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute name: \"" + attributeName +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }

Target:
public Attribute getAttribute(PerunSession sess, Member member, Group group, String attributeName) throws InternalErrorException, AttributeNotExistsException { try { return jdbc.queryForObject("select " + getAttributeMappingSelectQuery("mem_gr") + " from attr_names " + "left join member_group_attr_values mem_gr on id=mem_gr.attr_id and mem_gr.group_id=? and member_id=? " + "where attr_name=?", new AttributeRowMapper(sess, this, null), group.getId(), member.getId(), attributeName); } catch(EmptyResultDataAccessException ex) { throw new AttributeNotExistsException("Attribute name: \"" + attributeName +"\"", ex); } catch(RuntimeException ex) { throw new InternalErrorException(ex); } }
Source:
private void pop() { assert !_stack.isEmpty() : "Trying to pop empty stack"; DataComplex tmp = _stack.pop(); if (tmp instanceof DataMapBuilder) { tmp = ((DataMapBuilder) tmp).convertToDataMap(); } if (_stack.isEmpty()) { _result = (T) tmp; _expectedTokens = NONE; } else { _isCurrList = _stack.peek() instanceof DataList; if (!_isCurrList) { _currField = _currFieldStack.pop(); } addValue(tmp); updateExpected(); } }

Target:
private void pop() { assert !_stack.isEmpty() : "Trying to pop empty stack"; DataComplex tmp = _stack.pop(); tmp = postProcessDataComplex(tmp); if (_stack.isEmpty()) { _result = (T) tmp; _expectedTokens = NONE; } else { _isCurrList = _stack.peek() instanceof DataList; if (!_isCurrList) { _currField = _currFieldStack.pop(); } addValue(tmp); updateExpected(); } }
Source:
public void replaceInvalidEmptyStringMacAddressesWithNull(List<VmNetworkInterface> vmNetworkInterfaces) { vmNetworkInterfaces.stream() .filter(this::hasEmptyStringMacAddress) .forEach(e->e.setMacAddress(null)); }

Target:
public void replaceInvalidEmptyStringMacAddressesWithNull(List<VmNetworkInterface> vmNetworkInterfaces) { vmNetworkInterfaces.stream() .filter((vmNetworkInterface) -> StringUtils.isEmpty(vmNetworkInterface.getMacAddress())) .forEach(e->e.setMacAddress(null)); }
Source:
public ExtendedUserData(User user, PermissionsInterface authorizer) { Hibernate.initialize(user.getEntries()); try { this.canChangeUsername = user.getEntries().stream().noneMatch(Entry::getIsPublished) && !authorizer.isSharing(user) && user.getOrganizations().size() == 0; } catch (Exception e) { LOG.error("SAM is improperly configured."); this.canChangeUsername = false; } }

Target:
public ExtendedUserData(User user, PermissionsInterface authorizer) { Hibernate.initialize(user.getEntries()); try { this.canChangeUsername = user.getEntries().stream().noneMatch(Entry::getIsPublished) && !authorizer.isSharing(user) && user.getOrganizations().size() == 0; } catch (Exception e) { LOG.error("SAM is improperly configured.", e); this.canChangeUsername = false; } }