auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Response processResult(Object result, Class<?> resultType, String type) { Response.ResponseBuilder builder = Response.status(Response.Status.OK); if (resultType.equals(Void.TYPE) || resultType.equals(Void.class)) { builder.entity(type.equals(COMPLETE) ? ParticipantStatus.Completed.name() : ParticipantStatus.Compensated.name()); } else if (result == null) { builder.status(Response.Status.NOT_FOUND); } else if (result instanceof ParticipantStatus) { ParticipantStatus status = (ParticipantStatus) result; if (status == ParticipantStatus.Compensating || status == ParticipantStatus.Completing) { return builder.status(Response.Status.ACCEPTED).build(); } else { builder.entity(status.name()); } } else if (result instanceof Response) { return (Response) result; } else if (result instanceof Throwable) { builder.entity(processThrowable((Throwable) result, type)); } else { throw new IllegalStateException("Invalid type of returned object: " + result.getClass()); } <START> <END> return builder.build(); }</code><technical_language>@xstefank I if localization LRA if do a follow tasks localize this. required in this PR /cc @mmusgrov</technical_language>

Target:
private Response processResult(Object result, Class<?> resultType, String type) { Response.ResponseBuilder builder = Response.status(Response.Status.OK); if (resultType.equals(Void.TYPE) || resultType.equals(Void.class)) { builder.entity(type.equals(COMPLETE) ? ParticipantStatus.Completed.name() : ParticipantStatus.Compensated.name()); } else if (result == null) { builder.status(Response.Status.NOT_FOUND); } else if (result instanceof ParticipantStatus) { ParticipantStatus status = (ParticipantStatus) result; if (status == ParticipantStatus.Compensating || status == ParticipantStatus.Completing) { return builder.status(Response.Status.ACCEPTED).build(); } else { builder.entity(status.name()); } } else if (result instanceof Response) { return (Response) result; } else { builder.entity(processThrowable((Throwable) result, type)); } return builder.build(); }
Source:
<code>public void finish() { blocked.set(null); if (pageSource != null) { <START> recordPageSourceRawInputStats(); <END> try { pageSource.close(); } catch (IOException e) { throw new UncheckedIOException(e); } } else if (cursor != null) { recordCursorInputStats(0); cursor.close(); } finishing = true; mergingOutput.finish(); }</code><technical_language>I understand this call is needed. If LazyBlocks loaded, data is read, stats update</technical_language>

Target:
public void finish() { blocked.set(null); if (pageSource != null) { try { pageSource.close(); } catch (IOException e) { throw new UncheckedIOException(e); } } else if (cursor != null) { cursor.close(); } finishing = true; mergingOutput.finish(); }
Source:
<code>@Override public DataContainer toContainer() { final DataContainer container = new MemoryDataContainer(); container.set(Queries.CONTENT_VERSION, this.getContentVersion()) <START> .set(DataQuery.of("BaseColor"), this.baseColor.toContainer()) <END> .set(DataQuery.of("Shade"), this.shade.getId()); return container; }</code><technical_language>DataConstants thereof. generate new DataQuery objects time</technical_language>

Target:
public DataContainer toContainer() { final DataContainer container = DataContainer.createNew(); container.set(Queries.CONTENT_VERSION, this.getContentVersion()) .set(DataQueries.MAP_BASE_COLOR, this.baseColor) .set(DataQueries.MAP_SHADE, this.shade.getId()); return container; }
Source:
<code>public void setSystemProperty(CoreSession session, List<String> ids, Boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(NXQL.ECM_UUID)); try { session.setDocumentSystemProp(ref, "isTrashed", value); updatedRefs.add(ref); } catch (NuxeoException e) { getLog().warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { <START> getLog().warn("Cannot save session", e); <END> } }</code><technical_language>getLog() method</technical_language>

Target:
public void setSystemProperty(CoreSession session, List<String> ids, Boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL.NXQL)) { for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(NXQL.ECM_UUID)); try { session.setDocumentSystemProp(ref, "isTrashed", value); updatedRefs.add(ref); } catch (NuxeoException e) { log.warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { log.warn("Cannot save session", e); } }
Source:
<code>public Class<String> getDatumClass() { <START> return null; <END> }</code><technical_language>please return String.class</technical_language>

Target:
public Class<String> getDatumClass() { return String.class; }
Source:
<code>Software(String imageId, boolean cachedImage, Map<String, String> files, List<String> packages, List<Repository> repositories, Map<String, String> options) { super(options); <START> this.imageId = processImageId(imageId); <END> this.cachedImage = cachedImage; this.files = ImmutableMap.copyOf(files); this.packages = ImmutableList.copyOf(packages); this.repositories = ImmutableList.copyOf(repositories); }</code><technical_language>do smart - provider able decide map "default"</technical_language>

Target:
Software(String imageId, boolean cachedImage, Map<String, String> files, List<String> packages, List<Repository> repositories, Map<String, String> options) { super(options); this.imageId = checkNotNull(imageId, "The supplied imageId was null"); this.cachedImage = cachedImage; this.files = ImmutableMap.copyOf(files); this.packages = ImmutableList.copyOf(packages); this.repositories = ImmutableList.copyOf(repositories); }
Source:
<code>public @Nullable SerialPortIdentifier getPortIdentifier(URI port) { CommPortIdentifier ident = null; try { ident = CommPortIdentifier.getPortIdentifier(port.getPath()); } catch (javax.comm.NoSuchPortException e) { <START> logger.info("No SerialPortIdentifier found for: {}", port.getPath()); <END> return null; } return new SerialPortIdentifierImpl(ident); }</code><technical_language>This debug level</technical_language>

Target:
public @Nullable SerialPortIdentifier getPortIdentifier(URI port) { CommPortIdentifier ident = null; try { ident = CommPortIdentifier.getPortIdentifier(port.getPath()); } catch (javax.comm.NoSuchPortException e) { logger.debug("No SerialPortIdentifier found for: {}", port.getPath()); return null; } return new SerialPortIdentifierImpl(ident); }
Source:
<code>public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case INSTRUCTOR_SUBMISSION: String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); if (instructorAttributes == null) { <START> throw new EntityNotFoundException(new EntityDoesNotExistException("Instructor could not be found for " <END> + "this course")); } return new JsonResult(new InstructorData(instructorAttributes)); case FULL_DETAIL: return null; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }</code><technical_language>above, return 404 jsonresult message need</technical_language>

Target:
public ActionResult execute() { Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case INSTRUCTOR_SUBMISSION: String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); if (instructorAttributes == null) { return new JsonResult("Instructor could not be found for this course", HttpStatus.SC_NOT_FOUND); } return new JsonResult(new InstructorData(instructorAttributes)); case FULL_DETAIL: return null; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }
Source:
<code>public String getJMXUrl() { ServerDelegate sd = (ServerDelegate)server.loadAdapter(ServerDelegate.class, null); int port = -1; <START> if( !(sd instanceof IManagementPortProvider)) <END> port = IJBossToolingConstants.WILDFLY8_MANAGEMENT_PORT_DEFAULT_PORT; else { port = ((IManagementPortProvider)sd).getManagementPort(); } String url = "service:jmx:http-remoting-jmx://" + server.getHost() + ":" + port; return url; }</code><technical_language>^ this is a code duplication</technical_language>

Target:
public String getJMXUrl() { return getJMXUrl(IJBossToolingConstants.WILDFLY8_MANAGEMENT_PORT_DEFAULT_PORT, "service:jmx:http-remoting-jmx"); }
Source:
<code>private JLoadTest getExecutionLoadTest(String id, Iterable queryProvider, List<ResponseValidatorProvider> validators, JLoadProfile standardGroupLoad, JTerminationCriteria standardTermination) { JTestDefinition definition = JTestDefinition.builder(Id.of(id + "def"), Collections.singletonList(new JHttpEndpoint(TestContext.getEndpointUri()))) .withQueryProvider(queryProvider) .withInvoker(DefaultInvokerProvider.of(ExecutionManipulateInvoker.class)) .addValidators(validators) <START> .withLoadBalancer(new OneByOneLoadBalancer()) <END> .build(); return JLoadTest.builder(Id.of(id), definition, standardGroupLoad, standardTermination) .withLimits(JLimitVsRefValue.builder("successRate-Success rate", RefValue.of(1.0)).build()) .build(); }</code><technical_language>please, JLoadBalancer approach internal implementations</technical_language>

Target:
private JLoadTest getExecutionLoadTest(String id, Iterable queryProvider, List<ResponseValidatorProvider> validators, JLoadProfile standardGroupLoad, JTerminationCriteria standardTermination) { JTestDefinition definition = JTestDefinition.builder(Id.of(id + "def"), Collections.singletonList(new JHttpEndpoint(TestContext.getEndpointUri()))) .withQueryProvider(queryProvider) .withInvoker(DefaultInvokerProvider.of(ExecutionManipulateInvoker.class)) .addValidators(validators) .withLoadBalancer(JLoadBalancer.builder(JLoadBalancer.DefaultLoadBalancer.ONE_BY_ONE).build()) .build(); return JLoadTest.builder(Id.of(id), definition, standardGroupLoad, standardTermination) .withLimits(JLimitVsRefValue.builder("successRate-Success rate", RefValue.of(1.0)).build()) .build(); }
Source:
<code>public Builder jobs(List<Job> jobs) { <START> this.jobs = jobs; <END> return this; }</code><technical_language>Change to: java this.jobs = ImmutableList.copyOf(jobs);</technical_language>

Target:
public Builder jobs(List<Job> jobs) { this.jobs = ImmutableList.copyOf(jobs); return this; }
Source:
<code>protected final synchronized StageClient connect() throws RESTLightClientException { final String url = formatUrl( getNexusUrl() ); setAndValidateProxy(); getLog().info( "Logging into Nexus: " + url ); getLog().info( "User: " + getUsername() ); ProxyConfig proxyConfig = null; if ( getProxyHost() != null ) { getLog().info( "Proxying nexus through: " + getProxyHost() + ":" + getProxyPort() ); <START> proxyConfig = new ProxyConfig( getProxyHost(), getProxyPort(), getProxyUsername(), getProxyPassword() ); <END> } client = new StageClient( url, getUsername(), getPassword(), proxyConfig ); return client; }</code><technical_language>call getProxyHost getProxyPort - else risk logged message masking a version is used. Potential future bug change getProxyPort getProxyHost implementations</technical_language>

Target:
protected final synchronized StageClient connect() throws RESTLightClientException { final String url = formatUrl( getNexusUrl() ); setAndValidateProxy(); getLog().info( "Logging into Nexus: " + url ); getLog().info( "User: " + getUsername() ); ProxyConfig proxyConfig = null; final String proxyHost = getProxyHost(); if ( proxyHost != null ) { final int proxyPort = getProxyPort(); getLog().info( "Proxying nexus through: " + proxyHost + ":" + proxyPort ); proxyConfig = new ProxyConfig( proxyHost, proxyPort, getProxyUsername(), getProxyPassword() ); } client = new StageClient( url, getUsername(), getPassword(), proxyConfig ); return client; }
Source:
<code>public static <T extends BitmapDataProvider> T randomBitmap(int maxKeys, double rleLimit, double denseLimit, RoaringBitmapWriter<T> writer) { int[] keys = createSorted16BitInts(ThreadLocalRandom.current().nextInt(1, maxKeys)); IntStream.of(keys) .forEach(key -> { double choice = ThreadLocalRandom.current().nextDouble(); final IntStream stream; if (choice < rleLimit) { stream = rleRegion(); <START> } else if (choice < rleLimit+ denseLimit) { <END> stream = denseRegion(); } else { stream = sparseRegion(); } stream.map(i -> (key << 16) | i).forEach(writer::add); }); return writer.get(); }</code><technical_language>lines 40 46 rleLimit is chosen bound for of dense limit, this changed clearer</technical_language>

Target:
public static <T extends BitmapDataProvider> T randomBitmap(int maxKeys, double rleLimit, double denseLimit, RoaringBitmapWriter<T> writer) { int[] keys = createSorted16BitInts(ThreadLocalRandom.current().nextInt(1, maxKeys)); IntStream.of(keys) .forEach(key -> { double choice = ThreadLocalRandom.current().nextDouble(); final IntStream stream; if (choice < rleLimit) { stream = rleRegion(); } else if (choice < denseLimit) { stream = denseRegion(); } else { stream = sparseRegion(); } stream.map(i -> (key << 16) | i).forEach(writer::add); }); return writer.get(); }
Source:
<code>public static TestCase makeTestCaseFromK(CmdArg cmdArgs) throws InvalidConfigError { Annotated<String, LocationData> targetFile = new Annotated<>(cmdArgs.getTargetFile(), new LocationData()); List<Annotated<String, LocationData>> programs = new LinkedList<>(); programs.add(new Annotated<>(cmdArgs.getResults(), new LocationData())); List<Annotated<String,LocationData>> results = new LinkedList<>(); results.add(new Annotated<>(cmdArgs.getResults(), new LocationData())); List<PgmArg> emptyOpts = new ArrayList<>(0); HashMap<String, List<PgmArg>> emptyOptsMap = new HashMap<>(0); return new TestCase(targetFile, programs, cmdArgs.getExtensions(), cmdArgs.getExcludes(), results, emptyOpts, emptyOpts, emptyOptsMap, <START> new HashSet<KTestStep>(), ""); <END> }</code><technical_language>this set a setter else create a separate constructor in this parameter is present</technical_language>

Target:
public static TestCase makeTestCaseFromK(CmdArg cmdArgs) throws InvalidConfigError { Annotated<String, LocationData> targetFile = new Annotated<>(cmdArgs.getTargetFile(), new LocationData()); List<Annotated<String, LocationData>> programs = new LinkedList<>(); programs.add(new Annotated<>(cmdArgs.getResults(), new LocationData())); List<Annotated<String,LocationData>> results = new LinkedList<>(); results.add(new Annotated<>(cmdArgs.getResults(), new LocationData())); List<PgmArg> emptyOpts = new ArrayList<>(0); HashMap<String, List<PgmArg>> emptyOptsMap = new HashMap<>(0); return new TestCase(targetFile, programs, cmdArgs.getExtensions(), cmdArgs.getExcludes(), results, emptyOpts, emptyOpts, emptyOptsMap, new HashSet<KTestStep>()); }
Source:
<code>public long getAvailable() { long availableMemory = 0; long pageSize = 4096; try { int machPort = SystemB.INSTANCE.mach_host_self(); LongByReference pPageSize = new LongByReference(); int ret = SystemB.INSTANCE.host_page_size(machPort, pPageSize); if (ret == 0) { pageSize = pPageSize.getValue(); } VM_STATISTICS64 vmStats = new VM_STATISTICS64(); ret = SystemB.INSTANCE.host_statistics64(machPort, SystemB.HOST_VM_INFO64, vmStats, new IntByReference( SystemB.HOST_VM_INFO64_COUNT)); if (ret == 0) { availableMemory = (vmStats.free_count + vmStats.inactive_count) * pageSize; totalMemory = (vmStats.free_count + vmStats.inactive_count + vmStats.wire_count + vmStats.active_count + vmStats.compressor_page_count) * pageSize; } } catch (UnsatisfiedLinkError e) { <START> for (String line : ExecutingCommand.runNative("vm_stat")) { <END> if (line.matches("\\D+(page size of \\d+ bytes)\\D+")) { pageSize = new Long(line.replaceAll("\\D", "")); } else if (line.startsWith("Pages free:") || line.startsWith("Pages speculative:") || line.startsWith("Pages inactive:")) { String[] memorySplit = line.split(":\\s+"); if (memorySplit.length > 1) { availableMemory += new Long(memorySplit[1].replace(".", "")); } } } availableMemory *= pageSize; } return availableMemory; }</code><technical_language>fail? I fallback method is necessary there</technical_language>

Target:
public long getAvailable() { long availableMemory = 0; long pageSize = 4096; int machPort = SystemB.INSTANCE.mach_host_self(); LongByReference pPageSize = new LongByReference(); if (0 != SystemB.INSTANCE.host_page_size(machPort, pPageSize)) throw new LastErrorException("Error code: " + Native.getLastError()); pageSize = pPageSize.getValue(); VMStatistics vmStats = new VMStatistics(); if (0 != SystemB.INSTANCE.host_statistics(machPort, SystemB.HOST_VM_INFO, vmStats, new IntByReference(vmStats.size() / SystemB.INT_SIZE))) throw new LastErrorException("Error code: " + Native.getLastError()); availableMemory = (vmStats.free_count + vmStats.inactive_count) * pageSize; return availableMemory; }
Source:
<code>public static List<String> getDefaultDNS(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String vpnDns = prefs.getString("dns", null); boolean ignoresysdns = prefs.getBoolean("ignoresysdns", false); List<String> listDns = new ArrayList<>(); <START> if (!ignoresysdns) { <END> String dns1 = jni_getprop("net.dns1"); String dns2 = jni_getprop("net.dns2"); if (!TextUtils.isEmpty(dns1)) listDns.add(dns1); if (!TextUtils.isEmpty(dns2)) listDns.add(dns2); if (TextUtils.isEmpty(dns1) && TextUtils.isEmpty(dns2)) listDns.add("8.8.8.8"); } else if (TextUtils.isEmpty(vpnDns)) listDns.add("8.8.8.8"); return listDns; }</code><technical_language>is practice negate condition is need (when is else)</technical_language>

Target:
public static List<String> getDefaultDNS(Context context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String vpnDns = prefs.getString("dns", null); boolean ignoresysdns = prefs.getBoolean("ignoresysdns", false); List<String> listDns = new ArrayList<>(); if (ignoresysdns) if (TextUtils.isEmpty(vpnDns)) listDns.add("8.8.8.8"); else { String dns1 = jni_getprop("net.dns1"); String dns2 = jni_getprop("net.dns2"); if (!TextUtils.isEmpty(dns1)) listDns.add(dns1); if (!TextUtils.isEmpty(dns2)) listDns.add(dns2); if (TextUtils.isEmpty(dns1) && TextUtils.isEmpty(dns2)) listDns.add("8.8.8.8"); } return listDns; }
Source:
<code>public <V> DataSet<LocatedRow> readTextFile(SpliceOperation op, String location, String characterDelimiter, String columnDelimiter, int[] baseColumnMap, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow) throws StandardException { try { Dataset<Row> table = null; try { table = SpliceSpark.getSession().read().csv(location); List<Column> correctSchemaSelection = new ArrayList<>(); int fieldIndex = 0; for( int index = 0; index< baseColumnMap.length; index++){ if(baseColumnMap[index]!=-1){ StructField ft = table.schema().fields()[index]; <START> Column cl = new Column(ft.name()).cast(execRow.schema().fields()[baseColumnMap[index]].dataType()); <END> table = table.withColumn(ft.name(),cl); } } } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context,execRow))); } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }</code><technical_language>Remove correctSchemaSelection</technical_language>

Target:
public <V> DataSet<LocatedRow> readTextFile(SpliceOperation op, String location, String characterDelimiter, String columnDelimiter, int[] baseColumnMap, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow) throws StandardException { try { Dataset<Row> table = null; try { table = SpliceSpark.getSession().read().csv(location); for( int index = 0; index< baseColumnMap.length; index++){ if(baseColumnMap[index]!=-1){ StructField ft = table.schema().fields()[index]; Column cl = new Column(ft.name()).cast(execRow.schema().fields()[baseColumnMap[index]].dataType()); table = table.withColumn(ft.name(),cl); } } } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context,execRow))); } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }
Source:
<code>public DruidMasterRuntimeParams run(DruidMasterRuntimeParams params) { MasterStats stats = new MasterStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } DatabaseRuleManager databaseRuleManager = params.getDatabaseRuleManager(); for (DataSegment segment : params.getAvailableSegments()) { List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource()); boolean foundMatchingRule = false; for (Rule rule : rules) { if (rule.appliesTo(segment)) { stats.accumulate(rule.run(master, params, segment)); foundMatchingRule = true; break; } } if (!foundMatchingRule) { <START> log.makeAlert("Unable to find a matching rule for segment[%s]", segment.getIdentifier()).emit(); <END> } } return params.buildFromExisting() .withMasterStats(stats) .build(); }</code><technical_language>This data source name in message add actual identifier metadata alert. messages turn email subjects... Also, alert happens, this is fall out of if statement do other things. other want do</technical_language>

Target:
public DruidMasterRuntimeParams run(DruidMasterRuntimeParams params) { MasterStats stats = new MasterStats(); DruidCluster cluster = params.getDruidCluster(); if (cluster.isEmpty()) { log.warn("Uh... I have no servers. Not assigning anything..."); return params; } DatabaseRuleManager databaseRuleManager = params.getDatabaseRuleManager(); for (DataSegment segment : params.getAvailableSegments()) { List<Rule> rules = databaseRuleManager.getRulesWithDefault(segment.getDataSource()); boolean foundMatchingRule = false; for (Rule rule : rules) { if (rule.appliesTo(segment)) { stats.accumulate(rule.run(master, params, segment)); foundMatchingRule = true; break; } } if (!foundMatchingRule) { log.makeAlert( "Unable to find a matching rule for dataSource[%s]", segment.getDataSource() ) .addData("segment", segment.getIdentifier()) .emit(); } } return params.buildFromExisting() .withMasterStats(stats) .build(); }
Source:
<code>public static void swallowChildrenFailures() { TaskQueueingContext qc = DynamicTasks.getTaskQueuingContext(); <START> if (qc!=null) { <END> qc.swallowChildrenFailures(); } }</code><technical_language>Uncomfortable ignoring qc==null - I caller this method do expected throwing exception. Similar Preconditions.checkNotNull in others</technical_language>

Target:
public static void swallowChildrenFailures() { Preconditions.checkNotNull(DynamicTasks.getTaskQueuingContext(), "Task queueing context required here"); Tasks.swallowChildrenFailures(); }
Source:
<code><START> public void releaseResources() throws Exception{ <END> consumer.shutdown(); }</code><technical_language>public</technical_language>

Target:
private void releaseResources() throws Exception { consumer.shutdown(); }
Source:
<code>public synchronized void evictAll() throws IOException { Util.deleteContents(directory); redundantOpCount = 0; size = 0; <START> nextSequenceNumber = 0; <END> lruEntries.clear(); rebuildJournal(); }</code><technical_language>This need reset</technical_language>

Target:
public synchronized void evictAll() throws IOException { Util.deleteContents(directory); for (Editor editor : activeEditors.keySet()) { editor.invalidate(); } activeEditors.clear(); redundantOpCount = 0; size = 0; lruEntries.clear(); rebuildJournal(); }
Source:
<code><START> protected static String dockerMachineCertsDirectoryPath(@NotNull Map<String, String> env) { <END> String certPath = env.get(DOCKER_CERT_PATH_PROPERTY); if (certPath != null) { if (new File(certPath).exists()) { return certPath; } else { LOG.error(String.format("The directory provided by property %s doesn't exists. Returning default value", certPath)); } } return DEFAULT_DOCKER_MACHINE_CERTS_DIR; }</code><technical_language>If is required null add check e.g Objects.requireNonNull(env);</technical_language>

Target:
protected static String dockerMachineCertsDirectoryPath(@NotNull Map<String, String> env) { Objects.requireNonNull(env, "Required non-null env variables"); String certPath = env.get(DOCKER_CERT_PATH_PROPERTY); if (certPath != null) { if (new File(certPath).exists()) { return certPath; } else { LOG.error(String.format("The directory provided by property %s doesn't exists. Returning default value", certPath)); } } return DEFAULT_DOCKER_MACHINE_CERTS_DIR; }
Source:
<code>public void kickAfkPlayers() { if (lastPlayerActivity.size() < 1) { return; } if (plugin.getServer().getOnlinePlayers().length < playerCountThreshold) { return; } long activityWindow = System.currentTimeMillis() - kickTimeout; for (String name : lastPlayerActivity.keySet()) { Player player = plugin.getServer().getPlayer(name); if (player == null) { continue; } if (player.hasPermission(PERMISSION_EXEMPT) || (exemptPlayers.contains(name.toLowerCase()))) { continue; } <START> if (lastPlayerActivity.get(name) == null) { <END> continue; } long lastActivity = lastPlayerActivity.get(name); if (lastActivity < activityWindow) { kickIdlePlayer(player); } } }</code><technical_language>try Long tmpLong = lastPlayerActivity.get(name); if (tmpLong == null) { continue; } long lastActivity = tmpLong.longValue();</technical_language>

Target:
public void kickAfkPlayers() { if (lastPlayerActivity.size() < 1) { return; } if (plugin.getServer().getOnlinePlayers().length < playerCountThreshold) { return; } long activityWindow = System.currentTimeMillis() - kickTimeout; for (String name : lastPlayerActivity.keySet()) { Player player = plugin.getServer().getPlayer(name); if (player == null) { continue; } if (player.hasPermission(PERMISSION_EXEMPT) || (exemptPlayers.contains(name.toLowerCase()))) { continue; } Long tmpLong = lastPlayerActivity.get(name); if (tmpLong == null) { continue; } long lastActivity = tmpLong.longValue(); if (lastActivity < activityWindow) { kickIdlePlayer(player); } } }
Source:
<code>public IStatus validate(IValidationContext ctx) { <START> <END> IStatus status = null; EObject target = ctx.getTarget(); for (EObject content : target.eContents()) { if (content instanceof IdentifiedElement) { String elementName = ((IdentifiedElement) content).getName(); if (StringUtil.isEmpty(elementName)) { status = ctx.createFailureStatus(getPath(content) + ERROR_MESSAGE); } } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }</code><technical_language>Useless new line</technical_language>

Target:
public IStatus validate(IValidationContext ctx) { IStatus status = null; EObject target = ctx.getTarget(); if (target instanceof IdentifiedElement) { String elementName = ((IdentifiedElement) target).getName(); if (StringUtil.isEmpty(elementName)) { status = ctx.createFailureStatus(getPath(target) + ERROR_MESSAGE); } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }
Source:
<code>private String rolesToJson ( List<Role> roles, boolean includeFake, boolean includeLabelAll ) throws IOException, DotDataException, LanguageException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); Map<String, Object> m = new LinkedHashMap<String, Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = null; if(includeFake) { map = new HashMap<>(); <START> map.put( "name", "" ); <END> map.put( "id", 0 ); list.add( map ); } if(includeLabelAll) { map = new HashMap<>(); map.put( "name", "All" ); map.put( "id", "" ); list.add( map ); } User defaultUser = APILocator.getUserAPI().getDefaultUser(); Role defaultUserRole = null; if ( defaultUser != null ) { defaultUserRole = APILocator.getRoleAPI().getUserRole( defaultUser ); } for ( Role role : roles ) { map = new HashMap<String, Object>(); if ( defaultUserRole != null && role.getId().equals( defaultUserRole.getId() ) ) { continue; } if ( !role.isEditPermissions() ) { continue; } if ( role.getName().contains( "anonymous user" ) ) { continue; } map.put( "name", role.getName() + ((role.isUser()) ? " (" + LanguageUtil.get( PublicCompanyFactory.getDefaultCompany(), "User" ) + ")" : "")); map.put( "id", role.getId() ); list.add( map ); } m.put( "identifier", "id" ); m.put( "label", "name" ); m.put( "items", list ); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString( m ); }</code><technical_language>replace "" StringPool.EMPTY</technical_language>

Target:
private String rolesToJson ( List<Role> roles, boolean includeFake, boolean includeLabelAll ) throws IOException, DotDataException, LanguageException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false ); Map<String, Object> m = new LinkedHashMap<String, Object>(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = null; if(includeFake) { map = new HashMap<>(); map.put( "name", StringPool.BLANK ); map.put( "id", 0 ); list.add( map ); } if(includeLabelAll) { map = new HashMap<>(); map.put( "name", "All" ); map.put( "id", StringPool.BLANK); list.add( map ); } User defaultUser = APILocator.getUserAPI().getDefaultUser(); Role defaultUserRole = null; if ( defaultUser != null ) { defaultUserRole = APILocator.getRoleAPI().getUserRole( defaultUser ); } for ( Role role : roles ) { map = new HashMap<String, Object>(); if ( defaultUserRole != null && role.getId().equals( defaultUserRole.getId() ) ) { continue; } if ( !role.isEditPermissions() ) { continue; } if ( role.getName().contains( "anonymous user" ) ) { continue; } map.put( "name", role.getName() + ((role.isUser()) ? " (" + LanguageUtil.get( PublicCompanyFactory.getDefaultCompany(), "User" ) + ")" : "")); map.put( "id", role.getId() ); list.add( map ); } m.put( "identifier", "id" ); m.put( "label", "name" ); m.put( "items", list ); return mapper.writerWithDefaultPrettyPrinter().writeValueAsString( m ); }
Source:
<code>public void testWrongCtrlTaskId() { <START> final ILPSolverOptimizer wrongCtrlIlpSolverOptimizer = new ILPSolverOptimizer("##WRONG_CONTROLLER_TASK_ID##"); <END> final int availableEvaluators = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( new int[][]{{100, 50}, {100, 100}}, 50D); final Plan plan = wrongCtrlIlpSolverOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToAdd().size()); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToDelete().size()); assertEquals("The plan should be empty", 0, plan.getTransferSteps().size()); }</code><technical_language>change ILPQuickOptimizer Also, controlTaskId is null? DolphinDriver return a null (if evaluator setup yet), check calling initializeCtrlTaskContextId return null</technical_language>

Target:
public void testWrongCtrlTaskId() throws InjectionException { final CtrlTaskContextIdFetcher mockFetcher = mock(CtrlTaskContextIdFetcher.class); when(mockFetcher.getCtrlTaskContextId()).thenReturn(Optional.of("##WRONG_CONTROLLER_TASK_ID##")); final Injector injector = Tang.Factory.getTang().newInjector(); injector.bindVolatileInstance(CtrlTaskContextIdFetcher.class, mockFetcher); final ILPQuickOptimizer wrongCtrlIlpQuickerOptimizer = injector.getInstance(ILPQuickOptimizer.class); final int availableEvaluators = 4; final Collection<EvaluatorParameters> activeEvaluators = generateEvaluatorParameters( new int[][]{{100, 50}, {100, 100}}, 50D); final Plan plan = wrongCtrlIlpQuickerOptimizer.optimize(activeEvaluators, availableEvaluators); checkPlan(activeEvaluators, plan, availableEvaluators); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToAdd().size()); assertEquals("The plan should be empty", 0, plan.getEvaluatorsToDelete().size()); assertEquals("The plan should be empty", 0, plan.getTransferSteps().size()); }
Source:
<code>public void deleteWorkflowGroups(Collection collection) throws Exception { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); <START> Group defaultItemReadGroup = groupService.findByName(c, "COLLECTION_" + <END> collection.getID().toString() + "_ITEM_DEFAULT_READ"); Group defaultBitstreamReadGroup = groupService.findByName(c, "COLLECTION_" + collection.getID().toString() + "_BITSTREAM_DEFAULT_READ"); if (defaultItemReadGroup != null) { groupService.delete(c, defaultItemReadGroup); } if (defaultBitstreamReadGroup != null) { groupService.delete(c, defaultBitstreamReadGroup); } for (int i = 1; i <= 3; i++) { Group g = collectionService.getWorkflowGroup(c, collection, i); if (g != null) { Group attachedDso = c.reloadEntity(g); if (attachedDso != null) { collectionService.setWorkflowGroup(c, collection, i, null); groupService.delete(c, attachedDso); } } } c.complete(); } indexingService.commit(); }</code><technical_language>please put in a separate method rename this support method</technical_language>

Target:
public void deleteWorkflowGroups(Collection collection) throws Exception { try (Context c = new Context()) { c.turnOffAuthorisationSystem(); for (int i = 1; i <= 3; i++) { Group g = collectionService.getWorkflowGroup(c, collection, i); if (g != null) { Group attachedDso = c.reloadEntity(g); if (attachedDso != null) { collectionService.setWorkflowGroup(c, collection, i, null); groupService.delete(c, attachedDso); } } } c.complete(); } }
Source:
<code>public Dialog onCreateDialog(Bundle savedInstanceState) { final MainActivity activity = (MainActivity) getActivity(); Bundle arguments = getArguments(); final Uri uri = arguments.getParcelable(EXTRA_URI); return new AlertDialog.Builder(activity, R.style.PocketPaintAlertDialog) .setTitle(R.string.menu_new_image) .setMessage(R.string.dialog_warning_new_image) .setCancelable(true) .setPositiveButton(R.string.save_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); <START> presenter.checkPermissionAndForward(PERMISSION_EXTERNAL_STORAGE_SAVE_CONFIRMED_NEW_IMAGE, uri); <END> } }) .setNegativeButton(R.string.discard_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.chooseNewImage(); } }) .create(); }</code><technical_language>Translation request codes. Please in presenter</technical_language>

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { final MainActivity activity = (MainActivity) getActivity(); Bundle arguments = getArguments(); final int requestCode = arguments.getInt(EXTRA_REQUEST); final Uri uri = arguments.getParcelable(EXTRA_URI); return new AlertDialog.Builder(activity, R.style.PocketPaintAlertDialog) .setTitle(R.string.menu_new_image) .setMessage(R.string.dialog_warning_new_image) .setCancelable(true) .setPositiveButton(R.string.save_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.checkPermissionAndForward(requestCode, uri); } }) .setNegativeButton(R.string.discard_button_text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { MainActivityContracts.Presenter presenter = activity.getPresenter(); presenter.chooseNewImage(); } }) .create(); }
Source:
<code>public void fixedDelayTest() throws InterruptedException { Thread.sleep(2100); <START> assertEquals(1, messageCollector.forChannel(triggerSource.output()).size()); <END> messageCollector.forChannel(triggerSource.output()).take().getPayload().equals("test"); }</code><technical_language>tests dangerous time... .poll(10, TimeUnit.SECONDS); for forChannel() result. .equals() for payload, assertEquals(). remove Thread.sleep(), of course. take() good anyway, block thread indefinitely</technical_language>

Target:
public void fixedDelayTest() throws InterruptedException { assertTrue(messageCollector.forChannel(triggerSource.output()).poll(2100, TimeUnit.MILLISECONDS).getPayload().equals("test")); }
Source:
<code>public Boolean tryAdd(final T object) { if (object == null) { throw logger.logExceptionAsWarning(new IllegalArgumentException("object cannot be null")); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); return objectSerializer.serialize(outputStream, object).map(s -> { EventData eventData = new EventData(s.toByteArray()); EventData event = tracerProvider.isEnabled() ? traceMessageSpan(eventData) : eventData; return tryAdd(event); <START> }).block(); <END> }</code><technical_language>this method return Mono<Boolean> instead avoid blocking</technical_language>

Target:
public Mono<Boolean> tryAdd(final T object) { if (object == null) { return monoError(logger, new IllegalArgumentException("object cannot be null")); } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); return serializer.serialize(outputStream, object).map(s -> tryAdd(new EventData(s.toByteArray()))); }
Source:
<code>public void shouldWriteErrorsToCustomFileWhenConfigured() throws IOException { File customBoltLogFile = customBoltLogFile(); db.setConfig( bolt_logging_enabled, TRUE ); db.setConfig( bolt_log_filename, customBoltLogFile.toString() ); db.ensureStarted(); try { driver = newDriver(); } <START> catch ( Exception e ) <END> { String contents = readFile( customBoltLogFile ); System.out.println( contents ); assertThat( contents, containsString( "S: FAILURE" ) ); } assertTrue( fs.fileExists( customBoltLogFile ) ); String query = "RETURN 1 as 2"; try ( Session session = driver.session() ) { session.run( query ).consume(); fail( "Should have failed" ); } catch ( Exception e ) { String contents = readFile( customBoltLogFile ); assertThat( contents, containsString( "S FAILURE" ) ); } }</code><technical_language>this try-catch removed</technical_language>

Target:
public void shouldWriteErrorsToCustomFileWhenConfigured() throws IOException { File customBoltLogFile = customBoltLogFile(); db.setConfig( bolt_logging_enabled, TRUE ); db.setConfig( bolt_log_filename, customBoltLogFile.toString() ); db.ensureStarted(); driver = newDriver(); assertTrue( fs.fileExists( customBoltLogFile ) ); String query = "RETURN 1 as 2"; try ( Session session = driver.session() ) { session.run( query ).consume(); fail( "Should have failed" ); } catch ( Exception e ) { String contents = readFile( customBoltLogFile ); assertThat( contents, containsString( "S FAILURE" ) ); } }
Source:
<code>public GoVarProcessor(@NotNull PsiElement requestedName, @NotNull PsiElement origin, boolean completion, boolean delegate) { super(requestedName, origin, completion); myImShortVarDeclaration = PsiTreeUtil.getParentOfType(origin, GoShortVarDeclaration.class) != null && !delegate; <START> myImInForClause = PsiTreeUtil.getParentOfType(origin, GoForClause.class) != null; <END> myParentGuard = origin.getParent() instanceof GoTypeSwitchGuard ? origin.getParent() : null; myScope = getScope(origin); }</code><technical_language>for other cases too</technical_language>

Target:
public GoVarProcessor(@NotNull PsiElement requestedName, @NotNull PsiElement origin, boolean completion, boolean delegate) { super(requestedName, origin, completion); myImShortVarDeclaration = PsiTreeUtil.getParentOfType(origin, GoShortVarDeclaration.class) != null && !delegate; myParentGuard = origin.getParent() instanceof GoTypeSwitchGuard ? origin.getParent() : null; myScope = getScope(origin); }
Source:
<code>public List<Chapter> getChaptersByProperties(Map<String, String> properties) { List chapters = chapterDataService.executeQuery(new QueryExecution<List<Chapter>>() { @Override public List<Chapter> execute(Query query, InstanceSecurityRestriction restriction) { query.setFilter(buildParametersFilter(properties)); return (List) QueryExecutor.execute(query, restriction); } }); <START> return new ArrayList<>(chapters); <END> }</code><technical_language>reason packing results of queries ArrayLists</technical_language>

Target:
public List<Chapter> getChaptersByProperties(Map<String, String> properties) { return chapterDataService.executeQuery(new PropertiesMapQueryExecution<>(properties)); }
Source:
<code>public void onNavigationDrawerItemSelected(int position) { <START> Utils.setContext(this); END> String pin = getIntent().getStringExtra(PinManager.EXTRA_PIN); if (PinManager.get().isPin(pin)) { } FileIndex.create(false, new IOnResult<FileIndex>() { @Override public void onResult(FileIndex result) { Utils.toast("Created file index: " + result); if (result == null) return; FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, new ContentFragment()) .commit(); } }); }</code><technical_language>?! solutions for this. Context is a volatile object, retrieved needed instead of storing it. I a ready-to-go solution yet, find one</technical_language>

Target:
public void onNavigationDrawerItemSelected(int position) { Utils.setContext(this); String pin = getIntent().getStringExtra(PinManager.EXTRA_PIN); if (BuildConfig.DEBUG || PinManager.get().isPin(pin)) { FileIndex.create(false, new IOnResult<FileIndex>() { @Override public void onResult(FileIndex result) { Utils.d("Created file index: " + result); if (result == null) { return; } FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, new ContentFragment()) .commit(); } }); } }
Source:
<code><START> public final TYPE next() { <END> TYPE result = next; next = null; result = (result == null ? fromIterator.next() : result); return result; }</code><technical_language>java if (next == null) { return fromIterator.next(); } else { final TYPE result = next; next = null; return result; } I find this read</technical_language>

Target:
public final TYPE next() { if (next == null) { return fromIterator.next(); } else { final TYPE result = next; next = null; return result; } }
Source:
<code>public void test1() throws NoSuchAlgorithmException { ObjectId exp = ObjectId .fromString("a9993e364706816aba3e25717850c26c9cd0d89d"); MessageDigest m = MessageDigest.getInstance("SHA-1"); <START> m.update(TEST1.getBytes(StandardCharsets.ISO_8859_1)); <END> ObjectId m1 = ObjectId.fromRaw(m.digest()); SHA1 s = SHA1.newInstance(); s.update(TEST1.getBytes(StandardCharsets.ISO_8859_1)); ObjectId s1 = ObjectId.fromRaw(s.digest()); assertEquals(m1, s1); assertEquals(exp, s1); }</code><technical_language>nit: UTF_8 US_ASCII easier for casual readers charset decided</technical_language>

Target:
public void test1() throws NoSuchAlgorithmException { ObjectId exp = ObjectId .fromString("a9993e364706816aba3e25717850c26c9cd0d89d"); MessageDigest m = MessageDigest.getInstance("SHA-1"); m.update(TEST1.getBytes(StandardCharsets.UTF_8)); ObjectId m1 = ObjectId.fromRaw(m.digest()); SHA1 s = SHA1.newInstance(); s.update(TEST1.getBytes(StandardCharsets.UTF_8)); ObjectId s1 = ObjectId.fromRaw(s.digest()); assertEquals(m1, s1); assertEquals(exp, s1); }
Source:
<code>private void save(UnitTestClassReport report, InputFile inputFile, SensorContext context) { int testsCount = report.getTests() - report.getSkipped(); saveMeasure(context, inputFile, CoreMetrics.SKIPPED_TESTS, report.getSkipped()); saveMeasure(context, inputFile, CoreMetrics.TESTS, testsCount); saveMeasure(context, inputFile, CoreMetrics.TEST_ERRORS, report.getErrors()); saveMeasure(context, inputFile, CoreMetrics.TEST_FAILURES, report.getFailures()); saveMeasure(context, inputFile, CoreMetrics.TEST_EXECUTION_TIME, report.getDurationMilliseconds()); double passedTests = testsCount - report.getErrors() - report.getFailures(); if (testsCount > 0) { double percentage = ParsingUtils.scaleValue(passedTests * 100d / testsCount); if (!Double.isNaN(percentage)) { <START> context.<Double>newMeasure().forMetric(CoreMetrics.TEST_SUCCESS_DENSITY).on(inputFile).withValue(percentage).save(); <END> } } saveResults(inputFile, report); }</code><technical_language>![MAJOR](<LINK_0> this line start column 9. [![rule](<LINK_2>](<LINK_1></technical_language>

Target:
private void save(UnitTestClassReport report, InputFile inputFile, SensorContext context) { int testsCount = report.getTests() - report.getSkipped(); saveMeasure(context, inputFile, CoreMetrics.SKIPPED_TESTS, report.getSkipped()); saveMeasure(context, inputFile, CoreMetrics.TESTS, testsCount); saveMeasure(context, inputFile, CoreMetrics.TEST_ERRORS, report.getErrors()); saveMeasure(context, inputFile, CoreMetrics.TEST_FAILURES, report.getFailures()); saveMeasure(context, inputFile, CoreMetrics.TEST_EXECUTION_TIME, report.getDurationMilliseconds()); double passedTests = testsCount - (double) report.getErrors() - report.getFailures(); if (testsCount > 0) { double percentage = ParsingUtils.scaleValue(passedTests * 100d / testsCount); if (!Double.isNaN(percentage)) { context.<Double>newMeasure().forMetric(CoreMetrics.TEST_SUCCESS_DENSITY).on(inputFile).withValue(percentage).save(); } } saveResults(inputFile, report); }
Source:
<code>Entry<String, Map<String, String>> add(String s, Entry<String, Map<String, String>> entry, String key, String value) { checkNonNullArgument(s, "'s' cannot be null"); checkNonNullArgument(entry, "Requires " + s + " to be set before adding " + key + "=" + value); checkNonNullArgument(key, "Key cannot be null"); checkNonNullArgument(value, "Value cannot be null"); String put = entry.getValue().put(key, value); <START> checkState(put != null, "Value already set " + s + " : " + key + "=" + value + " old value was: " + put); <END> return entry; }</code><technical_language>This is wasteful. effort build exception message testing condition! do if (put != null) { throw some exception }</technical_language>

Target:
Entry<String, Map<String, String>> add(String s, Entry<String, Map<String, String>> entry, String key, String value) { requireNonNull(s, "'s' cannot be null"); requireNonNull(entry, "Requires " + s + " to be set before adding " + key + "=" + value); requireNonNull(key, "Key cannot be null"); requireNonNull(value, "Value cannot be null"); String put = entry.getValue().put(key, value); if (put != null) { throw new IllegalArgumentException( "Value already set " + s + " : " + key + "=" + value + " old value was: " + put); } return entry; }