auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean hasNext() { init(); if (jp.isClosed()) { return false; } <START> if (jp.getCurrentToken() == JsonToken.END_ARRAY) { <END> CloseQuietly.close(jp); return false; } return true; }</code><technical_language>this iterator is supposed read array of JSONs. Then, I checked token is a JsonToken.START_ARRAY</technical_language>

Target:
public boolean hasNext() { if (jp.isClosed()) { return false; } if (jp.getCurrentToken() == JsonToken.END_ARRAY) { CloseQuietly.close(jp); return false; } return true; }
Source:
<code>public Response toResponse(ServiceException exception) { log.info("Error handling request {}", exception.getErrorId(), exception); int status = exception.getStatus(); Response.ResponseBuilder builder = Response.status(status); try { SerializableError error = exception.getError(); builder.type(MediaType.APPLICATION_JSON); String json = MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", exception.getErrorId(), e); <START> builder = Response.status(status); <END> builder.type(MediaType.TEXT_PLAIN); builder.entity("Refer to the server logs with this errorId: " + exception.getErrorId()); } return builder.build(); }</code><technical_language>flow is a weird here. build a separate Response in try catch</technical_language>

Target:
public Response toResponse(ServiceException exception) { log.error("Error handling request {}", exception.getErrorId(), exception); try { SerializableError error = exception.getError(); String json = MAPPER.writeValueAsString(error); return Response.status(exception.getStatus()) .type(MediaType.APPLICATION_JSON) .entity(json) .build(); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", exception.getErrorId(), e); return Response.status(exception.getStatus()) .type(MediaType.TEXT_PLAIN) .entity("Refer to the server logs with this errorId: " + exception.getErrorId()) .build(); } }
Source:
<code>public void setPodTemplateName(String podTemplateName) { this.podTemplateName = podTemplateName; <START> if (!StringUtils.isEmpty(podTemplateName)) { <END> String cloudName = getCloud(); if (StringUtils.isEmpty(cloudName)) { cloudName = "kubernetes"; } Cloud cloud = Jenkins.getInstance().getCloud(cloudName); if (cloud instanceof KubernetesCloud) { KubernetesCloud kubernetesCloud = (KubernetesCloud) cloud; List<PodTemplate> templates = kubernetesCloud.getTemplates(); PodTemplate template = null; for (PodTemplate t : templates) { String name = t.getName(); if (podTemplateName.equals(name)) { template = t; break; } } if (template != null) { setPodTemplate(template); } } } }</code><technical_language>a null this.podTemplateName = Util.fixEmpty(podTemplateName) if ( this.podTemplateName != null ) {</technical_language>

Target:
public void setPodTemplateName(String podTemplateName) { this.podTemplateName = Util.fixEmpty(podTemplateName); if (podTemplateName != null) { String cloudName = getCloud(); if (StringUtils.isEmpty(cloudName)) { cloudName = KubernetesCloud.DEFAULT_CLOUD_NAME; } Cloud cloud = Jenkins.getInstance().getCloud(cloudName); if (cloud instanceof KubernetesCloud) { KubernetesCloud kubernetesCloud = (KubernetesCloud) cloud; List<PodTemplate> templates = kubernetesCloud.getTemplates(); PodTemplate template = null; for (PodTemplate t : templates) { String name = t.getName(); if (podTemplateName.equals(name)) { template = t; break; } } if (template != null) { setPodTemplate(template); } else { LOGGER.warning("Could not find a PodTemplate called " + podTemplateName + " in the cloud " + cloudName + " so cannot default the PodTemplate"); } } } }
Source:
<code>protected Object[] queryIndividualResourcesToExport(IAdaptable rootResource) { ResourceSelectionDialog dialog = new ResourceSelectionDialog( getContainer().getShell(), rootResource, IDEWorkbenchMessages.WizardExportPage_selectResourcesTitle); <START> dialog.setInitialSelections(selectedResources); <END> dialog.open(); return dialog.getResult(); }</code><technical_language>This setInitialElementSelections IMHO</technical_language>

Target:
protected Object[] queryIndividualResourcesToExport(IAdaptable rootResource) { ResourceSelectionDialog dialog = new ResourceSelectionDialog( getContainer().getShell(), rootResource, IDEWorkbenchMessages.WizardExportPage_selectResourcesTitle); dialog.setInitialElementSelections(selectedResources); dialog.open(); return dialog.getResult(); }
Source:
<code>public DeleteRepresentationAction(Collection<DRepresentation> representations) { super("Delete", AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/delete.gif")); this.selectedRepresentations = Collections2.filter(representations, new Predicate<DRepresentation>() { @Override public boolean apply(DRepresentation input) { EObject container = input.eContainer(); if (container instanceof DRepresentationContainer) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority != null && <START> !permissionAuthority.canCreateIn(container)) { <END> return false; } } return true; } }); if (this.selectedRepresentations.isEmpty()) { this.setEnabled(false); } }</code><technical_language>call a canDeleteInstance(input)</technical_language>

Target:
public DeleteRepresentationAction(Collection<DRepresentation> representations) { super("Delete", AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/delete.gif")); this.selectedRepresentations = Collections2.filter(representations, new Predicate<DRepresentation>() { @Override public boolean apply(DRepresentation input) { EObject container = input.eContainer(); if (container instanceof DRepresentationContainer) { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority != null && !permissionAuthority.canDeleteInstance(container)) { return false; } } return true; } }); if (this.selectedRepresentations.isEmpty()) { this.setEnabled(false); } }
Source:
<code>public static void main(String[] args) { <START> for(int i =0; i<5; i++) { <END> rowMergerPerf(createResponses(1)); } for (int i = 1; i <= 101; i += 10) { System.out.println("==================="); System.out.println("using " + i + " Cells"); rowMergerPerf(createResponses(i)); } }</code><technical_language>Minor: tweak spacing here? i = 0; i < 5; i++</technical_language>

Target:
public static void main(String[] args) { for (int i = 0; i < 5; i++) { rowMergerPerf(createResponses(1)); } for (int i = 5; i <= 100; i += 10) { System.out.println("==================="); System.out.println("using " + i + " Cells"); rowMergerPerf(createResponses(i)); } }
Source:
<code>private List<Machine> getMachines() { <START> List<Machine> machines = new ArrayList<>(); <END> Workspace workspace = appContext.getWorkspace(); if (workspace == null || workspace.getRuntime() == null) { return machines; } for (Machine currentMachine : workspace.getRuntime().getMachines()) { if (currentMachine instanceof MachineDto) { Machine machine = entityFactory.createMachine((MachineDto)currentMachine); machines.add(machine); } } return machines; }</code><technical_language>account final size of a list dynamically add items benefit of LinkedList. a real performance impact I recommend consider case for production code</technical_language>

Target:
private List<Machine> getMachines() { Workspace workspace = appContext.getWorkspace(); if (workspace == null || workspace.getRuntime() == null) { return emptyList(); } List<? extends Machine> runtimeMachines = workspace.getRuntime().getMachines(); List<Machine> machines = new ArrayList<>(runtimeMachines.size()); for (Machine currentMachine : runtimeMachines) { if (currentMachine instanceof MachineDto) { Machine machine = entityFactory.createMachine((MachineDto)currentMachine); machines.add(machine); } } return machines; }
Source:
<code>private void ensureWritableBytes(int minWritableBytes) { <START> assert slice.length() <= maxBufferSize; <END> int neededBufferSize = bufferPosition + minWritableBytes; if (neededBufferSize <= slice.length()) { return; } if (slice.length() == maxBufferSize) { flushBufferToOutputStream(); return; } int newBufferSize = min(max(slice.length() * 2, minWritableBytes), maxBufferSize); if (neededBufferSize <= newBufferSize) { byte[] previousBuffer = buffer; buffer = new byte[newBufferSize]; slice = wrappedBuffer(buffer); System.arraycopy(previousBuffer, 0, buffer, 0, bufferPosition); } else { flushBufferToOutputStream(); buffer = new byte[newBufferSize]; slice = wrappedBuffer(buffer); assert bufferPosition == 0; assert minWritableBytes <= slice.length(); } }</code><technical_language>In opinion this assert minWritableBytes <= maxBufferSize . sliceLength <= maxBufferSize verified in writeChunkToOutputStream</technical_language>

Target:
private void ensureWritableBytes(int minWritableBytes) { checkArgument(minWritableBytes <= maxBufferSize, "Min writable bytes must not exceed max buffer size"); int neededBufferSize = bufferPosition + minWritableBytes; if (neededBufferSize <= slice.length()) { return; } if (slice.length() >= maxBufferSize) { flushBufferToOutputStream(); return; } int newBufferSize = min(max(slice.length() * 2, minWritableBytes), maxBufferSize); if (neededBufferSize <= newBufferSize) { byte[] previousBuffer = buffer; buffer = new byte[newBufferSize]; slice = wrappedBuffer(buffer); System.arraycopy(previousBuffer, 0, buffer, 0, bufferPosition); } else { flushBufferToOutputStream(); buffer = new byte[newBufferSize]; slice = wrappedBuffer(buffer); } }
Source:
<code>public Map<String, String> parse(String input) { final Map<String, Object> inner = delegate.parse(input); final String k = Preconditions.checkNotNull( inner.get(key), "Key column [%s] missing data in line [%s]", key, input ).toString(); final Object val = inner.get(value); if (val == null) { <START> return null; <END> } return ImmutableMap.of(k, val.toString()); }</code><technical_language>do for empty string</technical_language>

Target:
public Map<String, String> parse(String input) { final Map<String, Object> inner = delegate.parse(input); final String k = Preconditions.checkNotNull( inner.get(key), "Key column [%s] missing data in line [%s]", key, input ).toString(); final Object val = inner.get(value); if (val == null) { return ImmutableMap.of(); } return ImmutableMap.of(k, val.toString()); }
Source:
<code>public void setUp() { this.client = DatabaseClientFactory.newClient( <START> "localhost", 8011, new DatabaseClientFactory.DigestAuthContext("rest-admin", "x") <END> ); }</code><technical_language>Gradle task initialize Java unit test appserver port 8012</technical_language>

Target:
public void setUp() { this.client = DatabaseClientFactory.newClient( "localhost", 8012, new DatabaseClientFactory.DigestAuthContext("rest-admin", "x") ); }
Source:
<code>protected void setupTypeNameAndVersion(final FBNetworkElement model, Figure container) { container.add(middle, BorderLayout.CENTER); middle.setCornerDimensions(new Dimension()); GridLayout middleLayout = new GridLayout(1, true); middleLayout.marginHeight = 2; middleLayout.verticalSpacing = 1; middle.setLayoutManager(middleLayout); LibraryElement type = model.getType(); String typeName = (null != type) ? type.getName() : Messages.FBFigure_TYPE_NOT_SET; typeLabel = new <START> UnderlineAlphaLabel(typeName != null ? <END> typeName : Messages.FBFigure_NOT_DEFINED_Text); typeLabel.setTextAlignment(PositionConstants.CENTER); typeLabel.setOpaque(false); middle.add(typeLabel); middle.setConstraint(typeLabel, new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); setupMouseListener(editPart); }</code><technical_language>constant LHS</technical_language>

Target:
protected void setupTypeNameAndVersion(final FBNetworkElement model, Figure container) { container.add(middle, BorderLayout.CENTER); middle.setCornerDimensions(new Dimension()); GridLayout middleLayout = new GridLayout(1, true); middleLayout.marginHeight = 2; middleLayout.verticalSpacing = 1; middle.setLayoutManager(middleLayout); LibraryElement type = model.getType(); String typeName = (null != type) ? type.getName() : Messages.FBFigure_TYPE_NOT_SET; typeLabel = new UnderlineAlphaLabel(null != typeName ? typeName : Messages.FBFigure_NOT_DEFINED_Text); typeLabel.setTextAlignment(PositionConstants.CENTER); typeLabel.setOpaque(false); middle.add(typeLabel); middle.setConstraint(typeLabel, new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); setupMouseListener(editPart); }
Source:
<code>public MafEntry(String entry) { String fields = entry.split("\\s+"); <START> if (fields.length != 7) throw new RuntimeException(entry); <END> if (! fields[0].equals("s")) throw new RuntimeException(entry); src = fields[1]; start0 = Integer.parseInt(fields[2]); size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException(entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }</code><technical_language>bit more descriptive exception</technical_language>

Target:
public MafEntry(String entry) { String fields = entry.split("\\s+"); if (fields.length != 7) throw new RuntimeException("Unexpected MAF line: "+entry); if (! fields[0].equals("s")) throw new RuntimeException("Unexpected MAF line: "+entry); src = fields[1]; start0 = Integer.parseInt(fields[2]); size = Integer.parseInt(fields[3]); strand = fields[4].equals("+"); if (! strand && !fields[4].equals("-") ) throw new RuntimeException("Unexpected MAF line: "+entry); srcSize = Integer.parseInt(fields[5]); text = fields[6]; }
Source:
<code>default String getFileName(){ <START> return new File(getUrl().getPath()).getName(); <END> }</code><technical_language>I a need for constructing a File object path URL here, split</technical_language>

Target:
default String getFileName() { String path = getUrl().getPath(); int end = path.lastIndexOf('/'); if (end < 0) { return path; } else { return path.substring(end + 1); } }
Source:
<code>public void testGetAnalysisModules() { Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(); assertTrue(modules.size() >= 3); <START> IAnalysisModule module = modules.get("org.eclipse.linuxtools.tmf.core.tests.analysis.test2"); <END> assertTrue(module.isAutomatic()); module = modules.get("org.eclipse.linuxtools.tmf.core.tests.analysis.test"); assertFalse(module.isAutomatic()); }</code><technical_language>paths constants (MODULE1, MODULE2, etc.) re-used</technical_language>

Target:
public void testGetAnalysisModules() { Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(); assertTrue(modules.size() >= 3); IAnalysisModule module = modules.get(MODULE_PARAM_DEFAULT); assertTrue(module.isAutomatic()); module = modules.get(MODULE_PARAM); assertFalse(module.isAutomatic()); }
Source:
<code>public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { this.startOutput(); for (Result result : results) { for (String resultString : resultParser(result)) { if (isDebugEnabled()) <START> System.out.println(resultString); <END> this.sendOutput(resultString); } } this.finishOutput(); }</code><technical_language>a logger call a call System.out</technical_language>

Target:
public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { this.startOutput(); for (Result result : results) { for (String resultString : resultParser(result)) { if (isDebugEnabled()) log.debug("TCollectorUDP Message: {}", resultString); this.sendOutput(resultString); } } this.finishOutput(); }
Source:
<code>public static int portFromTaskId(String taskId) { String[] parts = taskId.trim().split("-"); if (parts.length < 3) { throw new IllegalArgumentException("TaskID " + taskId.trim() + " is invalid. " + "Number of dash-delimited components (" + parts.length + ") is less than expected. " + <START> "Expected format is HOSTNAME-PORT-TIMESTAMP"); <END> } String portString = parts[parts.length - 2]; int port; try { port = Integer.parseInt(portString); } catch (NumberFormatException e) { LOG.error("Failed to parse string (" + portString + ") that was supposed to contain a port."); throw e; } if (port < 0 || port > 0xFFFF) { throw new IllegalArgumentException(port + " is not a valid port number"); } return port; }</code><technical_language>do deal compatibility - Like, do deal running supervisors older version of supervisorIds</technical_language>

Target:
public static int portFromTaskId(String taskId) { String[] parts = taskId.trim().split("-"); if (parts.length < 3) { throw new IllegalArgumentException(String.format("TaskID %s is invalid. " + "Number of dash-delimited components (%d) is less than expected. " + "Expected format is HOSTNAME-PORT-TIMESTAMP", taskId.trim(), parts.length)); } String portString = parts[parts.length - 2]; int port; try { port = Integer.parseInt(portString); } catch (NumberFormatException e) { LOG.error(String.format("Failed to parse string (%s) that was supposed to contain a port.", portString)); throw e; } if (port < 0 || port > 0xFFFF) { throw new IllegalArgumentException(String.format("%d is not a valid port number.", port)); } return port; }
Source:
<code>public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { if (ownsLaunchConfiguration(configuration)) { <START> if (configuration.isWorkingCopy()) <END> return true; launchConfigurationRemoved(configuration); return addLaunchConfiguration(configuration); } else if (ownedConfigs.contains(configuration)) { ILaunchBarManager manager = getManager(); manager.launchConfigurationRemoved(configuration); manager.launchConfigurationAdded(configuration); return true; } else { return false; } }</code><technical_language>this check top of this method. ignore working copies time</technical_language>

Target:
public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { if (ownsLaunchConfiguration(configuration)) { launchConfigurationRemoved(configuration); return addLaunchConfiguration(configuration); } else if (ownedConfigs.contains(configuration)) { ILaunchBarManager manager = getManager(); manager.launchConfigurationRemoved(configuration); manager.launchConfigurationAdded(configuration); return true; } else { return false; } }
Source:
<code>private byte[] getRenderedBlob() { try { writeDictionary(); } catch (IOException e) { throw new RuntimeException(e); } <START> try { <END> dictionaryDos.close(); metricDos.close(); } catch (IOException e) { throw new RuntimeException(e); } byte[] dictionaryBytes = dictionaryBaos.toByteArray(); byte[] metricsBytes = metricBaos.toByteArray(); int completeSize = SIZE_VERSION + SIZE_DICTIONARY_BLOB + dictionaryBytes.length + metricsBytes.length; ByteArrayOutputStream baos = new ByteArrayOutputStream(completeSize); DataOutputStream dos = new DataOutputStream(baos); try { dos.write((BINARY_FORMAT_VERSION >>> BITS_IN_BYTE) & BYTE_MASK); dos.write(BINARY_FORMAT_VERSION & BYTE_MASK); dos.writeInt(dictionaryBytes.length); dos.write(dictionaryBytes); dos.write(metricsBytes); dos.close(); } catch (IOException e) { throw new RuntimeException(e); } return baos.toByteArray(); }</code><technical_language>merge this try/catch block above</technical_language>

Target:
private byte[] getRenderedBlob() { try { writeDictionary(); dictionaryDos.close(); metricDos.close(); } catch (IOException e) { throw new RuntimeException(e); } byte[] dictionaryBytes = dictionaryBaos.toByteArray(); byte[] metricsBytes = metricBaos.toByteArray(); int completeSize = SIZE_VERSION + SIZE_DICTIONARY_BLOB + dictionaryBytes.length + metricsBytes.length; ByteArrayOutputStream baos = new ByteArrayOutputStream(completeSize); DataOutputStream dos = new DataOutputStream(baos); try { dos.write((BINARY_FORMAT_VERSION >>> BITS_IN_BYTE) & BYTE_MASK); dos.write(BINARY_FORMAT_VERSION & BYTE_MASK); dos.writeInt(dictionaryBytes.length); dos.write(dictionaryBytes); dos.write(metricsBytes); dos.close(); } catch (IOException e) { throw new RuntimeException(e); } return baos.toByteArray(); }
Source:
<code>public AdsBaseObject verifySlotAttribute(String slotName, String attribute, String value) { String slotParam = getSlotAttribute(slotName, attribute); Assertion.assertStringContains(slotParam, value); PageObjectLogging <START> .log("verifySlotAttribute", slotName + " has following ['" + attribute + "'] attribute: " + slotParam, true); <END> return this; }</code><technical_language>Try String.format() function, cleaner concatenation</technical_language>

Target:
public AdsBaseObject verifySlotAttribute(String slotName, String attribute, String value) { String slotParam = getSlotAttribute(slotName, attribute); Assertion.assertStringContains(slotParam, value); PageObjectLogging .log("verifySlotAttribute", String.format("%s has following [%s] attribute: %s", slotName, attribute, slotParam), true); return this; }
Source:
<code>protected List<Page> getResultForQueryAndCache(final CriteriaQuery<Page> criteriaQuery) { TypedQuery<Page> q = em.createQuery(criteriaQuery); q.setHint(QueryHints.HINT_CACHEABLE, true); q.setHint(QueryHints.HINT_CACHE_REGION, "query.Cms"); try { return q.getResultList(); } catch (NoResultException | EntityNotFoundException e) { <START> return new ArrayList<>(); <END> } }</code><technical_language>Collections.EMPTY_LIST</technical_language>

Target:
protected List<Page> getResultForQueryAndCache(final CriteriaQuery<Page> criteriaQuery) { TypedQuery<Page> q = em.createQuery(criteriaQuery); q.setHint(QueryHints.HINT_CACHEABLE, true); q.setHint(QueryHints.HINT_CACHE_REGION, "query.Cms"); try { return q.getResultList(); } catch (NoResultException | EntityNotFoundException e) { return Collections.emptyList(); } }
Source:
<code>private void attemptAddRoutes() { LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { RouteBuilder routeBuilder = createRouteBuilder(); verifyContentCamelComponentIsAvailable("content"); <START> verifyContentCamelComponentIsAvailable("catalog"); <END> camelContext.addRoutes(routeBuilder); setRouteCollection(routeBuilder); } catch (Exception e) { LOGGER.info("Unable to configure Camel route.", e); INGEST_LOGGER.warn("Unable to configure Camel route.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } }</code><technical_language>this method for components call "verifyCamelComponentIsAvailable()" instead of "verifyContentCamelComponentIsAvailable()"</technical_language>

Target:
private void attemptAddRoutes() { LOGGER.trace( "Attempting to add routes for content directory monitor watching {}", monitoredDirectory); try { RouteBuilder routeBuilder = createRouteBuilder(); verifyCamelComponentIsAvailable("content"); verifyCamelComponentIsAvailable("catalog"); camelContext.addRoutes(routeBuilder); setRouteCollection(routeBuilder); } catch (Exception e) { LOGGER.info("Unable to configure Camel route.", e); INGEST_LOGGER.warn("Unable to configure Camel route.", e); } finally { if (LOGGER.isDebugEnabled()) { dumpCamelContext("after attemptAddRoutes()"); } } }
Source:
<code>public void addTurnInfo(int fromEdge, int viaNode, int toEdge, long turnFlags) { if (turnFlags == EMPTY_FLAGS) { return; } BiFunction<Long, Long, Long> overwriteFunc = (oldFlags, newFlags) -> { return newFlags; <START> }; <END> setAndMergeTurnInfo(fromEdge, viaNode, toEdge, turnFlags, overwriteFunc); }</code><technical_language>avoid creating this function method call</technical_language>

Target:
public void addTurnInfo(int fromEdge, int viaNode, int toEdge, long turnFlags) { setAndMergeTurnInfo(fromEdge, viaNode, toEdge, turnFlags, false, false); }
Source:
<code>public void preferenceChange(PreferenceChangeEvent event) { if (LOG_LEVEL_KEY.equals(event.getKey())) { loggingLevel = Level.toLevel((String)event.getNewValue()); LOGGER.setLevel(loggingLevel); } else if (LOG_FILENAME_KEY.equals(event.getKey())) { path = (String)event.getNewValue(); } else if (LOG_BACKUP_COUNT_KEY.equals(event.getKey())) { RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); if (appender != null) { appender.setMaxBackupIndex(Integer.parseInt((String)event.getNewValue())); } } else if (LOG_FILE_MAX_SIZE_KEY.equals(event.getKey())) { RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); if (appender != null) { appender.setMaximumFileSize(Integer.parseInt((String)event.getNewValue()) * MEGABYTE); } } <START> if (loggingLevel != null && !Level.OFF.equals(loggingLevel) && path != null) { <END> initFile(); } }</code><technical_language>check is a property for path, of path. fine apparently</technical_language>

Target:
public void preferenceChange(PreferenceChangeEvent event) { IEclipsePreferences prefs = instanceScope.getNode(EMFCompareRCPPlugin.PLUGIN_ID); path = prefs.get(LOG_FILENAME_KEY, ""); if (LOG_LEVEL_KEY.equals(event.getKey())) { loggingLevel = Level.toLevel((String)event.getNewValue()); LOGGER.setLevel(loggingLevel); } else if (LOG_FILENAME_KEY.equals(event.getKey())) { path = (String)event.getNewValue(); } else if (LOG_BACKUP_COUNT_KEY.equals(event.getKey())) { RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); if (appender != null) { appender.setMaxBackupIndex(Integer.parseInt((String)event.getNewValue())); } } else if (LOG_FILE_MAX_SIZE_KEY.equals(event.getKey())) { RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); if (appender != null) { appender.setMaximumFileSize(Integer.parseInt((String)event.getNewValue()) * MEGABYTE); } } if (loggingLevel != null && !Level.OFF.equals(loggingLevel) && path != null && path.length() > 0) { initFile(); } }
Source:
<code>private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), <START> principalName, true, true); <END> if (principalRecord == null) { throw new RuntimeException(String.format("Unable to find principal %s in domain '%s'", principalName, authzName)); } return new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); }</code><technical_language>do resolve groups recursive search anyway</technical_language>

Target:
private DbUser getDbUserForPrincipalName(String principalName, String authzName) { ExtMap principalRecord = AuthzUtils.fetchPrincipalRecord( EngineExtensionsManager.getInstance().getExtensionByName(authzName), principalName, false, false); if (principalRecord == null) { throw new RuntimeException(String.format("Unable to find principal %s in domain '%s'", principalName, authzName)); } return new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); }
Source:
<code>public void testInvertSortKey() { assertEquals("ffffffffffffffff", ChangeUtil.invertSortKey( "0000000000000000").toLowerCase()); assertEquals("0000000000000001", ChangeUtil .invertSortKey("FFFFFFFFFFFFFFFE")); assertEquals("0001600000000000", ChangeUtil .invertSortKey("FFFE9FFFFFFFFFFF")); assertEquals("/", ChangeUtil.invertSortKey("z")); <START> assertEquals("z", ChangeUtil.invertSortKey("/").toLowerCase()); <END> }</code><technical_language>do need .toLowerCase here? a bug in inverse of '/'</technical_language>

Target:
public void testInvertSortKey() { assertEquals("ffffffffffffffff", ChangeUtil.invertSortKey( "0000000000000000").toLowerCase()); assertEquals("0000000000000001", ChangeUtil .invertSortKey("FFFFFFFFFFFFFFFE")); assertEquals("0001600000000000", ChangeUtil .invertSortKey("FFFE9FFFFFFFFFFF")); assertEquals("/", ChangeUtil.invertSortKey("z")); assertEquals("z", ChangeUtil.invertSortKey("/")); }
Source:
<code>public List<storage_pool> getAllByStatus(StoragePoolStatus status) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("status", status.getValue()); ParameterizedRowMapper<storage_pool> mapper = new ParameterizedRowMapper<storage_pool>() { @Override public storage_pool mapRow(ResultSet rs, int rowNum) throws SQLException { storage_pool entity = new storage_pool(); entity.setdescription(rs.getString("description")); entity.setId(Guid.createGuidFromString(rs.getString("id"))); entity.setname(rs.getString("name")); entity.setstorage_pool_type(StorageType.forValue(rs .getInt("storage_pool_type"))); entity.setstatus(StoragePoolStatus.forValue(rs.getInt("status"))); entity.setmaster_domain_version(rs .getInt("master_domain_version")); entity.setspm_vds_id(NGuid.createGuidFromString(rs .getString("spm_vds_id"))); entity.setcompatibility_version(new Version(rs .getString("compatibility_version"))); entity.setQuotaEnforcementType(QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type"))); entity.setStoragePoolFormatType(getStorageFormatTypeForPool(rs)); return entity; } }; <START> return getCallsHandler().executeReadList("GetAllByStatus", mapper, parameterSource); <END> }</code><technical_language>Please create a cleanup patch extract mapper a static instance <LINK_0> stack this patch</technical_language>

Target:
public List<storage_pool> getAllByStatus(StoragePoolStatus status) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("status", status.getValue()); return getCallsHandler().executeReadList("GetAllByStatus", mapper, parameterSource); }
Source:
<code>public void testBundledImageStyleCustomizationWithError() { try { openErrorLogViewByAPI(); SWTBot errorLogBot = bot.viewByTitle("Error Log").bot(); String error1 = <START> "Extension Id 'sample.design.donut2' denote a stroke <END> attribute but none attribute value is specified."; assertNotNull("Error \'" + error1 + "\' should be detected.", errorLogBot.tree().getTreeItem(error1)); String error2 = "Extension Id 'sample.design.donut2' denote a stop-color attribute but none attribute value is specified."; assertNotNull("Error \'" + error1 + "\' should be detected.", errorLogBot.tree().getTreeItem(error2)); } finally { SWTBotView errorView = bot.viewByTitle("Error Log"); if (errorView.isActive()) { errorView.close(); } bot.viewByTitle(PROPERTIES).setFocus(); } }</code><technical_language>change if change warning message</technical_language>

Target:
public void testBundledImageStyleCustomizationWithError() { try { openErrorLogViewByAPI(); SWTBot errorLogBot = bot.viewByTitle("Error Log").bot(); String error1 = "The org.eclipse.sirius.diagram.bundledImageShape extension of id 'sample.design.donut2' should have the colorAttribute attribute with a value."; assertNotNull("Error \'" + error1 + "\' should be detected.", errorLogBot.tree().getTreeItem(error1)); String error2 = "The org.eclipse.sirius.diagram.bundledImageShape extension of id 'sample.design.donut2' should have the borderColorAttribute attribute with a value."; assertNotNull("Error \'" + error1 + "\' should be detected.", errorLogBot.tree().getTreeItem(error2)); } finally { SWTBotView errorView = bot.viewByTitle("Error Log"); if (errorView.isActive()) { errorView.close(); } bot.viewByTitle(PROPERTIES).setFocus(); } }
Source:
<code>public int hashCode() { <START> return Objects.hash(replicaSet); <END> }</code><technical_language>varargs version</technical_language>

Target:
public int hashCode() { return replicaSet.hashCode(); }
Source:
<code><START> public AsyncJSON(Factory factory) <END> { this.factory = factory; this.stringBuilder = new Utf8StringBuilder(32); this.numberBuilder = new NumberBuilder(); }</code><technical_language>this constructor package-private</technical_language>

Target:
public AsyncJSON(Factory factory) { this.factory = factory; }
Source:
<code>public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); byte flag; switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; case BLOB_ID_V4: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; case BLOB_ID_V5: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; <START> if (blobDataType != null) { <END> flag |= (blobDataType.ordinal() << BLOB_DATA_TYPE_SHIFT); } idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }</code><technical_language>null in version 5</technical_language>

Target:
public byte[] toBytes() { ByteBuffer idBuf = ByteBuffer.allocate(sizeInBytes()); idBuf.putShort(version); byte flag; switch (version) { case BLOB_ID_V1: break; case BLOB_ID_V2: case BLOB_ID_V3: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; case BLOB_ID_V4: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; case BLOB_ID_V5: flag = (byte) (type.ordinal() & BLOB_ID_TYPE_MASK); flag |= isEncrypted ? IS_ENCRYPTED_MASK : 0; flag |= (blobDataType.ordinal() << BLOB_DATA_TYPE_SHIFT); idBuf.put(flag); idBuf.put(datacenterId); idBuf.putShort(accountId); idBuf.putShort(containerId); break; default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } idBuf.put(partitionId.getBytes()); idBuf.putInt(uuid.getBytes().length); idBuf.put(uuid.getBytes()); return idBuf.array(); }
Source:
<code>public Response updateConnection( DatabaseConnection connection ) throws ConnectionServiceException { <START> new UtilHtmlSanitizer().sanitizeConnectionParameters( connection ); <END> try { applySavedPassword( connection ); boolean success = connectionService.updateConnection( connection ); if ( success ) { return Response.ok().build(); } else { return Response.notModified().build(); } } catch ( Throwable t ) { t.printStackTrace(); return Response.serverError().build(); } }</code><technical_language>@YuryBY, instantiating sanitizer once, ConnectionService is initialized</technical_language>

Target:
public Response updateConnection( DatabaseConnection connection ) throws ConnectionServiceException { sanitizer.sanitizeConnectionParameters( connection ); try { applySavedPassword( connection ); boolean success = connectionService.updateConnection( connection ); if ( success ) { return Response.ok().build(); } else { return Response.notModified().build(); } } catch ( Throwable t ) { t.printStackTrace(); return Response.serverError().build(); } }
Source:
<code>public void execute(String resultsCache) throws CacheException { if (resultsCache == null || resultsCache.isEmpty()) { throw new IllegalArgumentException("Results cache can not be " + resultsCache); } Cache<Object, Object> rCache = cache.getCacheManager().getCache(resultsCache); <START> if (rCache == null) { <END> throw new IllegalArgumentException("Result cache " + resultsCache + " is not defined on this node"); } executeHelper(resultsCache); }</code><technical_language>I this is possible, if cache is defined created default configuration</technical_language>

Target:
public void execute(String resultsCache) throws CacheException { if (resultsCache == null || resultsCache.isEmpty()) { throw new IllegalArgumentException("Results cache can not be " + resultsCache); } executeHelper(resultsCache); }
Source:
<code>public static FluidStack createFluidStack(String name, int amount) { Fluid fluid = getFirstFluid(name.toLowerCase()); <START> return fluid == null ? null : new FluidStack(fluid, amount); <END> }</code><technical_language>missed</technical_language>

Target:
public static FluidStack createFluidStack(String name, int amount) { Fluid fluid = getFirstFluid(name.toLowerCase(Locale.ENGLISH)); return fluid == null ? null : new FluidStack(fluid, amount); }
Source:
<code><START> public ConcurrentMap<String, Pair<Long, Long>> getRetainedRegionRWRequestsCnt() { <END> return this.retainedRegionRWRequestsCnt; }</code><technical_language>public? package private</technical_language>

Target:
protected ConcurrentMap<String, Pair<Long, Long>> getRetainedRegionRWRequestsCnt() { return this.retainedRegionRWRequestsCnt; }
Source:
<code>static int doMain(String[] args) { ServerConfiguration conf; try { conf = parseCommandLine(args); } catch (IllegalArgumentException iae) { return ExitCode.INVALID_CONF; } LifecycleComponent server; try { server = buildBookieServer(new BookieConfiguration(conf)); } catch (Exception e) { log.error("Failed to build bookie server", e); return ExitCode.SERVER_EXCEPTION; } try { ComponentStarter.startComponent(server).get(); } catch (InterruptedException ie) { log.info("Bookie server is interrupted. Exiting ..."); } catch (ExecutionException ee) { <START> log.error("Error in bookie shutdown", ee); <END> return ExitCode.SERVER_EXCEPTION; } return ExitCode.OK; }</code><technical_language>log ee.getCause()</technical_language>

Target:
static int doMain(String[] args) { ServerConfiguration conf; try { conf = parseCommandLine(args); } catch (IllegalArgumentException iae) { return ExitCode.INVALID_CONF; } LifecycleComponent server; try { server = buildBookieServer(new BookieConfiguration(conf)); } catch (Exception e) { log.error("Failed to build bookie server", e); return ExitCode.SERVER_EXCEPTION; } try { ComponentStarter.startComponent(server).get(); } catch (InterruptedException ie) { log.info("Bookie server is interrupted. Exiting ..."); } catch (ExecutionException ee) { log.error("Error in bookie shutdown", ee.getCause()); return ExitCode.SERVER_EXCEPTION; } return ExitCode.OK; }
Source:
<code>private boolean checkQueryAccess(OperationContext ctx,QueryExpression query) { if(query!=null) { CompositeMetadata md=ctx.getTopLevelEntityMetadata(); FieldAccessRoleEvaluator eval=new FieldAccessRoleEvaluator(md,ctx.getCallerRoles()); List<FieldInfo> fields=query.getQueryFields(); LOGGER.debug("Checking access for query fields {}",fields); for(FieldInfo field:fields) { LOGGER.debug("Access checking field {}",field.getAbsFieldName()); if(eval.hasAccess(field.getAbsFieldName(),FieldAccessRoleEvaluator.Operation.find)) { LOGGER.debug("Field is readable",field.getAbsFieldName()); } else { LOGGER.debug("Field is not readable",field.getAbsFieldName()); ctx.addError(Error.get(CrudConstants.ERR_NO_ACCESS, field.getAbsFieldName().toString())); ctx.setStatus(OperationStatus.ERROR); <START> return false; <END> } } } return true; }</code><technical_language>fields, continue processing find out if additional caller is authorized access, add error</technical_language>

Target:
private boolean checkQueryAccess(OperationContext ctx,QueryExpression query) { boolean ret=true; if(query!=null) { CompositeMetadata md=ctx.getTopLevelEntityMetadata(); FieldAccessRoleEvaluator eval=new FieldAccessRoleEvaluator(md,ctx.getCallerRoles()); List<FieldInfo> fields=query.getQueryFields(); LOGGER.debug("Checking access for query fields {}",fields); for(FieldInfo field:fields) { LOGGER.debug("Access checking field {}",field.getAbsFieldName()); if(eval.hasAccess(field.getAbsFieldName(),FieldAccessRoleEvaluator.Operation.find)) { LOGGER.debug("Field is readable",field.getAbsFieldName()); } else { LOGGER.debug("Field is not readable",field.getAbsFieldName()); ctx.addError(Error.get(CrudConstants.ERR_NO_ACCESS, field.getAbsFieldName().toString())); ctx.setStatus(OperationStatus.ERROR); ret=false; } } } return ret; }
Source:
<code>private void calculateTotalAgentsInHostgroups() { int agentsToExpect = 0; <START> for (Entity entity : getChildren()) { <END> if (entity instanceof AmbariHostGroup) { agentsToExpect += entity.getConfig(AmbariHostGroup.INITIAL_SIZE); } } setAttribute(EXPECTED_AGENTS, agentsToExpect); }</code><technical_language>add a getHostGroups method returns Iterable<AmbariHostGroup> if repeat this pattern again</technical_language>

Target:
private void calculateTotalAgentsInHostgroups() { int agentsToExpect = 0; for (AmbariHostGroup hostGroup : getHostGroups()) { agentsToExpect += hostGroup.getConfig(AmbariHostGroup.INITIAL_SIZE); } setAttribute(EXPECTED_AGENTS, agentsToExpect); }
Source:
<code>public void onBlockHighlight(DrawBlockHighlightEvent event) { Item equipped = event.player.getCurrentEquippedItem() != null ? event.player.getCurrentEquippedItem().getItem() : null; int x = event.target.blockX; int y = event.target.blockY; int z = event.target.blockZ; if ((event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) && (event.player.worldObj.getBlock(x, y, z) instanceof BlockPipe) <START> && (equipped != null) && ((event.player.getCurrentEquippedItem().getItem() instanceof IPipeWrench && ((IPipeWrench) equipped).canWrench(event.player, x, y, z)))) { <END> RayTracer.retraceBlock(event.player.worldObj, event.player, x, y, z); } }</code><technical_language>event.player.getCurrentEquippedItem().getItem() changed equipped</technical_language>

Target:
public void onBlockHighlight(DrawBlockHighlightEvent event) { Item equipped = event.player.getCurrentEquippedItem() != null ? event.player.getCurrentEquippedItem().getItem() : null; int x = event.target.blockX; int y = event.target.blockY; int z = event.target.blockZ; if ((event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) && (event.player.worldObj.getBlock(x, y, z) instanceof BlockPipe) && (equipped != null) && ((equipped instanceof IPipeWrench && ((IPipeWrench) equipped).canWrench(event.player, x, y, z)))) { RayTracer.retraceBlock(event.player.worldObj, event.player, x, y, z); } }
Source:
<code>public Object changePassword(String payload) throws JSONException { NuxeoPrincipal currentUser = (NuxeoPrincipal) getContext().getCoreSession().getPrincipal(); JSONObject payloadJson = new JSONObject(payload); String oldPassword = payloadJson.getString("oldPassword"); String newPassword = payloadJson.getString("newPassword"); UserManager userManager = Framework.getService(UserManager.class); if (userManager.checkUsernamePassword(currentUser.getName(), oldPassword)) { currentUser.setPassword(newPassword); UpdateUserUnrestricted updateUserUnrestricted = new UpdateUserUnrestricted(ctx.getCoreSession(), currentUser.getModel()); <START> updateUserUnrestricted.runUnrestricted(); <END> return currentUser; } else { return Response.status(Status.UNAUTHORIZED).build(); } }</code><technical_language>simply do Framework.doPrivileged(() -> userManager.updateUser(updatedUser)) if goal is a system user call</technical_language>

Target:
public Object changePassword(String payload) throws JSONException { NuxeoPrincipal currentUser = (NuxeoPrincipal) getContext().getCoreSession().getPrincipal(); JSONObject payloadJson = new JSONObject(payload); String oldPassword = payloadJson.getString("oldPassword"); String newPassword = payloadJson.getString("newPassword"); UserManager userManager = Framework.getService(UserManager.class); if (userManager.checkUsernamePassword(currentUser.getName(), oldPassword)) { currentUser.setPassword(newPassword); Framework.doPrivileged(() -> userManager.updateUser(currentUser.getModel())); return currentUser; } else { return Response.status(Status.UNAUTHORIZED).build(); } }
Source:
<code><START> public GatewayResponse<BaseCaptureResponse> capture(ChargeEntity chargeEntity) { <END> return getPaymentProviderFor(chargeEntity) .getCaptureHandler() .capture(CaptureGatewayRequest.valueOf(chargeEntity)); }</code><technical_language>this method private</technical_language>

Target:
private GatewayResponse<BaseCaptureResponse> capture(ChargeEntity chargeEntity) { return getPaymentProviderFor(chargeEntity) .getCaptureHandler() .capture(CaptureGatewayRequest.valueOf(chargeEntity)); }
Source:
<code>private boolean restoreVolumeToSnapshot(Guid upServerId, GlusterVolumeEntity volume, String snapshotName) { if (volume != null) { try (EngineLock lock = acquireEngineLock(volume.getId(), LockingGroup.GLUSTER)) { VDSReturnValue retVal = runVdsCommand(VDSCommandType.RestoreGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionVDSParameters(upServerId, volume.getName(), snapshotName)); if (!retVal.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESTORE_FAILED, retVal.getVdsError() .getMessage()); setSucceeded(false); return false; } else { getGlusterVolumeSnapshotDao().removeByName(volume.getId(), snapshotName); <START> VDS upServer = getClusterUtils().getRandomUpServer(volume.getClusterId()); <END> VDSReturnValue volDetailsRetVal = runVdsCommand(VDSCommandType.GetGlusterVolumeInfo, new GlusterVolumeInfoVDSParameters(upServer.getId(), volume.getClusterId(), volume.getName())); GlusterVolumeEntity fetchedVolume = ((Map<Guid, GlusterVolumeEntity>) volDetailsRetVal.getReturnValue()).get(volume.getId()); List<GlusterBrickEntity> fetchedBricks = fetchedVolume.getBricks(); if (fetchedBricks != null) { getGlusterBrickDao().removeAllInBatch(volume.getBricks()); for (GlusterBrickEntity fetchdBrick : fetchedVolume.getBricks()) { if (fetchdBrick.getServerId() != null) { fetchdBrick.setStatus(GlusterStatus.UP); getGlusterBrickDao().save(fetchdBrick); } } } } } } return true; }</code><technical_language>potentially collide gluster sync a lock is acquired</technical_language>

Target:
private boolean restoreVolumeToSnapshot(Guid upServerId, GlusterVolumeEntity volume, String snapshotName) { if (volume != null) { try (EngineLock lock = acquireEngineLock(volume.getId(), LockingGroup.GLUSTER)) { VDSReturnValue retVal = runVdsCommand(VDSCommandType.RestoreGlusterVolumeSnapshot, new GlusterVolumeSnapshotActionVDSParameters(upServerId, volume.getName(), snapshotName)); if (!retVal.getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_SNAPSHOT_RESTORE_FAILED, retVal.getVdsError() .getMessage()); setSucceeded(false); return false; } else { getGlusterVolumeSnapshotDao().removeByName(volume.getId(), snapshotName); VDS upServer = getClusterUtils().getRandomUpServer(volume.getClusterId()); VDSReturnValue volDetailsRetVal = runVdsCommand(VDSCommandType.GetGlusterVolumeInfo, new GlusterVolumeInfoVDSParameters(upServer.getId(), volume.getClusterId(), volume.getName())); GlusterVolumeEntity fetchedVolume = ((Map<Guid, GlusterVolumeEntity>) volDetailsRetVal.getReturnValue()).get(volume.getId()); List<GlusterBrickEntity> fetchedBricks = fetchedVolume.getBricks(); if (fetchedBricks != null) { getGlusterBrickDao().removeAllInBatch(volume.getBricks()); for (GlusterBrickEntity fetchdBrick : fetchedVolume.getBricks()) { if (fetchdBrick.getServerId() != null) { fetchdBrick.setStatus(GlusterStatus.UP); getGlusterBrickDao().save(fetchdBrick); } else { log.warn("Invalid server details for brick " + fetchdBrick.getName() + ". Not adding now."); } } } } } } return true; }
Source:
<code><START> public String get(Enum<?> key) { <END> try { if(key == null){ return null; } String enumName = key.getDeclaringClass().toString(); enumName = enumName.substring(enumName.lastIndexOf(".")+1,enumName.length()); String translatedEnum = enums.getString(enumName + "___" + key.toString()); return translatedEnum; } catch (MissingResourceException e) { logger.info("Missing Enum resource: " + e.getLocalizedMessage()); return key.name(); } }</code><technical_language>remove inheritance translator this method static. need create instances of EnumTranslator</technical_language>

Target:
public String get(Enum<?> key) { if(key == null) { throw new IllegalArgumentException(); } try { String enumName = key.getDeclaringClass().toString(); enumName = enumName.substring(enumName.lastIndexOf(".")+1,enumName.length()); String translatedEnum = enums.getString(enumName + "___" + key.toString()); return translatedEnum; } catch (MissingResourceException e) { logger.info("Missing Enum resource: " + e.getLocalizedMessage()); return key.name(); } }