auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void parseDynamicValue(final ParseContext context, ObjectMapper parentMapper, String currentFieldName, XContentParser.Token token) throws IOException { ObjectMapper.Dynamic dynamic = dynamicOrDefault(parentMapper, context); if (dynamic == ObjectMapper.Dynamic.STRICT) { throw new StrictDynamicMappingException(parentMapper.fullPath(), currentFieldName); } if (dynamic == ObjectMapper.Dynamic.FALSE) { return; } final String path = context.path().pathAsText(currentFieldName); final Mapper.BuilderContext builderContext = new Mapper.BuilderContext(context.indexSettings().getSettings(), context.path()); final MappedFieldType existingFieldType = context.mapperService().fieldType(path); final Mapper.Builder builder; if (existingFieldType != null) { builder = createBuilderFromFieldType(context, existingFieldType, currentFieldName); } else { builder = createBuilderFromDynamicValue(context, token, currentFieldName); } Mapper mapper = builder.build(builderContext); context.addDynamicMapper(mapper); parseObjectOrField(context, mapper); }

Target:
private static void parseDynamicValue(final ParseContext context, ObjectMapper parentMapper, String currentFieldName, XContentParser.Token token) throws IOException { ObjectMapper.Dynamic dynamic = dynamicOrDefault(parentMapper, context); if (dynamic == ObjectMapper.Dynamic.STRICT) { throw new StrictDynamicMappingException(parentMapper.fullPath(), currentFieldName); } if (dynamic == ObjectMapper.Dynamic.FALSE) { return; } final Mapper.BuilderContext builderContext = new Mapper.BuilderContext(context.indexSettings().getSettings(), context.path()); final Mapper.Builder<?> builder = createBuilderFromDynamicValue(context, token, currentFieldName); Mapper mapper = builder.build(builderContext); context.addDynamicMapper(mapper); parseObjectOrField(context, mapper); }
Source:
public void testStackedMLP() { int firstLayerNeuronsCnt = 3; int secondLayerNeuronsCnt = 2; MLPConstInitializer initer = new MLPConstInitializer(1, 2); MLPArchitecture conf = new MLPArchitecture(4). withAddedLayer(firstLayerNeuronsCnt, false, Activators.SIGMOID). withAddedLayer(secondLayerNeuronsCnt, false, Activators.SIGMOID); MLP mlp = new MLP(conf, initer); MLPArchitecture mlpLayer1Conf = new MLPArchitecture(4). withAddedLayer(firstLayerNeuronsCnt, false, Activators.SIGMOID); MLPArchitecture mlpLayer2Conf = new MLPArchitecture(firstLayerNeuronsCnt). withAddedLayer(secondLayerNeuronsCnt, false, Activators.SIGMOID); MLP mlp1 = new MLP(mlpLayer1Conf, initer); MLP mlp2 = new MLP(mlpLayer2Conf, initer); MLP stackedMLP = mlp1.add(mlp2); Matrix predict = mlp.apply(new DenseLocalOnHeapMatrix(new double[][] {{1, 2, 3, 4}}).transpose()); Matrix stackedPredict = stackedMLP.apply(new DenseLocalOnHeapMatrix(new double[][] {{1, 2, 3, 4}}).transpose()); Assert.assertEquals(predict, stackedPredict); }

Target:
public void testStackedMLP() { int firstLayerNeuronsCnt = 3; int secondLayerNeuronsCnt = 2; MLPConstInitializer initer = new MLPConstInitializer(1, 2); MLPArchitecture conf = new MLPArchitecture(4). withAddedLayer(firstLayerNeuronsCnt, false, Activators.SIGMOID). withAddedLayer(secondLayerNeuronsCnt, false, Activators.SIGMOID); MultilayerPerceptron mlp = new MultilayerPerceptron(conf, initer); MLPArchitecture mlpLayer1Conf = new MLPArchitecture(4). withAddedLayer(firstLayerNeuronsCnt, false, Activators.SIGMOID); MLPArchitecture mlpLayer2Conf = new MLPArchitecture(firstLayerNeuronsCnt). withAddedLayer(secondLayerNeuronsCnt, false, Activators.SIGMOID); MultilayerPerceptron mlp1 = new MultilayerPerceptron(mlpLayer1Conf, initer); MultilayerPerceptron mlp2 = new MultilayerPerceptron(mlpLayer2Conf, initer); MultilayerPerceptron stackedMLP = mlp1.add(mlp2); Matrix predict = mlp.apply(new DenseLocalOnHeapMatrix(new double[][] {{1, 2, 3, 4}}).transpose()); Matrix stackedPredict = stackedMLP.apply(new DenseLocalOnHeapMatrix(new double[][] {{1, 2, 3, 4}}).transpose()); Assert.assertEquals(predict, stackedPredict); }
Source:
private Object objectInstance(String singleValue, List<String> multiValues) { Object obj = null; try { Class clazz = getEntityClass(); obj = clazz.newInstance(); PropertyUtil.setProperty(obj, CB_FIELD_SINGLE_NAME, singleValue); if (multiValues != null) { PropertyUtil.setProperty(obj, CB_FIELD_MULTI_NAME, new ArrayList<>(multiValues)); } } catch (Exception e) { LOGGER.error("Cannot create instance", e); return null; } return obj; }

Target:
private Object objectInstance(String singleValue, List<String> multiValues) throws Exception { Class clazz = getEntityClass(); Object obj = clazz.newInstance(); PropertyUtil.setProperty(obj, CB_FIELD_SINGLE_NAME, singleValue); if (multiValues != null) { PropertyUtil.setProperty(obj, CB_FIELD_MULTI_NAME, new ArrayList<>(multiValues)); } return obj; }
Source:
public void prepareRun(BatchSinkContext context) throws DatasetManagementException { super.prepareRun(context); String schemaString = tableSinkConfig.getSchemaStr(); if (schemaString != null) { try { Schema schema = Schema.parseJson(schemaString); if (schema.getFields() != null) { FieldOperation operation = new FieldWriteOperation("Write", "Writing to CDAP Table", EndPoint.of(context.getNamespace(), tableSinkConfig.getName()), schema.getFields().stream().map(Schema.Field::getName) .collect(Collectors.toList())); context.record(Collections.singletonList(operation)); } } catch (IOException e) { throw new IllegalStateException("Failed to parse schema", e); } } }

Target:
public void prepareRun(BatchSinkContext context) throws DatasetManagementException { super.prepareRun(context); String schemaString = tableSinkConfig.getSchemaStr(); if (schemaString != null) { try { Schema schema = Schema.parseJson(schemaString); if (schema.getFields() != null) { FieldOperation operation = new FieldWriteOperation("Write", "Wrote to CDAP Table", EndPoint.of(context.getNamespace(), tableSinkConfig.getName()), schema.getFields().stream().map(Schema.Field::getName) .collect(Collectors.toList())); context.record(Collections.singletonList(operation)); } } catch (IOException e) { throw new IllegalStateException("Failed to parse schema.", e); } } }
Source:
public boolean isDeleteQuery() { return getName().toLowerCase().startsWith("delete"); }

Target:
public boolean isDeleteQuery() { return getName().toLowerCase(Locale.ROOT).startsWith("delete"); }
Source:
public static <TClass, TAnnotation extends Annotation> void scanClasspath(Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { FastClasspathScanner fcs; if (requirePackage != null) { fcs = new FastClasspathScanner(requirePackage); } else { fcs = new FastClasspathScanner(); } List<String> matches = fcs.scan() .getNamesOfClassesWithAnnotation(annotationClass.getName()); for (String className : matches) { Class<?> clazz; try { System.setErr(NULL_PRINT_STREAM); clazz = Class.forName(className); System.setErr(ERR_PRINT_STREAM); } catch (ClassNotFoundException e) { log.trace("Cannot load class " + className, e); return; } catch (NoClassDefFoundError e) { log.trace("Cannot load class " + className, e); return; } catch (LinkageError e) { log.trace("Cannot load class " + className, e); return; } catch (Throwable e) { log.trace("Cannot load class " + className, e); return; } TAnnotation annotation = clazz.getAnnotation(annotationClass); if (annotation != null) { if (!superClass.isAssignableFrom(clazz)) { return; } consumer.accept((Class<? extends TClass>) clazz); } } }

Target:
public static <TClass, TAnnotation extends Annotation> void scanClasspath(Class<TClass> superClass, Class<TAnnotation> annotationClass, String requirePackage, Consumer<Class<? extends TClass>> consumer) { FastClasspathScanner fcs; if (requirePackage != null) { fcs = new FastClasspathScanner(requirePackage, superClass.getName()); } else { fcs = new FastClasspathScanner(superClass.getName()); } List<String> matches = fcs.scan() .getNamesOfClassesWithAnnotation(annotationClass.getName()); log.debug("Found " + matches.size() + " classes with annotation '" + annotationClass.getName() + "'"); for (String className : matches) { Class<?> clazz; try { clazz = Class.forName(className); consumer.accept((Class<? extends TClass>) clazz); } catch (Throwable e) { log.trace("Cannot load class " + className, e); return; } } }
Source:
public Builder explicitlySetWebsocketEndpointAndDiscovery(URI endpoint, boolean performWebsocketEndpointDiscovery) { if (endpoint == null) { throw new IllegalArgumentException("Provided endpoint URI must not be null"); } this.uri = endpoint; this.performWebsocketEndpointDiscovery = performWebsocketEndpointDiscovery; return this; }

Target:
public Builder explicitlySetWebsocketEndpointAndDiscovery(URI endpoint, boolean performWebsocketEndpointDiscovery) { Objects.requireNonNull(endpoint, "Provided endpoint URI must not be null"); this.uri = endpoint; this.performWebsocketEndpointDiscovery = performWebsocketEndpointDiscovery; return this; }
Source:
public String getUuidPathLikeIncludingSelf() { return DaoDatabaseUtils.buildLikeValue(formatUuidPathFromParent(this), WildcardPosition.AFTER); }

Target:
public String getUuidPathLikeIncludingSelf() { return buildLikeValue(formatUuidPathFromParent(this), WildcardPosition.AFTER); }
Source:
public final void issueResourceRequest(SamzaResourceRequest request) { resourceRequestState.addResourceRequest(request); state.containerRequests.incrementAndGet(); if (ResourceRequestState.ANY_HOST.equals(request.getPreferredHost())) { state.anyHostRequests.incrementAndGet(); } else { state.preferredHostRequests.incrementAndGet(); } if (request.getFaultDomains() != null && !request.getFaultDomains().isEmpty()) { state.faultDomainAwareContainerRequests.incrementAndGet(); } }

Target:
public final void issueResourceRequest(SamzaResourceRequest request) { resourceRequestState.addResourceRequest(request); state.containerRequests.incrementAndGet(); if (ResourceRequestState.ANY_HOST.equals(request.getPreferredHost())) { state.anyHostRequests.incrementAndGet(); } else { state.preferredHostRequests.incrementAndGet(); } if (!request.getFaultDomains().isEmpty()) { state.faultDomainAwareContainerRequests.incrementAndGet(); } }
Source:
public void testBingTilesWithRadiusBadInput() { assertInvalidFunction("bing_tiles_around(30.12, 60.0, 1, -1)", "Radius must be >= 0"); assertInvalidFunction("bing_tiles_around(30.12, 60.0, 1, 2000)", "Radius must be <= 1,000 km"); assertInvalidFunction("bing_tiles_around(30.12, 60.0, 20, 100)", "The number of tiles covering input rectangle exceeds the limit of 1M. Number of tiles: 36699364. Radius_km: 100.0. Zoom level: 20."); }

Target:
public void testBingTilesWithRadiusBadInput() { assertInvalidFunction("bing_tiles_around(30.12, 60.0, 1, -1)", "Radius must be >= 0"); assertInvalidFunction("bing_tiles_around(30.12, 60.0, 1, 2000)", "Radius must be <= 1,000 km"); assertInvalidFunction("bing_tiles_around(30.12, 60.0, 20, 100)", "The number of tiles covering input rectangle exceeds the limit of 1M. Number of tiles: 36699364. Radius: 100.0 km. Zoom level: 20."); }
Source:
public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { if (ListenableFuture.class != TypeToken.of(returnType).getRawType()) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new IllegalStateException("ListenableFuture return type must be parameterized" + " as ListenableFuture<Foo> or ListenableFuture<? extends Foo>"); } Type innerType = ((ParameterizedType) returnType).getActualTypeArguments()[0]; if (innerType instanceof WildcardType) { innerType = ((WildcardType) innerType).getUpperBounds()[0]; } if (Response.class != TypeToken.of(innerType).getRawType()) { return new BodyCallAdapter(innerType); } if (!(innerType instanceof ParameterizedType)) { throw new IllegalStateException("Response must be parameterized" + " as Response<Foo> or Response<? extends Foo>"); } Type responseType = ((ParameterizedType) innerType).getActualTypeArguments()[0]; if (responseType instanceof WildcardType) { responseType = ((WildcardType) responseType).getUpperBounds()[0]; } return new ResponseCallAdapter(responseType); }

Target:
public CallAdapter<?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { if (TypeToken.of(returnType).getRawType() != ListenableFuture.class) { return null; } if (!(returnType instanceof ParameterizedType)) { throw new IllegalStateException("ListenableFuture return type must be parameterized" + " as ListenableFuture<Foo> or ListenableFuture<? extends Foo>"); } Type innerType = ((ParameterizedType) returnType).getActualTypeArguments()[0]; if (innerType instanceof WildcardType) { innerType = ((WildcardType) innerType).getUpperBounds()[0]; } if (TypeToken.of(innerType).getRawType() != Response.class) { return new BodyCallAdapter(innerType); } if (!(innerType instanceof ParameterizedType)) { throw new IllegalStateException("Response must be parameterized" + " as Response<Foo> or Response<? extends Foo>"); } Type responseType = ((ParameterizedType) innerType).getActualTypeArguments()[0]; if (responseType instanceof WildcardType) { responseType = ((WildcardType) responseType).getUpperBounds()[0]; } return new ResponseCallAdapter(responseType); }
Source:
public BeanIdentifier deprefix(String id) { String deprefixed = id.substring(getPrefix().length() + getDelimiter().length()); if (deprefixed.startsWith(FALLBACK_FLAG)) { return new StringBeanIdentifier(deprefixed.substring(FALLBACK_FLAG.length())); } try { return index.getIdentifier(Integer.valueOf(deprefixed)); } catch (NumberFormatException e) { throw new IllegalStateException("Unable to deprefix invalid identifier", e); } }

Target:
public BeanIdentifier deprefix(String id) { String deprefixed = id.substring(getPrefix().length() + getDelimiter().length()); if (deprefixed.startsWith(FALLBACK_FLAG)) { return new StringBeanIdentifier(deprefixed.substring(FALLBACK_FLAG.length())); } try { return index.getIdentifier(Integer.valueOf(deprefixed)); } catch (NumberFormatException e) { throw new IllegalStateException("Unable to deprefix id:" + id, e); } }
Source:
public synchronized T obtain(Map flags) throws NoMachinesAvailableException { if (singleLocation == null) { if (provisioningLocation == null) provisioningLocation = (MachineProvisioningLocation) getManagementContext().getLocationRegistry().resolve( location); singleLocation = provisioningLocation.obtain(flags); inUse.add(singleLocation); } else { if (flags != null && locationFlags == null) { locationFlags = ImmutableMap.builder().putAll(flags).build(); } if (!Objects.equal(flags, locationFlags)) { log.warn("Flags passed to subsequent call to newLocationFromString will be ignored, using {}", flags, locationFlags); } } referenceCount++; return singleLocation; }

Target:
public synchronized T obtain(Map flags) throws NoMachinesAvailableException { log.info("Flags passed to newLocationFromString will be ignored, using {}", flags, locationFlags); return obtain(); }
Source:
private ResponseEntity<?> createSubscription(final SubscriptionBase subscriptionBase, final NativeWebRequest request, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION) && !applicationService.exists(subscriptionBase.getOwningApplication())) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), ExceptionWrapper.wrapFunction(eventTypeRepository::findByNameO))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { return create(UNPROCESSABLE_ENTITY, createErrorMessage(missingEventTypes), request); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); UriComponents components = SUBSCRIPTION_PATH.buildAndExpand(subscription.getId()); return status(HttpStatus.CREATED) .location(components.toUri()) .header(HttpHeaders.CONTENT_LOCATION, components.toString()) .body(subscription); }

Target:
private ResponseEntity<?> createSubscription(final SubscriptionBase subscriptionBase, final NativeWebRequest request, final Client client) throws InternalNakadiException, DuplicatedSubscriptionException, ServiceUnavailableException { if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION) && !applicationService.exists(subscriptionBase.getOwningApplication())) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } final Map<String, Optional<EventType>> eventTypeMapping = subscriptionBase.getEventTypes().stream() .collect(Collectors.toMap(Function.identity(), ExceptionWrapper.wrapFunction(eventTypeRepository::findByNameO))); final List<String> missingEventTypes = eventTypeMapping.entrySet().stream() .filter(entry -> !entry.getValue().isPresent()) .map(Map.Entry::getKey) .collect(Collectors.toList()); if (!missingEventTypes.isEmpty()) { return create(UNPROCESSABLE_ENTITY, createErrorMessage(missingEventTypes), request); } eventTypeMapping.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(eventType -> client.checkScopes(eventType.getReadScopes())); final Subscription subscription = subscriptionRepository.createSubscription(subscriptionBase); final UriComponents location = SUBSCRIPTION_PATH.buildAndExpand(subscription.getId()); return status(HttpStatus.CREATED) .location(location.toUri()) .header(HttpHeaders.CONTENT_LOCATION, location.toString()) .body(subscription); }
Source:
public String toString() { StringBuilder result = new StringBuilder(); for (String key : keySet()) { result.append(key); result.append(": \""); result.append(get(key)); result.append("\"\n"); } return result.toString(); }

Target:
public String toString() { StringBuilder result = new StringBuilder(getClass().getSimpleName()); result.append(": {\n"); for (Map.Entry<String, Object> entry : valueSet()) { result.append(entry.getKey()); result.append(": \""); result.append(entry.getValue()); result.append("\"\n"); } result.append("}\n"); return result.toString(); }
Source:
public void canParseNamedCaptureGroupsFromPattern() { assertThat(RegexUtils.getNamedCaptureGroupsFromPattern(""), hasSize(0)); assertThat(RegexUtils.getNamedCaptureGroupsFromPattern("(?<user>.*)"), contains("user")); assertThat(RegexUtils.getNamedCaptureGroupsFromPattern("Node /(?<poolName>.*?)/(?<poolMember>\\S+) address (?<poolAddr>\\S+) monitor status down. .*\\(slot(?<slotNum>[0-9]+)\\)"), containsInAnyOrder("poolName", "poolMember", "poolAddr", "slotNum")); }

Target:
public void canParseNamedCaptureGroupsFromPattern() { assertThat(RegexUtils.getNamedCaptureGroupsFromPattern(""), hasSize(0)); assertThat(RegexUtils.getNamedCaptureGroupsFromPattern("(?<user>.*)"), contains("user")); assertThat(RegexUtils.getNamedCaptureGroupsFromPattern("Node /(?<poolName>.*?)/(?<poolMember>\\S+) address (?<poolAddr>\\S+) monitor status down. .*\\(slot(?<slotNum>[0-9]+)\\)"), contains("poolName", "poolMember", "poolAddr", "slotNum")); }
Source:
private Callable<Boolean> canCreateKeyValueService() { return () -> { ConnectionManagerAwareDbKvs kvs = null; try { kvs = createKvs(); try (Connection connection = kvs.getConnectionManager().getConnection()) { return connection.isValid(FIVE_SECONDS); } } catch (Exception ex) { if (ex.getMessage().contains("The connection attempt failed.") || ex.getMessage().contains("the database system is starting up")) { return false; } else { throw ex; } } finally { if (kvs != null) { kvs.close(); } } }; }

Target:
private Callable<Boolean> canCreateKeyValueService() { return () -> { try (ConnectionManagerAwareDbKvs kvs = createKvs()) { try (Connection connection = kvs.getConnectionManager().getConnection()) { return connection.isValid(FIVE_SECONDS); } } catch (Exception ex) { if (ex.getMessage().contains("The connection attempt failed.") || ex.getMessage().contains("the database system is starting up")) { return false; } else { throw ex; } } }; }
Source:
private void addNewPaymentDetailToGroupIfTotalIsPositive(PdpFeedGroupEntry newGroupEntry, PdpFeedDetailEntry newDetailEntry, KualiDecimal originalDetailTransactionTotal) { if (LOG.isDebugEnabled()) { LOG.debug("addNewPaymentDetailToGroup, total transaction for " + newDetailEntry.getSourceDocNbr() + " detail: " + originalDetailTransactionTotal); } if (originalDetailTransactionTotal.isPositive()) { newGroupEntry.getDetail().add(newDetailEntry); } else { if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("addNewPaymentDetailToGroup SAE transactions summed to"); if (originalDetailTransactionTotal.isNegative()) { sb.append(" a negative amount in PDP, so it will be handled by collector."); } else { sb.append(" a zero amount in PDP, so no payment needs to be issued"); } LOG.debug(sb.toString()); } } }

Target:
private void addNewPaymentDetailToGroupIfTotalIsPositive(PdpFeedGroupEntry newGroupEntry, PdpFeedDetailEntry newDetailEntry, KualiDecimal originalDetailTransactionTotal) { if (LOG.isDebugEnabled()) { LOG.debug("addNewPaymentDetailToGroupIfTotalIsPositive, total transaction for " + newDetailEntry.getSourceDocNbr() + " detail: " + originalDetailTransactionTotal); } if (originalDetailTransactionTotal.isPositive()) { newGroupEntry.getDetail().add(newDetailEntry); } else { if (LOG.isDebugEnabled()) { StringBuilder sb = new StringBuilder("addNewPaymentDetailToGroupIfTotalIsPositive SAE transactions summed to"); if (originalDetailTransactionTotal.isNegative()) { sb.append(" a negative amount in PDP, so it will be handled by collector."); } else { sb.append(" a zero amount in PDP, so no payment needs to be issued"); } LOG.debug(sb.toString()); } } }
Source:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); InterceptorMethodParametersResolver parametersResolver = new InterceptorMethodParametersResolver(container); CacheStore<Class<?>, InterceptorHandler> cachedHandlers = new DefaultCacheStore<>(); factory = new DefaultInterceptorHandlerFactory(container, stepInvoker, parametersResolver, cachedHandlers, null); }

Target:
public void setUp() throws Exception { MockitoAnnotations.initMocks(this); InterceptorMethodParametersResolver parametersResolver = new InterceptorMethodParametersResolver(container); CacheStore<Class<?>, InterceptorHandler> cachedHandlers = new DefaultCacheStore<>(); factory = new DefaultInterceptorHandlerFactory(container, stepInvoker, parametersResolver, cachedHandlers, simpleStack); }
Source:
void addRow(List<WebElement> tableRows, String title, WebElement dialog) { for (WebElement tableRow : tableRows) { if (Browser.getCellDataByRow(tableRow, 0).equals(title)) { clickLinkOfTableRow(tableRow); try { Thread.sleep(1*1000); } catch (InterruptedException e) { Logger logger = LogManager.getLogger(Browser.class); logger.error(e.getMessage()); } Browser.closeDialog(dialog); return; } } throw new NoSuchElementException("No row for given value found: " + title); }

Target:
void addRow(List<WebElement> tableRows, String title, WebElement dialog) { for (WebElement tableRow : tableRows) { if (Browser.getCellDataByRow(tableRow, 0).equals(title)) { clickLinkOfTableRow(tableRow); try { Thread.sleep(3 * 1000); } catch (InterruptedException e) { Logger logger = LogManager.getLogger(EditPage.class); logger.error(e.getMessage(), e); } Browser.closeDialog(dialog); return; } } throw new NoSuchElementException("No row for given value found: " + title); }
Source:
private byte[] toJSONStringCompressed() { String str = m_configJSON.get(); if (str == null || str.length() == 0) { return new byte[0] ; } byte[] outStr; try { outStr = compressJSONString(str); } catch (IOException e) { throw new RuntimeException("Failed to serialized Hashinator Configuration to Compressed JSON .", e); } return outStr; }

Target:
private byte[] toJSONStringCompressed() { String str = toJSONString(); if (str == null || str.length() == 0) { return new byte[0] ; } byte[] outStr; try { outStr = compressJSONString(str); } catch (IOException e) { throw new RuntimeException("Failed to serialize Hashinator Configuration to Compressed JSON .", e); } return outStr; }
Source:
public static ZonedDateTime toZonedDateTime(Date date) { if (date == null) { return null; } return ofInstant(date.toInstant(), ZoneId.of("UTC")); }

Target:
public static ZonedDateTime toZonedDateTime(Date date) { if (date == null) { return null; } return ZonedDateTime.ofInstant(date.toInstant(), ZoneOffset.UTC); }
Source:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (item.getClass() == SwitchItem.class) { return; } if (item.getClass() == ContactItem.class) { return; } if (item.getClass() == NumberItem.class) { return; } if (item.getClass() == RollershutterItem.class) { return; } throw new BindingConfigParseException( "item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', only Switch, RS, Contact or Number are allowed - please check your *.items configuration"); }

Target:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (item.getClass() == SwitchItem.class) { return; } if (item.getClass() == ContactItem.class) { return; } if (item.getClass() == NumberItem.class) { return; } if (item.getClass() == RollershutterItem.class) { return; } throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', only Switch, Rollershutter, Contact or Number are allowed - please check your *.items configuration"); }
Source:
public void run() { if (isSuspending()) { suspended(); return; } if (SequenceTracer.isEnabled()) { SequenceTracer.startFrom(callerThread, "Work " + getTitleOr("unknown"), " #7acde9"); } RuntimeException suppressed = null; int retryCount = getRetryCount(); for (int i = 0; i <= retryCount; i++) { if (i > 0) { log.debug("Retrying work due to concurrent update (" + i + "): " + this); log.trace("Concurrent update", suppressed); } if (ExceptionUtils.hasInterruptedCause(suppressed)) { log.debug("No need to retry the work with id=" + getId() + ", work manager is shutting down"); break; } try { runWorkWithTransaction(); SequenceTracer.stop("Work done " + (completionTime - startTime) + " ms"); return; } catch (RuntimeException e) { if (suppressed == null) { suppressed = e; } else { suppressed.addSuppressed(e); } } } workFailed(suppressed, retryCount); }

Target:
public void run() { if (isSuspending()) { suspended(); return; } if (SequenceTracer.isEnabled()) { SequenceTracer.startFrom(callerThread, "Work " + getTitleOr("unknown"), " #7acde9"); } RuntimeException suppressed = null; int retryCount = getRetryCount(); for (int i = 0; i <= retryCount; i++) { if (i > 0) { log.debug("Retrying work due to concurrent update (" + i + "): " + this); log.trace("Concurrent update", suppressed); } if (ExceptionUtils.hasInterruptedCause(suppressed)) { log.debug("No need to retry the work with id=" + getId() + ", work manager is shutting down"); break; } try { runWorkWithTransaction(); SequenceTracer.stop("Work done " + (completionTime - startTime) + " ms"); return; } catch (RuntimeException e) { if (suppressed == null) { suppressed = e; } else { suppressed.addSuppressed(e); } } } workFailed(suppressed); }
Source:
public void testExecuteQueryCommand() { GetDiskImageByDiskAndImageIdsParameters params = getQueryParameters(); when(params.getDiskId()).thenReturn(diskId); when(params.getImageId()).thenReturn(imageId); when(diskImageDao.getDiskImageByDiskAndImageIds(diskId, imageId)).thenReturn(diskImage); GetDiskImageByDiskAndImageIdsQuery<GetDiskImageByDiskAndImageIdsParameters> query = getQuery(); query.executeQueryCommand(); DiskImage returnDiskImage = query.getQueryReturnValue().getReturnValue(); assertEquals(returnDiskImage, diskImage); }

Target:
public void testExecuteQueryCommand() { GetDiskImageByDiskAndImageIdsParameters params = getQueryParameters(); when(params.getDiskId()).thenReturn(diskId); when(params.getImageId()).thenReturn(imageId); when(diskImageDao.getDiskImageByDiskAndImageIds( diskId, imageId, getUser().getId(), getQueryParameters().isFiltered())).thenReturn(diskImage); GetDiskImageByDiskAndImageIdsQuery<GetDiskImageByDiskAndImageIdsParameters> query = getQuery(); query.executeQueryCommand(); DiskImage returnDiskImage = query.getQueryReturnValue().getReturnValue(); assertEquals(returnDiskImage, diskImage); }
Source:
public Block intersect( @TypeParameter("E") Type type, @SqlType("array(E)") Block leftArray, @SqlType("array(E)") Block rightArray) { if (leftArray.getPositionCount() < rightArray.getPositionCount()) { Block tempArray = leftArray; leftArray = rightArray; rightArray = tempArray; } int leftPositionCount = leftArray.getPositionCount(); int rightPositionCount = rightArray.getPositionCount(); if (rightPositionCount == 0) { return rightArray; } if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); TypedSet rightTypedSet = new TypedSet(type, rightPositionCount, "array_intersect"); for (int i = 0; i < rightPositionCount; i++) { rightTypedSet.add(rightArray, i); } TypedSet intersectTypedSet = new TypedSet(type, rightPositionCount, "array_intersect"); int intersectCount = 0; for (int i = 0; i < leftPositionCount; i++) { if (rightTypedSet.contains(leftArray, i) && !intersectTypedSet.contains(leftArray, i)) { intersectTypedSet.add(leftArray, i); type.appendTo(leftArray, i, blockBuilder); intersectCount++; } } return blockBuilder.getRegion(blockBuilder.getPositionCount() - intersectCount, intersectCount); }

Target:
public Block intersect( @TypeParameter("E") Type type, @SqlType("array(E)") Block leftArray, @SqlType("array(E)") Block rightArray) { if (leftArray.getPositionCount() < rightArray.getPositionCount()) { Block tempArray = leftArray; leftArray = rightArray; rightArray = tempArray; } int leftPositionCount = leftArray.getPositionCount(); int rightPositionCount = rightArray.getPositionCount(); if (rightPositionCount == 0) { return rightArray; } if (pageBuilder.isFull()) { pageBuilder.reset(); } TypedSet rightTypedSet = new TypedSet(type, rightPositionCount, "array_intersect"); for (int i = 0; i < rightPositionCount; i++) { rightTypedSet.add(rightArray, i); } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(0); TypedSet intersectTypedSet = new TypedSet(type, blockBuilder, rightPositionCount, "array_intersect"); for (int i = 0; i < leftPositionCount; i++) { if (rightTypedSet.contains(leftArray, i)) { intersectTypedSet.add(leftArray, i); } } pageBuilder.declarePositions(intersectTypedSet.size()); return blockBuilder.getRegion(blockBuilder.getPositionCount() - intersectTypedSet.size(), intersectTypedSet.size()); }
Source:
private ModelNode convertToExpectedType(final ModelNode node) { if (node.getType() == type || node.getType() == ModelType.EXPRESSION || Util.isExpression(node.asString()) || !node.isDefined()) { return node; } ModelNode result = node.clone(); switch (type) { case BIG_DECIMAL: result.set(node.asBigDecimal()); break; case BIG_INTEGER: result.set(node.asBigInteger()); break; case BOOLEAN: result.set(node.asBoolean()); break; case BYTES: result.set(node.asBytes()); break; case DOUBLE: result.set(node.asDouble()); break; case INT: result.set(node.asInt()); break; case LIST: result.set(node.asList()); break; case LONG: result.set(node.asLong()); break; case PROPERTY: result.set(node.asProperty()); break; case TYPE: result.set(node.asType()); break; case STRING: result.set(node.asString()); break; case OBJECT: default: result.set(node); break; } return result; }

Target:
private ModelNode convertToExpectedType(final ModelNode node) { if (node.getType() == type || node.getType() == ModelType.EXPRESSION || Util.isExpression(node.asString()) || !node.isDefined()) { return node; } switch (type) { case BIG_DECIMAL: return new ModelNode(node.asBigDecimal()); case BIG_INTEGER: return new ModelNode(node.asBigInteger()); case BOOLEAN: return new ModelNode(node.asBoolean()); case BYTES: return new ModelNode(node.asBytes()); case DOUBLE: return new ModelNode(node.asDouble()); case INT: return new ModelNode(node.asInt()); case LIST: return new ModelNode().set(node.asList()); case LONG: return new ModelNode(node.asLong()); case PROPERTY: return new ModelNode().set(node.asProperty()); case TYPE: return new ModelNode(node.asType()); case STRING: return new ModelNode(node.asString()); case OBJECT: default: return node; } }
Source:
public void deleteTrace(List<Connection> toDelete, EObject traceModel) { GenericTraceModel TModel = (GenericTraceModel) traceModel; EList<RelatedTo> links = TModel.getTraces(); ResourceSet resourceSet = new ResourceSetImpl(); for (Connection c : toDelete) { links.remove(c.getTlink()); } GenericTraceModel newTraceModel = GenericTraceMetaModelFactory.eINSTANCE.createGenericTraceModel(); newTraceModel.getTraces().addAll(links); URI traceModelURI = EcoreUtil.getURI(traceModel); Resource resourceForTraces = resourceSet.createResource(traceModelURI); resourceForTraces.getContents().add(newTraceModel); try { resourceForTraces.save(null); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void deleteTrace(List<Connection> toDelete, EObject traceModel) { if(traceModel instanceof GenericTraceModel) { GenericTraceModel TModel = (GenericTraceModel) traceModel; EList<RelatedTo> links = TModel.getTraces(); ResourceSet resourceSet = new ResourceSetImpl(); for (Connection c : toDelete) { links.remove(c.getTlink()); } GenericTraceModel newTraceModel = GenericTraceMetaModelFactory.eINSTANCE.createGenericTraceModel(); newTraceModel.getTraces().addAll(links); URI traceModelURI = EcoreUtil.getURI(traceModel); Resource resourceForTraces = resourceSet.createResource(traceModelURI); resourceForTraces.getContents().add(newTraceModel); try { resourceForTraces.save(null); } catch (IOException e) { e.printStackTrace(); } } }
Source:
private Map<Guid, GlusterAsyncTask> updateTasksInCluster(final VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } for (Entry<Guid, GlusterAsyncTask> entry : runningTasks.entrySet()) { Guid taskId = entry.getKey(); final GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); if (steps == null || steps.isEmpty()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { try { createJobToMonitor(cluster,task); } catch (VdcBLLException e) { log.error("Error creating job for task from CLI", e); } return null; } }); } else { for (Step step: steps) { if (step.getEndTime() != null) { continue; } step.setDescription(getTaskMessage(cluster,step.getStepType(),task)); if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } } return runningTasks; }

Target:
private Map<Guid, GlusterAsyncTask> updateTasksInCluster(final VDSGroup cluster) { if (!supportsGlusterAsyncTasksFeature(cluster)) { return null; } Map<Guid, GlusterAsyncTask> runningTasks = getProvider().getTaskListForCluster(cluster.getId()); if (runningTasks == null) { return null; } for (Entry<Guid, GlusterAsyncTask> entry : runningTasks.entrySet()) { Guid taskId = entry.getKey(); final GlusterAsyncTask task = entry.getValue(); List<Step> steps = getStepDao().getStepsByExternalId(taskId); if (steps.isEmpty()) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { try { createJobToMonitor(cluster,task); } catch (VdcBLLException e) { log.error("Error creating job for task from CLI", e); } return null; } }); } for (Step step: steps) { if (step.getEndTime() != null) { continue; } step.setDescription(getTaskMessage(cluster,step.getStepType(),task)); if (hasTaskCompleted(task)) { step.markStepEnded(task.getStatus()); endStepJob(step); releaseVolumeLock(task.getTaskId()); } else { getJobRepository().updateStep(step); } } } return runningTasks; }
Source:
public void testUpdateFeedbackSession() throws Exception { restoreTypicalDataInDatastore(); FeedbackSessionAttributes fsa = null; ______TS("failure 1: null object"); try { fsLogic.updateFeedbackSession(fsa); signalFailureToDetectException(); } catch (AssertionError ae) { AssertHelper.assertContains(Const.StatusCodes.NULL_PARAMETER, ae.getMessage()); } catch (Exception e) { signalDetectionOfWrongException("Expected AssertionError"); } ______TS("failure 2: non-existent session name"); fsa = new FeedbackSessionAttributes(); fsa.feedbackSessionName = "asdf_randomName1423"; fsa.courseId = "idOfTypicalCourse1"; try { fsLogic.updateFeedbackSession(fsa); signalFailureToDetectException(); } catch (EntityDoesNotExistException edne) { assertEquals("Trying to update a feedback session that does not exist.", edne.getMessage()); } catch (Exception e) { signalDetectionOfWrongException("Expected EntityDoesNotExistException"); } ______TS("success 1: all changeable values sent are null"); fsa = dataBundle.feedbackSessions.get("session1InCourse1"); fsa.instructions = null; fsa.startTime = null; fsa.endTime = null; fsa.feedbackSessionType = null; fsa.sessionVisibleFromTime = null; fsa.resultsVisibleFromTime = null; try { fsLogic.updateFeedbackSession(fsa); } catch (Exception e) { signalDetectionOfWrongException("No Exceptions Expected"); } assertEquals(fsa.toString(), fsLogic.getFeedbackSession(fsa.feedbackSessionName, fsa.courseId).toString()); }

Target:
public void testUpdateFeedbackSession() throws Exception { restoreTypicalDataInDatastore(); FeedbackSessionAttributes fsa = null; ______TS("failure 1: null object"); try { fsLogic.updateFeedbackSession(fsa); signalFailureToDetectException(); } catch (AssertionError ae) { AssertHelper.assertContains(Const.StatusCodes.NULL_PARAMETER, ae.getMessage()); } ______TS("failure 2: non-existent session name"); fsa = new FeedbackSessionAttributes(); fsa.feedbackSessionName = "asdf_randomName1423"; fsa.courseId = "idOfTypicalCourse1"; try { fsLogic.updateFeedbackSession(fsa); signalFailureToDetectException(); } catch (EntityDoesNotExistException edne) { assertEquals("Trying to update a feedback session that does not exist.", edne.getMessage()); } ______TS("success 1: all changeable values sent are null"); fsa = dataBundle.feedbackSessions.get("session1InCourse1"); fsa.instructions = null; fsa.startTime = null; fsa.endTime = null; fsa.feedbackSessionType = null; fsa.sessionVisibleFromTime = null; fsa.resultsVisibleFromTime = null; fsLogic.updateFeedbackSession(fsa); assertEquals(fsa.toString(), fsLogic.getFeedbackSession(fsa.feedbackSessionName, fsa.courseId).toString()); }
Source:
public static DateTimeZone getTimeZone(String timezoneParam) { try { return DateTimeZone.forID(timezoneParam); } catch (final IllegalArgumentException e) { TimeZone zone = ZoneInfo.getTimeZone(timezoneParam); if(null == zone) return null; try { return DateTimeZone.forTimeZone(zone); } catch (final IllegalArgumentException e1) { return null; } } }

Target:
public static DateTimeZone getTimeZone(String timezoneParam) { try { return DateTimeZone.forID(timezoneParam); } catch (final IllegalArgumentException e) { TimeZone zone = ZoneInfo.getTimeZone(timezoneParam); if(null == zone) { return null; } try { return DateTimeZone.forTimeZone(zone); } catch (final IllegalArgumentException e1) { return null; } } }
Source:
private void writeMapToDisk(String prefix, byte[] userMapBytes) throws Exception { File cacheDir = new File(commonCacheConfig.getCacheDirectory()); cacheDir.mkdirs(); File userMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); Files.write(userMapBytes, userMapFile); }

Target:
private void writeMapToDisk(String prefix, byte[] userMapBytes) throws IOException { File cacheDir = new File(commonCacheConfig.getCacheDirectory()); cacheDir.mkdirs(); File userMapFile = new File(commonCacheConfig.getCacheDirectory(), getUserRoleMapFilename(prefix)); Files.write(userMapBytes, userMapFile); }
Source:
public String toString(){ StringBuffer sb = new StringBuffer(); for (int i = 0; i < size.width + 3; i++){ sb.append("-"); } sb.append("\n"); for (int i = 0; i < squares.length; i++){ sb.append("|"); for (int j = 0; j < squares[i].length; j++){ sb.append(squares[i][j].toString()); } sb.append("|\n"); } for (int i = 0; i < size.width + 3; i++){ sb.append("-"); } return sb.toString(); }

Target:
public String toString(){ StringBuffer sb = new StringBuffer(); final int EXTRA_WIDTH = 2; for (int i = 0; i < size.width + EXTRA_WIDTH; i++){ sb.append("-"); } sb.append("\n"); for (int j = 0; j < size.height; j++){ sb.append("|"); for (int i = 0; i < size.width; i++){ sb.append(squares[j][i].toString()); } sb.append("|\n"); } for (int i = 0; i < size.width + EXTRA_WIDTH; i++){ sb.append("-"); } return sb.toString(); }
Source:
public static void createDwrModulesXml(String realPath) { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("dwr"); doc.appendChild(rootElement); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(realPath, "/WEB-INF/dwr-modules.xml")); transformer.transform(source, result); } catch (ParserConfigurationException pce) { log.error("Failed to parse document", pce); } catch (TransformerException tfe) { log.error("Failed to transorm xml source", tfe); } }

Target:
public static void createDwrModulesXml(String realPath) { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("dwr"); doc.appendChild(rootElement); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(Paths.get(realPath, "WEB-INF", "dwr-modules.xml").toString())); transformer.transform(source, result); } catch (ParserConfigurationException pce) { log.error("Failed to parse document", pce); } catch (TransformerException tfe) { log.error("Failed to transorm xml source", tfe); } }
Source:
public MessageQueueingContentWriter(MessageSender<EntityUpdatedMessage> sender, ContentWriter delegate, Timestamper clock) { this.sender = sender; this.delegate = delegate; this.clock = clock; }

Target:
public MessageQueueingContentWriter(MessageSender<EntityUpdatedMessage> sender, ContentWriter delegate, Timestamper clock) { this.sender = checkNotNull(sender); this.delegate = checkNotNull(delegate); this.clock = checkNotNull(clock); }
Source:
public ChartData(IDataChartProvider<?> provider, List<ChartSeries> series) { fProvider = provider; fSeries = series; }

Target:
public ChartData(IDataChartProvider<?> provider, List<ChartSeries> series) { fProvider = provider; fSeries = checkNotNull(ImmutableList.copyOf(series)); }
Source:
void method2() { return b.method((a, b) -> true); }

Target:
void method2() { BiFunction<String, SSLSession, Boolean> lambda = (a, b) -> true; b.method((a, b) -> true); b.method((a, b) -> (((true)))); b.method((a, b) -> a.equalsIgnoreCase(b.getPeerHost())); b.method(lambda); }
Source:
public static final String md5(final String s) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes()); byte messageDigest[] = digest.digest(); return Base64.encodeToString(messageDigest, Base64.URL_SAFE | Base64.NO_WRAP); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } }

Target:
public static final String md5(final String s) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(s.getBytes("utf-8")); byte messageDigest[] = digest.digest(); return Base64.encodeToString(messageDigest, Base64.URL_SAFE | Base64.NO_WRAP); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
public Integer add(T value) { Integer bit = getBit(value); if (bit != null) { return bit; } rwLock.writeLock().lock(); try { bit = value2Bit.get(value); if (bit != null) { return bit; } bit = freedBitSet.nextSetBit(0); if (bit > -1) { freedBitSet.clear(bit); } else { bit = nextBit; } value2Bit.put(value, bit); bit2Value.put(bit, value); return bit; } finally { rwLock.writeLock().unlock(); } }

Target:
public Integer add(T value) { Integer bit = getBit(value); if (bit != null) { return bit; } rwLock.writeLock().lock(); try { bit = value2Bit.get(value); if (bit != null) { return bit; } bit = freedBitSet.nextSetBit(0); if (bit > -1) { freedBitSet.clear(bit); } else { bit = nextBit++; } value2Bit.put(value, bit); bit2Value.put(bit, value); return bit; } finally { rwLock.writeLock().unlock(); } }
Source:
private Result analyzeIsStandard() { if (!wallet.getNetworkParameters().getId().equals(NetworkParameters.ID_MAINNET)) return Result.OK; Map<Sha256Hash, Transaction> depMap = new HashMap<Sha256Hash, Transaction>(); for (Transaction transaction : dependencies) depMap.put(transaction.getHash(), transaction); nonStandard = isStandard(tx, depMap); if (nonStandard != null) return Result.NON_STANDARD; for (Transaction dep : dependencies) { nonStandard = isStandard(dep, depMap); if (nonStandard != null) return Result.NON_STANDARD; } return Result.OK; }

Target:
private Result analyzeIsStandard() { if (!wallet.getNetworkParameters().getId().equals(NetworkParameters.ID_MAINNET)) return Result.OK; nonStandard = isStandard(tx); if (nonStandard != null) return Result.NON_STANDARD; for (Transaction dep : dependencies) { nonStandard = isStandard(dep); if (nonStandard != null) return Result.NON_STANDARD; } return Result.OK; }
Source:
private void updateToolItem() { ToolItem item = (ToolItem) widget; String text = model.getLocalizedLabel(); final boolean forceText = model.getTags().contains(FORCE_TEXT); if ((item.getImage() == null || forceText) && text != null) { item.setText(text); } else { final MCommand command = model.getCommand(); if (command == null) { item.setText("UnLabled"); } else { item.setText(command.getCommandName()); } } final String tooltip = getToolTipText(); item.setToolTipText(tooltip); item.setSelection(model.isSelected()); item.setEnabled(model.isEnabled()); }

Target:
private void updateToolItem() { ToolItem item = (ToolItem) widget; String text = model.getLocalizedLabel(); if (item.getImage() == null || model.getTags().contains(FORCE_TEXT)) { if (text == null || text.length() == 0) { final MCommand command = model.getCommand(); if (command == null) { item.setText("UnLabled"); } else { item.setText(command.getCommandName()); } } else { item.setText(text); } } else { item.setText(""); } final String tooltip = getToolTipText(); item.setToolTipText(tooltip); item.setSelection(model.isSelected()); item.setEnabled(model.isEnabled()); }
Source:
public void open() { }

Target:
public void open() { assertIsOpen(false); LOGGER.debug().setMessage("Opening NoAlertExecutionRepository").log(); _isOpen.set(true); }