auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.GET == request.getMethod()) { try { Map<String, String> output = Maps.newHashMap(); List<Journal> journals = Lists.newArrayListWithCapacity(conf.getJournalDirs().length); for (File journalDir : conf.getJournalDirs()) { journals.add(new Journal(journalDir, conf, new LedgerDirsManager(conf, conf.getLedgerDirs(), new DiskChecker(conf.getDiskUsageThreshold(), conf.getDiskUsageWarnThreshold())))); } for (Journal journal : journals) { LogMark lastLogMark = journal.getLastLogMark().getCurMark(); LOG.debug("LastLogMark: Journal Id - " + lastLogMark.getLogFileId() + "(" + Long.toHexString(lastLogMark.getLogFileId()) + ".txn), Pos - " + lastLogMark.getLogFileOffset()); output.put("LastLogMark: Journal Id - " + lastLogMark.getLogFileId() + "(" + Long.toHexString(lastLogMark.getLogFileId()) + ".txn)", "Pos - " + lastLogMark.getLogFileOffset()); } String jsonResponse = JsonUtil.toJson(output); <START> LOG.info("output body:" + jsonResponse); <END> response.setBody(jsonResponse); response.setCode(HttpServer.StatusCode.OK); return response; } catch (Exception e) { e.printStackTrace(); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("ERROR handling request: " + e.getMessage()); return response; } } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be GET method"); return response; } }</code><technical_language>this is debug I</technical_language>

Target:
public HttpServiceResponse handle(HttpServiceRequest request) throws Exception { HttpServiceResponse response = new HttpServiceResponse(); if (HttpServer.Method.GET == request.getMethod()) { try { Map<String, String> output = Maps.newHashMap(); List<Journal> journals = Lists.newArrayListWithCapacity(conf.getJournalDirs().length); for (File journalDir : conf.getJournalDirs()) { journals.add(new Journal(journalDir, conf, new LedgerDirsManager(conf, conf.getLedgerDirs(), new DiskChecker(conf.getDiskUsageThreshold(), conf.getDiskUsageWarnThreshold())))); } for (Journal journal : journals) { LogMark lastLogMark = journal.getLastLogMark().getCurMark(); LOG.debug("LastLogMark: Journal Id - " + lastLogMark.getLogFileId() + "(" + Long.toHexString(lastLogMark.getLogFileId()) + ".txn), Pos - " + lastLogMark.getLogFileOffset()); output.put("LastLogMark: Journal Id - " + lastLogMark.getLogFileId() + "(" + Long.toHexString(lastLogMark.getLogFileId()) + ".txn)", "Pos - " + lastLogMark.getLogFileOffset()); } String jsonResponse = JsonUtil.toJson(output); LOG.debug("output body:" + jsonResponse); response.setBody(jsonResponse); response.setCode(HttpServer.StatusCode.OK); return response; } catch (Exception e) { LOG.error("Exception occurred while getting last log mark", e); response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("ERROR handling request: " + e.getMessage()); return response; } } else { response.setCode(HttpServer.StatusCode.NOT_FOUND); response.setBody("Not found method. Should be GET method"); return response; } }
Source:
<code>private static BytecodeBlock generateCheckYieldBlock(Variable thisVariable, Variable index, FieldDefinition yieldSignal, FieldDefinition nextIndexOrPosition) { return new BytecodeBlock() .comment("if (yieldSignal.isSet()) return Optional.empty();") <START> .append(new BytecodeBlock() <END> .append(new IfStatement() .condition(thisVariable.getField(yieldSignal).invoke("isSet", boolean.class)) .ifTrue(new BytecodeBlock() .comment("nextIndexOrPosition = index + 1;") .append(thisVariable.setField(nextIndexOrPosition, add(index, constantInt(1)))) .comment("return Optional.empty();") .append(invokeStatic(Optional.class, "empty", Optional.class).ret())))); }</code><technical_language>Wrapping IfStatement append is unnecessaryYou do append(new IfStatement... instead</technical_language>

Target:
private static BytecodeBlock generateCheckYieldBlock(Variable thisVariable, Variable index, FieldDefinition yieldSignal, FieldDefinition nextIndexOrPosition) { return new BytecodeBlock() .comment("if (yieldSignal.isSet()) return Optional.empty();") .append(new IfStatement() .condition(thisVariable.getField(yieldSignal).invoke("isSet", boolean.class)) .ifTrue(new BytecodeBlock() .comment("nextIndexOrPosition = index + 1;") .append(thisVariable.setField(nextIndexOrPosition, add(index, constantInt(1)))) .comment("return Optional.empty();") .append(invokeStatic(Optional.class, "empty", Optional.class).ret()))); }
Source:
<code>public Response getSegmentDataSourceSpecificInterval( @PathParam("dataSourceName") String dataSourceName, @PathParam("interval") String interval, @QueryParam("partial") final boolean partial ) { TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); final Interval theInterval = new Interval(interval.replace("_", "/")); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); <START> return Response.noContent().build(); <END> } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval); FunctionalIterable<SegmentLoadInfo> retval = FunctionalIterable .create(lookup).transformCat( new Function<TimelineObjectHolder<String, SegmentLoadInfo>, Iterable<SegmentLoadInfo>>() { @Override public Iterable<SegmentLoadInfo> apply( TimelineObjectHolder<String, SegmentLoadInfo> input ) { return Iterables.transform( input.getObject(), new Function<PartitionChunk<SegmentLoadInfo>, SegmentLoadInfo>() { @Override public SegmentLoadInfo apply( PartitionChunk<SegmentLoadInfo> chunk ) { return chunk.getObject(); } } ); } } ); return Response.ok(retval).build(); }</code><technical_language>return empty array? ok for a datasource/interval pair served segments</technical_language>

Target:
public Response getSegmentDataSourceSpecificInterval( @PathParam("dataSourceName") String dataSourceName, @PathParam("interval") String interval, @QueryParam("partial") final boolean partial ) { TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline( new TableDataSource(dataSourceName) ); final Interval theInterval = new Interval(interval.replace("_", "/")); if (timeline == null) { log.debug("No timeline found for datasource[%s]", dataSourceName); return Response.ok(Lists.<ImmutableSegmentLoadInfo>newArrayList()).build(); } Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval); FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable .create(lookup).transformCat( new Function<TimelineObjectHolder<String, SegmentLoadInfo>, Iterable<ImmutableSegmentLoadInfo>>() { @Override public Iterable<ImmutableSegmentLoadInfo> apply( TimelineObjectHolder<String, SegmentLoadInfo> input ) { return Iterables.transform( input.getObject(), new Function<PartitionChunk<SegmentLoadInfo>, ImmutableSegmentLoadInfo>() { @Override public ImmutableSegmentLoadInfo apply( PartitionChunk<SegmentLoadInfo> chunk ) { return chunk.getObject().toImmutableSegmentLoadInfo(); } } ); } } ); return Response.ok(retval).build(); }
Source:
<code>public int hashCode() { <START> int result1 = cursor.hashCode(); <END> result1 = 31 * result1 + result.hashCode(); return result1; }</code><technical_language>result2 is a fit? :)</technical_language>

Target:
public int hashCode() { int hashCode = cursor.hashCode(); hashCode = 31 * hashCode + result.hashCode(); return hashCode; }
Source:
<code>public void testScriptRun() throws Exception { serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); manager.startServers(server); CARBON_HOME = server.getCarbonHome(); manager.stopAllServers(); String[] cmdArray; String commandDirectory; if (CarbonCommandToolsUtil.isCurrentOSWindows()) { cmdArray = new String[] {"cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + CARBON_HOME + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", "wso2carbon", "--username", "admin", "--new-password", <START> "admin123"}; <END> commandDirectory = CARBON_HOME + File.separator + "bin"; } else { cmdArray = new String[] {"sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + CARBON_HOME + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", "wso2carbon", "--username", "admin", "--new-password", "admin123"}; commandDirectory = CARBON_HOME + "/bin"; } scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed successfully"); manager.startServers(server); }</code><technical_language>char array hold new password complex password special characters etc..</technical_language>

Target:
public void testScriptRun() throws Exception { serverPropertyMap.put("-DportOffset", Integer.toString(portOffset)); AutomationContext autoCtx = new AutomationContext(); CarbonTestServerManager server = new CarbonTestServerManager(autoCtx, System.getProperty("carbon.zip"), serverPropertyMap); carbonHome = server.startServer(); server.stopServer(); String[] cmdArray; String commandDirectory = carbonHome + File.separator + "bin"; if ((CarbonCommandToolsUtil.getCurrentOperatingSystem(). contains(OperatingSystems.WINDOWS.name().toLowerCase()))) { cmdArray = new String[] {"cmd.exe", "/c", "chpasswd.bat", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } else { cmdArray = new String[] {"sh", "chpasswd.sh", "--db-url", "jdbc:h2:" + carbonHome + H2DB_URL, "--db-driver", "org.h2.Driver", "--db-username", "wso2carbon", "--db-password", String.valueOf(dbPassword), "--username", userName, "--new-password", String.valueOf(userNewPassword)}; } scriptRunStatus = CarbonCommandToolsUtil.isScriptRunSuccessfully(commandDirectory, cmdArray, "Password updated successfully"); log.info("Script running status : " + scriptRunStatus); assertTrue(scriptRunStatus, "Script executed unsuccessfully"); CarbonCommandToolsUtil.startServerUsingCarbonHome(carbonHome, 1, context, null); }
Source:
<code>public ThemeView() { final Span textSpan = new Span("This is the theme test view"); textSpan.setId(TEST_TEXT_ID); Span subCss = new Span(); subCss.setId(SUB_COMPONENT_ID); Span butterfly = new Span(); butterfly.setId(BUTTERFLY_ID); Span octopuss = new Span(); octopuss.setId(OCTOPUSS_ID); Span faText = new Span("This test is FontAwesome."); <START> faText.setClassName("fab"); <END> faText.setId(FONTAWESOME_ID); Image snowFlake = new Image( "VAADIN/static/fortawesome/icons/snowflake.svg", "snowflake"); snowFlake.setHeight("1em"); snowFlake.setId(SNOWFLAKE_ID); add(textSpan, snowFlake, subCss, butterfly, octopuss, faText); add(new Div()); add(new MyPolymerField().withId(MY_POLYMER_ID)); add(new Div()); add(new MyLitField().withId(MY_LIT_ID)); }</code><technical_language>this give visible add a icon class name also</technical_language>

Target:
public ThemeView() { final Span textSpan = new Span("This is the theme test view"); textSpan.setId(TEST_TEXT_ID); Span subCss = new Span(); subCss.setId(SUB_COMPONENT_ID); Span butterfly = new Span(); butterfly.setId(BUTTERFLY_ID); Span octopuss = new Span(); octopuss.setId(OCTOPUSS_ID); Span faText = new Span("This test is FontAwesome."); faText.setClassName("fas fa-coffee"); faText.setId(FONTAWESOME_ID); Image snowFlake = new Image( "VAADIN/static/fortawesome/icons/snowflake.svg", "snowflake"); snowFlake.setHeight("1em"); snowFlake.setId(SNOWFLAKE_ID); add(textSpan, snowFlake, subCss, butterfly, octopuss, faText); add(new Div()); add(new MyPolymerField().withId(MY_POLYMER_ID)); add(new Div()); add(new MyLitField().withId(MY_LIT_ID)); }
Source:
<code>protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { TypedSubAppNetworkEditPart compositeNetEP = new TypedSubAppNetworkEditPart(){ <START> @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new SubAppTypeFBNetworkLayoutEditPolicy()); } <END> }; return compositeNetEP; } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }</code><technical_language>created typedSubAppNetworkEditPart this there</technical_language>

Target:
protected EditPart getPartForElement(EditPart context, Object modelElement) { if (modelElement instanceof FBNetwork) { CompositeNetworkEditPart compositeNetEP = new CompositeNetworkEditPart() { @Override protected void createEditPolicies() { installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy()); installEditPolicy(EditPolicy.LAYOUT_ROLE, new SubAppTypeFBNetworkLayoutEditPolicy()); } }; return compositeNetEP; } if (modelElement instanceof SubApp) { return new SubAppForFBNetworkEditPart(zoomManager); } return super.getPartForElement(context, modelElement); }
Source:
<code>private void processCommand() throws IOException { try { FastByteBufferQueueInputStream is = new FastByteBufferQueueInputStream(receiveQueue, readCommandSizes[0]); try { ObjectInputStreamEx ois = new ObjectInputStreamEx(is, channel.baseClassLoader, channel.classFilter); receiver.handle(Command.readFrom(channel, ois)); } catch (IOException e1) { LOGGER.log(Level.WARNING, "Failed to construct Command", e1); } catch (ClassNotFoundException e11) { LOGGER.log(Level.WARNING, "Failed to construct Command", e11); } finally { int available = is.available(); if (available > 0) { is.skip(available); } <START> IOUtils.closeQuietly(is); <END> } } finally { if (readCommandIndex == 1) { if (readCommandSizes.length > 16) { int temp = readCommandSizes[1]; readCommandSizes = new int[16]; readCommandSizes[0] = temp; } else { readCommandSizes[0] = readCommandSizes[1]; } readCommandIndex = 0; } else { System.arraycopy(readCommandSizes, 1, readCommandSizes, 0, readCommandIndex); readCommandIndex--; } } }</code><technical_language>Why? exception API allows</technical_language>

Target:
private void processCommand() throws IOException { try { FastByteBufferQueueInputStream is = new FastByteBufferQueueInputStream(receiveQueue, readCommandSizes[0]); try { ObjectInputStreamEx ois = new ObjectInputStreamEx(is, channel.baseClassLoader, channel.classFilter); receiver.handle(Command.readFrom(channel, ois)); } catch (IOException e1) { LOGGER.log(Level.WARNING, "Failed to construct Command", e1); } catch (ClassNotFoundException e11) { LOGGER.log(Level.WARNING, "Failed to construct Command", e11); } finally { int available = is.available(); if (available > 0) { if (is.skip(available) != available) { LOGGER.log(Level.FINE, "Failed to skip remainder of Command"); } } IOUtils.closeQuietly(is); } } finally { if (readCommandIndex == 1) { if (readCommandSizes.length > 16) { int temp = readCommandSizes[1]; readCommandSizes = new int[16]; readCommandSizes[0] = temp; } else { readCommandSizes[0] = readCommandSizes[1]; } readCommandIndex = 0; } else { System.arraycopy(readCommandSizes, 1, readCommandSizes, 0, readCommandIndex); readCommandIndex--; } } }
Source:
<code>public String getVersionPart() { <START> return versioning == null ? "latest" : versioning.toString(); <END> }</code><technical_language>versioning @NonNull Versioning.TagVersioning.LATEST if null is passed @Nullable methods</technical_language>

Target:
public String getVersionPart() { return versioning.toString(); }
Source:
<code>private void executePrivateParentMethod(String method) throws IOException { try { Method m = this.parent.getDeclaredMethod(method); m.setAccessible(true); m.invoke(this); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { <START> logger.severe("Error trying to abort JmDNS: " + e.getMessage()); <END> throw new IOException(e); } }</code><technical_language>Add</technical_language>

Target:
private void executePrivateParentMethod(String method) throws IOException { try { Method m = this.parent.getDeclaredMethod(method); m.setAccessible(true); m.invoke(this); } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { logger.log(Level.SEVERE, "Error trying to abort JmDNS", e); throw new IOException(e); } }
Source:
<code>public Token<AbstractS3ATokenIdentifier> getDelegationToken(String renewer) throws IOException { entryPoint(Statistic.INVOCATION_GET_DELEGATION_TOKEN); LOG.debug("Delegation token requested"); if (delegationTokens.isPresent()) { return delegationTokens.get().getBoundOrNewDT(encryptionSecrets, <START> (renewer!=null ? new Text(renewer) : null)); <END> } else { LOG.debug("Token support is not enabled"); return null; } }</code><technical_language>Is for renewer null empty</technical_language>

Target:
public Token<AbstractS3ATokenIdentifier> getDelegationToken(String renewer) throws IOException { entryPoint(Statistic.INVOCATION_GET_DELEGATION_TOKEN); LOG.debug("Delegation token requested"); if (delegationTokens.isPresent()) { return delegationTokens.get().getBoundOrNewDT(encryptionSecrets, (renewer != null ? new Text(renewer) : new Text())); } else { LOG.debug("Token support is not enabled"); return null; } }
Source:
<code>private synchronized void stopEmitterThread() { if (emitterThread != null) { <START> emitterThread.quit(); <END> emitterThread = null; } }</code><technical_language>I killed in here. Thread.interrupt()</technical_language>

Target:
private synchronized void stopEmitterThread() { if (emitterThread != null) { emitterThread.shutdown(); emitterThread = null; } }
Source:
<code>protected ClientDMNType createDMNType(final Map<String, JSITItemDefinition> allDefinitions, final JSITItemDefinition itemDefinition, final String namespace, final Map<String, ClientDMNType> dmnTypesDataMap) { ClientDMNType itemDefinitionDMNType = new ClientDMNType(namespace, itemDefinition.getName(), itemDefinition.getId(), itemDefinition.getIsCollection(), itemDefinition.getItemComponent() != null && !itemDefinition.getItemComponent().isEmpty()); if (allDefinitions.containsKey(itemDefinition.getName())) { dmnTypesDataMap.put(itemDefinition.getName(), itemDefinitionDMNType); } String typeRef = itemDefinition.getTypeRef(); if (typeRef != null) { final ClientDMNType superDmnType = getOrCreateDMNType(allDefinitions, typeRef, namespace, dmnTypesDataMap); if (superDmnType != null) { itemDefinitionDMNType.addFields(superDmnType.getFields()); itemDefinitionDMNType.setCollection(superDmnType.isCollection() || itemDefinitionDMNType.isCollection()); itemDefinitionDMNType.setIsComposite(superDmnType.isComposite() || itemDefinitionDMNType.isComposite()); itemDefinitionDMNType.setFeelType(superDmnType.getFeelType() != null ? superDmnType.getFeelType() : null); } else { throw new IllegalStateException( "Item: " + itemDefinition.getName() + " refers to typeRef: " + itemDefinition.getTypeRef() + " which can't be found."); } } else { <START> populateItemDefinitionFields(allDefinitions, <END> itemDefinition, namespace, dmnTypesDataMap, itemDefinitionDMNType); } return itemDefinitionDMNType; }</code><technical_language>remove this else support field declaration in parent in current type. This is supported moment standard a more flexible code</technical_language>

Target:
protected ClientDMNType createDMNType(final Map<String, JSITItemDefinition> allDefinitions, final JSITItemDefinition itemDefinition, final String namespace, final Map<String, ClientDMNType> dmnTypesDataMap) { ClientDMNType itemDefinitionDMNType = new ClientDMNType(namespace, itemDefinition.getName(), itemDefinition.getId(), itemDefinition.getIsCollection(), itemDefinition.getItemComponent() != null && !itemDefinition.getItemComponent().isEmpty()); if (allDefinitions.containsKey(itemDefinition.getName())) { dmnTypesDataMap.put(itemDefinition.getName(), itemDefinitionDMNType); } String typeRef = itemDefinition.getTypeRef(); if (typeRef != null) { final ClientDMNType superDmnType = getOrCreateDMNType(allDefinitions, typeRef, namespace, dmnTypesDataMap); if (superDmnType != null) { itemDefinitionDMNType.addFields(superDmnType.getFields()); itemDefinitionDMNType.setCollection(superDmnType.isCollection() || itemDefinitionDMNType.isCollection()); itemDefinitionDMNType.setIsComposite(superDmnType.isComposite() || itemDefinitionDMNType.isComposite()); itemDefinitionDMNType.setFeelType(superDmnType.getFeelType() != null ? superDmnType.getFeelType() : null); } else { throw new IllegalStateException( "Item: " + itemDefinition.getName() + " refers to typeRef: " + itemDefinition.getTypeRef() + " which can't be found."); } } populateItemDefinitionFields(allDefinitions, itemDefinition, namespace, dmnTypesDataMap, itemDefinitionDMNType); return itemDefinitionDMNType; }
Source:
<code>public static IborInterpolatedRateObservation of(IborIndex index1, IborIndex index2, LocalDate fixingDate) { ArgChecker.notNull(index1, "index1"); ArgChecker.notNull(index2, "index2"); ArgChecker.notNull(fixingDate, "fixingDate"); <START> if (fixingDate.plus(index1.getTenor()).isAfter(fixingDate.plus(index2.getTenor()))) { <END> return IborInterpolatedRateObservation.builder() .shortIndex(index2) .longIndex(index1) .fixingDate(fixingDate) .build(); } else { return IborInterpolatedRateObservation.builder() .shortIndex(index1) .longIndex(index2) .fixingDate(fixingDate) .build(); } }</code><technical_language>this if statement read appropriately named method</technical_language>

Target:
public static IborInterpolatedRateObservation of(IborIndex index1, IborIndex index2, LocalDate fixingDate) { ArgChecker.notNull(index1, "index1"); ArgChecker.notNull(index2, "index2"); ArgChecker.notNull(fixingDate, "fixingDate"); boolean inOrder = indicesInOrder(index1, index2, fixingDate); return IborInterpolatedRateObservation.builder() .shortIndex(inOrder ? index1 : index2) .longIndex(inOrder ? index2 : index1) .fixingDate(fixingDate) .build(); }
Source:
<code>public String toHeader() { StringBuilder builder = new StringBuilder() <START> .append(traceId.getTraceId().toString(16)) <END> .append('/') .append(spanId.getSpanId()) .append(";o=") .append(traceOptions.getOptionsMask()); return builder.toString(); }</code><technical_language>trace id string 32 characters long, padded zeroes, if necessary, API reject it</technical_language>

Target:
public String toHeader() { StringBuilder builder = new StringBuilder() .append(traceId.getApiString()) .append('/') .append(spanId.getSpanId()) .append(";o=") .append(traceOptions.getOptionsMask()); return builder.toString(); }
Source:
<code><START> @VisibleForTesting ResourceConfiguration getMaxChildResources(String queue) { <END> return maxChildQueueResources.get(queue); }</code><technical_language>@VisibleForTesting in previous line</technical_language>

Target:
@VisibleForTesting ConfigurableResource getMaxChildResources(String queue) { return maxChildQueueResources.get(queue); }
Source:
<code>public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); Status status = null; try { if (method.getStatusCode() == HttpStatus.SC_OK) { Header contentDisposition = method.getResponseHeader("Content-disposition"); if (contentDisposition == null) { status = parseHtmlError(method.getResponseBodyAsStream()); } else { return method.getResponseBodyAsStream(); } } else { status = parseHtmlError(method.getResponseBodyAsStream()); } } catch (Exception e) { status = new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e); } finally { <START> WebUtil.releaseConnection(method, monitor); <END> if (status != null) { throw new CoreException(status); } } return null; }</code><technical_language>close connection returning stream. This invoked in case of exception</technical_language>

Target:
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException, CoreException { String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId; GetMethod method = getConnect(url, monitor); Status status = null; try { if (method.getStatusCode() == HttpStatus.SC_OK) { Header contentDisposition = method.getResponseHeader("Content-disposition"); if (contentDisposition == null) { status = parseHtmlError(method.getResponseBodyAsStream()); } else { return method.getResponseBodyAsStream(); } } else { status = parseHtmlError(method.getResponseBodyAsStream()); } } catch (Exception e) { status = new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, "Unable to retrieve attachment", e); } finally { if (status != null) { WebUtil.releaseConnection(method, monitor); throw new CoreException(status); } } throw new CoreException(status); }
Source:
<code>public void testIdMissingPrices() { ProductItem item = ProductItem.builder().build(); <START> assertEquals(item.getId() + "", imageId().apply(item)); <END> }</code><technical_language>item.getId() is, assertEquals("", imageId().apply(item)); here</technical_language>

Target:
public void testIdMissingPrices() { ProductItem item = ProductItem.builder().build(); imageId().apply(item); }
Source:
<code>public void recalculateIncludedValues(TableReader tableReader) { <START> final SymbolMapReaderImpl symbolMapReader = (SymbolMapReaderImpl) tableReader.getSymbolMapReader(columnIndex); <END> for (int i = 0; i < symbolMapReader.size(); i++) { final CharSequence symbol = symbolMapReader.valueOf(i); if (keyExcludedValues.indexOf(symbol) < 0 && includedValues.indexOf(symbol) < 0) { final RowCursorFactory rowCursorFactory; int symbolKey = symbolMapReader.keyOf(symbol); if (filter == null) { rowCursorFactory = new SymbolIndexRowCursorFactory(columnIndex, symbolKey, cursorFactories.size() == 0, indexDirection); } else { rowCursorFactory = new SymbolIndexFilteredRowCursorFactory(columnIndex, symbolKey, filter, cursorFactories.size() == 0, indexDirection); } includedValues.add(symbol); cursorFactories.add(rowCursorFactory); } } }</code><technical_language>i find tests exercise deferred symbol logic</technical_language>

Target:
public void recalculateIncludedValues(TableReader tableReader) { final SymbolMapReaderImpl symbolMapReader = (SymbolMapReaderImpl) tableReader.getSymbolMapReader(columnIndex); for (int i = 0; i < symbolMapReader.size(); i++) { final CharSequence symbol = symbolMapReader.valueOf(i); if (keyExcludedValues.indexOf(symbol) < 0 && includedValues.indexOf(symbol) < 0) { final RowCursorFactory rowCursorFactory; int symbolKey = symbolMapReader.keyOf(symbol); if (filter == null) { rowCursorFactory = new SymbolIndexRowCursorFactory(columnIndex, symbolKey, cursorFactories.size() == 0, indexDirection); } else { rowCursorFactory = new SymbolIndexFilteredRowCursorFactory(columnIndex, symbolKey, filter, cursorFactories.size() == 0, indexDirection); } includedValues.add(Chars.toString(symbol)); cursorFactories.add(rowCursorFactory); } } }
Source:
<code>private PointSensitivityBuilder calculateRateSensitivity() { pastAccumulation(); <START> valuationDateAccumulation(); <END> PointSensitivityBuilder combinedPointSensitivity = PointSensitivityBuilder.none(); PointSensitivityBuilder approximatedForwardAccumulationSensitivity = approximatedForwardAccumulationSensitivity(); PointSensitivityBuilder cutOffAccumulationSensitivity = cutOffAccumulationSensitivity(); combinedPointSensitivity = combinedPointSensitivity.combinedWith(approximatedForwardAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.combinedWith(cutOffAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.multipliedBy(1.0d / accrualFactorTotal); return combinedPointSensitivity; }</code><technical_language>methods rely a side effect altering a local variable. Ideally, mutable local state here. fixedPeriod is mutable state</technical_language>

Target:
private PointSensitivityBuilder calculateRateSensitivity() { pastAccumulation(); valuationDateAccumulation(); PointSensitivityBuilder combinedPointSensitivity = approximatedForwardAccumulationSensitivity(); PointSensitivityBuilder cutOffAccumulationSensitivity = cutOffAccumulationSensitivity(); combinedPointSensitivity = combinedPointSensitivity.combinedWith(cutOffAccumulationSensitivity); combinedPointSensitivity = combinedPointSensitivity.multipliedBy(1.0d / accrualFactorTotal); return combinedPointSensitivity; }
Source:
<code>public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<Subscription> subscriptions = owningApplication == null ? subscriptionRepository.listSubscriptions() : subscriptionRepository.listSubscriptionsForOwningApplication(owningApplication); <START> return status(OK).body(subscriptions); <END> } catch (final ServiceUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return create(e.asProblem(), request); } }</code><technical_language>I remember a change subscription list, - decided wrapper object for that... I do remember owning application filter in api..</technical_language>

Target:
public ResponseEntity<?> listSubscriptions( @Nullable @RequestParam(value = "owning_application", required = false) final String owningApplication, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final List<Subscription> subscriptions = owningApplication == null ? subscriptionRepository.listSubscriptions() : subscriptionRepository.listSubscriptionsForOwningApplication(owningApplication); return status(OK).body(new SubscriptionListWrapper(subscriptions)); } catch (final ServiceUnavailableException e) { LOG.error("Error occurred during listing of subscriptions", e); return create(e.asProblem(), request); } }
Source:
<code>public void createLabelAndProperty() throws Exception { TokenWriteOperations tokenWrites = tokenWriteOperationsInNewTransaction(); labelId = tokenWrites.labelGetOrCreateForName( LABEL ); propertyKeyId = tokenWrites.propertyKeyGetOrCreateForName( PROPERTY_KEY ); final int labelId1 = labelId; final int[] propertyKeyIds = new int[]{propertyKeyId}; <START> descriptor = SchemaDescriptorFactory.forLabel( labelId1, propertyKeyIds ); <END> commit(); }</code><technical_language>Another</technical_language>

Target:
public void createLabelAndProperty() throws Exception { TokenWriteOperations tokenWrites = tokenWriteOperationsInNewTransaction(); labelId = tokenWrites.labelGetOrCreateForName( LABEL ); propertyKeyId = tokenWrites.propertyKeyGetOrCreateForName( PROPERTY_KEY ); descriptor = SchemaDescriptorFactory.forLabel( labelId, propertyKeyId ); commit(); }
Source:
<code>public List<OrderedPartitionableRecord<String, String>> poll(long timeout) { checkIfClosed(); if (checkPartitionsStarted) { partitionResources.values().forEach(PartitionResource::start); checkPartitionsStarted = false; } try { <START> List<OrderedPartitionableRecord<String, String>> polledRecords = new ArrayList<>(); <END> Queues.drain( records, polledRecords, Math.min(Math.max(records.size(), 1), maxRecordsPerPoll), timeout, TimeUnit.MILLISECONDS ); polledRecords = polledRecords.stream() .filter(x -> partitionResources.containsKey(x.getStreamPartition())) .collect(Collectors.toList()); return polledRecords; } catch (InterruptedException e) { log.warn(e, "Interrupted while polling"); return Collections.emptyList(); } }</code><technical_language>nit: initialize arrayList expected size</technical_language>

Target:
public List<OrderedPartitionableRecord<String, String>> poll(long timeout) { checkIfClosed(); if (checkPartitionsStarted) { partitionResources.values().forEach(PartitionResource::startBackgroundFetch); checkPartitionsStarted = false; } try { int expectedSize = Math.min(Math.max(records.size(), 1), maxRecordsPerPoll); List<OrderedPartitionableRecord<String, String>> polledRecords = new ArrayList<>(expectedSize); Queues.drain( records, polledRecords, expectedSize, timeout, TimeUnit.MILLISECONDS ); polledRecords = polledRecords.stream() .filter(x -> partitionResources.containsKey(x.getStreamPartition())) .collect(Collectors.toList()); return polledRecords; } catch (InterruptedException e) { log.warn(e, "Interrupted while polling"); return Collections.emptyList(); } }
Source:
<code>public static List<Object> getListofOptions(String appModel) { Yaml yamlApp = new Yaml(); if (log.isDebugEnabled()) { <START> log.debug("Loading String to a YAML using sknakeyaml.Yaml"); <END> } return (List<Object>) yamlApp.load(appModel); }</code><technical_language>This sense, log.debug() printed log stream if running log level set debug. is need double check</technical_language>

Target:
public static List<Object> getListofOptions(String appModel) { Yaml yamlApp = new Yaml(); log.debug("Loading String to a YAML using sknakeyaml.Yaml"); return (List<Object>) yamlApp.load(appModel); }
Source:
<code>private void stopGlusterServices(VDS vds) { <START> boolean succeeded = false; <END> if (vds.getVdsGroupSupportsGlusterService()) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.info("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }</code><technical_language>this defined if statement, is assigned, i.e.: boolean succeeded = resourceManagerProvider.get().runVdsCommand(...)</technical_language>

Target:
private void stopGlusterServices(VDS vds) { if (vds.getVdsGroupSupportsGlusterService()) { boolean succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.ManageGlusterService, new GlusterServiceVDSParameters(vds.getId(), Arrays.asList("glusterd"), "stop")).getSucceeded(); if (succeeded) { succeeded = resourceManagerProvider.get().runVdsCommand(VDSCommandType.StopGlusterProcesses, new VdsIdVDSCommandParametersBase(vds.getId())).getSucceeded(); if (succeeded) { List<GlusterBrickEntity> bricks = glusterBrickDao.getGlusterVolumeBricksByServerId(vds.getId()); for (GlusterBrickEntity brick : bricks) { brick.setStatus(GlusterStatus.DOWN); } glusterBrickDao.updateBrickStatuses(bricks); } } if(!succeeded){ log.info("Failed to stop gluster services while moving the host '{}' to maintenance", vds.getName()); } } }
Source:
<code>public EditionLimiter(TextViewer viewer) { this.textViewer = viewer; textViewer.getTextWidget().addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.keyCode == 'd')) { triggeredFromWidget = true; StyledText txt = (StyledText) e.getSource(); int lineLength = 0; int lineNo = 0; int caretOffset = txt.getCaretOffset(); if (document == null) { initialize(); } try { lineNo = document.getLineOfOffset(caretOffset); lineLength = document.getLineLength(lineNo); } catch (BadLocationException e1) { <START> logger.debug("Exception inserting " + "Could not obtain line info", e1); END> } try { if (!isEditableLine(document.getLineOffset(lineNo), 1)) { return; } } catch (BadLocationException e2) { logger.debug("Exception inserting " + "Could not check if editable", e2); } isDeleteLine = true; doit(caretOffset, lineLength, "", false, true); try { document.replace(document.getLineOffset(lineNo), lineLength, ""); } catch (BadLocationException e1) { logger.debug("Exception inserting " + "Could not replace text", e1); } isDeleteLine = false; lastTextForShortCircuiting = null; triggeredFromWidget = false; } } @Override public void keyReleased(KeyEvent e) { } }); }</code><technical_language>message is more specific (e.g. exception executing ctrl+d)... this point I return do nothing</technical_language>

Target:
public EditionLimiter(TextViewer viewer) { this.textViewer = viewer; textViewer.getTextWidget().addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (((e.stateMask & SWT.CTRL) == SWT.CTRL) && (e.keyCode == 'd')) { triggeredFromWidget = true; StyledText txt = (StyledText) e.getSource(); int lineLength = 0; int lineNo = 0; int caretOffset = txt.getCaretOffset(); if (document == null) { initialize(); } try { lineNo = document.getLineOfOffset(caretOffset); lineLength = document.getLineLength(lineNo); if (!isEditableLine(document.getLineOffset(lineNo), 1)) { return; } doit(caretOffset, lineLength, "", false, true); document.replace(document.getLineOffset(lineNo), lineLength, ""); } catch (BadLocationException e1) { logger.debug("Exception while performing Ctrl-D", e1); return; } finally { lastTextForShortCircuiting = null; triggeredFromWidget = false; } } } @Override public void keyReleased(KeyEvent e) { } }); }
Source:
<code>private void createMenuItemMultiple(Menu menu, Repository[] repositories, String shortName) { MenuItem item = new MenuItem(menu, SWT.PUSH); item.setText(shortName); boolean allRepositoriesCheckedOut = Stream.of(repositories) .allMatch(r -> shortName.equals(getBranch(r))); if (allRepositoriesCheckedOut) { item.setImage(checkedOutImage); } else { item.setImage(branchImage); } item.setEnabled(!allRepositoriesCheckedOut); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Repository[] reposToSwitch = Stream.of(repositories) .filter(r -> !shortName.equals(getBranch(r))) <START> .toArray(Repository[]::new); <END> BranchOperationUI.checkout(reposToSwitch, shortName).start(); } }); }</code><technical_language>delay this do in background job BranchOperationUI? get hideously complicated</technical_language>

Target:
private void createMenuItemMultiple(Menu menu, Repository[] repositories, String shortName) { MenuItem item = new MenuItem(menu, SWT.PUSH); item.setText(shortName); boolean allRepositoriesCheckedOut = Stream.of(repositories) .allMatch(r -> shortName.equals(getBranch(r))); if (allRepositoriesCheckedOut) { item.setImage(checkedOutImage); } else { item.setImage(branchImage); } item.setEnabled(!allRepositoriesCheckedOut); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { BranchOperationUI.checkout(repositories, shortName).start(); } }); }
Source:
<code>private static void enterMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> cls = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("\u21E2 "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); builder.append(Strings.toString(parameterValues[i])); } builder.append(')'); <START> final String logtag = asTag(cls); <END> if (android.os.Build.VERSION.SDK_INT >= 18) { final String section = builder.toString().substring(2); Trace.beginSection(section); } Log.v(logtag, builder.toString()); if (Looper.myLooper() != Looper.getMainLooper()) { builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]"); } Log.v(asTag(cls), builder.toString()); }</code><technical_language>Remove</technical_language>

Target:
private static void enterMethod(JoinPoint joinPoint) { CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature(); Class<?> cls = codeSignature.getDeclaringType(); String methodName = codeSignature.getName(); String[] parameterNames = codeSignature.getParameterNames(); Object[] parameterValues = joinPoint.getArgs(); StringBuilder builder = new StringBuilder("\u21E2 "); builder.append(methodName).append('('); for (int i = 0; i < parameterValues.length; i++) { if (i > 0) { builder.append(", "); } builder.append(parameterNames[i]).append('='); builder.append(Strings.toString(parameterValues[i])); } builder.append(')'); if (Looper.myLooper() != Looper.getMainLooper()) { builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]"); } Log.v(asTag(cls), builder.toString()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { final String section = builder.toString().substring(2); Trace.beginSection(section); } }
Source:
<code>public void start() { if (!sarosSession.isHost()) { <START> return; <END> } sarosSession.addListener(sessionListener); resourceActivityFilter.initialize(); }</code><technical_language>I this is easy, do prevent this component added container instead</technical_language>

Target:
public void start() { sarosSession.addListener(sessionListener); resourceActivityFilter.initialize(); }
Source:
<code>public int getConsumersNumber(SubscriptionName subscriptionName) { <START> final int requiredConsumers = getSubscriptionConstraints(subscriptionName) <END> .map(Constraints::getConsumersNumber) .orElse(0); if (requiredConsumers > 0) { if (requiredConsumers <= availableConsumers) { return requiredConsumers; } else { return availableConsumers; } } final int requiredConsumersForTopic = getTopicConstraints(subscriptionName.getTopicName()) .map(Constraints::getConsumersNumber) .orElse(0); if (requiredConsumersForTopic > 0) { if (requiredConsumersForTopic <= availableConsumers) { return requiredConsumersForTopic; } else { return availableConsumers; } } return consumersPerSubscription; }</code><technical_language>algorithm simplified code duplication: final int requiredConsumers = subscriptionConstraints.getOrDefault(subscriptionName, topicConstraints.get(subscriptionName.getTopicName())) .map(Constraints::getConsumersNumber) .orElse(0);</technical_language>

Target:
public int getConsumersNumber(SubscriptionName subscriptionName) { final int requiredConsumers = subscriptionConstraints .getOrDefault(subscriptionName, topicConstraints.getOrDefault(subscriptionName.getTopicName(), new Constraints(consumersPerSubscription))) .getConsumersNumber(); if (requiredConsumers > 0) { if (requiredConsumers <= availableConsumers) { return requiredConsumers; } else { return availableConsumers; } } return consumersPerSubscription; }
Source:
<code>public Tuple exec(final Tuple input) throws IOException { if ((input == null) || (input.size() != 2)) { return null; } final DataByteArray dbaA = (DataByteArray) input.get(0); final DataByteArray dbaB = (DataByteArray) input.get(1); final ArrayOfDoublesSketch sketchA = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaA.get())); final ArrayOfDoublesSketch sketchB = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaB.get())); if (sketchA.getNumValues() != sketchB.getNumValues()) { throw new IllegalArgumentException("Both sketches must have the same number of values"); } int numMetrics = sketchA.getNumValues(); if (sketchA.isEmpty() || sketchB.isEmpty()) { return null; } if (sketchA.getRetainedEntries() < 2 || sketchB.getRetainedEntries() < 2) { <START> return null; <END> } SummaryStatistics[] summaryA = sketchToSummaryStatistics(sketchA, numMetrics); SummaryStatistics[] summaryB = sketchToSummaryStatistics(sketchB, numMetrics); double[] pValues = new double[numMetrics]; TTest tTest = new TTest(); for (int i = 0; i < numMetrics; i++) { pValues[i] = tTest.tTest(summaryA[i], summaryB[i]); } return Util.doubleArrayToTuple(pValues); }</code><technical_language>commons-math do if delegated this (not checked all)</technical_language>

Target:
public Tuple exec(final Tuple input) throws IOException { if ((input == null) || (input.size() != 2)) { return null; } final DataByteArray dbaA = (DataByteArray) input.get(0); final DataByteArray dbaB = (DataByteArray) input.get(1); final ArrayOfDoublesSketch sketchA = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaA.get())); final ArrayOfDoublesSketch sketchB = ArrayOfDoublesSketches.wrapSketch(Memory.wrap(dbaB.get())); if (sketchA.getNumValues() != sketchB.getNumValues()) { throw new IllegalArgumentException("Both sketches must have the same number of values"); } int numMetrics = sketchA.getNumValues(); if (sketchA.getRetainedEntries() < 2 || sketchB.getRetainedEntries() < 2) { return null; } SummaryStatistics[] summaryA = sketchToSummaryStatistics(sketchA, numMetrics); SummaryStatistics[] summaryB = sketchToSummaryStatistics(sketchB, numMetrics); double[] pValues = new double[numMetrics]; TTest tTest = new TTest(); for (int i = 0; i < numMetrics; i++) { pValues[i] = tTest.tTest(summaryA[i], summaryB[i]); } return Util.doubleArrayToTuple(pValues); }
Source:
<code>EntityAnnotation(Class<?> clazz) { this.clazz = clazz; Field tmpIdField = null; ImmutableMap.Builder<String, Field> builder = ImmutableMap.builder(); Set<String> lowerCaseColumnNames = Sets.newHashSet(); for (Field field : clazz.getDeclaredFields()) { Id idAnnotation = field.getAnnotation(Id.class); Column columnAnnotation = field.getAnnotation(Column.class); if ((idAnnotation != null) && (columnAnnotation != null)) { throw new IllegalArgumentException("field cannot be marked as both an Id and a Column: " + field.getName()); } if(idAnnotation != null) { Preconditions.checkArgument(tmpIdField == null, "there are multiple fields with @Id annotation"); field.setAccessible(true); tmpIdField = field; } if ((columnAnnotation != null)) { String columnName = getColumnName(columnAnnotation, field); Preconditions.checkArgument(!lowerCaseColumnNames.contains(columnName.toLowerCase()), String.format("duplicate case-insensitive column name: %s", columnName)); lowerCaseColumnNames.add(columnName.toLowerCase()); field.setAccessible(true); <START> builder.put(columnName, field); <END> } } Preconditions.checkNotNull(tmpIdField, "there are no field with @Id annotation"); idField = tmpIdField; this.columns = builder.build(); }</code><technical_language>Column case</technical_language>

Target:
EntityAnnotation(Class<?> clazz) { this.clazz = clazz; Field tmpIdField = null; ImmutableMap.Builder<String, ColumnMapper> builder = ImmutableMap.builder(); Set<String> usedColumnNames = Sets.newHashSet(); for (Field field : clazz.getDeclaredFields()) { Id idAnnotation = field.getAnnotation(Id.class); Column columnAnnotation = field.getAnnotation(Column.class); if ((idAnnotation != null) && (columnAnnotation != null)) { throw new IllegalArgumentException("field cannot be marked as both an Id and a Column: " + field.getName()); } if(idAnnotation != null) { Preconditions.checkArgument(tmpIdField == null, "there are multiple fields with @Id annotation"); field.setAccessible(true); tmpIdField = field; } if ((columnAnnotation != null)) { String columnName = getColumnName(columnAnnotation, field); Preconditions.checkArgument(!usedColumnNames.contains(columnName), String.format("duplicate case-insensitive column name: %s", columnName)); usedColumnNames.add(columnName); field.setAccessible(true); Serializer<?> serializer = SerializerTypeInferer.getSerializer(field.getType()); builder.put(columnName, new ColumnMapper(field, serializer)); } } Preconditions.checkNotNull(tmpIdField, "there are no field with @Id annotation"); idField = tmpIdField; this.columnMappers = builder.build(); }
Source:
<code>public void testAddNull() { registry.add(null); <START> assertTrue(registry.getItemDescriptors().isEmpty()); <END> }</code><technical_language>remove this assertion, reached</technical_language>

Target:
public void testAddNull() { registry.add(null); }