auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Void computeResults(final OperationParams params) { if (parameters.size() != 2) { throw new ParameterException("Requires arguments: <store name> <type name>"); } final String inputStoreName = parameters.get(0); final String typeName = parameters.get(1); final File configFile = getGeoWaveConfigFile(params); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info( "Describing everything in store: " + inputStoreName + " with type name: " + typeName); <START> DataTypeAdapter[] types = inputStoreOptions.createDataStore().getTypes(); <END> for (DataTypeAdapter type : types) { if (type.getTypeName().equals(typeName)) { Map<String, String> description = type.describe(); List<List<Object>> rows = new ArrayList<>(); for (Entry<String, String> entry : description.entrySet()) { List<Object> row = new ArrayList<>(); row.add(entry.getKey()); row.add(entry.getValue()); rows.add(row); } List<String> headers = new ArrayList<>(); headers.add("Property"); headers.add("Value"); ConsolePrinter cp = new ConsolePrinter(); cp.print(headers, rows); } } return null; }</code><technical_language>is a getType function DataStore get adapter type name. eliminate need for loop check</technical_language>

Target:
public Void computeResults(final OperationParams params) { if (parameters.size() != 2) { throw new ParameterException("Requires arguments: <store name> <type name>"); } final String inputStoreName = parameters.get(0); final String typeName = parameters.get(1); final File configFile = getGeoWaveConfigFile(params); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info( "Describing everything in store: " + inputStoreName + " with type name: " + typeName); final PersistentAdapterStore adapterStore = inputStoreOptions.createAdapterStore(); final InternalAdapterStore internalAdapterStore = inputStoreOptions.createInternalAdapterStore(); final DataTypeAdapter<?> type = adapterStore.getAdapter(internalAdapterStore.getAdapterId(typeName)).getAdapter(); Map<String, String> description = type.describe(); List<List<Object>> rows = new ArrayList<>(); for (Entry<String, String> entry : description.entrySet()) { List<Object> row = new ArrayList<>(); row.add(entry.getKey()); row.add(entry.getValue()); rows.add(row); } List<String> headers = new ArrayList<>(); headers.add("Property"); headers.add("Value"); ConsolePrinter cp = new ConsolePrinter(); cp.print(headers, rows); return null; }
Source:
<code>public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) { Object[] lookupObjects = lookup(projectionBlock); int[] resultSet = new int[lookupObjects.length]; Arrays.fill(resultSet, ((Number) _lookupColumnFieldSpec.getDefaultNullValue()).intValue()); for (int i = 0; i < lookupObjects.length; i++) { <START> resultSet[i] = ((Number) lookupObjects[i]).intValue(); <END> } return resultSet; }</code><technical_language>Need check null, for other places</technical_language>

Target:
public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) { Object[] lookupObjects = lookup(projectionBlock); int[] resultSet = new int[lookupObjects.length]; Arrays.fill(resultSet, ((Number) _lookupColumnFieldSpec.getDefaultNullValue()).intValue()); for (int i = 0; i < lookupObjects.length; i++) { if (lookupObjects[i] != null) { resultSet[i] = ((Number) lookupObjects[i]).intValue(); } } return resultSet; }
Source:
<code>public void shouldSaveNewConfiguration() throws CommcareConnectionFailureException { Config config = configService.create(); config.setName("newName"); Config savedConfig = configService.saveNewConfig(config); assertEquals(config.getName(), savedConfig.getName()); <START> } <END></code><technical_language>new line this</technical_language>

Target:
public void shouldSaveNewConfiguration() throws CommcareConnectionFailureException { Config config = configService.create(); config.setName("newName"); Config savedConfig = configService.addConfig(config); assertEquals(config.getName(), savedConfig.getName()); }
Source:
<code>public void setUseIntermediateSharedCache(boolean useIntermediateSharedCache) { <START> } <END></code><technical_language>throw UnsupportedOperationException() in this case? create interface support extend interface methods</technical_language>

Target:
public boolean setUseIntermediateSharedCache(boolean useIntermediateSharedCache) { return false; }
Source:
<code>public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && valueMatcher.matches(e, oldValue, newValue, valueEquivalence)) { e.setChanged(true); Object old = e.setValue(newValue); <START> updateMetadata(e, metadata); <END> if (valueMatcher != ValueMatcher.MATCH_EXPECTED_OR_NEW) { return returnValue(old, e.getMetadata(), true, ctx); } else { return returnValue(oldValue, e.getMetadata(), true, ctx); } } return returnValue(null, null, false, ctx); }</code><technical_language>remove isValueEquals method (line 89/90)</technical_language>

Target:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && valueMatcher.matches(e, oldValue, newValue, valueEquivalence)) { e.setChanged(true); Object old = e.setValue(newValue); Metadatas.updateMetadata(e, metadata); if (valueMatcher != ValueMatcher.MATCH_EXPECTED_OR_NEW) { return returnValue(old, e.getMetadata(), true, ctx); } else { return returnValue(oldValue, e.getMetadata(), true, ctx); } } return returnValue(null, null, false, ctx); }
Source:
<code>public static boolean binaryIdentical(IStorage left, IStorage right) { BufferedInputStream leftStream = null; BufferedInputStream rightStream = null; try { final int maxBufferSize = 8192; final byte[] leftBuff = new byte[maxBufferSize]; final byte[] rightBuff = new byte[maxBufferSize]; leftStream = new BufferedInputStream(left.getContents(), maxBufferSize); rightStream = new BufferedInputStream(right.getContents(), maxBufferSize); boolean diffFound = false, eofFound = false; while (!diffFound && !eofFound) { leftStream.mark(maxBufferSize); rightStream.mark(maxBufferSize); int readLeft = leftStream.read(leftBuff, 0, leftBuff.length); int readRight = rightStream.read(rightBuff, 0, rightBuff.length); int readMin = Math.min(readLeft, readRight); diffFound |= (readLeft == -1) != (readRight == -1); <START> diffFound |= !equalArrays(readMin, leftBuff, rightBuff); <END> eofFound |= readMin < 0; if (readMin > 0) { leftStream.reset(); rightStream.reset(); leftStream.skip(readMin); rightStream.skip(readMin); } } return !diffFound; } catch (CoreException e) { logError(e); } catch (IOException e) { logError(e); } finally { Closeables.closeQuietly(leftStream); Closeables.closeQuietly(rightStream); } return false; }</code><technical_language>I dubious "|=" operator, bitwse or, logical. I prefer do that: if ((readLeft == -1) != (readRight == -1) || !equalArrays(readMin, leftBuff, rightBuff) { return false; } remove diffFound variable return true while loop</technical_language>

Target:
public static boolean binaryIdentical(IStorage left, IStorage right) { BufferedInputStream leftStream = null; BufferedInputStream rightStream = null; try { final int maxBufferSize = 8192; final byte[] leftBuff = new byte[maxBufferSize]; final byte[] rightBuff = new byte[maxBufferSize]; leftStream = new BufferedInputStream(left.getContents(), maxBufferSize); rightStream = new BufferedInputStream(right.getContents(), maxBufferSize); int readMin; do { leftStream.mark(maxBufferSize); rightStream.mark(maxBufferSize); int readLeft = leftStream.read(leftBuff, 0, leftBuff.length); int readRight = rightStream.read(rightBuff, 0, rightBuff.length); readMin = Math.min(readLeft, readRight); if ((readLeft == -1) != (readRight == -1) || !equalArrays(readMin, leftBuff, rightBuff)) { return false; } if (readMin > 0) { resetAndSkip(leftStream, readMin); resetAndSkip(rightStream, readMin); } } while (readMin > 0); return true; } catch (CoreException e) { logError(e); } catch (IOException e) { logError(e); } finally { Closeables.closeQuietly(leftStream); Closeables.closeQuietly(rightStream); } return false; }
Source:
<code>private static void spawnMetricsAccounting(SpawnMetrics.Builder spawnMetrics, ExecutedActionMetadata executionMetadata) { if (!executionMetadata.getWorker().isEmpty()) { <START> Duration remoteQueueTime = spawnMetrics.build().remoteQueueTime().plus( <END> between( executionMetadata.getQueuedTimestamp(), executionMetadata.getWorkerStartTimestamp())); spawnMetrics.setRemoteQueueTime(remoteQueueTime); Duration setupTime = between( executionMetadata.getWorkerStartTimestamp(), executionMetadata.getExecutionStartTimestamp()); spawnMetrics.setSetupTime(setupTime); Duration executionWallTime = between( executionMetadata.getExecutionStartTimestamp(), executionMetadata.getExecutionCompletedTimestamp()); spawnMetrics.setExecutionWallTime(executionWallTime); Duration remoteProcessOutputsTime = between( executionMetadata.getOutputUploadStartTimestamp(), executionMetadata.getOutputUploadCompletedTimestamp()); spawnMetrics.setRemoteProcessOutputsTime(remoteProcessOutputsTime); } }</code><technical_language>I a hard time understanding summing queue times. explain this a bit more please</technical_language>

Target:
static void spawnMetricsAccounting(SpawnMetrics.Builder spawnMetrics, ExecutedActionMetadata executionMetadata) { if (!executionMetadata.getWorker().isEmpty()) { Duration remoteQueueTime = spawnMetrics.build().remoteQueueTime().plus( between( executionMetadata.getQueuedTimestamp(), executionMetadata.getWorkerStartTimestamp())); spawnMetrics.setRemoteQueueTime(remoteQueueTime); Duration setupTime = between( executionMetadata.getWorkerStartTimestamp(), executionMetadata.getExecutionStartTimestamp()); spawnMetrics.setSetupTime(setupTime); Duration executionWallTime = between( executionMetadata.getExecutionStartTimestamp(), executionMetadata.getExecutionCompletedTimestamp()); spawnMetrics.setExecutionWallTime(executionWallTime); Duration remoteProcessOutputsTime = between( executionMetadata.getOutputUploadStartTimestamp(), executionMetadata.getOutputUploadCompletedTimestamp()); spawnMetrics.setRemoteProcessOutputsTime(remoteProcessOutputsTime); } }
Source:
<code>public Object onTraversalSuccess(){ if (! exhaustedTruthVariants){ if (currentTruthVariant.get().isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } while (truthIterator.hasNext()){ currentTruthVariant = getNextNonSVTruthVariant(); <START> if (! currentTruthVariant.isPresent()) { break; } <END> if (currentTruthVariant.get().isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } } } try ( ConcordanceSummaryRecord.Writer concordanceSummaryWriter = ConcordanceSummaryRecord.getWriter(summary) ){ concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.SNP, snpTruePositives, snpFalsePositives, snpFalseNegatives)); concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.INDEL, indelTruePositives, indelFalsePositives, indelFalseNegatives)); variantStatusWriter.close(); } catch (IOException e){ throw new UserException("Encountered an IO exception writing the concordance summary table", e); } return "SUCCESS"; }</code><technical_language>FilterIterator this get simpler</technical_language>

Target:
public Object onTraversalSuccess() { if (! exhaustedTruthVariants ) { while (true) { if (currentTruthVariant.isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } if (truthIterator.hasNext()) { checkInvariant(); currentTruthVariant = truthIterator.next(); } else { break; } } } try ( ConcordanceSummaryRecord.Writer concordanceSummaryWriter = ConcordanceSummaryRecord.getWriter(summary) ){ concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.SNP, snpTruePositives, snpFalsePositives, snpFalseNegatives)); concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.INDEL, indelTruePositives, indelFalsePositives, indelFalseNegatives)); variantStatusWriter.close(); } catch (IOException e){ throw new UserException("Encountered an IO exception writing the concordance summary table", e); } return "SUCCESS"; }
Source:
<code>private static void runInCurrentThread(IRunnableWithProgress runnable, IProgressMonitor progressMonitor) throws InterruptedException, InvocationTargetException { try { if (runnable != null) { runnable.run(progressMonitor); } } catch (InvocationTargetException | InterruptedException | ThreadDeath e) { throw e; <START> }catch (OperationCanceledException e) { <END> throw new InterruptedException(); } catch (RuntimeException | Error e) { throw new InvocationTargetException(e); } }</code><technical_language>space catch</technical_language>

Target:
private static void runInCurrentThread(IRunnableWithProgress runnable, IProgressMonitor progressMonitor) throws InterruptedException, InvocationTargetException { try { if (runnable != null) { runnable.run(progressMonitor); } } catch (InvocationTargetException | InterruptedException e) { throw e; } catch (OperationCanceledException e) { throw new InterruptedException(); } catch (ThreadDeath e) { throw e; } catch (RuntimeException | Error e) { throw new InvocationTargetException(e); } }
Source:
<code>public void updateChange(ChangeContext ctx) throws OrmException, AuthException, ResourceNotFoundException { IdentifiedUser user = ctx.getUser().asIdentifiedUser(); Change change = ctx.getChange(); ChangeControl ctl = ctx.getChangeControl(); PatchSet.Id psId = change.currentPatchSetId(); PatchSetApproval psa = null; StringBuilder msg = new StringBuilder(); for (PatchSetApproval a : approvalsUtil.byPatchSetUser( ctx.getDb(), ctl, psId, accountId)) { if (ctl.canRemoveReviewer(a)) { if (a.getLabel().equals(label)) { msg.append("Removed ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(user.getAccountId()) .getNameEmail()) .append("\n"); psa = a; a.setValue((short)0); ctx.getChangeUpdate().setPatchSetId(psId); ctx.getChangeUpdate().removeApproval(label); break; } } else { throw new AuthException("delete not permitted"); } } if (psa == null) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(change.getId(), ctx.getDb()); ctx.getDb().patchSetApprovals().update(Collections.singleton(psa)); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(ctx.getDb())), user.getAccountId(), <START> TimeUtil.nowTs(), <END> change.currentPatchSetId()); changeMessage.setMessage(msg.toString()); cmUtil.addChangeMessage(ctx.getDb(), ctx.getChangeUpdate(), changeMessage); } }</code><technical_language>ctx.getWhen()</technical_language>

Target:
public void updateChange(ChangeContext ctx) throws OrmException, AuthException, ResourceNotFoundException { IdentifiedUser user = ctx.getUser().asIdentifiedUser(); Change change = ctx.getChange(); ChangeControl ctl = ctx.getChangeControl(); PatchSet.Id psId = change.currentPatchSetId(); PatchSetApproval psa = null; StringBuilder msg = new StringBuilder(); for (PatchSetApproval a : approvalsUtil.byPatchSetUser( ctx.getDb(), ctl, psId, accountId)) { if (ctl.canRemoveReviewer(a)) { if (a.getLabel().equals(label)) { msg.append("Removed ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(user.getAccountId()) .getNameEmail()) .append("\n"); psa = a; a.setValue((short)0); ctx.getChangeUpdate().setPatchSetId(psId); ctx.getChangeUpdate().removeApproval(label); break; } } else { throw new AuthException("delete not permitted"); } } if (psa == null) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(change.getId(), ctx.getDb()); ctx.getDb().patchSetApprovals().update(Collections.singleton(psa)); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(ctx.getDb())), user.getAccountId(), ctx.getWhen(), change.currentPatchSetId()); changeMessage.setMessage(msg.toString()); cmUtil.addChangeMessage(ctx.getDb(), ctx.getChangeUpdate(), changeMessage); } }
Source:
<code>public void onArrowSuccessfulHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Arrow && e.getEntity() instanceof LivingEntity) { <START> if (e.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) return; <END> SlimefunBow bow = projectiles.get(e.getDamager().getUniqueId()); if (bow != null) { bow.callItemHandler(BowShootHandler.class, handler -> handler.onHit(e, (LivingEntity) e.getEntity())); } projectiles.remove(e.getDamager().getUniqueId()); } }</code><technical_language>negate include this in if-statement above</technical_language>

Target:
public void onArrowSuccessfulHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Arrow && e.getEntity() instanceof LivingEntity && e.getCause() != EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) { SlimefunBow bow = projectiles.get(e.getDamager().getUniqueId()); if (bow != null) { bow.callItemHandler(BowShootHandler.class, handler -> handler.onHit(e, (LivingEntity) e.getEntity())); } projectiles.remove(e.getDamager().getUniqueId()); } }
Source:
<code>public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data, final String versionMessage ) { Constructor exceptionConstructor = null; try { exceptionConstructor = UnifiedRepositoryUpdateFileException.class.getConstructor( String.class, Throwable.class ); } catch ( NoSuchMethodException e ) { <START> e.printStackTrace(); <END> } return callLogThrow( new Callable<RepositoryFile>() { public RepositoryFile call() throws Exception { return delegatee.updateFile( file, data, versionMessage ); } }, Messages.getInstance().getString( "ExceptionLoggingDecorator.updateFile", file != null ? file.getId() : null ), exceptionConstructor ); }</code><technical_language>above. e.printStackTrace() essentially kills exception there, exceptionConstructor in return null</technical_language>

Target:
public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data, final String versionMessage ) { Constructor exceptionConstructor = null; try { exceptionConstructor = UnifiedRepositoryUpdateFileException.class.getConstructor( String.class, Throwable.class ); } catch ( NoSuchMethodException e ) { logger.error( e ); } return callLogThrow( new Callable<RepositoryFile>() { public RepositoryFile call() throws Exception { return delegatee.updateFile( file, data, versionMessage ); } }, Messages.getInstance().getString( "ExceptionLoggingDecorator.updateFile", file != null ? file.getId() : null ), exceptionConstructor ); }
Source:
<code>private static <T extends PlanNode> Optional<T> findSinglePlanNode(StreamingSubPlan plan, Class<T> clazz) { List<PlanNode> allMatches = findPlanNodes(plan, clazz); switch (allMatches.size()) { case 0: return Optional.empty(); case 1: <START> return Optional.of((T) getOnlyElement(allMatches)); <END> default: throw new IllegalStateException(format("Multiple matches found for class %s", clazz)); } }</code><technical_language>avoid unchecked cast: * List<PlanNode> allMatches -> List<T> allMatches * In findPlanNodes: <T extends PlanNode> List<PlanNode> -> <T extends PlanNode> List<T>, .findAll()) -> .<T>findAll())</technical_language>

Target:
private static <T extends PlanNode> Optional<T> findSinglePlanNode(StreamingSubPlan plan, Class<T> clazz) { List<T> allMatches = findPlanNodes(plan, clazz); switch (allMatches.size()) { case 0: return Optional.empty(); case 1: return Optional.of(getOnlyElement(allMatches)); default: throw new IllegalArgumentException(format("Multiple matches found for class %s", clazz)); } }
Source:
<code>private ValuesWriter dictWriterWithFallBack(ColumnDescriptor path, int initialSizePerCol) { ValuesWriter fallbackWriter = fallbackWriter(path, initialSizePerCol); if (enableDictionary) { <START> return FallbackValuesWriter.of( <END> dictionaryWriter(path, initialSizePerCol), fallbackWriter); } else { return fallbackWriter; } }</code><technical_language>rename FallbackableValuesWriter a distinction fallBackWriter writer fall back</technical_language>

Target:
private ValuesWriter dictWriterWithFallBack(ColumnDescriptor path, int initialSizePerCol) { ValuesWriter writerToFallBackTo = writerToFallbackTo(path, initialSizePerCol); if (enableDictionary) { return FallbackValuesWriter.of( dictionaryWriter(path, initialSizePerCol), writerToFallBackTo); } else { return writerToFallBackTo; } }
Source:
<code>private String getRSyncPath() throws IOException { ProcessBuilder builder; if (Platform.OS_WIN32.equals(Platform.getOS())) { builder = new ProcessBuilder("where", "rsync.exe"); } else { builder = new ProcessBuilder("which", "rsync"); } Process process = builder.start(); String path; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { path = reader.readLine(); } try { if (process.waitFor() == 0) { return path; } else { throw new IOException(); } <START> } catch (InterruptedException e) { <END> throw new IOException(e); } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') re-interrupt this method rethrow "InterruptedException". [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private String getRSyncPath() throws IOException { ProcessBuilder builder; builder = getProcessBuilder(); Process process = builder.start(); String path; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { path = reader.readLine(); } try { if (process.waitFor() == 0) { return path; } else { throw new IOException(); } } catch (InterruptedException e) { throw new IOException(e); } }
Source:
<code>public OrderingScheme map(OrderingScheme orderingScheme) { return new OrderingScheme(orderingScheme.getOrderBy().stream().map(this::map).collect(toImmutableList()), <START> orderingScheme.getOrderings().entrySet().stream().collect(toMap(entry -> map(entry.getKey()), entry -> entry.getValue()))); <END> }</code><technical_language>Is this after</technical_language>

Target:
public OrderingScheme map(OrderingScheme orderingScheme) { ImmutableList.Builder<VariableReferenceExpression> orderBy = ImmutableList.builder(); ImmutableMap.Builder<VariableReferenceExpression, SortOrder> ordering = ImmutableMap.builder(); for (VariableReferenceExpression variable : orderingScheme.getOrderBy()) { VariableReferenceExpression translated = map(variable); orderBy.add(translated); ordering.put(translated, orderingScheme.getOrdering(variable)); } return new OrderingScheme(orderBy.build(), ordering.build()); }
Source:
<code>public void testRunNonStaticMain() throws Throwable { RunJar runJar = spy(new RunJar()); when(runJar.useClientClassLoader()).thenReturn(true); String mainCls = NonStaticMain.class.getName(); String systemClasses = "-" + mainCls + "," + ApplicationClassLoader.SYSTEM_CLASSES_DEFAULT; when(runJar.getSystemClasses()).thenReturn(systemClasses); <START> File testJar = JarFinder.makeClassLoaderTestJar(this.getClass(), TEST_ROOT_DIR, TEST_JAR_2_NAME, BUFF_SIZE, <END> mainCls); String[] args = new String[3]; args[0] = testJar.getAbsolutePath(); args[1] = mainCls; try { runJar.run(args); fail("run should throw IOException."); } catch (IOException e) { GenericTestUtils.assertExceptionContains("Method main must be static", e); } }</code><technical_language>80 chars</technical_language>

Target:
public void testRunNonStaticMain() throws Throwable { RunJar runJar = spy(new RunJar()); when(runJar.useClientClassLoader()).thenReturn(true); String mainCls = NonStaticMain.class.getName(); String systemClasses = "-" + mainCls + "," + ApplicationClassLoader.SYSTEM_CLASSES_DEFAULT; when(runJar.getSystemClasses()).thenReturn(systemClasses); File testJar = JarFinder.makeClassLoaderTestJar(this.getClass(), TEST_ROOT_DIR, TEST_JAR_2_NAME, BUFF_SIZE, mainCls); String[] args = new String[] {testJar.getAbsolutePath(), mainCls}; try { runJar.run(args); fail("run should throw IOException."); } catch (IOException e) { GenericTestUtils.assertExceptionContains("Method main must be static", e); } }
Source:
<code>private boolean isLastDayOfMonth(Calendar calendar) { calendar.set(Calendar.DATE, (calendar.get(Calendar.DATE) + 1)); <START> if (calendar.get(Calendar.DAY_OF_MONTH) == 1) { <END> return true; } return false; }</code><technical_language>return calendar.get(Calendar.DAY_OF_MONTH) == 1</technical_language>

Target:
private boolean isLastDayOfMonth(Calendar calendar) { calendar.set(Calendar.DATE, (calendar.get(Calendar.DATE) + 1)); return calendar.get(Calendar.DAY_OF_MONTH) == 1; }
Source:
<code>private static List<? extends KeyFormat<?>> createPersistenceList(int size) { <START> List<SimpleKeyFormat<Type>> list = new ArrayList<>(); <END> for (int index = 0; index < size; index++) { SimpleKeyFormat<Type> typeSimpleKeyFormat = new SimpleKeyFormat<>((Class<Type>) Type.values()[index].getClass(), value -> Type.valueOf(value), Type::name); list.add(typeSimpleKeyFormat); } return list; }</code><technical_language>ArrayList constructed fixed capacity</technical_language>

Target:
private static List<? extends KeyFormat<?>> createPersistenceList(int size) { return java.util.stream.IntStream.range(0, size).mapToObj(index -> new SimpleKeyFormat<>((Class<Type>) Type.values()[index].getClass(), value -> Type.valueOf(value), Type::name)).collect(Collectors.toList()); }
Source:
<code>public final Object invoke(Object proxy, Method invoked, @Nullable Object[] argv) throws Throwable { if (argv == null) { argv = NO_ARGS; } if (argv.length == 0 && invoked.getName().equals("hashCode")) { return hashCode(); } if (argv.length == 1 && invoked.getName().equals("equals") && invoked.getParameterTypes()[0] == Object.class) { Object arg = argv[0]; return proxy.getClass().isInstance(arg) && equals(Proxy.getInvocationHandler(arg)); } if (argv.length == 0 && invoked.getName().equals("toString")) { return toString(); } List<Object> args = Arrays.asList(argv); if (all(args, notNull())) args = ImmutableList.copyOf(args); else args = Collections.unmodifiableList(args); Invokable<?, Object> invokable = method(ownerType, invoked); Invocation invocation = Invocation.create(invokable, args); try { <START> return handle(invocation, invoked); <END> } catch (Throwable e) { propagateIfPossible(e, invocation.getInvokable().getExceptionTypes()); throw e; } }</code><technical_language>Right, backport upgrade Guava, work for handful of users a newer Guava older jclouds version</technical_language>

Target:
public final Object invoke(Object proxy, Method invoked, @Nullable Object[] argv) throws Throwable { if (argv == null) { argv = NO_ARGS; } if (argv.length == 0 && invoked.getName().equals("hashCode")) { return hashCode(); } if (argv.length == 1 && invoked.getName().equals("equals") && invoked.getParameterTypes()[0] == Object.class) { Object arg = argv[0]; return proxy.getClass().isInstance(arg) && equals(Proxy.getInvocationHandler(arg)); } if (argv.length == 0 && invoked.getName().equals("toString")) { return toString(); } List<Object> args = Arrays.asList(argv); if (all(args, notNull())) args = ImmutableList.copyOf(args); else args = Collections.unmodifiableList(args); Invokable<?, Object> invokable = method(ownerType, invoked); Invocation invocation = Invocation.create(invokable, args); try { return handle(invocation); } catch (Throwable e) { propagateIfPossible(e, invocation.getInvokable().getExceptionTypes()); throw e; } }
Source:
<code>public Date getEndDate() { <START> return endDate != null ? (Date) endDate.clone() : new Date(); <END> }</code><technical_language>diffrent methods here? 1 . new Date(onsetDate.getTime()) 2. (Date) endDate.clone() consistency code, provide feedback select others</technical_language>

Target:
public Date getEndDate() { return endDate != null ? (Date) endDate.clone() : null; }
Source:
<code>public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap(); <START> observations.put("1","1"); <END> List<Observation> obsList = convertObservationMapToList(observations, encounterDatetime); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, provider.getPerson(), obsList); doReturn(Collections.singletonList(location)).when(locationService).getLocations(eq(null), eq(location.getName())); doReturn(patient).when(patientService).getPatientByUuid(eq(null), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(null), eq(provider.getUuid())); openMRSActionProxyService.createEncounter(new DateTime(encounter.getEncounterDatetime()), encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), observations); verify(encounterService).createEncounter(eq(null), encounterCaptor.capture()); assertEquals(encounter, encounterCaptor.getValue()); }</code><technical_language>some more realistic values for observations. key is concept name, I right ? please 'testConceptName'</technical_language>

Target:
public void shouldCreateEncounterWithGivenParameters() { Location location = new Location(); location.setName("testLocation"); Patient patient = new Patient(); patient.setUuid("10"); Provider provider = new Provider(); provider.setUuid("20"); Person person = new Person(); person.setUuid("30"); provider.setPerson(person); DateTime encounterDatetime = new DateTime("2000-08-16T07:22:05Z"); Map<String, String> observations = new HashMap<>(); observations.put("testConceptName","testObservationValueName"); List<Observation> obsList = createObservationList(); Encounter encounter = new Encounter(location, new EncounterType("testEncounterType"), encounterDatetime.toDate(), patient, provider.getPerson(), obsList); doReturn(Collections.singletonList(location)).when(locationService).getLocations(eq(null), eq(location.getName())); doReturn(patient).when(patientService).getPatientByUuid(eq(null), eq(patient.getUuid())); doReturn(provider).when(providerService).getProviderByUuid(eq(null), eq(provider.getUuid())); openMRSActionProxyService.createEncounter(new DateTime(encounter.getEncounterDatetime()), encounter.getEncounterType().getName(), location.getName(), patient.getUuid(), provider.getUuid(), observations); verify(encounterService).createEncounter(eq(null), encounterCaptor.capture()); assertEquals(encounter, encounterCaptor.getValue()); }
Source:
<code>public Boolean getUserPropertyAsBoolean(String propertyKey) { String userProperty = this.getUserProperty(propertyKey); <START> if(userProperty != null && "1".equals(userProperty)) { <END> return true; } else { return false; } }</code><technical_language>Mixed tabs spaces. return userProperty != null && "1".equals(userProperty); :P</technical_language>

Target:
public Boolean getUserPropertyAsBoolean(String propertyKey) { String userProperty = this.getUserProperty(propertyKey); return userProperty != null && "1".equals(userProperty); }
Source:
<code>private List<Tag> configureTags(CloudSigma2TemplateOptions options) { ImmutableList.Builder<Tag> builder = ImmutableList.builder(); for (String tagName : options.getTags()) { String nameWithPrefix = groupNamingConvention.sharedNameForGroup(tagName); builder.add(new Tag.Builder().name(nameWithPrefix).build()); } List<Tag> tags = builder.build(); List<Tag> result = Lists.newArrayList(); if (!tags.isEmpty()) { logger.debug(">> creating tags..."); result.addAll(api.createTags(tags)); } <START> return result; <END> }</code><technical_language>immutable list builder here? result _need_ mutable</technical_language>

Target:
private List<Tag> configureTags(CloudSigma2TemplateOptions options) { ImmutableList.Builder<Tag> builder = ImmutableList.builder(); for (String tagName : options.getTags()) { String nameWithPrefix = groupNamingConvention.sharedNameForGroup(tagName); builder.add(new Tag.Builder().name(nameWithPrefix).build()); } List<Tag> tags = builder.build(); builder = ImmutableList.builder(); if (!tags.isEmpty()) { logger.debug(">> creating tags..."); builder.addAll(api.createTags(tags)); } return builder.build(); }
Source:
<code>public String getDefaultEndpointURL(String hcid, String sUniformServiceName, String exchangeName) throws ExchangeManagerException { LOG.info("Picking endpoint from exchange", null == exchangeName ? getDefaultExchange() : exchangeName); OrganizationType org = this.getOrganization(exchangeName, hcid); if (null == org) { return ""; } if (org.getEndpointList() != null && CollectionUtils.isNotEmpty(org.getEndpointList().getEndpoint())) { for (EndpointType epType : org.getEndpointList().getEndpoint()) { if (ExchangeManagerHelper.hasService(epType, sUniformServiceName)) { NhincConstants.UDDI_SPEC_VERSION highestVersion = ExchangeManagerHelper.getHighestUDDISpecVersion( ExchangeManagerHelper.getSpecVersions(epType)); <START> return StoreUtil.addGatewayAlias(ExchangeManagerHelper.getEndpointURLBySpecVersion( <END> epType.getEndpointConfigurationList(), highestVersion), getGatewayAlias(exchangeName)); } } } return ""; }</code><technical_language>Recommend divide 2 method. for save internal hashmap other for return url lookup. For example: String url = ExchangeManagerHelper.getEndpointURLBySpecVersion(epType.getEndpointConfigurationList(),higestAPI); StoreUtil.addGatewayAlias(url,getGatewayAlias(exchangeName))</technical_language>

Target:
public String getDefaultEndpointURL(String hcid, String sUniformServiceName, String exchangeName) throws ExchangeManagerException { LOG.info("Picking endpoint from exchange", null == exchangeName ? getDefaultExchange() : exchangeName); OrganizationType org = this.getOrganization(exchangeName, hcid); if (null == org) { return ""; } if (org.getEndpointList() != null && CollectionUtils.isNotEmpty(org.getEndpointList().getEndpoint())) { for (EndpointType epType : org.getEndpointList().getEndpoint()) { if (ExchangeManagerHelper.hasService(epType, sUniformServiceName)) { NhincConstants.UDDI_SPEC_VERSION highestVersion = ExchangeManagerHelper.getHighestUDDISpecVersion( ExchangeManagerHelper.getSpecVersions(epType)); String url = ExchangeManagerHelper .getEndpointURLBySpecVersion(epType.getEndpointConfigurationList(), highestVersion); return StoreUtil.addGatewayAlias(url, getGatewayAlias(exchangeName)); } } } return ""; }
Source:
<code>public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); TiledReaderWriter tiledReadWriter = new TiledReaderWriter(args[0], args[1], tileSizeX, tileSizeY); <START> boolean initializationSuccess = tiledReadWriter.initialize(); <END> tiledReadWriter.readWriteTiles(); tiledReadWriter.cleanup(); }</code><technical_language>reported Travis, method is void boolean initializationSuccess = removed</technical_language>

Target:
public static void main(String[] args) throws FormatException, IOException, DependencyException, ServiceException { int tileSizeX = Integer.parseInt(args[2]); int tileSizeY = Integer.parseInt(args[3]); TiledReaderWriter tiledReadWriter = new TiledReaderWriter(args[0], args[1], tileSizeX, tileSizeY); tiledReadWriter.initialize(); try { tiledReadWriter.readWriteTiles(); } catch(Exception e) { System.err.println("Failed to read and write tiles."); e.printStackTrace(); throw e; } finally { tiledReadWriter.cleanup(); } }
Source:
<code>public boolean isEvaluable(TermContext context) { if (evaluable != null) { return evaluable; } evaluable = false; if (!(kLabel instanceof KLabelConstant)) { <START> return evaluable; <END> } KLabelConstant kLabelConstant = (KLabelConstant) kLabel; if (!(kList instanceof KList)) { return evaluable; } if (kLabelConstant.label().startsWith("is") || !context.definition().functionRules().get(kLabelConstant).isEmpty() || BuiltinFunction.isBuiltinKLabel(kLabelConstant)) { return evaluable = true; } return evaluable; }</code><technical_language>return false</technical_language>

Target:
public boolean isEvaluable(TermContext context) { if (evaluable != null) { return evaluable; } evaluable = false; if (!(kLabel instanceof KLabelConstant)) { return false; } KLabelConstant kLabelConstant = (KLabelConstant) kLabel; if (!(kList instanceof KList)) { return false; } if (kLabelConstant.label().startsWith("is") || !context.definition().functionRules().get(kLabelConstant).isEmpty() || BuiltinFunction.isBuiltinKLabel(kLabelConstant)) { evaluable = true; } return evaluable; }
Source:
<code>public Mono<VirtualNetworkGatewayConnection> createResourceAsync() { beforeCreating(); return myManager .serviceClient() .getVirtualNetworkGatewayConnections() .createOrUpdateAsync(this.resourceGroupName(), this.name(), this.innerModel()) .map(innerToFluentMap(this)) .flatMap(virtualNetworkGatewayConnection -> { if (updateSharedKey == null) { return Mono.just(virtualNetworkGatewayConnection); } return myManager.serviceClient().getVirtualNetworkGatewayConnections() .setSharedKeyAsync( this.resourceGroupName(), this.name(), new ConnectionSharedKeyInner().withValue(updateSharedKey)) <START> .map(inner -> { updateSharedKey = null; return inner; }) <END> .then(myManager.serviceClient().getVirtualNetworkGatewayConnections() .getByResourceGroupAsync(this.resourceGroupName(), this.name()) .map(innerToFluentMap(this))); }); }</code><technical_language>doOnNext doOnComplete</technical_language>

Target:
public Mono<VirtualNetworkGatewayConnection> createResourceAsync() { beforeCreating(); return myManager .serviceClient() .getVirtualNetworkGatewayConnections() .createOrUpdateAsync(this.resourceGroupName(), this.name(), this.innerModel()) .map(innerToFluentMap(this)) .flatMap(virtualNetworkGatewayConnection -> { if (updateSharedKey == null) { return Mono.just(virtualNetworkGatewayConnection); } return myManager.serviceClient().getVirtualNetworkGatewayConnections() .setSharedKeyAsync( this.resourceGroupName(), this.name(), new ConnectionSharedKeyInner().withValue(updateSharedKey)) .doOnSuccess(inner -> { updateSharedKey = null; }) .then(myManager.serviceClient().getVirtualNetworkGatewayConnections() .getByResourceGroupAsync(this.resourceGroupName(), this.name()) .map(innerToFluentMap(this))); }); }
Source:
<code>private void service() throws IOException { if (biDirectionalPipe) sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut)); else { refs = refFilter.filter(db.getAllRefs()); for (Ref r : refs.values()) { try { walk.parseAny(r.getObjectId()).add(ADVERTISED); } catch (IOException e) { } } } recvWants(); if (wantAll.isEmpty()) return; if (options.contains(OPTION_MULTI_ACK_DETAILED)) multiAck = MultiAck.DETAILED; else if (options.contains(OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; <START> if (depth != 0) { <END> processShallow(); } if (negotiate()) { sendPack(); } }</code><technical_language>Style-nit: unnecessary curly braces</technical_language>

Target:
private void service() throws IOException { if (biDirectionalPipe) sendAdvertisedRefs(new PacketLineOutRefAdvertiser(pckOut)); else { refs = refFilter.filter(db.getAllRefs()); for (Ref r : refs.values()) { try { walk.parseAny(r.getObjectId()).add(ADVERTISED); } catch (IOException e) { } } } recvWants(); if (wantAll.isEmpty()) return; if (options.contains(OPTION_MULTI_ACK_DETAILED)) multiAck = MultiAck.DETAILED; else if (options.contains(OPTION_MULTI_ACK)) multiAck = MultiAck.CONTINUE; else multiAck = MultiAck.OFF; if (depth != 0) processShallow(); if (negotiate()) sendPack(); }
Source:
<code>public Block appendNull() { int desiredLength = idsOffset + positionCount + 1; int[] newIds = Arrays.copyOf(ids, desiredLength); Block newDictionary = dictionary; int nullIndex = findNull(dictionary); if (nullIndex == NULL_NOT_FOUND) { newIds[idsOffset + positionCount] = dictionary.getPositionCount(); newDictionary = dictionary.appendNull(); <START> } <END> else { newIds[idsOffset + positionCount] = nullIndex; } return new DictionaryBlock(idsOffset, positionCount + 1, newDictionary, newIds, isCompact(), getDictionarySourceId()); }</code><technical_language>ensureCapacity helper method; here</technical_language>

Target:
public Block appendNull() { int desiredLength = idsOffset + positionCount + 1; int[] newIds = Arrays.copyOf(ids, desiredLength); Block newDictionary = dictionary; int nullIndex = NULL_NOT_FOUND; if (dictionary.mayHaveNull()) { int dictionaryPositionCount = dictionary.getPositionCount(); for (int i = 0; i < dictionaryPositionCount; i++) { if (dictionary.isNull(i)) { nullIndex = i; break; } } } if (nullIndex == NULL_NOT_FOUND) { newIds[idsOffset + positionCount] = dictionary.getPositionCount(); newDictionary = dictionary.appendNull(); } else { newIds[idsOffset + positionCount] = nullIndex; } return new DictionaryBlock(idsOffset, positionCount + 1, newDictionary, newIds, isCompact(), getDictionarySourceId()); }
Source:
<code>generateExpressionsArrayOnStack(ExpressionClassBuilder acb, MethodBuilder mb, ResultColumnList resultColumns) { boolean genExpressions = resultColumns != null; int numberOfValues = genExpressions ? resultColumns.size() : 0; String expressions = new String[numberOfValues]; int i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { expressions[i] = OperatorToString.opToSparkString(rc.getExpression()); if (expressions[i] == null) { genExpressions = false; numberOfValues = 0; break; } i++; } } <START> String stringClassName = "java.lang.String"; <END> LocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, stringClassName + "[]"); mb.pushNewArray(stringClassName, numberOfValues); mb.setField(arrayField); i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { mb.getField(arrayField); mb.push(expressions[i]); mb.setArrayElement(i++); } } mb.getField(arrayField); }</code><technical_language>generated String.class..</technical_language>

Target:
generateExpressionsArrayOnStack(ExpressionClassBuilder acb, MethodBuilder mb, ResultColumnList resultColumns) throws StandardException { boolean genExpressions = resultColumns != null; int numberOfValues = genExpressions ? resultColumns.size() : 0; String expressions = new String[numberOfValues]; int i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { expressions[i] = OperatorToString.opToSparkString(rc.getExpression()); if (expressions[i].isEmpty()) { genExpressions = false; numberOfValues = 0; break; } i++; } } String stringClassName = "java.lang.String"; LocalField arrayField = acb.newFieldDeclaration( Modifier.PRIVATE, stringClassName + "[]"); mb.pushNewArray(stringClassName, numberOfValues); mb.setField(arrayField); i = 0; if (genExpressions) { for (ResultColumn rc : resultColumns) { mb.getField(arrayField); mb.push(expressions[i]); mb.setArrayElement(i++); } } mb.getField(arrayField); }
Source:
<code>public void updateSpawner() { if (isActivated()) { BlockPos blockpos = this.getSpawnerPosition(); if (!getSpawnerWorld().isRemote) { if (this.spawnDelay == -1) { this.resetTimer(); } if (this.spawnDelay > 0) { --this.spawnDelay; return; } if ((getSpawnerWorld().getWorldTime()) % 24000 < this.spawnedLast) { this.spawnedToday = 0; this.flag = true; } if (!this.flag) return; boolean flag1 = false; for (int i = 0; i < this.spawnCount; ++i) { Entity entity = EntityList.createEntityByIDFromName(this.getEntityName(), this.getSpawnerWorld()); if (entity == null) { break; } int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), getSpawningBox()).size(); if (j >= this.maxNearbyEntities) { this.resetTimer(); break; } if (limitType != null) { int total = this.getSpawnerWorld().countEntities(limitType, true); total = total * UtilLib.countPlayerLoadedChunks(this.getSpawnerWorld()) / MOB_COUNT_DIV; if (total > limitType.getMaxNumberOfCreature()) { this.resetTimer(); break; } } if (UtilLib.spawnEntityInWorld(getSpawnerWorld(), getSpawningBox(), entity, 1)) { onSpawned(entity); flag1 = true; } } if (flag1) { this.resetTimer(); this.spawnedToday++; <START> this.spawnedLast = getSpawnerWorld().getWorldTime(); <END> } } } }</code><technical_language>worldTime behaves (it larger 24000). worlTime change if day night cycle is disabled. I getTotalWorldTime % 24000 (as above). worldTime % 24000</technical_language>

Target:
public void updateSpawner() { if (isActivated()) { BlockPos blockpos = this.getSpawnerPosition(); if (!getSpawnerWorld().isRemote) { if (this.spawnDelay == -1) { this.resetTimer(); } if (this.spawnDelay > 0) { --this.spawnDelay; return; } if ((getSpawnerWorld().getTotalWorldTime()) % 24000 < this.spawnedLast) { this.spawnedToday = 0; this.flag = true; } if (!this.flag) return; boolean flag1 = false; for (int i = 0; i < this.spawnCount; ++i) { Entity entity = EntityList.createEntityByIDFromName(this.getEntityName(), this.getSpawnerWorld()); if (entity == null) { break; } int j = this.getSpawnerWorld().getEntitiesWithinAABB(entity.getClass(), getSpawningBox()).size(); if (j >= this.maxNearbyEntities) { this.resetTimer(); break; } if (limitType != null) { int total = this.getSpawnerWorld().countEntities(limitType, true); total = total * UtilLib.countPlayerLoadedChunks(this.getSpawnerWorld()) / MOB_COUNT_DIV; if (total > limitType.getMaxNumberOfCreature()) { this.resetTimer(); break; } } if (UtilLib.spawnEntityInWorld(getSpawnerWorld(), getSpawningBox(), entity, 1)) { onSpawned(entity); flag1 = true; } } if (flag1) { this.resetTimer(); this.spawnedToday++; this.spawnedLast = getSpawnerWorld().getTotalWorldTime() % 24000; } } } }
Source:
<code><START> public void visit(Consumer<? super T> consumer) { <END> }</code><technical_language>this method do something</technical_language>

Target:
public void visit(Consumer<? super T> consumer) { consumer.accept(expression); }
Source:
<code>public TaskRepository repository() { <START> repository = new TaskRepository(getConnectorKind(), getRepositoryUrl()); <END> return repository; }</code><technical_language>field removed well</technical_language>

Target:
public TaskRepository repository() { return new TaskRepository(getConnectorKind(), getRepositoryUrl()); }
Source:
<code>public RequestProp(String name, ModelNode props, ModelNode value) { this.name = name; this.props = props; this.value = value; this.type = props.get("type").asType(); if (props.get("description").isDefined()) { this.description = props.get("description").asString(); } if (props.get("required").isDefined()) { this.isRequired = props.get("required").asBoolean(); } if (props.get("nillable").isDefined()) { this.nillable = props.get("nillable").asBoolean(); } <START> if (props.get("expressions-allowed").isDefined()) { <END> this.expressionsAllowed = props.get("expressions-allowed").asBoolean(); } if (props.get("default").isDefined()) { this.defaultValue = props.get("default"); } setInputComponent(); setInputComponentValue(); }</code><technical_language>props.hasDefined("expressions-allowed") ModeNode "get" method mutates model node adding undefined child key. This a fluent API node.get("enabled").set(true) possible. means need "hasDefined" for this kind of check avoid unintended mutation of node. In this case matter, enforce this a code style kind of people correct usage matter</technical_language>

Target:
public RequestProp(String name, ModelNode props, ModelNode value) { this.name = name; this.props = props; this.value = value; this.type = props.get("type").asType(); if (props.hasDefined("description")) { this.description = props.get("description").asString(); } if (props.hasDefined("required")) { this.isRequired = props.get("required").asBoolean(); } if (props.hasDefined("nillable")) { this.nillable = props.get("nillable").asBoolean(); } if (props.hasDefined("expressions-allowed")) { this.expressionsAllowed = props.get("expressions-allowed").asBoolean(); } if (props.hasDefined("default")) { this.defaultValue = props.get("default"); } setInputComponent(); setInputComponentValue(); }