auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static TypeName forTypeMirror(TypeMirror mirror) { return mirror.accept(new SimpleTypeVisitor6<TypeName, Void>() { @Override protected TypeName defaultAction(TypeMirror e, Void p) { throw new IllegalArgumentException(e.toString()); } @Override public ArrayTypeName visitArray(ArrayType t, Void p) { return new ArrayTypeName(t.getComponentType().accept(this, null)); } @Override public TypeName visitDeclared(DeclaredType t, Void p) { return t.getTypeArguments().isEmpty() ? ClassName.fromTypeElement((TypeElement) t.asElement()) : new ParameterizedTypeName( ClassName.fromTypeElement((TypeElement) t.asElement()), FluentIterable.from(t.getTypeArguments()).transform(FOR_TYPE_MIRROR)); } @Override public PrimitiveName visitPrimitive(PrimitiveType t, Void p) { return PrimitiveName.forTypeMirror(t); } @Override <START> public TypeName visitTypeVariable(javax.lang.model.type.TypeVariable t, Void p) { <END> return TypeVariableName.forTypeMirror(t); } @Override public WildcardName visitWildcard(WildcardType t, Void p) { return WildcardName.forTypeMirror(t); } @Override public NullName visitNull(NullType t, Void p) { return NullName.NULL; } @Override public TypeName visitNoType(NoType t, Void p) { switch (t.getKind()) { case VOID: return VoidName.VOID; case PACKAGE: throw new IllegalArgumentException(); default: throw new IllegalStateException(); } } }, null); }</code><technical_language>Import? I a name collision</technical_language>

Target:
public static TypeName forTypeMirror(TypeMirror mirror) { return mirror.accept(new SimpleTypeVisitor6<TypeName, Void>() { @Override protected TypeName defaultAction(TypeMirror e, Void p) { throw new IllegalArgumentException(e.toString()); } @Override public ArrayTypeName visitArray(ArrayType t, Void p) { return new ArrayTypeName(t.getComponentType().accept(this, null)); } @Override public TypeName visitDeclared(DeclaredType t, Void p) { return t.getTypeArguments().isEmpty() ? ClassName.fromTypeElement((TypeElement) t.asElement()) : new ParameterizedTypeName( ClassName.fromTypeElement((TypeElement) t.asElement()), FluentIterable.from(t.getTypeArguments()).transform(FOR_TYPE_MIRROR)); } @Override public PrimitiveName visitPrimitive(PrimitiveType t, Void p) { return PrimitiveName.forTypeMirror(t); } @Override public TypeName visitTypeVariable(TypeVariable t, Void p) { return TypeVariableName.forTypeMirror(t); } @Override public WildcardName visitWildcard(WildcardType t, Void p) { return WildcardName.forTypeMirror(t); } @Override public NullName visitNull(NullType t, Void p) { return NullName.NULL; } @Override public TypeName visitNoType(NoType t, Void p) { switch (t.getKind()) { case VOID: return VoidName.VOID; case PACKAGE: throw new IllegalArgumentException(); default: throw new IllegalStateException(); } } }, null); }
Source:
<code>public Content(PluginInfo pluginInfo, PluginInfo.Release pluginRelease) { this.pluginId = pluginInfo.getId(); this.description = pluginInfo.getDescription(); <START> this.provider = pluginInfo.getProvider(); <END> this.version = pluginRelease.getVersion(); this.releaseDate = pluginRelease.getDate(); this.parsedRequires = pluginRelease.getParsedRequires(); this.binaryUrl = pluginRelease.getUrl(); this.sha512sum = pluginRelease.getSha512sum(); this.preferred = pluginRelease.isPreferred(); this.lastModified = pluginRelease.getLastModified().toString(); }</code><technical_language>Yeah, I so</technical_language>

Target:
public Content(PluginInfo pluginInfo, PluginInfo.Release pluginRelease) { this.pluginId = pluginInfo.getId(); this.description = pluginInfo.getDescription(); this.provider = pluginInfo.getProvider(); this.version = pluginRelease.getVersion(); this.releaseDate = pluginRelease.getDate(); this.requires = pluginRelease.getRequires(); this.parsedRequires = pluginRelease.getParsedRequires(); this.binaryUrl = pluginRelease.getUrl(); this.sha512sum = pluginRelease.getSha512sum(); this.preferred = pluginRelease.isPreferred(); Instant lastModified = pluginRelease.getLastModified(); this.lastModified = lastModified != null ? lastModified.toString() : null; }
Source:
<code>public void distinctAsync_rememberQueryParams() { final Realm realm = looperThread.realm; realm.beginTransaction(); final int TEST_SIZE = 10; for (int i = 0; i < TEST_SIZE; i++) { realm.createObject(AllJavaTypes.class, i); } realm.commitTransaction(); RealmResults<AllJavaTypes> results = realm.where(AllJavaTypes.class) .notEqualTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2) .distinctAsync(AllJavaTypes.FIELD_ID); results.addChangeListener(new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> results) { <START> assertEquals(TEST_SIZE - 1, results.size()); <END> looperThread.testComplete(); } }); }</code><technical_language>5 is in returned results? assertFalse("Contained unexpected value", list.contains(object));</technical_language>

Target:
public void distinctAsync_rememberQueryParams() { final Realm realm = looperThread.realm; realm.beginTransaction(); final int TEST_SIZE = 10; for (int i = 0; i < TEST_SIZE; i++) { realm.createObject(AllJavaTypes.class, i); } realm.commitTransaction(); RealmResults<AllJavaTypes> results = realm.where(AllJavaTypes.class) .notEqualTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2) .distinctAsync(AllJavaTypes.FIELD_ID); results.addChangeListener(new RealmChangeListener<RealmResults<AllJavaTypes>>() { @Override public void onChange(RealmResults<AllJavaTypes> results) { assertEquals(TEST_SIZE - 1, results.size()); assertEquals(0, results.where().equalTo(AllJavaTypes.FIELD_ID, TEST_SIZE / 2).count()); looperThread.testComplete(); } }); }
Source:
<code>public void testOverlappingGroupsFail() throws AccumuloSecurityException, AccumuloException, TableExistsException { Connector conn = getConnector(); String tableName = getUniqueNames(2)[0]; NewTableConfiguration ntc = new NewTableConfiguration(); Map<String,Set<Text>> lgroups = new HashMap<>(); lgroups.put("lg1", ImmutableSet.of(new Text("colFamA"), new Text("colFamB"))); lgroups.put("lg2", ImmutableSet.of(new Text("colFamC"), new Text("colFamB"))); ntc.setLocalityGroups(lgroups); <START> conn.tableOperations().create(tableName, ntc); <END> }</code><technical_language>this line omitted</technical_language>

Target:
public void testOverlappingGroupsFail() throws AccumuloSecurityException, AccumuloException, TableExistsException { NewTableConfiguration ntc = new NewTableConfiguration(); Map<String,Set<Text>> lgroups = new HashMap<>(); lgroups.put("lg1", ImmutableSet.of(new Text("colFamA"), new Text("colFamB"))); lgroups.put("lg2", ImmutableSet.of(new Text("colFamC"), new Text("colFamB"))); ntc.setLocalityGroups(lgroups); }
Source:
<code>protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .indexing() .enable() .addIndexedEntity(Person.class) .addIndexedEntity(AnotherGrassEater.class) .addProperty(SearchConfig.DIRECTORY_TYPE, SearchConfig.HEAP) .addProperty(SearchConfig.DIRECTORY_ROOT, indexDirectory) .addProperty(SearchConfig.THREAD_POOL_SIZE, "6") .addProperty(SearchConfig.QUEUE_COUNT, "6") .addProperty(SearchConfig.QUEUE_SIZE, "4096") .addProperty(SearchConfig.COMMIT_INTERVAL, "10000") .addProperty(SearchConfig.SHARDING_STRATEGY, SearchConfig.HASH) .addProperty(SearchConfig.NUMBER_OF_SHARDS, "6") ; <START> <END> enhanceConfig(cfg); return TestCacheManagerFactory.createCacheManager(cfg); }</code><technical_language>lucene level properties supported</technical_language>

Target:
protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .indexing() .enable() .addIndexedEntity(Person.class) .addIndexedEntity(AnotherGrassEater.class) .addKeyTransformer(CustomKey3.class, CustomKey3Transformer.class) .addProperty(SearchConfig.DIRECTORY_TYPE, SearchConfig.HEAP) .addProperty(SearchConfig.DIRECTORY_ROOT, indexDirectory) .addProperty(SearchConfig.THREAD_POOL_SIZE, "6") .addProperty(SearchConfig.QUEUE_COUNT, "6") .addProperty(SearchConfig.QUEUE_SIZE, "4096") .addProperty(SearchConfig.COMMIT_INTERVAL, "10000") .addProperty(SearchConfig.SHARDING_STRATEGY, SearchConfig.HASH) .addProperty(SearchConfig.NUMBER_OF_SHARDS, "6") .addProperty(SearchConfig.ERROR_HANDLER, StaticTestingErrorHandler.class.getName()); enhanceConfig(cfg); return TestCacheManagerFactory.createCacheManager(cfg); }
Source:
<code>public void testRequiresNew() throws Exception { service.inPropagationRequired(outer -> { final Handle h = JdbiUtil.getHandle(outer); h.insert("insert into something (id, name) values (7, 'ignored')"); try { service.inRequiresNewReadUncommitted(inner -> { final Handle h1 = JdbiUtil.getHandle(inner); int count = h1.createQuery("select count(*) from something").mapTo(Integer.class).findOnly(); assertThat(count).isEqualTo(1); h1.insert("insert into something (id, name) values (8, 'ignored again')"); throw new ForceRollback(); }); } catch (ForceRollback e) { <START> assertThat(e).isNotNull(); <END> } int count = h.createQuery("select count(*) from something").mapTo(Integer.class).findOnly(); assertThat(count).isEqualTo(1); }); }</code><technical_language>another</technical_language>

Target:
public void testRequiresNew() throws Exception { service.inPropagationRequired(outer -> { final Handle h = JdbiUtil.getHandle(outer); h.insert("insert into something (id, name) values (7, 'ignored')"); assertThatExceptionOfType(ForceRollback.class).isThrownBy(() -> { service.inRequiresNewReadUncommitted(inner -> { final Handle h1 = JdbiUtil.getHandle(inner); int count = h1.createQuery("select count(*) from something").mapTo(Integer.class).findOnly(); assertThat(count).isEqualTo(1); h1.insert("insert into something (id, name) values (8, 'ignored again')"); throw new ForceRollback(); }); }); int count = h.createQuery("select count(*) from something").mapTo(Integer.class).findOnly(); assertThat(count).isEqualTo(1); }); }
Source:
<code>private List<Integer> spreadBytesAsIntegerList() { <START> if (spread == null) <END> { return Collections.emptyList(); } List<Integer> integers = new ArrayList<>(spread.length); for (int i = 0; (i < spread.length); i++) { integers.set(i, (int) spread[i]); } return integers; }</code><technical_language>This true. spread computed in this case. Actually, length of 96</technical_language>

Target:
private List<Integer> spreadBytesAsIntegerList() { assert spread.length == SPREAD_COUNT; List<Integer> integers = new ArrayList<>(spread.length); for (int i = 0; (i < spread.length); i++) { integers.set(i, (int) spread[i]); } return integers; }
Source:
<code>private void visitUnionType(UnionType ut) { Collection<JSType> alts = Collections2.filter(ut.getAlternates(), new Predicate<JSType>() { @Override public boolean apply(JSType input) { <START> return !input.isNullable() && !input.isVoidType() <END> || input.isTemplateType(); } }); if (alts.size() == 1) { visitType(alts.iterator().next()); return; } emit("("); Iterator<JSType> it = alts.iterator(); while (it.hasNext()) { visitType(it.next()); if (it.hasNext()) { emit("|"); } } emit(")"); }</code><technical_language>add parenthesis this rely operator precedence</technical_language>

Target:
private void visitUnionType(UnionType ut) { Collection<JSType> alts = Collections2.filter(ut.getAlternates(), new Predicate<JSType>() { @Override public boolean apply(JSType input) { return !input.isNullType() && !input.isVoidType(); } }); if (alts.size() == 1) { visitType(alts.iterator().next()); return; } emit("("); Iterator<JSType> it = alts.iterator(); while (it.hasNext()) { visitType(it.next()); if (it.hasNext()) { emit("|"); } } emit(")"); }
Source:
<code>public int hashCode() { int result = getClassName().hashCode(); result = 31 * result + getName().hashCode(); result = 31 * result + getReturnType().hashCode(); result = 31 * result + getExceptionType().hashCode(); <START> result = 31 * result + getParametersType().hashCode(); <END> return result; }</code><technical_language>IntelliJ code generation is again! I suggest replacing method body a single call [Objects.hash](<LINK_0></technical_language>

Target:
public int hashCode() { return Objects.hash(); }
Source:
<code><START> public BitSet getCoveredBranches() { <END> return coveredBranches; }</code><technical_language>@Godin I prefer BitSet internally. - int getCoveredBranches() - Add void merge(Instruction) This encapsulation cleaner allows internal optimizations later</technical_language>

Target:
public int getCoveredBranches() { return coveredBranches.cardinality(); }
Source:
<code>public void setAttribute(final String key, final String value) { <START> super.setAttribute(key, value); <END> if (key.equals(SORT_ORDER_TAG)) this.setSortOrder(SortOrder.valueOf(value)); else if (key.equals(GROUP_ORDER_TAG)) this.setGroupOrder(GroupOrder.valueOf(value)); else super.setAttribute(key, value); }</code><technical_language>called here</technical_language>

Target:
public void setAttribute(final String key, final String value) { if (key.equals(SORT_ORDER_TAG)) { this.sortOrder = null; } else if (key.equals(GROUP_ORDER_TAG)) { this.groupOrder = null; } super.setAttribute(key, value); }
Source:
<code>private String updateOperator(byte[] byteContent) { String result = null; if (byteContent != null) { boolean modified = false; try { Document document = getSchemaDocument(byteContent); NodeList appinfoTags = document.getElementsByTagName("xsd:appinfo"); int len = appinfoTags.getLength(); for (int i = 0; i < len; i++) { Node appItem = appinfoTags.item(i); Node sourceAttr = appItem.getAttributes().getNamedItem("source"); if (sourceAttr.getNodeValue().equals("X_ForeignKey_Filter")) { String content = appItem.getTextContent(); if (content.contains("Strict Contains") || content.contains("Contains Text Of")) { content = content.replaceAll("Contains Text Of", "Contains"); content = content.replaceAll("Strict Contains", "Contains"); appItem.setTextContent(content); modified = true; } } } if (modified) { result = Util.nodeToString(document); } } catch (Exception e) { <START> log.error(e.getMessage(), e); <END> } } return result; }</code><technical_language>a sefl-defined error message here. LOG.error("self-defined message", e)</technical_language>

Target:
private String updateOperator(byte[] byteContent) { String result = null; if (byteContent != null) { boolean modified = false; try { Document document = getSchemaDocument(byteContent); NodeList appinfoTags = document.getElementsByTagName("xsd:appinfo"); int len = appinfoTags.getLength(); for (int i = 0; i < len; i++) { Node appItem = appinfoTags.item(i); Node sourceAttr = appItem.getAttributes().getNamedItem("source"); if (sourceAttr.getNodeValue().equals("X_ForeignKey_Filter")) { String content = appItem.getTextContent(); if (content.contains("Strict Contains") || content.contains("Contains Text Of")) { content = content.replaceAll("Contains Text Of", "Contains"); content = content.replaceAll("Strict Contains", "Contains"); appItem.setTextContent(content); modified = true; } } } if (modified) { result = Util.nodeToString(document); } } catch (Exception e) { LOG.error("Failed to update data model condition operator.", e); } } return result; }
Source:
<code>public void aboutToBeShown() { super.aboutToBeShown(); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (!onClickExpression.isEmpty()) { this.hyperlinkListener = new EEFHyperlinkListener(this, <START> this.text, this.container, <END> this.controller); text.addMouseListener(hyperlinkListener); } }</code><technical_language>hyperlink</technical_language>

Target:
public void aboutToBeShown() { super.aboutToBeShown(); String onClickExpression = Optional.ofNullable(this.description.getOnClickExpression()).orElse(""); if (!onClickExpression.isEmpty()) { this.hyperlinkListener = new EEFHyperlinkListener(this, this.hyperlink, this.container, this.controller); hyperlink.addMouseListener(hyperlinkListener); } }
Source:
<code>void onMode(@SuppressWarnings("unused") ChangeEvent e) { final String mode = getSelectedMode(); prefs.syntaxHighlighting(true); syntaxHighlighting.setValue(true, false); new ModeInjector().add(mode).inject(new GerritCallback<Void>() { @Override public void onSuccess(Void result) { <START> if (prefs.syntaxHighlighting() && eq(mode, getSelectedMode()) && view.isAttached()) { <END> view.operation(new Runnable() { @Override public void run() { view.getCmFromSide(DisplaySide.A).setOption("mode", mode); view.getCmFromSide(DisplaySide.B).setOption("mode", mode); } }); } } }); }</code><technical_language>simplify handling uninteresting case first: if (!prefs.syntaxHighlighting() || !Objects.equals(mode, getSelectedMode()) || !view.isAttached()) { return; } view.operation(</technical_language>

Target:
void onMode(@SuppressWarnings("unused") ChangeEvent e) { final String mode = getSelectedMode(); prefs.syntaxHighlighting(true); syntaxHighlighting.setValue(true, false); new ModeInjector().add(mode).inject(new GerritCallback<Void>() { @Override public void onSuccess(Void result) { if (prefs.syntaxHighlighting() && Objects.equals(mode, getSelectedMode()) && view.isAttached()) { view.operation(new Runnable() { @Override public void run() { view.getCmFromSide(DisplaySide.A).setOption("mode", mode); view.getCmFromSide(DisplaySide.B).setOption("mode", mode); } }); } } }); }
Source:
<code>private String createHtmlEmailBody(JobExecutionContext jobContext) { JobDataMap jdm = jobContext.getMergedJobDataMap(); String reasonForStatusChange = jdm.getString("reason"); if (StringUtils.isEmpty(reasonForStatusChange)) { reasonForStatusChange = "<strong>ONC-ACB provided reason for status change:</strong> This field is blank"; } else { reasonForStatusChange = "<strong>ONC-ACB provided reason for status change:</strong> \"" + reasonForStatusChange + "\""; } String reasonForListingChange = jdm.getString("reasonForChange"); if (StringUtils.isEmpty(reasonForListingChange)) { reasonForListingChange = "<strong>ONC-ACB provided reason for listing change:</strong> This field is blank"; } else { reasonForListingChange = "<strong>ONC-ACB provided reason for listing change:</strong> \"" + reasonForListingChange + "\""; } int openNcs = jdm.getInt("openNcs"); int closedNcs = jdm.getInt("closedNcs"); String htmlMessage = String.format(env.getProperty("developerBanEmailBody"), env.getProperty("chplUrlBegin"), <START> env.getProperty("developerBanEmailUrl"), <END> jdm.getLong("dbId"), jdm.getString("chplId"), jdm.getString("developer"), jdm.getString("acb"), Util.getDateFormatter().format(new Date(jdm.getLong("changeDate"))), jdm.getString("fullName"), jdm.getString("status"), Util.getDateFormatter().format(new Date(jdm.getLong("effectiveDate"))), reasonForStatusChange, reasonForListingChange, (openNcs != 1 ? "were" : "was"), openNcs, (openNcs != 1 ? "ies" : "y"), closedNcs, (closedNcs != 1 ? "ies" : "y")); return htmlMessage; }</code><technical_language>this property in developerBanEmailBody string</technical_language>

Target:
private String createHtmlEmailBody(JobExecutionContext jobContext) { JobDataMap jdm = jobContext.getMergedJobDataMap(); String reasonForStatusChange = jdm.getString("reason"); if (StringUtils.isEmpty(reasonForStatusChange)) { reasonForStatusChange = "<strong>ONC-ACB provided reason for status change:</strong> This field is blank"; } else { reasonForStatusChange = "<strong>ONC-ACB provided reason for status change:</strong> \"" + reasonForStatusChange + "\""; } String reasonForListingChange = jdm.getString("reasonForChange"); if (StringUtils.isEmpty(reasonForListingChange)) { reasonForListingChange = "<strong>ONC-ACB provided reason for listing change:</strong> This field is blank"; } else { reasonForListingChange = "<strong>ONC-ACB provided reason for listing change:</strong> \"" + reasonForListingChange + "\""; } int openNcs = jdm.getInt("openNcs"); int closedNcs = jdm.getInt("closedNcs"); String htmlMessage = String.format(env.getProperty("developerBanEmailBody"), env.getProperty("chplUrlBegin"), env.getProperty("listingDetailsUrl"), jdm.getLong("dbId"), jdm.getString("chplId"), jdm.getString("developer"), jdm.getString("acb"), Util.getDateFormatter().format(new Date(jdm.getLong("changeDate"))), jdm.getString("fullName"), jdm.getString("status"), Util.getDateFormatter().format(new Date(jdm.getLong("effectiveDate"))), reasonForStatusChange, reasonForListingChange, (openNcs != 1 ? "were" : "was"), openNcs, (openNcs != 1 ? "ies" : "y"), closedNcs, (closedNcs != 1 ? "ies" : "y")); return htmlMessage; }
Source:
<code>public PluginsZip(SystemEnvironment systemEnvironment, ZipUtil zipUtil) { pluginsEnabled = systemEnvironment.get(SystemEnvironment.PLUGIN_FRAMEWORK_ENABLED); destZipFile = new File(systemEnvironment.get(SystemEnvironment.ALL_PLUGINS_ZIP_PATH)); bundledPlugins = new File(systemEnvironment.get(SystemEnvironment.PLUGIN_GO_PROVIDED_PATH)); externalPlugins = new File(systemEnvironment.get(SystemEnvironment.PLUGIN_EXTERNAL_PROVIDED_PATH)); this.zipUtil = zipUtil; <START> checkFilesAccessibility(bundledPlugins, externalPlugins); <END> }</code><technical_language>prefer constructors blow unexpected errors. mind moving this check create() method</technical_language>

Target:
public PluginsZip(SystemEnvironment systemEnvironment, ZipUtil zipUtil) { pluginsEnabled = systemEnvironment.get(SystemEnvironment.PLUGIN_FRAMEWORK_ENABLED); destZipFile = new File(systemEnvironment.get(SystemEnvironment.ALL_PLUGINS_ZIP_PATH)); bundledPlugins = new File(systemEnvironment.get(SystemEnvironment.PLUGIN_GO_PROVIDED_PATH)); externalPlugins = new File(systemEnvironment.get(SystemEnvironment.PLUGIN_EXTERNAL_PROVIDED_PATH)); this.zipUtil = zipUtil; }
Source:
<code>private void createIndex() { try ( Transaction tx = db.beginTx() ) { db.execute( "CREATE INDEX ON " + indexDefinition ); tx.success(); } try ( Transaction tx = db.beginTx() ) { <START> db.schema().awaitIndexesOnline( 1, TimeUnit.SECONDS ); <END> tx.success(); } }</code><technical_language>this enough latest 3.3 version</technical_language>

Target:
private void createIndex() { try ( Transaction tx = db.beginTx() ) { db.execute( "CREATE INDEX ON " + indexDefinition ); tx.success(); } try ( Transaction tx = db.beginTx() ) { db.schema().awaitIndexesOnline( 5, TimeUnit.SECONDS ); tx.success(); } }
Source:
<code>public List<FirmwareCountInfo> getSeenFirmwareByTime(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("range_start") final Long rangeStart, @QueryParam("range_end") final Long rangeEnd) { if(rangeStart == null) { LOGGER.error("Missing range_start parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } if(rangeEnd == null) { LOGGER.error("Missing range_end parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); <START> final List<FirmwareCountInfo> firmwareCounts = new ArrayList<>(); <END> try { final Set<Tuple> seenFirmwares = jedis.zrangeByScoreWithScores(REDIS_SEEN_FIRMWARE_KEY, rangeStart, rangeEnd); for (final Tuple fwInfo:seenFirmwares) { final long lastSeen = (long) fwInfo.getScore(); final long fwCount = jedis.zcard(fwInfo.getElement()); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmware by time.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }</code><technical_language>Guava style list creation</technical_language>

Target:
public List<FirmwareCountInfo> getSeenFirmwareByTime(@Scope(OAuthScope.ADMINISTRATION_READ) final AccessToken accessToken, @QueryParam("range_start") final Long rangeStart, @QueryParam("range_end") final Long rangeEnd) { if(rangeStart == null) { LOGGER.error("Missing range_start parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } if(rangeEnd == null) { LOGGER.error("Missing range_end parameter"); throw new WebApplicationException(Response.Status.BAD_REQUEST); } final Jedis jedis = jedisPool.getResource(); final List<FirmwareCountInfo> firmwareCounts = Lists.newArrayList(); try { final Set<Tuple> seenFirmwares = jedis.zrangeByScoreWithScores(REDIS_SEEN_FIRMWARE_KEY, rangeStart, rangeEnd); final Pipeline pipe = jedis.pipelined(); final Map<String, redis.clients.jedis.Response<Long>> responseMap = Maps.newHashMap(); for (final Tuple fwInfo:seenFirmwares) { responseMap.put(fwInfo.getElement(), pipe.zcard(fwInfo.getElement())); } pipe.sync(); for (final Tuple fwInfo:seenFirmwares) { final String fwVersion = fwInfo.getElement(); final long fwCount = responseMap.get(fwVersion).get(); final long lastSeen = (long) fwInfo.getScore(); if (fwCount > 0) { firmwareCounts.add(new FirmwareCountInfo(fwInfo.getElement(), fwCount, lastSeen)); } } } catch (Exception e) { LOGGER.error("Failed retrieving all seen firmware by time.", e.getMessage()); } finally { jedisPool.returnResource(jedis); } return firmwareCounts; }
Source:
<code>public void onMapReady(@NonNull final MapboxMap mapboxMap) { TilequeryActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { addClickLayer(); addResultLayer(); <START> displayDeviceLocation(); <END> mapboxMap.addOnMapClickListener(TilequeryActivity.this); Toast.makeText(TilequeryActivity.this, R.string.click_on_map_instruction, Toast.LENGTH_SHORT).show(); } }); }</code><technical_language>provide style parameter methods</technical_language>

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { TilequeryActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { addClickLayer(style); addResultLayer(style); displayDeviceLocation(style); mapboxMap.addOnMapClickListener(TilequeryActivity.this); Toast.makeText(TilequeryActivity.this, R.string.click_on_map_instruction, Toast.LENGTH_SHORT).show(); } }); }
Source:
<code>public void run() { while (true) { if (persistQueue.peek() != null) { try { StreamsDatum entry = persistQueue.remove(); write(entry); } catch (Exception ex) { <START> ex.printStackTrace(); <END> } } try { Thread.sleep(new Random().nextInt(1)); } catch (InterruptedException interrupt) { LOGGER.trace("Interrupt", interrupt); } } }</code><technical_language>Log Exception instead Logger</technical_language>

Target:
public void run() { while (true) { if (persistQueue.peek() != null) { try { StreamsDatum entry = persistQueue.remove(); write(entry); } catch (Exception ex) { LOGGER.warn("Failure writing entry from Queue: {}", ex.getMessage()); } } try { Thread.sleep(new Random().nextInt(1)); } catch (InterruptedException interrupt) { LOGGER.trace("Interrupt", interrupt); } } }
Source:
<code>public void run() { synchronized (isActive) { if (isActive.getAndSet(true)) throw new IllegalStateException("already running"); } while (shouldBeActive.get()) { long startTime = System.currentTimeMillis(); try { if (preAttempt()) { int code = HttpTestUtils.getHttpStatusCode(url); lastTime.set(System.currentTimeMillis()-startTime); if (code!=200) { lastStatus.set(code); lastFailure.set(code); failures.incrementAndGet(); onFailure("return code "+code); } else { <START> lastStatus.set(null); <END> successes.incrementAndGet(); } } } catch (Exception e) { lastTime.set(System.currentTimeMillis()-startTime); lastStatus.set(e); lastFailure.set(e); failures.incrementAndGet(); onFailure(e); } try { if (delayMillis > 0) { Thread.sleep(delayMillis); } } catch (InterruptedException e) { onFailure(e); shouldBeActive.set(false); } } synchronized (isActive) { if (!isActive.getAndSet(false)) throw new IllegalStateException("shouldn't be possible!"); isActive.notifyAll(); } }</code><technical_language>minor: suggest moving lastStatus.set(code) of if-else, 200 if run passes</technical_language>

Target:
public void run() { synchronized (isActive) { if (isActive.getAndSet(true)) throw new IllegalStateException("already running"); } while (shouldBeActive.get()) { long startTime = System.currentTimeMillis(); try { if (preAttempt()) { int code = HttpTestUtils.getHttpStatusCode(url); lastTime.set(System.currentTimeMillis()-startTime); lastStatus.set(code); if (isResponseOkay(code)) { lastFailure.set(code); failures.incrementAndGet(); onFailure("return code "+code); } else { successes.incrementAndGet(); } } } catch (Exception e) { lastTime.set(System.currentTimeMillis()-startTime); lastStatus.set(e); lastFailure.set(e); failures.incrementAndGet(); onFailure(e); } try { if (delayMillis > 0) { Thread.sleep(delayMillis); } } catch (InterruptedException e) { onFailure(e); shouldBeActive.set(false); } } synchronized (isActive) { if (!isActive.getAndSet(false)) throw new IllegalStateException("shouldn't be possible!"); isActive.notifyAll(); } }
Source:
<code>private static void writeParameter(final Object param, final ByteBuffer b) { if (param instanceof SPromise) { <START> b.put((byte) 0x04); <END> b.putLong(((SPromise) param).getPromiseId()); } else if (param instanceof SResolver) { b.put((byte) 0x05); b.putLong(((SResolver) param).getPromise().getPromiseId()); } else if (param instanceof SAbstractObject) { b.put((byte) 0x06); b.putShort(((SAbstractObject) param).getSOMClass().getName().getSymbolId()); } else { if (param instanceof Long) { b.put((byte) 0x02); b.putLong((Long) param); } else if (param instanceof Double) { b.put((byte) 0x03); b.putDouble((Double) param); } else if (param instanceof Boolean) { if ((Boolean) param) { b.put((byte) 0x01); } else { b.put((byte) 0x00); } } else if (param instanceof String) { b.put((byte) 0x07); } else { throw new RuntimeException("unexpected parameter type"); } } }</code><technical_language>enum.id() (which want add getter) here. Also, age question in software maintainability: if a polymorphic method class takes byte buffer? sure, I I prefer enum id step, avoid trivial bugs</technical_language>

Target:
private static void writeParameter(final Object param, final ByteBuffer b) { if (param instanceof SPromise) { b.put(ParamTypes.Promise.id()); b.putLong(((SPromise) param).getPromiseId()); } else if (param instanceof SResolver) { b.put(ParamTypes.Resolver.id()); b.putLong(((SResolver) param).getPromise().getPromiseId()); } else if (param instanceof SAbstractObject) { b.put(ParamTypes.Object.id()); b.putShort(((SAbstractObject) param).getSOMClass().getName().getSymbolId()); } else { if (param instanceof Long) { b.put(ParamTypes.Long.id()); b.putLong((Long) param); } else if (param instanceof Double) { b.put(ParamTypes.Double.id()); b.putDouble((Double) param); } else if (param instanceof Boolean) { if ((Boolean) param) { b.put(ParamTypes.True.id()); } else { b.put(ParamTypes.False.id()); } } else if (param instanceof String) { b.put(ParamTypes.String.id()); } else { throw new RuntimeException("unexpected parameter type"); } } }
Source:
<code>public static SWTBotTreeItem createProject(SWTWorkbenchBot bot, String projectName) { SWTBotUtils.createProject(projectName); SWTBotView projectExplorerBot = bot.viewByTitle("Project Explorer"); projectExplorerBot.show(); SWTBotTreeItem treeItem = projectExplorerBot.bot().tree().getTreeItem(projectName); treeItem.select(); treeItem.expand(); SWTBotTreeItem treeNode = null; for (String node : treeItem.getNodes()) { <START> if (node.startsWith("Trace")) { <END> treeNode = treeItem.getNode(node); break; } } assertNotNull(treeNode); return treeNode; }</code><technical_language>more test for .equals("Traces"). create a file called "Trace" in project root</technical_language>

Target:
public static SWTBotTreeItem createProject(SWTWorkbenchBot bot, String projectName) { SWTBotUtils.createProject(projectName); SWTBotView projectExplorerBot = bot.viewByTitle("Project Explorer"); projectExplorerBot.show(); SWTBotTreeItem treeItem = projectExplorerBot.bot().tree().getTreeItem(projectName); treeItem.select(); treeItem.expand(); SWTBotTreeItem treeNode = null; for (String node : treeItem.getNodes()) { if (node.matches("Traces\\s\\[(\\d)*\\]")) { treeNode = treeItem.getNode(node); break; } } assertNotNull(treeNode); return treeNode; }
Source:
<code>protected boolean consumeNextMessage() { Message rawMessage = null; try { boolean hasNext = mMessageReader.hasNext(); if (!hasNext) { return false; } rawMessage = mMessageReader.read(); } catch (ConsumerTimeoutException e) { LOG.trace("Consumer timed out", e); } if (rawMessage != null) { try { mMessageWriter.adjustOffset(rawMessage); } catch (IOException e) { throw new RuntimeException("Failed to adjust offset.", e); } <START> Message transformedMessage = mMessageTransformer.transform(rawMessage); <END> if(transformedMessage == null) { return true; } ParsedMessage parsedMessage = null; try { parsedMessage = mMessageParser.parse(transformedMessage); final double DECAY = 0.999; mUnparsableMessages *= DECAY; } catch (Throwable e) { mMetricCollector.increment("consumer.message_errors.count", rawMessage.getTopic()); mUnparsableMessages++; final double MAX_UNPARSABLE_MESSAGES = 1000.; if (mUnparsableMessages > MAX_UNPARSABLE_MESSAGES) { throw new RuntimeException("Failed to parse message " + rawMessage, e); } LOG.warn("Failed to parse message {}", rawMessage, e); } if (parsedMessage != null) { try { mMessageWriter.write(parsedMessage); mMetricCollector.metric("consumer.message_size_bytes", rawMessage.getPayload().length, rawMessage.getTopic()); mMetricCollector.increment("consumer.throughput_bytes", rawMessage.getPayload().length, rawMessage.getTopic()); } catch (Exception e) { throw new RuntimeException("Failed to write message " + parsedMessage, e); } } } return true; }</code><technical_language>transform call is moved try/catch block</technical_language>

Target:
protected boolean consumeNextMessage() { Message rawMessage = null; try { boolean hasNext = mMessageReader.hasNext(); if (!hasNext) { return false; } rawMessage = mMessageReader.read(); } catch (ConsumerTimeoutException e) { LOG.trace("Consumer timed out", e); } if (rawMessage != null) { try { mMessageWriter.adjustOffset(rawMessage); } catch (IOException e) { throw new RuntimeException("Failed to adjust offset.", e); } ParsedMessage parsedMessage = null; try { Message transformedMessage = mMessageTransformer.transform(rawMessage); if (transformedMessage == null) { return true; } parsedMessage = mMessageParser.parse(transformedMessage); final double DECAY = 0.999; mUnparsableMessages *= DECAY; } catch (Throwable e) { mMetricCollector.increment("consumer.message_errors.count", rawMessage.getTopic()); mUnparsableMessages++; final double MAX_UNPARSABLE_MESSAGES = 1000.; if (mUnparsableMessages > MAX_UNPARSABLE_MESSAGES) { throw new RuntimeException("Failed to parse message " + rawMessage, e); } LOG.warn("Failed to parse message {}", rawMessage, e); } if (parsedMessage != null) { try { mMessageWriter.write(parsedMessage); mMetricCollector.metric("consumer.message_size_bytes", rawMessage.getPayload().length, rawMessage.getTopic()); mMetricCollector.increment("consumer.throughput_bytes", rawMessage.getPayload().length, rawMessage.getTopic()); } catch (Exception e) { throw new RuntimeException("Failed to write message " + parsedMessage, e); } } } return true; }
Source:
<code>public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); <START> assertTrue(state.toString(), state.state().active()); <END> state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(INACTIVE, state.state()); state.state(ACTIVE, false); assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(ACTIVE, state.state()); }</code><technical_language>toString() is overriden in GridClientClusterState. I state.state().toString()</technical_language>

Target:
public void testActivateDeActivate() throws GridClientException { GridClientClusterState state = client.state(); assertTrue(state.state().toString(), state.state().active()); state.state(INACTIVE, true); IgniteEx ig1 = grid(0); IgniteEx ig2 = grid(1); assertFalse(ig1.active()); assertFalse(ig2.active()); assertEquals(INACTIVE, state.state()); state.state(ACTIVE, false); assertTrue(ig1.active()); assertTrue(ig2.active()); assertEquals(ACTIVE, state.state()); }
Source:
<code>public void subscribeToDataStoreInternal(@NonNull CompositeSubscription compositeSubscription) { Log.v(TAG, "subscribeToDataStoreInternal"); ConnectableObservable<DataStreamNotification<GitHubRepositorySearch>> repositorySearchSource = searchString .filter(string -> string.length() > 2) .debounce(SEARCH_INPUT_DELAY, TimeUnit.MILLISECONDS) .distinctUntilChanged() .doOnNext(string -> Log.d(TAG, "Searching with: " + string)) .switchMap(getGitHubRepositorySearch::call) .publish(); compositeSubscription.add(repositorySearchSource .doOnNext(notification -> Log.d(TAG, "status: " + notification)) .map(toProgressStatus()) .doOnNext(progressStatus -> Log.d(TAG, "Progress status: " + progressStatus.name())) .subscribe(this::setNetworkStatusText)); compositeSubscription.add(repositorySearchSource .filter(DataStreamNotification::isOnNext) <START> .doOnNext(notification -> Log.d(TAG, "Processing search results")) <END> .map(DataStreamNotification::getValue) .map(GitHubRepositorySearch::getItems) .flatMap(toGitHubRepositoryList()) .doOnNext(list -> Log.d(TAG, "Publishing " + list.size() + " repositories from the ViewModel")) .subscribe(RepositoriesViewModel.this.repositories::onNext)); compositeSubscription.add(repositorySearchSource.connect()); }</code><technical_language>new logging leftovers</technical_language>

Target:
public void subscribeToDataStoreInternal(@NonNull CompositeSubscription compositeSubscription) { Log.v(TAG, "subscribeToDataStoreInternal"); ConnectableObservable<DataStreamNotification<GitHubRepositorySearch>> repositorySearchSource = searchString .filter(string -> string.length() > 2) .debounce(SEARCH_INPUT_DELAY, TimeUnit.MILLISECONDS) .distinctUntilChanged() .doOnNext(string -> Log.d(TAG, "Searching with: " + string)) .switchMap(getGitHubRepositorySearch::call) .publish(); compositeSubscription.add(repositorySearchSource .map(toProgressStatus()) .doOnNext(progressStatus -> Log.d(TAG, "Progress status: " + progressStatus.name())) .subscribe(this::setNetworkStatusText)); compositeSubscription.add(repositorySearchSource .filter(DataStreamNotification::isOnNext) .map(DataStreamNotification::getValue) .map(GitHubRepositorySearch::getItems) .flatMap(toGitHubRepositoryList()) .doOnNext(list -> Log.d(TAG, "Publishing " + list.size() + " repositories from the ViewModel")) .subscribe(RepositoriesViewModel.this.repositories::onNext)); compositeSubscription.add(repositorySearchSource.connect()); }
Source:
<code>private Map<String, ?> transform(String payload) { Map<String, Object> map = new LinkedHashMap<String, Object>(); Matcher matcher = pattern.matcher(payload); if (matcher.matches()) { try { String facilityString = matcher.group(1); int facility = Integer.parseInt(facilityString); int severity = facility & 0x7; facility = facility >> 3; map.put(FACILITY, facility); map.put(SEVERITY, severity); String timestamp = matcher.group(2); Date date; try { date = this.dateFormat.parse(timestamp); Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); calendar.setTime(date); if (month == 11 && calendar.get(Calendar.MONTH) == 0) { calendar.set(Calendar.YEAR, year + 1); } else if (month == 0 && calendar.get(Calendar.MONTH) == 1) { calendar.set(Calendar.YEAR, year - 1); } else { calendar.set(Calendar.YEAR, year); } map.put(TIMESTAMP, calendar.getTime()); } catch (Exception e) { map.put(TIMESTAMP, timestamp); } map.put(HOST, matcher.group(3)); map.put(TAG, matcher.group(4)); map.put(MESSAGE, matcher.group(5)); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not decode:" + payload, e); } map.clear(); map.put(UNDECODED, payload); } } else { if (logger.isDebugEnabled()) { logger.debug("Could not decode:" + payload); } map.put(UNDECODED, payload); } <START> return map; <END> }</code><technical_language>simply omit TAG map element setting null</technical_language>

Target:
private Map<String, ?> transform(String payload) { Map<String, Object> map = new LinkedHashMap<String, Object>(); Matcher matcher = pattern.matcher(payload); if (matcher.matches()) { try { String facilityString = matcher.group(1); int facility = Integer.parseInt(facilityString); int severity = facility & 0x7; facility = facility >> 3; map.put(FACILITY, facility); map.put(SEVERITY, severity); String timestamp = matcher.group(2); Date date; try { date = this.dateFormat.parse(timestamp); Calendar calendar = Calendar.getInstance(); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); calendar.setTime(date); if (month == 11 && calendar.get(Calendar.MONTH) == 0) { calendar.set(Calendar.YEAR, year + 1); } else if (month == 0 && calendar.get(Calendar.MONTH) == 1) { calendar.set(Calendar.YEAR, year - 1); } else { calendar.set(Calendar.YEAR, year); } map.put(TIMESTAMP, calendar.getTime()); } catch (Exception e) { map.put(TIMESTAMP, timestamp); } map.put(HOST, matcher.group(3)); if (matcher.group(4) != null) { map.put(TAG, matcher.group(4)); } map.put(MESSAGE, matcher.group(5)); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Could not decode:" + payload, e); } map.clear(); map.put(UNDECODED, payload); } } else { if (logger.isDebugEnabled()) { logger.debug("Could not decode:" + payload); } map.put(UNDECODED, payload); } return map; }
Source:
<code>void create() { statusTransitioner.checkMaintenance(); try { if (!getRuntimeConfiguration().getResourcePools().getPoolForResource(ResourceType.Core.DISK).isPersistent()) { destroy(); } PersistenceSpaceIdentifier space = localPersistenceService.getOrCreatePersistenceSpace(id); <START> throw new UnsupportedOperationException("How do I get the space reference in to the service config list?"); <END> } catch (CachePersistenceException e) { throw new RuntimeException("Unable to create persistence context for user managed cache " + id, e); } }</code><technical_language>Reads a problem needs solving</technical_language>

Target:
void create() { statusTransitioner.checkMaintenance(); try { if (!getRuntimeConfiguration().getResourcePools().getPoolForResource(ResourceType.Core.DISK).isPersistent()) { destroy(); } localPersistenceService.getOrCreatePersistenceSpace(id); } catch (CachePersistenceException e) { throw new RuntimeException("Unable to create persistence space for user managed cache " + id, e); } }
Source:
<code>public static void setup() throws Exception { esSetup = new EsSetup(); elasticIO = new ElasticIO(); elasticIO.insertDiscovery(createTestMetrics(TENANT_A)); elasticIO.insertDiscovery(createTestMetrics(TENANT_B)); elasticIO.insertDiscovery(createTestMetricsFromInterface(TENANT_C)); <START> Thread.sleep(3*1000); END> }</code><technical_language>refresh operation is useful in types of unit tests avoid a hard-coded pause <LINK_0></technical_language>

Target:
public void setup() throws Exception { helper = ElasticsearchRestHelper.getInstance(); tearDown(); elasticIO = new ElasticIO(); elasticIO.insertDiscovery(createTestMetrics(TENANT_A)); elasticIO.insertDiscovery(createTestMetrics(TENANT_B)); elasticIO.insertDiscovery(createTestMetricsFromInterface(TENANT_C)); String TOKEN_INDEX_NAME_OLD = ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_WRITE + "_v1"; elasticTokensIO = new ElasticTokensIO() { @Override protected String[] getIndexesToSearch() { return new String[] {ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_READ, TOKEN_INDEX_NAME_OLD}; } }; elasticTokensIO.insertDiscovery(createTestTokens(TENANT_A)); elasticTokensIO.insertDiscovery(createTestTokens(TENANT_B)); List<Token> tokens = createTestTokens(TENANT_C); for(Token token : tokens){ elasticTokensIO.insertDiscovery(token); } this.insertTokenDiscovery(createTestTokens(TENANT_A), TOKEN_INDEX_NAME_OLD, elasticTokensIO.elasticsearchRestHelper); this.insertTokenDiscovery(createTestTokens(TENANT_B), TOKEN_INDEX_NAME_OLD, elasticTokensIO.elasticsearchRestHelper); this.insertTokenDiscovery(createTestTokens(TENANT_C), TOKEN_INDEX_NAME_OLD, elasticTokensIO.elasticsearchRestHelper); helper.refreshIndex("metric_metadata"); helper.refreshIndex("metric_tokens"); }
Source:
<code>protected void addUserAgentHeader(HttpRequest request) { if (USER_AGENT_VALUE == null) { USER_AGENT_VALUE = <START> "bazel/" + StringUtils.defaultIfEmpty(BlazeVersionInfo.instance().getVersion(), "dev"); <END> } request.headers().set(HttpHeaderNames.USER_AGENT, USER_AGENT_VALUE); }</code><technical_language>discussed yesterday I try consistent gRPC protocol http protocol. argue if version is provided plain bazel if a version is provided bazel <version number></technical_language>

Target:
protected void addUserAgentHeader(HttpRequest request) { request.headers().set(HttpHeaderNames.USER_AGENT, USER_AGENT_VALUE); }
Source:
<code>public Set<String> getGenres(final Record record) { String leaderStr = record.getLeader().marshal(); char leaderChar07 = leaderStr.charAt(7); Set<String> resultSet = new HashSet<String>(); if (!record.getVariableFields("502").isEmpty()) resultSet.add(Genre.THESIS.toString()); List<DataField> dfList = (List<DataField>) record.getDataFields(); for (DataField df : dfList) { if (df.getTag().startsWith("6")) { List<String> subList = MarcUtils.getSubfieldStrings(df, 'x'); subList.addAll(MarcUtils.getSubfieldStrings(df, 'v')); for (String s : subList) { if (s.toLowerCase().contains("congresses")) { resultSet.add(Genre.CONFERENCE_PROCEEDINGS.toString()); } } } } if (leaderChar07 == 'm' || leaderChar07 == 's') { char c29 = '\u0000'; if (cf008 != null && cf008.getData().length() >= 30) { c29 = ((ControlField) cf008).getData().charAt(29); if (c29 == '1') resultSet.add(Genre.CONFERENCE_PROCEEDINGS.toString()); } } if (cf008 != null && cf008.getData().length() >= 29) { if (!main_formats.contains(Format.MUSIC_SCORE.toString()) && !main_formats.contains(Format.MUSIC_RECORDING.toString()) && !main_formats.contains(Format.MANUSCRIPT_ARCHIVE.toString()) && <START> cf008.find("^.{28}[a-z]")) <END> { resultSet.add(Genre.GOVERNMENT_DOCUMENTS.toString()); } } return resultSet; }</code><technical_language>Is character in 008 byte 28 required alpha character</technical_language>

Target:
public Set<String> getGenres(final Record record) { String leaderStr = record.getLeader().marshal(); char leaderChar07 = leaderStr.charAt(7); Set<String> resultSet = new HashSet<String>(); if (!record.getVariableFields("502").isEmpty()) resultSet.add(Genre.THESIS.toString()); List<DataField> dfList = (List<DataField>) record.getDataFields(); for (DataField df : dfList) { if (df.getTag().startsWith("6")) { List<String> subList = MarcUtils.getSubfieldStrings(df, 'x'); subList.addAll(MarcUtils.getSubfieldStrings(df, 'v')); for (String s : subList) { if (s.toLowerCase().contains("congresses")) { resultSet.add(Genre.CONFERENCE_PROCEEDINGS.toString()); } } } } if (leaderChar07 == 'm' || leaderChar07 == 's') { char c29 = '\u0000'; if (cf008 != null && cf008.getData().length() >= 30) { c29 = ((ControlField) cf008).getData().charAt(29); if (c29 == '1') resultSet.add(Genre.CONFERENCE_PROCEEDINGS.toString()); } } if (cf008 != null && cf008.getData().length() >= 29) { if (!main_formats.contains(Format.MUSIC_SCORE.toString()) && !main_formats.contains(Format.MUSIC_RECORDING.toString()) && !main_formats.contains(Format.MANUSCRIPT_ARCHIVE.toString()) && cf008.find("^.{28}[a-z]")) { resultSet.add(Genre.GOVERNMENT_DOCUMENT.toString()); } } return resultSet; }
Source:
<code>public static CodeSystem b2iExtension(String extensionPath) { return CodeSystem.builder() <START> .name("Systematized Nomenclature of Medicine Clinical Terms, B2i extension") <END> .shortName(SNOMED_B2I_SHORT_NAME) .oid(SNOMED_B2I_OID) .primaryLanguage(SNOMED_INT_LANGUAGE) .organizationLink("<LINK_0>") .citation(SNOMED_INT_CITATION) .branchPath(extensionPath) .iconPath(SNOMED_INT_ICON_PATH) .repositoryUuid(REPOSITORY_UUID) .terminologyId(TERMINOLOGY_ID) .extensionOf(SNOMED_SHORT_NAME) .build(); }</code><technical_language>CDO, SNOMED is longer officially acronym. I guess this **SNOMED CT, B2i extension**</technical_language>

Target:
public static CodeSystem b2iExtension(String extensionPath) { return CodeSystem.builder() .name(SNOMED_B2I_NAME) .shortName(SNOMED_B2I_SHORT_NAME) .oid(SNOMED_B2I_OID) .primaryLanguage(SNOMED_INT_LANGUAGE) .organizationLink(SNOMED_B2I_LINK) .citation(SNOMED_INT_CITATION) .branchPath(extensionPath) .iconPath(SNOMED_INT_ICON_PATH) .repositoryUuid(REPOSITORY_UUID) .terminologyId(TERMINOLOGY_ID) .extensionOf(SNOMED_SHORT_NAME) .build(); }