auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private HashSet<CableBlockEntity> visitCableNode(CableBlockEntity currentEntity, HashSet<CableBlockEntity> visitedNodes) { visitedNodes.add(currentEntity); HashSet<CableBlockEntity> seenNodes = new HashSet<>(); if (currentEntity != null) { TechReborn.LOGGER.debug( "Visiting node on behalf of ({} visited total)", currentEntity.getPos().asLong(), this, visitedNodes.size()); seenNodes.add(currentEntity); for (Direction face : Direction.values()) { <START> BlockPos blockToCheckPos = currentEntity.getPos().offset(face); <END> BlockEntity blockEntity = currentEntity.getWorld().getBlockEntity(blockToCheckPos); if (!(blockEntity instanceof CableBlockEntity) || visitedNodes.contains(blockEntity)) { continue; } CableBlockEntity targetEntity = (CableBlockEntity) blockEntity; TechReborn.LOGGER.debug( "Node is on network {}", targetEntity.getPos().asLong(), targetEntity.getElectricNetwork()); if (currentEntity.canConnectTo(targetEntity)) { TechReborn.LOGGER.debug("Seen another node -- {}", blockToCheckPos.asLong()); seenNodes.add(targetEntity); } } } return seenNodes; }</code><technical_language>a chance test this work part of network is in unloaded chunk</technical_language>

Target:
private Set<CableBlockEntity> visitCableNode(CableBlockEntity currentEntity, HashSet<CableBlockEntity> visitedNodes) { visitedNodes.add(currentEntity); HashSet<CableBlockEntity> seenNodes = new HashSet<>(); if (currentEntity != null) { TechReborn.LOGGER.debug( "Visiting node on behalf of ({} visited total)", currentEntity.getPos().asLong(), this, visitedNodes.size()); seenNodes.add(currentEntity); for (Direction face : Direction.values()) { BlockPos blockToCheckPos = currentEntity.getPos().offset(face); BlockEntity blockEntity = currentEntity.getWorld().getBlockEntity(blockToCheckPos); if (!(blockEntity instanceof CableBlockEntity) || visitedNodes.contains(blockEntity)) { continue; } CableBlockEntity targetEntity = (CableBlockEntity) blockEntity; TechReborn.LOGGER.debug( "Node is on network {}", targetEntity.getPos().asLong(), targetEntity.getElectricNetwork()); if (currentEntity.canConnectTo(targetEntity)) { TechReborn.LOGGER.debug("Seen another node -- {}", blockToCheckPos.asLong()); seenNodes.add(targetEntity); } } } return seenNodes; }
Source:
<code>public void testDisable() throws Exception { for (String regionId : regions) { <START> assertNotNull(api.cdnApiInRegion(regionId).disable(name)); <END> } }</code><technical_language>more specific assertions in tests</technical_language>

Target:
public void testDisable() throws Exception { for (String regionId : regions) { assertTrue(api.cdnApiInRegion(regionId).disable(name)); CDNContainer container = api.cdnApiInRegion(regionId).get(name); assertFalse(container.isEnabled()); } }
Source:
<code><START> private Node convert(AResource r) { <END> if (!r.isAnonymous()) return NodeFactory.createURI(r.getURI()); Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }</code><technical_language>out of curiosity, static anymore</technical_language>

Target:
private Node convert(AResource r) { if (!r.isAnonymous()) { String uriStr = r.getURI() ; if ( errorForSpaceInURI ) { if ( uriStr.contains(" ") ) { int i = uriStr.indexOf(' '); String s = uriStr.substring(0,i); String msg = String.format("Bad character in IRI (space): <%s[space]...>", s); riotErrorHandler.error(msg, -1, -1); throw new RiotParseException(msg, -1, -1); } } return NodeFactory.createURI(uriStr); } Node rr = (Node) r.getUserData(); if (rr == null) { rr = NodeFactory.createBlankNode(); r.setUserData(rr); } return rr; }
Source:
<code>public WebViewMapFragment build() { if (options == null) { options = new MapboxWebMapType(accessToken, mapId); } if (options instanceof MapboxWebMapType) { return MapboxWebViewMapFragment.newInstance(options); } <START> return null; <END> }</code><technical_language>throw IllegalStateException instead of returning null easier identify root faster</technical_language>

Target:
public WebViewMapFragment build() { if (options == null) { options = new MapboxWebMapType(accessToken, mapId); } if (options instanceof MapboxWebMapType) { return MapboxWebViewMapFragment.newInstance(options); } throw new IllegalStateException("Unable to build MapboxWebMapViewFragment." + " options == '" + options + "'"); }
Source:
<code>public boolean accept(File pathname) { <START> return (pathname.isDirectory() && pathname.getName().equals("index")); END> }</code><technical_language>hardcoded</technical_language>

Target:
public boolean accept(File pathname) { return (pathname.isDirectory() && pathname.getName().equals(INDEX_DIRECTORY)); }
Source:
<code>private RequestContextSubscriber(CoreSubscriber<T> delegate, Authentication authentication) { this.delegate = delegate; Context parentContext = this.delegate.currentContext(); Context context; <START> if (parentContext.hasKey(REQUEST_CONTEXT_DATA_HOLDER_ATTR_NAME)) { <END> context = parentContext; } else { context = parentContext.put(REQUEST_CONTEXT_DATA_HOLDER_ATTR_NAME, new RequestContextDataHolder(authentication)); } this.context = context; }</code><technical_language>create empty RequestContextDataHolder? java if (authentication == null || parentContext.hasKey(REQUEST_CONTEXT_DATA_HOLDER_ATTR_NAME)) {}</technical_language>

Target:
private RequestContextSubscriber(CoreSubscriber<T> delegate, Authentication authentication) { this.delegate = delegate; Context parentContext = this.delegate.currentContext(); Context context; if (authentication == null || parentContext.hasKey(REQUEST_CONTEXT_DATA_HOLDER_ATTR_NAME)) { context = parentContext; } else { context = parentContext.put(REQUEST_CONTEXT_DATA_HOLDER_ATTR_NAME, new RequestContextDataHolder(authentication)); } this.context = context; }
Source:
<code>public void testCopyFileInvalid() throws IOException { Path created = FileHelper.createFile(fileSystem.getPath(getCurrentTestName())); FileHelper.copyFile(created, fileSystem.getPath("../" + getCurrentTestName())); <START> } <END></code><technical_language>previous remark explicit _Fail_ call</technical_language>

Target:
public void testCopyFileInvalid() throws IOException { Path created = FileHelper.createFile(fileSystem.getPath(getCurrentTestName())); Path copy = FileHelper.copyFile(created, fileSystem.getPath("../" + getCurrentTestName())); fail(String.format("Unexpected success in copying file to %s", copy.toString())); }
Source:
<code>public static void setup() { FloatInputPoll pressureInput = Igneous.makeAnalogInput(0); FloatStatus min = ControlInterface.mainTuning.getFloat("pressure-min", 0.0f); FloatStatus max = ControlInterface.mainTuning.getFloat("pressure-max", 1.0f); EventStatus setMin = new EventStatus(); EventStatus setMax = new EventStatus(); FloatMixing.pumpWhen(setMin, pressureInput, min); FloatMixing.pumpWhen(setMax, pressureInput, max); pressureGauge = FloatMixing.createDispatch(FloatMixing.normalizeFloat(pressureInput, min, max), Igneous.globalPeriodic); Cluck.publish("Pressure Switch", pressureSwitch); Cluck.publish("Pressure Gauge", pressureGauge); Cluck.publish("Compressor Enable", compressor); Cluck.publish("Pressure Min Set", setMin); <START> Cluck.publish("Pressure Max Set", setMax); <END> }</code><technical_language>reason published EventStatus instead of publishing EventOutput directly? Remember pumpEvent exists</technical_language>

Target:
public static void setup() { FloatInput pressureInput = FloatMixing.createDispatch(Igneous.makeAnalogInput(0), Igneous.globalPeriodic); FloatStatus min = ControlInterface.mainTuning.getFloat("pressure-min", 0.0f); FloatStatus max = ControlInterface.mainTuning.getFloat("pressure-max", 1.0f); pressureGauge = FloatMixing.createDispatch(FloatMixing.normalizeFloat(pressureInput, min, max), Igneous.globalPeriodic); Cluck.publish("Pressure Switch", pressureSwitch); Cluck.publish("Pressure Gauge", pressureGauge); Cluck.publish("Pressure Gauge Raw", pressureInput); Cluck.publish("Compressor Enable", compressor); Cluck.publish("Pressure Min Set", FloatMixing.pumpEvent(pressureInput, min)); Cluck.publish("Pressure Max Set", FloatMixing.pumpEvent(pressureInput, max)); }
Source:
<code>public Response getPolicies(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { try { <START> LOGGER.debug("Getting policies for [" + tenant + "] and subject [" + subject + "]"); <END> Collection<Policy> policyList = dao.getPolicies(tenant, subject); PolicySet ps = new PolicySet(tenant + ":" + subject, policyList); Document setDocument = ps.toXml(); String result = Xml.toString(setDocument); return Response.ok(result).build(); } catch (IOException ex) { return Response.status(500).build(); } catch (SAXException ex) { return Response.status(500).build(); } catch (TransformerException ex) { return Response.status(500).build(); } }</code><technical_language><LINK_0></technical_language>

Target:
public Response getPolicies(@PathParam("tenant") String tenant, @PathParam("subject") String subject) { try { LOGGER.debug("Getting policies for and subject [{}]", tenant, subject); Collection<Policy> policyList = dao.getPolicies(tenant, subject); PolicySet ps = new PolicySet(tenant + ":" + subject, policyList); Document setDocument = ps.toXml(); String result = Xml.toString(setDocument); return Response.ok(result).build(); } catch (IOException ex) { return Response.status(500).build(); } catch (SAXException ex) { return Response.status(500).build(); } catch (TransformerException ex) { return Response.status(500).build(); } }
Source:
<code><START> private SharedRealm(long nativeSharedRealmPtr, OsRealmConfig osRealmConfig) { <END> this.nativePtr = nativeSharedRealmPtr; this.osRealmConfig = osRealmConfig; this.schemaInfo = new OsSchemaInfo(nativeGetSchemaInfo(nativePtr), this); this.context = osRealmConfig.getContext(); this.isPhantomRef = false; this.capabilities = new AndroidCapabilities(); this.realmNotifier = null; nativeSetAutoRefresh(nativePtr, false); }</code><technical_language>this.context.addReference(this); isPhantomRef is true? purpose of keeping NativeObject interface if add reference(addReference)</technical_language>

Target:
private SharedRealm(long nativeSharedRealmPtr, OsRealmConfig osRealmConfig) { this.nativePtr = nativeSharedRealmPtr; this.osRealmConfig = osRealmConfig; this.schemaInfo = new OsSchemaInfo(nativeGetSchemaInfo(nativePtr), this); this.context = osRealmConfig.getContext(); this.context.addReference(this); this.capabilities = new AndroidCapabilities(); this.realmNotifier = null; nativeSetAutoRefresh(nativePtr, false); }
Source:
<code>private void configureCommand(TransportCommand<?, ?> command) { command.setTimeout(this.timeout); <START> command.setTransportConfigCallback(this.transportConfigCallback); <END> command.setCredentialsProvider(getCredentialsProvider()); }</code><technical_language>Is setting null OK</technical_language>

Target:
private void configureCommand(TransportCommand<?, ?> command) { command.setTimeout(this.timeout); if (this.transportConfigCallback != null) { command.setTransportConfigCallback(this.transportConfigCallback); } CredentialsProvider credentialsProvider = getCredentialsProvider(); if (credentialsProvider != null) { command.setCredentialsProvider(credentialsProvider); } }
Source:
<code>private void createKerberosLdapAAAConfigurations() { for (String domain : Config.<String> getValue(ConfigValues.DomainName).split("[,]", 0)) { <START> if (!domain.isEmpty()) { <END> Properties authConfig = new Properties(); authConfig.put(ExtensionsManager.CLASS, "org.ovirt.engine.extensions.aaa.builtin.kerberosldap.KerberosLdapAuthenticator"); authConfig.put(ExtensionsManager.PROVIDES, "org.ovirt.engine.authentication"); authConfig.put(ExtensionsManager.ENABLED, "true"); authConfig.put(ExtensionsManager.MODULE, "org.ovirt.engine.extensions.builtin"); authConfig.put(ExtensionsManager.NAME, String.format("builtin-authn-%1$s", domain)); authConfig.put("ovirt.engine.aaa.authn.profile.name", domain); authConfig.put("ovirt.engine.aaa.authn.authz.plugin", domain); ExtensionsManager.getInstance().load(authConfig); Properties dirConfig = new Properties(); dirConfig.put(ExtensionsManager.CLASS, "org.ovirt.engine.extensions.aaa.builtin.kerberosldap.KerberosLdapDirectory"); dirConfig.put(ExtensionsManager.PROVIDES, "org.ovirt.engine.authorization"); dirConfig.put(ExtensionsManager.ENABLED, "true"); dirConfig.put(ExtensionsManager.MODULE, "org.ovirt.engine.extensions.builtin"); dirConfig.put(ExtensionsManager.NAME, domain); ExtensionsManager.getInstance().load(dirConfig); } } }</code><technical_language>trim()</technical_language>

Target:
private void createKerberosLdapAAAConfigurations() { for (String domain : Config.<String> getValue(ConfigValues.DomainName).split("[,]", 0)) { domain = domain.trim(); if (!domain.isEmpty()) { Properties authConfig = new Properties(); authConfig.put(ExtensionsManager.CLASS, "org.ovirt.engine.extensions.aaa.builtin.kerberosldap.KerberosLdapAuthenticator"); authConfig.put(ExtensionsManager.PROVIDES, "org.ovirt.engine.authentication"); authConfig.put(ExtensionsManager.ENABLED, "true"); authConfig.put(ExtensionsManager.MODULE, "org.ovirt.engine.extensions.builtin"); authConfig.put(ExtensionsManager.NAME, String.format("builtin-authn-%1$s", domain)); authConfig.put("ovirt.engine.aaa.authn.profile.name", domain); authConfig.put("ovirt.engine.aaa.authn.authz.plugin", domain); ExtensionsManager.getInstance().load(authConfig); Properties dirConfig = new Properties(); dirConfig.put(ExtensionsManager.CLASS, "org.ovirt.engine.extensions.aaa.builtin.kerberosldap.KerberosLdapDirectory"); dirConfig.put(ExtensionsManager.PROVIDES, "org.ovirt.engine.authorization"); dirConfig.put(ExtensionsManager.ENABLED, "true"); dirConfig.put(ExtensionsManager.MODULE, "org.ovirt.engine.extensions.builtin"); dirConfig.put(ExtensionsManager.NAME, domain); ExtensionsManager.getInstance().load(dirConfig); } } }
Source:
<code>public ExtendedLockPromise acquire(Object key, Object lockOwner, long time, TimeUnit timeUnit) { <START> AtomicReference<ExtendedLockPromise> reference = new AtomicReference<>(); <END> lockMap.compute(key, (aKey, lock) -> { if (lock == null) { lock = createInfinispanLock(aKey); } reference.set(lock.acquire(lockOwner, time, timeUnit)); return lock; }); return reference.get(); }</code><technical_language>ByRef work here</technical_language>

Target:
public ExtendedLockPromise acquire(Object key, Object lockOwner, long time, TimeUnit timeUnit) { ByRef<ExtendedLockPromise> reference = ByRef.create(null); lockMap.compute(key, (aKey, lock) -> { if (lock == null) { lock = createInfinispanLock(aKey); } reference.set(lock.acquire(lockOwner, time, timeUnit)); return lock; }); return reference.get(); }
Source:
<code>private void discard(Throwable cause) { for (;;) { PendingWrite currentWrite = this.currentWrite; if (this.currentWrite == null) { currentWrite = queue.poll(); } else { this.currentWrite = null; } if (currentWrite == null) { break; } Object message = currentWrite.msg; if (message instanceof ChunkedInput) { ChunkedInput<?> in = (ChunkedInput<?>) message; try { boolean endOfInput = in.isEndOfInput(); long inputLength = in.length(); closeInput(in); if (!endOfInput) { if (cause == null) { cause = new ClosedChannelException(); } currentWrite.fail(cause); } else { currentWrite.success(inputLength); } } catch (Exception e) { <START> closeInput(in); <END> currentWrite.fail(e); if (logger.isWarnEnabled()) { logger.warn(ChunkedInput.class.getSimpleName() + " failed", e); } } } else { if (cause == null) { cause = new ClosedChannelException(); } currentWrite.fail(cause); } } }</code><technical_language>@lutovich assume in.isEndOfInput in.length able fail, right? I move this try/catch upper more "targeted" specific. Otherwise, obvious glance do try close input here</technical_language>

Target:
private void discard(Throwable cause) { for (;;) { PendingWrite currentWrite = this.currentWrite; if (this.currentWrite == null) { currentWrite = queue.poll(); } else { this.currentWrite = null; } if (currentWrite == null) { break; } Object message = currentWrite.msg; if (message instanceof ChunkedInput) { ChunkedInput<?> in = (ChunkedInput<?>) message; boolean endOfInput; long inputLength; try { endOfInput = in.isEndOfInput(); inputLength = in.length(); closeInput(in); } catch (Exception e) { closeInput(in); currentWrite.fail(e); if (logger.isWarnEnabled()) { logger.warn(ChunkedInput.class.getSimpleName() + " failed", e); } continue; } if (!endOfInput) { if (cause == null) { cause = new ClosedChannelException(); } currentWrite.fail(cause); } else { currentWrite.success(inputLength); } } else { if (cause == null) { cause = new ClosedChannelException(); } currentWrite.fail(cause); } } }
Source:
<code>public void time() throws Exception { TimeStat stat = new TimeStat(ticker); <START> stat.time((Callable<Void>) () -> { <END> ticker.increment(10, TimeUnit.MILLISECONDS); return null; }); TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }</code><technical_language>Is cast needed? is time(x) method</technical_language>

Target:
public void time() throws Exception { TimeStat stat = new TimeStat(ticker); stat.time(() -> { ticker.increment(10, TimeUnit.MILLISECONDS); return null; }); TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }
Source:
<code>public SlackTextMessage execute(String... args) { SecurityContext ctx = ACL.impersonate(ACL.SYSTEM); String response = "*Projects:*\n"; Jenkins j = Jenkins.getInstance(); if (j == null) { throw new IllegalStateException(); } List<AbstractProject> jobs = j.getAllItems(AbstractProject.class); SecurityContextHolder.setContext(ctx); <START> StringBuffer buf = new StringBuffer(); <END> for (AbstractProject job : jobs) { if (job.isBuildable()) { AbstractBuild lastBuild = job.getLastBuild(); String buildNumber = "TBD"; String status = "TBD"; if (lastBuild != null) { buildNumber = Integer.toString(lastBuild.getNumber()); if (lastBuild.isBuilding()) { status = "BUILDING"; } Result result = lastBuild.getResult(); if (result != null) { status = result.toString(); } } if (jobs.size() <= 10) { buf.append(">*") .append(job.getDisplayName()) .append("*\n>*Last Build:* #") .append(buildNumber) .append("\n>*Status:* ") .append(status) .append("\n\n\n"); } else { buf.append(">*") .append(job.getDisplayName()) .append("* :: *Last Build:* #") .append(buildNumber) .append(" :: *Status:* ") .append(status) .append("\n\n"); } } } response += buf.toString(); if (jobs.size() == 0) response += ">_No projects found_"; return new SlackTextMessage(response); }</code><technical_language>If operate in a single thread, StringBuilder. is *MUCH* more efficient, concurrency logic overheads</technical_language>

Target:
public SlackTextMessage execute(String... args) { SecurityContext ctx = ACL.impersonate(ACL.SYSTEM); Jenkins jenkins = Jenkins.getActiveInstance(); List<AbstractProject> jobs = jenkins.getAllItems(AbstractProject.class); SecurityContextHolder.setContext(ctx); StringBuilder builder = new StringBuilder("*Projects:*\n"); for (AbstractProject job : jobs) { if (job.isBuildable()) { AbstractBuild lastBuild = job.getLastBuild(); String buildNumber = "TBD"; String status = "TBD"; if (lastBuild != null) { buildNumber = Integer.toString(lastBuild.getNumber()); if (lastBuild.isBuilding()) { status = "BUILDING"; } Result result = lastBuild.getResult(); if (result != null) { status = result.toString(); } } if (jobs.size() <= 10) { builder.append(">*") .append(job.getDisplayName()) .append("*\n>*Last Build:* #") .append(buildNumber) .append("\n>*Status:* ") .append(status) .append("\n\n\n"); } else { builder.append(">*") .append(job.getDisplayName()) .append("* :: *Last Build:* #") .append(buildNumber) .append(" :: *Status:* ") .append(status) .append("\n\n"); } } } if (jobs.size() == 0) builder.append(">_No projects found_"); return new SlackTextMessage(builder.toString()); }
Source:
<code>@Override public synchronized void close() { closed = true; asyncRunner.shutdown(); try { asyncRunner.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException ignore) { } if (channels.get() != null) { <START> for (ClientChannelHolder hld: channels.get()) <END> hld.close(); } }</code><technical_language>below: race condition - channels null null check. Copy a variable, check for null / iterate / etc</technical_language>

Target:
@Override public synchronized void close() { closed = true; asyncRunner.shutdown(); try { asyncRunner.awaitTermination(EXECUTOR_SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException ignore) { } List<ClientChannelHolder> holders = channels; if (holders != null) { for (ClientChannelHolder hld: holders) hld.close(); } }
Source:
<code>public PageProjectionOutput project(ConnectorSession session, DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions) { blockBuilder = blockBuilder.newBlockBuilderLike(new BlockBuilderStatus()); try { return pageProjectionOutputClass .getDeclaredConstructor(BlockBuilder.class, ConnectorSession.class, DriverYieldSignal.class, Page.class, SelectedPositions.class) <START> .newInstance(blockBuilder, session, yieldSignal, page, selectedPositions); <END> } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } }</code><technical_language>Turn this a method handle in constructor</technical_language>

Target:
public PageProjectionOutput project(ConnectorSession session, DriverYieldSignal yieldSignal, Page page, SelectedPositions selectedPositions) { blockBuilder = blockBuilder.newBlockBuilderLike(new BlockBuilderStatus()); try { return (PageProjectionOutput) pageProjectionOutputFactory.invoke(blockBuilder, session, yieldSignal, page, selectedPositions); } catch (Throwable e) { throw new RuntimeException(e); } }
Source:
<code>public void setFieldName(String name) { if(state == null) { if (name.equals("imports")) { if(seenImports) throw new UnsupportedOperationException("Two import declarations found."); state = State.preImp; } else if (name.equals("symbols")) { <START> if(decSymbols.size() > 0) throw new UnsupportedOperationException("Two symbol list declarations found."); <END> state = State.preSym; } else { throw new UnsupportedOperationException(); } } else if(state == State.impDesc) { if(name.equals("name")) { state = State.impName; } else if(name.equals("version")) { state = State.impVer; } else if(name.equals("max_id")) { state = State.impMID; } } else { throw new UnsupportedOperationException(); } }</code><technical_language>if a previous symbols list empty</technical_language>

Target:
public void setFieldName(String name) { if(state == State.LST_STRUCT) { if (name.equals("imports")) { if(seenImports) throw new UnsupportedOperationException("Two import declarations found."); state = State.PRE_IMPORT_LIST; } else if (name.equals("symbols")) { if(seenSymbols) throw new UnsupportedOperationException("Two symbol list declarations found."); state = State.PRE_SYMBOL_LIST; } else { throw new UnsupportedOperationException(); } } else if(state == State.IMPORT_DESCRIPTOR) { if(name.equals("name")) { state = State.IMPORT_NAME; } else if(name.equals("version")) { state = State.IMPORT_VERSION; } else if(name.equals("max_id")) { state = State.IMPORT_MAX_ID; } } else { throw new UnsupportedOperationException(); } }
Source:
<code>private void setUpGameWorlds() { gameWorlds.subscribeSelection((widget, worldInfo) -> { if (worldInfo == null) { return; } descriptionTitle.setText(translationSystem.translate("${engine:menu#game-details-world-description}")); description.setText(getWorldDescription(worldInfo)); gameModules.setSelection(null); biomes.setSelection(null); blocks.setSelection(null); }); gameWorlds.setItemRenderer(new AbstractItemRenderer<WorldInfo>() { @Override public void draw(WorldInfo value, Canvas canvas) { <START> if(value.getCustomTitle().isEmpty()==true) { <END> canvas.drawText(value.getTitle()); } else { canvas.drawText(value.getCustomTitle()); } } @Override public Vector2i getPreferredSize(WorldInfo value, Canvas canvas) { String text = value.getCustomTitle(); return new Vector2i(canvas.getCurrentStyle().getFont().getWidth(text), canvas.getCurrentStyle().getFont().getLineHeight()); } }); }</code><technical_language>need ==true here. java if (value.getCustomTitle().isEmpty() == true) { Is java if (value.getCustomTitle().isEmpty()) {</technical_language>

Target:
private void setUpGameWorlds() { gameWorlds.subscribeSelection((widget, worldInfo) -> { if (worldInfo == null) { return; } descriptionTitle.setText(translationSystem.translate("${engine:menu#game-details-world-description}")); description.setText(getWorldDescription(worldInfo)); gameModules.setSelection(null); biomes.setSelection(null); blocks.setSelection(null); }); gameWorlds.setItemRenderer(new AbstractItemRenderer<WorldInfo>() { @Override public void draw(WorldInfo value, Canvas canvas) { if(value.getCustomTitle().isEmpty()) { canvas.drawText(value.getTitle()); } else { canvas.drawText(value.getCustomTitle()); } } @Override public Vector2i getPreferredSize(WorldInfo value, Canvas canvas) { String text = value.getCustomTitle(); return new Vector2i(canvas.getCurrentStyle().getFont().getWidth(text), canvas.getCurrentStyle().getFont().getLineHeight()); } }); }
Source:
<code><START> public PotionRemoveEvent(EntityLivingBase living, Potion potion) <END> { super(living, living.getActivePotionMap().get(potion)); toRemove = potion; }</code><technical_language>spaces in Potion potion</technical_language>

Target:
public PotionRemoveEvent(EntityLivingBase living, Potion potion) { super(living, living.getActivePotionMap().get(potion)); this.potion = potion; }
Source:
<code>public FracturedLoyalty(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); <START> this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(new FracturedLoyaltyTriggeredAbility(), AttachmentType.AURA, Duration.WhileOnBattlefield, "Whenever enchanted creature becomes the target of a spell or ability, that spell or ability's controller gains control of that creature."))); <END> }</code><technical_language>This a triggered ability of enchantment, a trigger gained creature</technical_language>

Target:
public FracturedLoyalty(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}"); this.subtype.add(SubType.AURA); TargetPermanent auraTarget = new TargetCreaturePermanent(); this.getSpellAbility().addTarget(auraTarget); this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); this.addAbility(new FracturedLoyaltyTriggeredAbility()); }
Source:
<code>public void before() { Resource resource = mock(Resource.class); ModuleDefinition sinkDefinition = new ModuleDefinition(ModuleType.SINK.getTypeName(), ModuleType.SINK.getTypeName(), resource); ModuleDefinition sourceDefinition = new ModuleDefinition(ModuleType.SOURCE.getTypeName(), ModuleType.SOURCE.getTypeName(), resource); ArrayList<ModuleDefinition> definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.SOURCE.getTypeName(), ModuleType.SOURCE.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.SOURCE.getTypeName())).thenReturn(definitions); when(moduleRegistry.findDefinitions("time")).thenReturn(definitions); when(moduleRegistry.lookup("time", "source")).thenReturn(sourceDefinition); definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.SINK.getTypeName(), ModuleType.SINK.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.SINK.getTypeName())).thenReturn(definitions); when(moduleRegistry.findDefinitions("log")).thenReturn(definitions); <START> when(moduleRegistry.lookup("log", "sink")).thenReturn(sourceDefinition); <END> definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.PROCESSOR.getTypeName(), ModuleType.PROCESSOR.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.PROCESSOR.getTypeName())).thenReturn(definitions); }</code><technical_language>this return sinkDefinition ??? (unused variable yellow squiggly line) I guess this test is good if pick this up</technical_language>

Target:
public void before() { Resource resource = mock(Resource.class); ModuleDefinition sinkDefinition = new ModuleDefinition(ModuleType.SINK.getTypeName(), ModuleType.SINK.getTypeName(), resource); ModuleDefinition sourceDefinition = new ModuleDefinition(ModuleType.SOURCE.getTypeName(), ModuleType.SOURCE.getTypeName(), resource); ArrayList<ModuleDefinition> definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.SOURCE.getTypeName(), ModuleType.SOURCE.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.SOURCE.getTypeName())).thenReturn(definitions); when(moduleRegistry.findDefinitions("time")).thenReturn(definitions); when(moduleRegistry.lookup("time", "source")).thenReturn(sourceDefinition); definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.SINK.getTypeName(), ModuleType.SINK.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.SINK.getTypeName())).thenReturn(definitions); when(moduleRegistry.findDefinitions("log")).thenReturn(definitions); when(moduleRegistry.lookup("log", "sink")).thenReturn(sinkDefinition); definitions = new ArrayList<ModuleDefinition>(); definitions.add(new ModuleDefinition(ModuleType.PROCESSOR.getTypeName(), ModuleType.PROCESSOR.getTypeName(), resource)); when(moduleRegistry.findDefinitions(ModuleType.PROCESSOR.getTypeName())).thenReturn(definitions); }
Source:
<code>public void storeDescriptor(Map<String, String> props, String namePrefix) { if(namePrefix == null) namePrefix = ""; props.put(namePrefix + STUN_ADDRESS, getAddress()); if(getPort() != -1) props.put(namePrefix + STUN_PORT, Integer.toString( getPort() )); if (getUsername() != null && getUsername().length > 0) try { props.put(namePrefix + STUN_USERNAME, <START> StringUtils.toString(getUsername(), StandardCharsets.UTF_8.name())); <END> } catch (UnsupportedEncodingException e) { props.put(namePrefix + STUN_USERNAME, getUsername().toString()); } if (getPassword() != null && getPassword().length > 0) { props.put(namePrefix + "." + STUN_PASSWORD, new String(getPassword())); } props.put(namePrefix + STUN_IS_TURN_SUPPORTED, Boolean.toString( isTurnSupported() )); }</code><technical_language>new String(..., StandardCharsets.UTF_8). if this throws, toEncodedString</technical_language>

Target:
public void storeDescriptor(Map<String, String> props, String namePrefix) { if(namePrefix == null) namePrefix = ""; props.put(namePrefix + STUN_ADDRESS, getAddress()); if(getPort() != -1) props.put(namePrefix + STUN_PORT, Integer.toString( getPort() )); if (getUsername() != null && getUsername().length > 0) props.put(namePrefix + STUN_USERNAME, StringUtils.toEncodedString(getUsername(), StandardCharsets.UTF_8)); if (getPassword() != null && getPassword().length > 0) { props.put(namePrefix + "." + STUN_PASSWORD, new String(getPassword())); } props.put(namePrefix + STUN_IS_TURN_SUPPORTED, Boolean.toString( isTurnSupported() )); }
Source:
<code>public String toString() { <START> return schemaName + ":" + tableName + ":" + analyzeHandle; <END> }</code><technical_language>This toString() is printing query plan. want include partition values</technical_language>

Target:
public String toString() { return toStringHelper(this) .add("schemaName", schemaName) .add("tableName", tableName) .add("analyzePartitionValues", analyzePartitionValues) .toString(); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof CleanUpDomainCommand)) return false; <START> if (!super.equals(o)) return false; <END> CleanUpDomainCommand that = (CleanUpDomainCommand) o; if (_domainCleanUp != null ? !_domainCleanUp.equals(that._domainCleanUp) : that._domainCleanUp != null) return false; return true; }</code><technical_language>coding standards, if blocks wrapped in curly braces</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof CleanUpDomainCommand)) { return false; } CleanUpDomainCommand that = (CleanUpDomainCommand) o; return super.equals(that) && Objects.equals(_domainCleanUp, that._domainCleanUp); }
Source:
<code>private void emitContentLengthMismatchFailureEvent(final BulkObject ds3Object, final Throwable t) { <START> final FailureEvent failureEvent = new FailureEvent.Builder() <END> .doingWhat(FailureEvent.FailureActivity.GettingObject) .usingSystemWithEndpoint(client.getConnectionDetails().getEndpoint()) .withCausalException(t) .withObjectNamed(ds3Object.getName()) .build(); emitFailureEvent(failureEvent); }</code><technical_language>I tend favor syntax guava for builders. FailureEvent.builder() new FailureEvent.Builder()</technical_language>

Target:
private void emitContentLengthMismatchFailureEvent(final BulkObject ds3Object, final Throwable t) { final FailureEvent failureEvent = FailureEvent.builder() .doingWhat(FailureEvent.FailureActivity.GettingObject) .usingSystemWithEndpoint(client.getConnectionDetails().getEndpoint()) .withCausalException(t) .withObjectNamed(ds3Object.getName()) .build(); emitFailureEvent(failureEvent); }
Source:
<code>public Map<String, String> toConfig(Config jobConfig, Config tableConfig) { final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT, Modifier.STATIC).create(); <START> return Collections.singletonMap(String.format("%s.%s", getTableId(), this.getClass().getCanonicalName()), <END> gson.toJson(this)); }</code><technical_language>key format is consistent table configuration items format</technical_language>

Target:
public Map<String, String> toConfig(Config jobConfig, Config tableConfig) { return Collections.singletonMap(this.getClass().getSimpleName(), SerdeUtils.toJson("table retry policy", this)); }
Source:
<code>boolean canReconnectNow() { <START> return System.currentTimeMillis() >= nextReconnectionTime; <END> }</code><technical_language>weird for ConvictionPolicy dictate reconnect. I easier manage if responsible for mark connection down, especially if intend expose this</technical_language>

Target:
boolean canReconnectNow() { return nextReconnectionTime == Long.MIN_VALUE || System.nanoTime() >= nextReconnectionTime; }
Source:
<code>public void testCastOptimization() { assertOptimizedEquals("cast(bound_integer as VARCHAR)", "'1234'"); assertOptimizedEquals("cast(bound_long as VARCHAR)", "'1234'"); assertOptimizedEquals("cast(bound_integer + 1 as VARCHAR)", "'1235'"); assertOptimizedEquals("cast(bound_long + 1 as VARCHAR)", "'1235'"); <START> assertOptimizedEquals("cast(unbound_string as VARCHAR)", "cast(unbound_string as VARCHAR)"); <END> assertOptimizedMatches("cast(unbound_string as VARCHAR)", "unbound_string"); assertOptimizedMatches("cast(unbound_integer as INTEGER)", "unbound_integer"); }</code><technical_language>this rewrite</technical_language>

Target:
public void testCastOptimization() { assertOptimizedEquals("cast(bound_integer as VARCHAR)", "'1234'"); assertOptimizedEquals("cast(bound_long as VARCHAR)", "'1234'"); assertOptimizedEquals("cast(bound_integer + 1 as VARCHAR)", "'1235'"); assertOptimizedEquals("cast(bound_long + 1 as VARCHAR)", "'1235'"); assertOptimizedEquals("cast(unbound_string as VARCHAR)", "cast(unbound_string as VARCHAR)"); assertOptimizedMatches("cast(unbound_string as VARCHAR)", "unbound_string"); assertOptimizedMatches("cast(unbound_integer as INTEGER)", "unbound_integer"); assertOptimizedMatches("cast(unbound_string as VARCHAR(10))", "cast(unbound_string as VARCHAR(10))"); }
Source:
<code>public void cancelRepeatPrompt() { analytics.logEvent(ADD_REPEAT, "InlineDecline"); <START> FormController formController = this.formController; <END> if (jumpBackIndex != null) { formController.jumpToIndex(jumpBackIndex); jumpBackIndex = null; } else { try { this.formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } }</code><technical_language>necessary</technical_language>

Target:
public void cancelRepeatPrompt() { if (formController == null) { return; } analytics.logEvent(ADD_REPEAT, "InlineDecline", formController.getCurrentFormIdentifierHash()); if (jumpBackIndex != null) { formController.jumpToIndex(jumpBackIndex); jumpBackIndex = null; } else { try { this.formController.stepToNextScreenEvent(); } catch (JavaRosaException exception) { error.setValue(exception.getCause().getMessage()); } } }
Source:
<code>public void reset(Site site) { currentAge = 0; cards.clear(); for (FeedClientInterface client : currentScript) { client.cancel(); } currentScript.clear(); cards.clear(); currentScript.add(new BecauseYouReadClient(site)); currentScript.add(new ContinueReadingClient()); <START> getNextCard(); <END> }</code><technical_language>This method easier test if put this sequence starter client. more closely match state construction</technical_language>

Target:
public void reset(Site site) { currentAge = 0; cards.clear(); for (FeedClientInterface client : currentScript) { client.cancel(); } currentScript.clear(); cards.clear(); buildScript(site); getNextCard(); }
Source:
<code>void addExternalEncoding(final DataSeries dataSeries, final EncodingParams params, final ExternalCompressor compressor) { <START> header.externalIds.add(dataSeries.ordinal()); <END> header.externalCompressors.put(dataSeries.ordinal(), compressor); header.encodingMap.put(dataSeries, params); }</code><technical_language>a bit strange dataSeries.ordinal. Do if actual numeric is important for some reason? Is mapping data series integer in cram spec something? sense enum key directly. If integer is important add explicit constructor parameter enum</technical_language>

Target:
private void addExternalEncoding(final DataSeries dataSeries, final EncodingParams params, final ExternalCompressor compressor) { header.externalIds.add(dataSeries.getExternalBlockContentId()); header.externalCompressors.put(dataSeries.getExternalBlockContentId(), compressor); header.encodingMap.put(dataSeries, params); }
Source:
<code>public static TokenEndpointResponse swapJWTForTokens(HttpAccess httpAccessor, URI loginServerUrl, String jwt) throws IOException, URISyntaxException, OAuthFailedException { FormBody.Builder formBodyBuilder = new FormBody.Builder() .add(GRANT_TYPE, JWT_BEARER) .add(ASSERTION, jwt); TokenEndpointResponse tr = makeTokenEndpointRequest(httpAccessor, loginServerUrl, formBodyBuilder); <START> return tr; <END> }</code><technical_language>return directly</technical_language>

Target:
public static TokenEndpointResponse swapJWTForTokens(HttpAccess httpAccessor, URI loginServerUrl, String jwt) throws IOException, URISyntaxException, OAuthFailedException { FormBody.Builder formBodyBuilder = new FormBody.Builder() .add(GRANT_TYPE, JWT_BEARER) .add(ASSERTION, jwt); return makeTokenEndpointRequest(httpAccessor, loginServerUrl, formBodyBuilder); }
Source:
<code>public SimplisticQuadTree getOrCreateSubTree(int x, int y, int zm) { SimplisticQuadTree result = this; while (true) { if (zm <= result.zoom) { return result; } else { result.initChildren(); int nx = (x >> (zm - result.zoom - 1)) - (result.x << 1); int ny = (y >> (zm - result.zoom - 1)) - (result.y << 1); if (nx > 1 || nx < 0 || ny > 1 || ny < 0) { return null; } <START> result = result.children[nx * 2 + ny]; <END> } } }</code><technical_language>this is line is</technical_language>

Target:
public SimplisticQuadTree getOrCreateSubTree(int x, int y, int zm) { if (zm <= zoom) { return this; } else { initChildren(); int nx = (x >> (zm - zoom - 1)) - (this.x << 1); int ny = (y >> (zm - zoom - 1)) - (this.y << 1); if (nx > 1 || nx < 0 || ny > 1 || ny < 0) { return null; } return children[nx * 2 + ny].getOrCreateSubTree(x, y, zm); } }
Source:
<code>public void testOrder() { assertEquals(0, MethodMatchEnum.NONE.ordinal()); assertEquals(1, MethodMatchEnum.APPROXIMATE.ordinal()); <START> assertEquals(2, MethodMatchEnum.PERFECT.ordinal()); <END> }</code><technical_language>Is EXACT more descriptive PERFECT</technical_language>

Target:
public void testOrder() { assertEquals(0, MethodMatchEnum.NONE.ordinal()); assertEquals(1, MethodMatchEnum.APPROXIMATE.ordinal()); assertEquals(2, MethodMatchEnum.EXACT.ordinal()); }
Source:
<code><START> public int read(int offset, int[] positions, int positionCount) throws IOException <END> { checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (!rowGroupOpen) { openRowGroup(); } allNulls = false; if (outputRequired) { ensureValuesCapacity(positionCount, nullsAllowed && presentStream != null); } if (filter != null) { ensureOutputPositionsCapacity(positionCount); } else { outputPositions = positions; } systemMemoryContext.setBytes(getRetainedSizeInBytes()); if (readOffset < offset) { skip(offset - readOffset); } int streamPosition = 0; if (dataStream == null && presentStream != null) { streamPosition = readAllNulls(positions, positionCount); } else if (filter == null) { streamPosition = readNoFilter(positions, positionCount); } else { outputPositionCount = 0; for (int i = 0; i < positionCount; i++) { int position = positions[i]; if (position > streamPosition) { skip(position - streamPosition); streamPosition = position; } if (presentStream != null && !presentStream.nextBit()) { if (nullsAllowed) { if (outputRequired) { nulls[outputPositionCount] = true; } outputPositions[outputPositionCount] = position; outputPositionCount++; } } else { byte value = dataStream.next(); if (filter.testLong(value)) { if (outputRequired) { values[outputPositionCount] = value; if (nullsAllowed && presentStream != null) { nulls[outputPositionCount] = false; } } outputPositions[outputPositionCount] = position; outputPositionCount++; } } streamPosition++; } } readOffset = offset + streamPosition; return outputPositionCount; }</code><technical_language>throws IOException new line</technical_language>

Target:
public int read(int offset, int[] positions, int positionCount) throws IOException { checkState(!valuesInUse, "BlockLease hasn't been closed yet"); if (!rowGroupOpen) { openRowGroup(); } allNulls = false; if (outputRequired) { ensureValuesCapacity(positionCount, nullsAllowed && presentStream != null); } if (filter != null) { ensureOutputPositionsCapacity(positionCount); } else { outputPositions = positions; } systemMemoryContext.setBytes(getRetainedSizeInBytes()); if (readOffset < offset) { skip(offset - readOffset); } int streamPosition = 0; if (dataStream == null && presentStream != null) { streamPosition = readAllNulls(positions, positionCount); } else if (filter == null) { streamPosition = readNoFilter(positions, positionCount); } else { streamPosition = readWithFilter(positions, positionCount); } readOffset = offset + streamPosition; return outputPositionCount; }
Source:
<code>public void registerSettingListeners(Object o) { for(Method m : o.getClass().getMethods()) { <START> for(Annotation a : m.getAnnotations()) { <END> if( a instanceof SettingListener ) { Setting s = ((SettingListener) a).setting(); settingListeners.get(s).add(Pair.of(o,m)); try { m.invoke(o, getSettingValue(s)); } catch (IllegalAccessException ex) { Exceptions.printStackTrace(ex); } catch (IllegalArgumentException ex) { Exceptions.printStackTrace(ex); } catch (InvocationTargetException ex) { Exceptions.printStackTrace(ex); } break; } } } }</code><technical_language>Method exposes "getAnnotation(Class<T>)", allows annotation wish retrieve. This simplify a lot in this method</technical_language>

Target:
public void registerSettingListeners(Object o) { for(Method m : o.getClass().getMethods()) { for(Annotation a : m.getAnnotationsByType( SettingListener.class )) { Setting s = ((SettingListener) a).setting(); settingListeners.get(s).add(Pair.of(o,m)); try { m.invoke(o, s.getValue()); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { Exceptions.printStackTrace(ex); } break; } } }
Source:
<code>private void setNumaInfoMsg(String message) { if (message == null) { message = ""; } <START> numaInfoIcon.setText(SafeHtmlUtils.fromTrustedString(message)); <END> }</code><technical_language>italic text for info icons this: numaInfoIcon.setText(applicationTemplates.italicText(message));</technical_language>

Target:
private void setNumaInfoMsg(String message) { if (message == null) { message = ""; } numaInfoIcon.setText(applicationTemplates.italicText(message)); }
Source:
<code>public VariantContextBuilder filter(final String filter) { makeFiltersModifiable(); if ( this.filters == null ) { <START> filtersAsIs(new LinkedHashSet<>(1)); <END> } this.filters.add(filter); return this; }</code><technical_language>this done makeFiltersModifiable()</technical_language>

Target:
public VariantContextBuilder filter(final String filter) { makeFiltersModifiable(); this.filters.add(filter); return this; }
Source:
<code>private void readCentralDirectoryFileHeaders(ZipFileData fileData, DataInputSource dataInputSource, long fileOffset, Charset charset, long count) throws IOException { try { long position = fileOffset; <START> for (long i = 0; i < count; ++i) { <END> position += CentralDirectoryFileHeader.read(fileData, dataInputSource, position, charset); } } catch (ZipException e) { throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e); } }</code><technical_language>i++</technical_language>

Target:
private void readCentralDirectoryFileHeaders(ZipFileData fileData, DataInputSource dataInputSource, long fileOffset, Charset charset, long count) throws IOException { try { long position = fileOffset; for (long i = 0; i < count; i++) { position += CentralDirectoryFileHeader.read(fileData, dataInputSource, position, charset); } } catch (ZipException e) { throw new PrestoException(DRUID_SEGMENT_LOAD_ERROR, e); } }
Source:
<code>public static GitInfo readGitProperties(final String fileName) { final Properties properties = new Properties(); <START> LOGGER.info("Retrieving git properties"); <END> try { properties.load(GitInfo.class.getClassLoader().getResourceAsStream(fileName)); return new GitInfo(String.valueOf(properties.get("git.commit.id.abbrev")), String.valueOf(properties.get("git.build.version"))); } catch (Exception e) { LOGGER.error("Could not load git.properties", e); String propertyNotFound = "git property not found"; return new GitInfo(propertyNotFound, propertyNotFound); } }</code><technical_language>debug (its a judgement call, for this message shown do telling ... trace)</technical_language>

Target:
public static GitInfo readGitProperties(final String fileName) { final Properties properties = new Properties(); LOGGER.debug("Retrieving git properties from file: " + fileName); try { properties.load(GitInfo.class.getClassLoader().getResourceAsStream(fileName)); return new GitInfo(String.valueOf(properties.get("git.commit.id.abbrev")), String.valueOf(properties.get("git.build.version"))); } catch (Exception e) { LOGGER.error("Could not load git.properties", e); String propertyNotFound = "git property not found"; return new GitInfo(propertyNotFound, propertyNotFound); } }