auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Map<Method, Handler> methodHandlersFor(Class<?> sqlObjectType, Handlers registry, HandlerDecorators decorators) { return handlersCache.computeIfAbsent(sqlObjectType, type -> { final Map<Method, Handler> handlers = new HashMap<>(); handlers.putAll(handlerEntry((t, a, h) -> sqlObjectType.getName() + '@' + Integer.toHexString(t.hashCode()), Object.class, "toString")); handlers.putAll(handlerEntry((t, a, h) -> t == a[0], Object.class, "equals", Object.class)); handlers.putAll(handlerEntry((t, a, h) -> System.identityHashCode(t), Object.class, "hashCode")); handlers.putAll(handlerEntry((t, a, h) -> h.getHandle(), SqlObject.class, "getHandle")); try { handlers.putAll(handlerEntry((t, a, h) -> null, sqlObjectType, "finalize")); } catch (IllegalStateException expected) { } for (Method method : sqlObjectType.getMethods()) { if (Modifier.isStatic(method.getModifiers())) { continue; } handlers.computeIfAbsent(method, m -> buildMethodHandler(sqlObjectType, m, registry, decorators)); } handlers.keySet().stream() .filter(m -> !m.isSynthetic()) .collect(Collectors.groupingBy(m -> Arrays.asList(m.getName(), Arrays.asList(m.getParameterTypes())))) .values() .stream() .filter(l -> l.size() > 1) .findAny() .ifPresent(ms -> { <START> throw new UnableToCreateSqlObjectException(sqlObjectType + " has ambiguous methods " + ms); <END> }); return handlers; }); }</code><technical_language>This error message more helpful if included a suggestion override method annotate / provide a default implementaiton in sqlObjectType</technical_language>

Target:
private Map<Method, Handler> methodHandlersFor(Class<?> sqlObjectType, Handlers registry, HandlerDecorators decorators) { return handlersCache.computeIfAbsent(sqlObjectType, type -> { final Map<Method, Handler> handlers = new HashMap<>(); handlers.putAll(handlerEntry((t, a, h) -> sqlObjectType.getName() + '@' + Integer.toHexString(t.hashCode()), Object.class, "toString")); handlers.putAll(handlerEntry((t, a, h) -> t == a[0], Object.class, "equals", Object.class)); handlers.putAll(handlerEntry((t, a, h) -> System.identityHashCode(t), Object.class, "hashCode")); handlers.putAll(handlerEntry((t, a, h) -> h.getHandle(), SqlObject.class, "getHandle")); try { handlers.putAll(handlerEntry((t, a, h) -> null, sqlObjectType, "finalize")); } catch (IllegalStateException expected) { } for (Method method : sqlObjectType.getMethods()) { if (Modifier.isStatic(method.getModifiers())) { continue; } handlers.computeIfAbsent(method, m -> buildMethodHandler(sqlObjectType, m, registry, decorators)); } handlers.keySet().stream() .filter(m -> !m.isSynthetic()) .collect(Collectors.groupingBy(m -> Arrays.asList(m.getName(), Arrays.asList(m.getParameterTypes())))) .values() .stream() .filter(l -> l.size() > 1) .findAny() .ifPresent(ms -> { throw new UnableToCreateSqlObjectException(sqlObjectType + " has ambiguous methods " + ms + ", please resolve with an explicit override"); }); return handlers; }); }
Source:
<code>public void forEach(IntConsumer action) { <START> if (action instanceof CacheAware) { <END> ((CacheAware) action).injectCache(registry.getComponent(Cache.class)); } createStream().forEach(action); }</code><technical_language>factor out this code ? repeated in a places</technical_language>

Target:
public void forEach(IntConsumer action) { injectCache(action); createStream().forEach(action); }
Source:
<code>public String asString() { return value; <START> } <END></code><technical_language>right, is it? This (un)escaping asChar(). Interesting question: StringLiteralExpr(String) do</technical_language>

Target:
public String asString() { return StringEscapeUtils.unescapeJava(value); }
Source:
<code>private void readManifest(final URL url) throws IOException { try (InputStream is = url.openStream()) { <START> if (is != null) { <END> final Manifest mf = new Manifest(); mf.read(is); final Attributes atts = mf.getMainAttributes(); Optional.ofNullable(atts.getValue(Attributes.Name.IMPLEMENTATION_TITLE)).ifPresent(t -> LOG.debug("Implementation Title: {}", t)); Optional.ofNullable(atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION)).ifPresent(t -> LOG.debug("Implementation Version: {}", t)); Optional.ofNullable(atts.getValue(COMMIT)).ifPresent(t -> LOG.debug("Git commit: {}", t)); } } }</code><technical_language>I null returned, this if redundant</technical_language>

Target:
private void readManifest(final URL url) throws IOException { try (InputStream is = url.openStream()) { final Manifest mf = new Manifest(); mf.read(is); final Attributes atts = mf.getMainAttributes(); LOG.debug("Starting up: version - built from commit {}", atts.getValue(Attributes.Name.IMPLEMENTATION_TITLE), atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION), atts.getValue(COMMIT) ); } }
Source:
<code>public JLoadScenario jaagerSmokeTest() { <START> return new JaggerSmokeTest().jTestSuites(); <END> }</code><technical_language>please, naming for methods. test suits http scenarios</technical_language>

Target:
public JLoadScenario jaagerSmokeTest() { return new JaggerSmokeTest().getJaggerScenario(); }
Source:
<code>private void resolveGetterConflicts(Map<String, List<Method>> conflictingGetters) { for (Entry<String, List<Method>> entry : conflictingGetters.entrySet()) { Method winner = null; String propName = entry.getKey(); boolean isAmbiguous = false; for (Method candidate : entry.getValue()) { if (winner == null) { winner = candidate; continue; } Class<?> winnerType = winner.getReturnType(); Class<?> candidateType = candidate.getReturnType(); if (candidateType.equals(winnerType)) { if (!boolean.class.equals(candidateType)) { isAmbiguous = true; break; } else if (candidate.getName().startsWith("is")) { winner = candidate; } } else if (candidateType.isAssignableFrom(winnerType)) { } else if (winnerType.isAssignableFrom(candidateType)) { winner = candidate; } else { isAmbiguous = true; break; } } <START> if (winner != null) { <END> addGetMethod(propName, winner, isAmbiguous); } } }</code><technical_language>Is case winner null actually</technical_language>

Target:
private void resolveGetterConflicts(Map<String, List<Method>> conflictingGetters) { for (Entry<String, List<Method>> entry : conflictingGetters.entrySet()) { Method winner = null; String propName = entry.getKey(); boolean isAmbiguous = false; for (Method candidate : entry.getValue()) { if (winner == null) { winner = candidate; continue; } Class<?> winnerType = winner.getReturnType(); Class<?> candidateType = candidate.getReturnType(); if (candidateType.equals(winnerType)) { if (!boolean.class.equals(candidateType)) { isAmbiguous = true; break; } else if (candidate.getName().startsWith("is")) { winner = candidate; } } else if (candidateType.isAssignableFrom(winnerType)) { } else if (winnerType.isAssignableFrom(candidateType)) { winner = candidate; } else { isAmbiguous = true; break; } } addGetMethod(propName, winner, isAmbiguous); } }
Source:
<code>public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String annotationName, boolean runtimeVisible) { if (typePath != null) { <START> if (typeRef == 335544320) <END> { discoverer.startMethodTypeAnnotation(methodName, typePath.toString(), methodSignatureMap.get(ASMModParser.EnumMethodAdditionalInfo.RETURN_VALUE_TYPE).get(typePath.toString()), annotationName, ASMModParser.EnumMethodAdditionalInfo.RETURN_VALUE_TYPE); return new ModAnnotationVisitor(discoverer); } else if (typeRef == 369098752) { discoverer.startMethodTypeAnnotation(methodName, typePath.toString(), methodSignatureMap.get(ASMModParser.EnumMethodAdditionalInfo.PARAMETER_TYPE).get(typePath.toString()), annotationName, ASMModParser.EnumMethodAdditionalInfo.PARAMETER_TYPE); return new ModAnnotationVisitor(discoverer); } return null; } else { return null; } }</code><technical_language>Magic value. this from</technical_language>

Target:
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String annotationName, boolean runtimeVisible) { if (typePath != null) { if (typeRef == TypeReference.newTypeReference(TypeReference.METHOD_RETURN).getValue()) { discoverer.startMethodTypeAnnotation(methodName, typePath.toString(), methodSignatureMap.get(TypeReference.METHOD_RETURN).get(typePath.toString()), annotationName, "METHOD_RETURN"); return new ModAnnotationVisitor(discoverer); } else if (typeRef == TypeReference.newTypeReference(TypeReference.METHOD_FORMAL_PARAMETER).getValue()) { discoverer.startMethodTypeAnnotation(methodName, typePath.toString(), methodSignatureMap.get(TypeReference.METHOD_FORMAL_PARAMETER).get(typePath.toString()), annotationName, "METHOD_FORMAL_PARAMETER"); return new ModAnnotationVisitor(discoverer); } return null; } else { return null; } }
Source:
<code>protected String getYesterdayHttpDate(Calendar calendar) { calendar.add(Calendar.DAY_OF_MONTH, -1); <START> SimpleDateFormat dateFormat = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); <END> dateFormat.setTimeZone(TimeZone.getTimeZone(GMT)); return dateFormat.format(calendar.getTime()); }</code><technical_language>Yes, sense, update patch</technical_language>

Target:
protected String getYesterdayHttpDate(Calendar calendar) { calendar.add(Calendar.DAY_OF_MONTH, -1); return formatUsLocaleGMTZone(calendar); }
Source:
<code><START> public static boolean isDefaultName(String name) { <END> if (name != null) { return false; } else if (name.equals(DEFAULT_NAME)) { return false; } else if (name.equals("(Default)")) { return false; } return true; }</code><technical_language>Consider @Restricted(NoExternalUse.class), I reason this public API</technical_language>

Target:
public static boolean isDefaultName(String name) { if ("(Default)".equals(name)) { return true; } return DEFAULT_NAME.equals(name); }
Source:
<code>private void writeConfig(NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException { String interfaceName = netInterfaceConfig.getName(); List<? extends NetInterfaceAddressConfig> netInterfaceAddressConfigs = netInterfaceConfig .getNetInterfaceAddresses(); if (netInterfaceAddressConfigs != null && !netInterfaceAddressConfigs.isEmpty()) { for (NetInterfaceAddressConfig netInterfaceAddressConfig : netInterfaceAddressConfigs) { if (netInterfaceAddressConfig instanceof WifiInterfaceAddressConfigImpl) { List<NetConfig> netConfigs = netInterfaceAddressConfig.getConfigs(); NetInterfaceStatus netInterfaceStatus = NetInterfaceStatus.netIPv4StatusDisabled; WifiConfig apConfig = null; String interfaceDriver = null; if (netConfigs != null) { for (NetConfig netConfig : netConfigs) { try { if (netConfig instanceof WifiConfig) { if (((WifiConfig) netConfig).getMode() == WifiMode.MASTER) { logger.debug("Found wifiConfig with mode set to master"); interfaceDriver = ((WifiConfig) netConfig).getDriver(); if (interfaceDriver != null) { logger.debug("Writing wifiConfig: {}", netConfig); apConfig = (WifiConfig) netConfig; } else { logger.error("Can't generate hostapd config - no driver specified"); } } } else if (netConfig instanceof NetConfigIP4) { netInterfaceStatus = ((NetConfigIP4) netConfig).getStatus(); } } catch (Exception e) { logger.error("Failed to configure Hostapd"); throw KuraException.internalError(e); } } <START> if (netInterfaceStatus == NetInterfaceStatus.netIPv4StatusDisabled <END> || netInterfaceStatus == NetInterfaceStatus.netIPv4StatusUnmanaged) { logger.info( "Network interface status for is - not overwriting hostapd configuration file", interfaceName, netInterfaceStatus); return; } if (apConfig != null) { try { generateHostapdConf(apConfig, interfaceName, interfaceDriver); } catch (Exception e) { logger.error("Failed to generate hostapd configuration file for interface", interfaceName); throw KuraException.internalError(e); } } } } } } }</code><technical_language>this check, is in other files, externalised a method isDisabled isManaged simplify reading</technical_language>

Target:
private void writeConfig(NetInterfaceConfig<? extends NetInterfaceAddressConfig> netInterfaceConfig) throws KuraException { if (netInterfaceConfig == null) { return; } List<NetConfig> netConfigs = ((AbstractNetInterface<?>) netInterfaceConfig).getNetConfigs(); if (netConfigs.isEmpty()) { return; } String interfaceName = netInterfaceConfig.getName(); WifiConfig apConfig = getAccessPointConfig(netConfigs); NetInterfaceStatus netInterfaceStatus = getNetInterfaceStatus(netConfigs); if (!isInterfaceEnabled(netInterfaceStatus)) { logger.info("Network interface status for is - not overwriting hostapd configuration file", interfaceName, netInterfaceStatus); return; } if (apConfig != null) { try { generateHostapdConf(apConfig, interfaceName); } catch (Exception e) { logger.error("Failed to generate hostapd configuration file for interface", interfaceName); throw KuraException.internalError(e); } } }
Source:
<code>public static RealVector convertINDArrayToApacheVector(@Nonnull final INDArray vector) { if (!vector.isVector()) { throw new IllegalArgumentException("Input INDArray is not a vector."); } <START> final int length = vector.length(); <END> final RealVector out = new ArrayRealVector(length); for (int i=0; i<length; i++) { out.setEntry(i, vector.getDouble(i)); } return out; }</code><technical_language>return new ArrayRealVector(new IndexRange(0, vector.length()).mapToDouble(vector::getDouble));</technical_language>

Target:
public static RealVector convertINDArrayToApacheVector(@Nonnull final INDArray vector) { Utils.validateArg(vector.isVector(), "Input INDArray is not a vector."); return new ArrayRealVector(vector.isView() ? vector.dup().data().asDouble() : vector.data().asDouble(), false); }
Source:
<code>protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { try{ Session session = request.getResourceResolver().adaptTo(Session.class); final String vanityPath = request.getParameter("vanityPath"); final String pagePath = request.getParameter("pagePath"); try { QueryManager qm = session.getWorkspace().getQueryManager(); <START> String xpath = " END> Query query = qm.createQuery(xpath, Query.XPATH); logger.debug("Xpath Query Statement is {}", query.getStatement()); QueryResult result = query.execute(); NodeIterator nodes = result.getNodes(); TidyJSONWriter tidyJSONWriter = new TidyJSONWriter(response.getWriter()); tidyJSONWriter.object(); tidyJSONWriter.key("vanitypaths").array(); response.setContentType("text/html"); while (nodes.hasNext()) { Node node = nodes.nextNode(); if(node != null && node.getPath().contains("/content")) { if(node.getPath().equals(pagePath)) { } else { tidyJSONWriter.value(node.getPath()); } } } tidyJSONWriter.endArray(); tidyJSONWriter.endObject(); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); } catch(RepositoryException re){ logger.error( "Error in doGet", re ); } } catch (JSONException e) { logger.error( "Error in doGet", e ); } }</code><technical_language>a Constant for sling:vanityPath .. <LINK_0></technical_language>

Target:
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException { try{ Session session = request.getResourceResolver().adaptTo(Session.class); final String vanityPath = request.getParameter("vanityPath"); final String pagePath = request.getParameter("pagePath"); try { QueryManager qm = session.getWorkspace().getQueryManager(); String xpath = " Query query = qm.createQuery(xpath, Query.XPATH); log.debug("Xpath Query Statement is {}", query.getStatement()); QueryResult result = query.execute(); NodeIterator nodes = result.getNodes(); TidyJSONWriter tidyJSONWriter = new TidyJSONWriter(response.getWriter()); tidyJSONWriter.object(); tidyJSONWriter.key("vanitypaths").array(); while (nodes.hasNext()) { Node node = nodes.nextNode(); if(node != null && node.getPath().startsWith("/content")) { if(node.getPath().equals(pagePath)) { } else { tidyJSONWriter.value(node.getPath()); } } } tidyJSONWriter.endArray(); tidyJSONWriter.endObject(); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); } catch(RepositoryException re){ log.error( "Error in doGet", re ); } } catch (JSONException e) { log.error( "Error in doGet", e ); } }
Source:
<code>public static void main(String[] args) throws Exception { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); <START> FSubscriberTransportFactory subscriberFactory = new FJmsSubscriberTransport.Factory(connection, "Consumer.frugal-examples.VirtualTopic."); <END> FScopeProvider provider = new FScopeProvider(null, subscriberFactory, protocolFactory); AlbumWinnersSubscriber.Iface subscriber = new AlbumWinnersSubscriber.Client(provider); subscriber.subscribeWinner((ctx, album) -> System.out.println("You won! " + album)); subscriber.subscribeContestStart((ctx, albums) -> System.out.println("Contest started, available albums: " + albums)); System.out.println("Subscriber started..."); }</code><technical_language>suggestion FSubscriberTransportFactory subscriberFactory = new FJmsSubscriberTransport.Factory(connection, "Consumer.frugal-examples.VirtualTopic.", true);</technical_language>

Target:
public static void main(String[] args) throws Exception { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); FSubscriberTransportFactory subscriberFactory = new FJmsSubscriberTransport.Factory(connection, "Consumer.frugal-examples.VirtualTopic.", true); FScopeProvider provider = new FScopeProvider(null, subscriberFactory, protocolFactory); AlbumWinnersSubscriber.Iface subscriber = new AlbumWinnersSubscriber.Client(provider); subscriber.subscribeWinner((ctx, album) -> System.out.println("You won! " + album)); subscriber.subscribeContestStart((ctx, albums) -> System.out.println("Contest started, available albums: " + albums)); System.out.println("Subscriber started..."); }
Source:
<code>default String getFactsString() { <START> return String.join(", ", Arrays.stream(getFacts()) <END> .map(o -> (o == null) ? null : o.toString()) .toArray(CharSequence[]::new)); }</code><technical_language>do same, avoid creating array inbetween, Collectors.joining() stream</technical_language>

Target:
default String getFactsString() { return Arrays.stream(getFacts()) .map(o -> (o == null) ? null : o.toString()) .collect(Collectors.joining(", ")); }
Source:
<code>private void onSave() <START> { <END> if (getProgress() != null) { return; } if (!validate()) { return; } flush(); startProgress(null); Frontend.getInstance().runAction(VdcActionType.AddSubnetToProvider, new AddExternalSubnetParameters(subnet, getNetwork().getSelectedItem().getId()), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); stopProgress(); if (returnValue != null && returnValue.getSucceeded()) { cancel(); } } }, this, true); }</code><technical_language>Parentheses formatting</technical_language>

Target:
private void onSave() { if (!validate()) { return; } flush(); startProgress(null); Frontend.getInstance().runAction(VdcActionType.AddSubnetToProvider, new AddExternalSubnetParameters(subnet, getNetwork().getSelectedItem().getId()), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { VdcReturnValueBase returnValue = result.getReturnValue(); stopProgress(); if (returnValue != null && returnValue.getSucceeded()) { cancel(); } } }, this, true); }
Source:
<code>public void load(@Nonnull NamespacedKey namespace, @Nonnull ItemStack itemStack) { reset(); if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) { return; } <START> final ItemMeta meta = itemStack.getItemMeta(); <END> if (meta != null) { load(namespace, meta); } }</code><technical_language>forgot check hasItemMeta() first</technical_language>

Target:
public void load(@Nonnull NamespacedKey namespace, @Nonnull ItemStack itemStack) { clear(); if (!SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) { return; } ItemMeta meta; if (itemStack.hasItemMeta() && (meta = itemStack.getItemMeta()) != null) { load(namespace, meta); } }
Source:
<code>public static <T> QosClient.QueryWeigher<T> readWeigher(Function<T, Long> bytesRead, Function<T, Integer> numRows) { return new QosClient.QueryWeigher<T>() { @Override public QueryWeight estimate() { return DEFAULT_ESTIMATED_WEIGHT; } @Override public QueryWeight weigh(T result, long timeTakenNanos) { return ImmutableQueryWeight.builder() .numBytes(safeGetNumBytesOrDefault(() -> bytesRead.apply(result))) <START> .timeTakenNanos((int) timeTakenNanos) <END> .numDistinctRows(numRows.apply(result)) .build(); } }; }</code><technical_language>casting long int for nanoseconds? overflow in 3 seconds?</technical_language>

Target:
public static <T> QosClient.QueryWeigher<T> readWeigher(Function<T, Long> bytesRead, Function<T, Integer> numRows) { return new QosClient.QueryWeigher<T>() { @Override public QueryWeight estimate() { return DEFAULT_ESTIMATED_WEIGHT; } @Override public QueryWeight weigh(T result, long timeTakenNanos) { return ImmutableQueryWeight.builder() .numBytes(safeGetNumBytesOrDefault(() -> bytesRead.apply(result))) .timeTakenNanos(timeTakenNanos) .numDistinctRows(numRows.apply(result)) .build(); } }; }
Source:
<code>private ByteBuf retain0(final int increment) { int adjustIncrement = increment << 1; int oldRef = refCntUpdater.getAndAdd(this, adjustIncrement); if ((oldRef & 1) != 0) { throw new IllegalReferenceCountException(0, increment); <START> } else if (oldRef <= 0 ? oldRef + adjustIncrement > 0 <END> : oldRef + adjustIncrement < oldRef) { refCntUpdater.getAndAdd(this, -increment); throw new IllegalReferenceCountException(realRef(oldRef), increment); } return this; }</code><technical_language>nit: remove else return in previous if block</technical_language>

Target:
private ByteBuf retain0(final int increment) { int adjustedIncrement = increment << 1; int oldRef = refCntUpdater.getAndAdd(this, adjustedIncrement); if ((oldRef & 1) != 0) { throw new IllegalReferenceCountException(0, increment); } if ((oldRef <= 0 && oldRef + adjustedIncrement >= 0) || (oldRef >= 0 && oldRef + adjustedIncrement < oldRef)) { refCntUpdater.getAndAdd(this, -adjustedIncrement); throw new IllegalReferenceCountException(realRefCnt(oldRef), increment); } return this; }
Source:
<code>public static Property getPropertyDefinitionInWorkspace(String pdname) { Injector injector = IResourceServiceProvider.Registry.INSTANCE .getResourceServiceProvider(URI.createFileURI("dummy.aadl")).get(Injector.class); final ResourceDescriptionsProvider resourceDescriptionsProvider = injector .getInstance(ResourceDescriptionsProvider.class); final IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider <START> .getResourceDescriptions(OsateResourceUtil.getResourceSet()); <END> for (IEObjectDescription eobjDesc : resourceDescriptions .getExportedObjectsByType(Aadl2Package.eINSTANCE.getProperty())) { if (eobjDesc.getName().toString("::").equalsIgnoreCase(pdname)) { EObject res = eobjDesc.getEObjectOrProxy(); res = EcoreUtil.resolve(res, OsateResourceUtil.getResourceSet()); if (!Aadl2Util.isNull(res)) { return (Property) res; } } } throw new TbException( "Error: " + pdname + " does not correspond to any " + "system implementation in the workspace.\n"); }</code><technical_language>better: new ResourceSet()</technical_language>

Target:
public static Property getPropertyDefinitionInWorkspace(String pdname) { Injector injector = IResourceServiceProvider.Registry.INSTANCE .getResourceServiceProvider(URI.createFileURI("dummy.aadl")).get(Injector.class); final ResourceDescriptionsProvider resourceDescriptionsProvider = injector .getInstance(ResourceDescriptionsProvider.class); final IResourceDescriptions resourceDescriptions = resourceDescriptionsProvider .getResourceDescriptions(new XtextResourceSet()); for (IEObjectDescription eobjDesc : resourceDescriptions .getExportedObjectsByType(Aadl2Package.eINSTANCE.getProperty())) { if (eobjDesc.getName().toString("::").equalsIgnoreCase(pdname)) { EObject res = eobjDesc.getEObjectOrProxy(); res = EcoreUtil.resolve(res, OsateResourceUtil.getResourceSet()); if (!Aadl2Util.isNull(res)) { return (Property) res; } } } throw new TbException( "Error: " + pdname + " does not correspond to any " + "system implementation in the workspace.\n"); }
Source:
<code>public void testLockedStreamTxInsideConsumer() { for (int i = 0; i < 5; i++) { cache.put(i, "value" + i); } cache.getAdvancedCache().lockedStream().forEach((c, e) -> { TransactionManager tm = c.getAdvancedCache().getTransactionManager(); try { tm.begin(); c.put(e.getKey(), e.getValue() + "-changed"); tm.commit(); } catch (Exception e1) { throw new RuntimeException(e1); } }); for (int i = 0; i < 5; i++) { assertEquals("value" + i + "-changed", cache.get(i)); } <START> } <END></code><technical_language>I miss case outer transaction (though code I pretty confident work this moment)</technical_language>

Target:
public void testLockedStreamTxInsideConsumer() { for (int i = 0; i < 5; i++) { cache.put(i, "value" + i); } cache.getAdvancedCache().lockedStream().forEach((c, e) -> { try { TestingUtil.withTx(c.getAdvancedCache().getTransactionManager(), () -> c.put(e.getKey(), e.getValue() + "-changed")); } catch (Exception e1) { throw new RuntimeException(e1); } }); for (int i = 0; i < 5; i++) { assertEquals("value" + i + "-changed", cache.get(i)); } }
Source:
<code>public DBSSession(DBSRepository repository) { this.repository = repository; transaction = new DBSTransactionState(repository, this); FulltextConfiguration fulltextConfiguration = repository.getFulltextConfiguration(); fulltextSearchDisabled = fulltextConfiguration == null || fulltextConfiguration.fulltextSearchDisabled; saveTimer = registry.timer(MetricRegistry.name("nuxeo", "repositories", repository.getName(), "saves")); queryTimer = registry.timer(MetricRegistry.name("nuxeo", "repositories", repository.getName(), "queries")); LOG_MIN_DURATION_NS = Long.parseLong(Framework.getProperty(LOG_MIN_DURATION_KEY, "-1")) * 1000000; <START> isLatestVersionDisabled = Boolean.parseBoolean(Framework.getProperty(DISABLED_ISLATESTVERSION_PROPERTY, "false")); <END> }</code><technical_language>Guess Framework#isBooleanPropertyTrue(DISABLED_ISLATESTVERSION_PROPERTY) here</technical_language>

Target:
public DBSSession(DBSRepository repository) { this.repository = repository; transaction = new DBSTransactionState(repository, this); FulltextConfiguration fulltextConfiguration = repository.getFulltextConfiguration(); fulltextSearchDisabled = fulltextConfiguration == null || fulltextConfiguration.fulltextSearchDisabled; saveTimer = registry.timer(MetricRegistry.name("nuxeo", "repositories", repository.getName(), "saves")); queryTimer = registry.timer(MetricRegistry.name("nuxeo", "repositories", repository.getName(), "queries")); LOG_MIN_DURATION_NS = Long.parseLong(Framework.getProperty(LOG_MIN_DURATION_KEY, "-1")) * 1000000; isLatestVersionDisabled = Framework.isBooleanPropertyTrue(DISABLED_ISLATESTVERSION_PROPERTY); }
Source:
<code>public void shouldNotChangeProjectAndTitleWhenContextChange() throws Exception { presenter.changeProjectAndTitleWhenContextChange(new WorkspaceProjectContextChangeEvent() { @Override public WorkspaceProject getWorkspaceProject() { return null; } }); <START> verify(view, never()).setTitle("module name"); <END> }</code><technical_language>a niptick, never()).setTitle(any()) test more restrictive changeProjectAndTitleWhenContextChange implementation do</technical_language>

Target:
public void shouldNotChangeProjectAndTitleWhenContextChange() throws Exception { presenter.changeProjectAndTitleWhenContextChange(new WorkspaceProjectContextChangeEvent() { @Override public WorkspaceProject getWorkspaceProject() { return null; } }); verify(view, never()).setTitle(any()); }
Source:
<code>public void setTitleIconStartMargin(@Px int margin) { MarginLayoutParams marginParams = (MarginLayoutParams) mTitleIconView.getLayoutParams(); <START> marginParams.setMarginStart(margin); <END> }</code><technical_language>Needs a requestLayout() call mTitleIconView get apply</technical_language>

Target:
public void setTitleIconStartMargin(@Px int margin) { MarginLayoutParams marginParams = (MarginLayoutParams) mTitleIconView.getLayoutParams(); marginParams.setMarginStart(margin); requestLayout(); }
Source:
<code>void refreshChildren() { IFolder folder = getResource(); Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>(); for (ITmfProjectModelElement element : getChildren()) { childrenMap.put(element.getResource().getName(), element); } try { IResource[] members = folder.members(); for (IResource resource : members) { String name = resource.getName(); boolean isFolder = resource instanceof IFolder && (resource.getPersistentProperty(TmfCommonConstants.TRACETYPE) == null) && <START> !TmfTraceType.getInstance().isDirectoryTrace(resource.getLocationURI().getPath()); <END> ITmfProjectModelElement element = childrenMap.get(name); if (isFolder && !(element instanceof TmfTraceFolder)) { element = new TmfTraceFolder(name, (IFolder) resource, this); } else if (!isFolder && !(element instanceof TmfTraceElement)) { element = new TmfTraceElement(name, resource, this); } else { childrenMap.remove(name); } ((TmfProjectModelElement) element).refreshChildren(); } } catch (CoreException e) { } for (ITmfProjectModelElement danglingChild : childrenMap.values()) { removeChild(danglingChild); } }</code><technical_language>check done once, e.g. resource identified a trace a folder</technical_language>

Target:
void refreshChildren() { IFolder folder = getResource(); Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>(); for (ITmfProjectModelElement element : getChildren()) { childrenMap.put(element.getResource().getName(), element); } try { IResource[] members = folder.members(); for (IResource resource : members) { String name = resource.getName(); boolean isFolder = resource instanceof IFolder && (resource.getPersistentProperty(TmfCommonConstants.TRACETYPE) == null); ITmfProjectModelElement element = childrenMap.get(name); if (isFolder && !(element instanceof TmfTraceFolder) && !(element instanceof TmfTraceElement)) { if (TmfTraceType.getInstance().isDirectoryTrace(resource.getLocationURI().getPath())) { element = new TmfTraceElement(name, resource, this); } else { element = new TmfTraceFolder(name, (IFolder) resource, this); } } else if (!isFolder && !(element instanceof TmfTraceElement)) { element = new TmfTraceElement(name, resource, this); } else { childrenMap.remove(name); } ((TmfProjectModelElement) element).refreshChildren(); } } catch (CoreException e) { } for (ITmfProjectModelElement danglingChild : childrenMap.values()) { removeChild(danglingChild); } }
Source:
<code>private String encodeOptions(Map<String, String> options) { try { <START> ByteArrayOutputStream os = new ByteArrayOutputStream(); <END> ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeInt(options.size()); for (Map.Entry<String, String> entry : options.entrySet()) { oos.writeUTF(entry.getKey()); oos.writeUTF(entry.getValue()); } oos.flush(); return printBase64Binary(os.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>try resources</technical_language>

Target:
private String encodeOptions(Map<String, String> options) { try (ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os)) { oos.writeInt(options.size()); for (Map.Entry<String, String> entry : options.entrySet()) { oos.writeUTF(entry.getKey()); oos.writeUTF(entry.getValue()); } oos.flush(); return printBase64Binary(os.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>private void serveAttachmentSet(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { final String documentType = getDocumentType(request); final String documentId = request.getParameter(PortalConstants.DOCUMENT_ID); final User user = UserCacheHolder.getUserFromRequest(request); final TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory()); List<String> attachments = getAttachments(documentId, documentType, user).stream().sorted((left, right) -> { <START> return left.getFilename().compareTo(right.getFilename()); <END> }).map(attachment -> { try { return serializer.toString(attachment); } catch (TException exception) { return "{ \"error\": \"" + TagUtils.escapeAttributeValue(exception.toString()) + "\" }"; } }).collect(Collectors.toList()); JSONObject attachmentTypes = JSONFactoryUtil.createJSONObject(); for (AttachmentType attachmentType : AttachmentType.values()) { attachmentTypes.put(String.valueOf(attachmentType.getValue()), ThriftEnumUtils.enumToString(attachmentType)); } JSONObject checkStatuses = JSONFactoryUtil.createJSONObject(); for (CheckStatus checkStatus : CheckStatus.values()) { checkStatuses.put(String.valueOf(checkStatus.getValue()), ThriftEnumUtils.enumToString(checkStatus)); } try { JSONObject data = JSONFactoryUtil.createJSONObject(); data.put("data", JSONFactoryUtil.createJSONArray(attachments.toString())); data.put("attachmentTypes", attachmentTypes); data.put("checkStatuses", checkStatuses); writeJSON(request, response, data); } catch (JSONException exception) { LOGGER.error("Cannot serialize attachments", exception); response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "500"); } }</code><technical_language>IntelliJ suggests .sorted(Comparator.comparing(Attachment::getFilename)) instead, is neater</technical_language>

Target:
private void serveAttachmentSet(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { final String documentType = getDocumentType(request); final String documentId = request.getParameter(PortalConstants.DOCUMENT_ID); final User user = UserCacheHolder.getUserFromRequest(request); List<Attachment> attachments = getAttachments(documentId, documentType, user).stream() .sorted(Comparator.comparing(Attachment::getFilename)).collect(Collectors.toList()); Map<String, Object> data = Maps.newHashMap(); data.put("data", attachments); data.put("attachmentTypes", ATTACHMENT_TYPE_MAP); data.put("checkStatuses", CHECK_STATUS_MAP); writeJSON(request, response, OBJECT_MAPPER.writeValueAsString(data)); }
Source:
<code>public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> objectToDrop) { <START> List children <END> = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; Point center = graphicalEditPart.getFigure().getBounds().getCenter(); dropObjectsRequest.setLocation(center); dropObjectsRequest.setObjects(objectToDrop); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }</code><technical_language>please add <?> avoid warning</technical_language>

Target:
public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> objectToDrop) { List<?> children = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; Point center = graphicalEditPart.getFigure().getBounds().getCenter(); dropObjectsRequest.setLocation(center); dropObjectsRequest.setObjects(objectToDrop); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }
Source:
<code>public String getVoxelId() { <START> return voxelState.getId(); <END> }</code><technical_language>Qualify this. everywhere</technical_language>

Target:
public String getVoxelId() { return this.voxelState.getId(); }
Source:
<code>public ReactiveProcessor apply(Processor component, ReactiveProcessor next) { if (!isInterceptable(component)) { return next; } final ComponentLocation componentLocation = ((Component) component).getLocation(); if (!interceptorFactory.intercept(componentLocation)) { return next; } final ProcessorInterceptor interceptor = interceptorFactory.get(); Map<String, String> dslParameters = (Map<String, String>) ((Component) component).getAnnotation(ANNOTATION_PARAMETERS); <START> ReactiveProcessor interceptedProcessor = doApply(component, next, componentLocation, interceptor, dslParameters.entrySet().stream().filter(param -> !(param.getKey().equals("moduleOperation") || param.getKey().equals("moduleName"))).collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()))); <END> LOGGER.debug("Interceptor '{}' for processor '{}' configured.", interceptor, componentLocation.getLocation()); return interceptedProcessor; }</code><technical_language>a singleton list parameter names check contains</technical_language>

Target:
public ReactiveProcessor apply(Processor component, ReactiveProcessor next) { if (!isInterceptable(component)) { return next; } final ComponentLocation componentLocation = ((Component) component).getLocation(); if (!interceptorFactory.intercept(componentLocation)) { return next; } final ProcessorInterceptor interceptor = interceptorFactory.get(); Map<String, String> dslParameters = (Map<String, String>) ((Component) component).getAnnotation(ANNOTATION_PARAMETERS); ReactiveProcessor interceptedProcessor = doApply(component, next, componentLocation, interceptor, dslParameters.entrySet().stream().filter(param -> !macroExpansionInternalParams.contains(param.getKey())).collect(toMap(p -> p.getKey(), p -> p.getValue()))); LOGGER.debug("Interceptor '{}' for processor '{}' configured.", interceptor, componentLocation.getLocation()); return interceptedProcessor; }
Source:
<code>public boolean canFlipToNextPage() { if (generationOptions.isAutogeneratedScript()) { <START> return true; <END> } else { return false; } }</code><technical_language>return generationOptions.isAutogeneratedScript()</technical_language>

Target:
public boolean canFlipToNextPage() { if (contract.eContainer() instanceof Pool) { return generationOptions.isAutogeneratedScript() && super.canFlipToNextPage(); } else { return super.canFlipToNextPage(); } }
Source:
<code>void addTransactionsDependingOn(Set<Transaction> txSet, Set<Transaction> txPool) { Deque<Transaction> txDeque = new LinkedList<Transaction>(); txDeque.addAll(txSet); while(!txDeque.isEmpty()) { Transaction tx = txDeque.poll(); for (Transaction anotherTx : txPool) { if (anotherTx.equals(tx)) continue; for (TransactionInput input : anotherTx.getInputs()) { if (input.getOutpoint().getHash().equals(tx.getHash())) { <START> if (!txDeque.contains(anotherTx)) { <END> txDeque.add(anotherTx); txSet.add(anotherTx); } } } } } }</code><technical_language>contains() in a LinkedList is expensive. want a LinkedHashMap get fast random access? matter much</technical_language>

Target:
void addTransactionsDependingOn(Set<Transaction> txSet, Set<Transaction> txPool) { Map<Sha256Hash, Transaction> txQueue = new LinkedHashMap<Sha256Hash, Transaction>(); for (Transaction tx : txSet) { txQueue.put(tx.getHash(), tx); } while(!txQueue.isEmpty()) { Transaction tx = txQueue.remove(txQueue.keySet().iterator().next()); for (Transaction anotherTx : txPool) { if (anotherTx.equals(tx)) continue; for (TransactionInput input : anotherTx.getInputs()) { if (input.getOutpoint().getHash().equals(tx.getHash())) { if (txQueue.get(anotherTx.getHash()) == null) { txQueue.put(anotherTx.getHash(), anotherTx); txSet.add(anotherTx); } } } } } }
Source:
<code>void processChange(InvocationContext ctx, FlagAffectedCommand command, Object storedKey, Object storedOldValue, Object storedNewValue) { int segment = SegmentSpecificCommand.extractSegment(command, storedKey, keyPartitioner); <START> Object key = extractKey(storedKey); <END> Object oldValue = storedOldValue == UNKNOWN ? UNKNOWN : extractValue(storedOldValue); Object newValue = extractValue(storedNewValue); boolean skipIndexCleanup = command != null && command.hasAnyFlag(FlagBitSets.SKIP_INDEX_CLEANUP); if (!skipIndexCleanup) { if (oldValue == UNKNOWN) { if (shouldModifyIndexes(command, ctx, storedKey, newValue)) { removeFromIndexes(key, segment); } } else if (indexInspector.isIndexedType(oldValue) && (newValue == null || shouldRemove(newValue, oldValue)) && shouldModifyIndexes(command, ctx, storedKey, oldValue)) { removeFromIndexes(oldValue, key, segment); } else if (trace) { log.tracef("Index cleanup not needed for %s -> %s", oldValue, newValue); } } else if (trace) { log.tracef("Skipped index cleanup for command %s", command); } if (indexInspector.isIndexedType(newValue)) { if (shouldModifyIndexes(command, ctx, storedKey, newValue)) { updateIndexes(skipIndexCleanup, newValue, key, segment); } else { if (trace) { log.tracef("Not modifying index for %s (%s)", storedKey, command); } } } else if (trace) { log.tracef("Update not needed for %s", newValue); } }</code><technical_language>Ok, this is safe, still... a single session a single PojoIndexer better</technical_language>

Target:
void processChange(InvocationContext ctx, FlagAffectedCommand command, Object storedKey, Object storedOldValue, Object storedNewValue) { int segment = SegmentSpecificCommand.extractSegment(command, storedKey, keyPartitioner); Object key = extractKey(storedKey); Object oldValue = storedOldValue == UNKNOWN ? UNKNOWN : extractValue(storedOldValue); Object newValue = extractValue(storedNewValue); boolean skipIndexCleanup = command != null && command.hasAnyFlag(FlagBitSets.SKIP_INDEX_CLEANUP); if (!skipIndexCleanup) { if (oldValue == UNKNOWN) { if (shouldModifyIndexes(command, ctx, storedKey)) { removeFromIndexes(key, segment); } } else if (searchMappingHolder.isIndexedType(oldValue) && (newValue == null || shouldRemove(newValue, oldValue)) && shouldModifyIndexes(command, ctx, storedKey)) { removeFromIndexes(oldValue, key, segment); } else if (trace) { log.tracef("Index cleanup not needed for %s -> %s", oldValue, newValue); } } else if (trace) { log.tracef("Skipped index cleanup for command %s", command); } if (searchMappingHolder.isIndexedType(newValue)) { if (shouldModifyIndexes(command, ctx, storedKey)) { updateIndexes(skipIndexCleanup, newValue, key, segment); } else { if (trace) { log.tracef("Not modifying index for %s (%s)", storedKey, command); } } } else if (trace) { log.tracef("Update not needed for %s", newValue); } }
Source:
<code>public ResponseEntity<Problem> handleDbWriteOperationsBlockedException( final DbWriteOperationsBlockedException exception, final NativeWebRequest request) { <START> LOG.error(exception.getMessage()); <END> return Responses.create(Response.Status.SERVICE_UNAVAILABLE, "Database is currently in read-only mode", request); }</code><technical_language>I logged WARN this is situation create aware of it, error</technical_language>

Target:
public ResponseEntity<Problem> handleDbWriteOperationsBlockedException( final DbWriteOperationsBlockedException exception, final NativeWebRequest request) { LOG.warn(exception.getMessage()); return Responses.create(Response.Status.SERVICE_UNAVAILABLE, "Database is currently in read-only mode", request); }
Source:
<code>public void start() { LOG.info("Starting Azure job coordinator."); streamMetadataCache = StreamMetadataCache.apply(METADATA_CACHE_TTL_MS, config); <START> table.addProcessorEntity(INITIAL_STATE, processorId, azureLeaderElector.amILeader()); <END> LOG.info("Starting scheduler for heartbeating."); heartbeat.scheduleTask(); azureLeaderElector.tryBecomeLeader(); LOG.info("Starting scheduler to check for job model version upgrades."); versionUpgrade.setStateChangeListener(createJMVersionUpgradeListener()); versionUpgrade.scheduleTask(); LOG.info("Starting scheduler to check for leader liveness."); leaderAlive.setStateChangeListener(createLeaderLivenessListener()); leaderAlive.scheduleTask(); }</code><technical_language>azureLeaderElector.amILeader() return false this point</technical_language>

Target:
public void start() { LOG.info("Starting Azure job coordinator."); streamMetadataCache = StreamMetadataCache.apply(METADATA_CACHE_TTL_MS, config); table.addProcessorEntity(INITIAL_STATE, processorId, false); LOG.info("Starting scheduler for heartbeating."); heartbeat.scheduleTask(); azureLeaderElector.tryBecomeLeader(); LOG.info("Starting scheduler to check for job model version upgrades."); versionUpgrade.setStateChangeListener(createJMVersionUpgradeListener()); versionUpgrade.scheduleTask(); LOG.info("Starting scheduler to check for leader liveness."); leaderAlive.setStateChangeListener(createLeaderLivenessListener()); leaderAlive.scheduleTask(); }
Source:
<code>public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); boolean isLongInstance = value instanceof Long; boolean isStringInstance = value instanceof String && <START> !"".equals(((String) value).trim()); <END> if (value != null && (isStringInstance || isLongInstance)) { Long longValue = tryParseLong(value); String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }</code><technical_language>this is nicer: !((String) value).trim().isEmpty()</technical_language>

Target:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); boolean isLongInstance = value instanceof Long; boolean isStringInstance = value instanceof String && !((String) value).trim().isEmpty(); if (value != null && (isStringInstance || isLongInstance)) { Long longValue = tryParseLong(value); String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }