auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "created.")); String[] args2 = {"check", "credential1", "-provider", jceksProvider}; ArrayList<String> password = new ArrayList<String>(); password.add("p@ssw0rd"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); assertTrue(outContent.toString().contains("Password match success for credential1.")); String[] args3 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args3); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "deleted.")); }

Target:
public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertOutputContains("credential1 has been successfully created."); String[] args2 = {"check", "credential1", "-provider", jceksProvider}; ArrayList<String> password = new ArrayList<String>(); password.add("p@ssw0rd"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); assertOutputContains("Password match success for credential1."); ArrayList<String> passwordError = new ArrayList<String>(); passwordError.add("p@ssw0rderr"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); assertOutputContains("Password match failed for credential1."); String[] args3 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args3); assertEquals(0, rc); assertOutputContains("credential1 has been successfully deleted."); }
Source:
public void setTimestamp() { long timestamp = System.currentTimeMillis(); this.put("timestamp", timestamp); this.timestamp = timestamp; }

Target:
public void setTimestamp() { long timestamp = System.currentTimeMillis(); this.setTimestamp(timestamp); }
Source:
public <T extends IdentifiableBean> Result<T> get(StandardId id, Class<T> type) { Optional<IdentifiableBean> opt = sourceProvider.get(id); return opt.map(b -> { Class<? extends IdentifiableBean> receivedType = b.getClass(); return type.isAssignableFrom(receivedType) ? Result.success(type.cast(b)) : Result.<T>failure(FailureReason.MISSING_DATA, "Found data with id: of type: but expected type was: {}", id, receivedType.getSimpleName(), type.getSimpleName()); }).orElse(Result.<T>failure(FailureReason.MISSING_DATA, "Unable to find data with id: {}", id)); }

Target:
public <T extends IdentifiableBean> Result<T> get(StandardId id, Class<T> type) { Optional<IdentifiableBean> opt = sourceProvider.get(id); return opt .map(b -> attemptTypeConversion(id, type, b)) .orElse(createMissingDataFailure(id)); }
Source:
public void testPropertiesViewTitleOnDiagramDialectEditorWithContributions() { addContributions(); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), DIAGRAM_DESC_NAME, "new " + DIAGRAM_DESC_NAME, DDiagram.class); SWTBotView propertiesView = bot.viewByTitle("Properties"); SWTBot propertiesViewBot = propertiesView.bot(); try { setSiriusSheetLabelProvider(propertiesView); editor.select("test"); editor.setFocus(); SWTBotCLabel titleLabelBot = propertiesViewBot.clabel(); String assertMessage = "On DDiagramElement selection, the DiagramLabelProvider should be used"; assertEquals(assertMessage, DiagramLabelProvider.LABEL, titleLabelBot.getText()); assertTrue(assertMessage, ImageEquality.areEqualImages(DIAGRAM_IMAGE, titleLabelBot.image())); } finally { resetSiriusSheetLabelProvider(propertiesView); editor.close(); } }

Target:
public void testPropertiesViewTitleOnDiagramDialectEditorWithContributions() { addContributions(); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), DIAGRAM_DESC_NAME, "new " + DIAGRAM_DESC_NAME, DDiagram.class); SWTBotView propertiesView = bot.viewByTitle("Properties"); SWTBot propertiesViewBot = propertiesView.bot(); Object oldLabelProvider = null; try { oldLabelProvider = setSiriusSheetLabelProvider(propertiesView); editor.select("test"); editor.setFocus(); SWTBotCLabel titleLabelBot = propertiesViewBot.clabel(); String assertMessage = "On DDiagramElement selection, the DiagramLabelProvider should be used"; assertEquals(assertMessage, DiagramLabelProvider.LABEL, titleLabelBot.getText()); assertTrue(assertMessage, ImageEquality.areEqualImages(DIAGRAM_IMAGE, titleLabelBot.image())); } finally { resetSiriusSheetLabelProvider(propertiesView, oldLabelProvider); editor.close(); } }
Source:
private List<SimpleObject> createListResponse(List<ConceptSearchResult> resultList, ConceptSource conceptSource) { List<SimpleObject> allDiagnoses = new ArrayList<SimpleObject>(); for (ConceptSearchResult diagnosis : resultList) { SimpleObject diagnosisObject = new SimpleObject(); diagnosisObject.add("conceptName", diagnosis.getConcept().getName().getName()); diagnosisObject.add("conceptUuid", diagnosis.getConcept().getUuid()); diagnosisObject.add("matchedName", diagnosis.getConceptName()!=null ? diagnosis.getConceptName().getName() : null); Concept concept = diagnosis.getConcept(); ConceptReferenceTerm term = getConceptReferenceTermByConceptSource(concept, conceptSource); if(term != null) diagnosisObject.add("code", term.getCode()); allDiagnoses.add(diagnosisObject); } return allDiagnoses; }

Target:
private List<SimpleObject> createListResponse(List<ConceptSearchResult> resultList, ConceptSource conceptSource) { List<SimpleObject> allDiagnoses = new ArrayList<SimpleObject>(); for (ConceptSearchResult diagnosis : resultList) { SimpleObject diagnosisObject = new SimpleObject(); diagnosisObject.add("conceptName", diagnosis.getConcept().getName().getName()); diagnosisObject.add("conceptUuid", diagnosis.getConcept().getUuid()); if(diagnosis.getConceptName()!=null) { diagnosisObject.add("matchedName", diagnosis.getConceptName().getName()); } ConceptReferenceTerm term = getConceptReferenceTermByConceptSource(diagnosis.getConcept(), conceptSource); if(term != null) { diagnosisObject.add("code", term.getCode()); } allDiagnoses.add(diagnosisObject); } return allDiagnoses; }
Source:
private static void drawRangeDecorators(Rectangle rect, GC gc, int x1, int x2, int align) { int y1 = align == SWT.BOTTOM ? rect.y + rect.height - 9 : 5; int y2 = align == SWT.BOTTOM ? rect.y + rect.height - 5 : 9; int ym = (y1 + y2) / 2; if (x1 >= rect.x) { gc.drawLine(x1 - 2, y1, x1 - 2, y2); gc.drawLine(x1 - 3, y1, x1 - 1, y1); gc.drawLine(x1 + 1, y1, x1 + 1, y2); } if (x2 >= rect.x && Math.abs(x2 - x1 - 2) > 3) { gc.drawLine(x2 - 2, y1, x2 - 2, y2); gc.drawLine(x2 - 3, y1, x2 - 1, y1); } if (x2 >= rect.x && Math.abs(x2 - x1 + 3) > 3) { gc.drawLine(x2 + 1, y1, x2 + 3, y1); gc.drawLine(x2 + 3, y1, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 1, y2); gc.drawLine(x2 + 1, y2, x2 + 3, y2); } }

Target:
private static void drawRangeDecorators(Rectangle rect, GC gc, int x1, int x2, int align) { int y1 = align == SWT.BOTTOM ? rect.y + rect.height - TICK_HEIGHT - DECORATOR_HEIGHT: TICK_HEIGHT; int y2 = y1 + DECORATOR_HEIGHT; int ym = y1 + DECORATOR_HEIGHT / 2; if (x1 >= rect.x) { gc.drawLine(x1 - 2, y1, x1 - 2, y2); gc.drawLine(x1 - 3, y1, x1 - 1, y1); gc.drawLine(x1 + 1, y1, x1 + 1, y2); } if (x2 >= rect.x && Math.abs(x2 - x1 - 2) > 3) { gc.drawLine(x2 - 2, y1, x2 - 2, y2); gc.drawLine(x2 - 3, y1, x2 - 1, y1); } if (x2 >= rect.x && Math.abs(x2 - x1 + 3) > 3) { gc.drawLine(x2 + 1, y1, x2 + 3, y1); gc.drawLine(x2 + 3, y1, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 1, y2); gc.drawLine(x2 + 1, y2, x2 + 3, y2); } }
Source:
public void testTransform() throws Exception { TupleExpression expression1 = new DomainExpression<Integer>(1, Domain.singleValue(BIGINT, 1L)); TupleExpression expression2 = new DomainExpression<Integer>(2, Domain.singleValue(BIGINT, 2L)); TupleExpression expression3 = new DomainExpression<Integer>(3, Domain.singleValue(BIGINT, 3L)); TupleExpression combinedExpression = new NotExpression<Integer>( new OrExpression<Integer>(expression3, new AndExpression<Integer>(expression1, expression2))); TupleExpression<String> transformed = combinedExpression.transform(Object::toString); TupleExpression expression1Transformed = new DomainExpression<String>("1", Domain.singleValue(BIGINT, 1L)); TupleExpression expression2Transformed = new DomainExpression<String>("2", Domain.singleValue(BIGINT, 2L)); TupleExpression expression3Transformed = new DomainExpression<String>("3", Domain.singleValue(BIGINT, 3L)); TupleExpression expectedExpression = new NotExpression<String>( new OrExpression<String>(expression3Transformed, new AndExpression<Integer>(expression1Transformed, expression2Transformed))); assertEquals(transformed, expectedExpression); }

Target:
public void testTransform() throws Exception { TupleExpression integerExpression1 = new DomainExpression<Integer>(1, Domain.singleValue(BIGINT, 1L)); TupleExpression integerExpression2 = new DomainExpression<Integer>(2, Domain.singleValue(BIGINT, 2L)); TupleExpression integerExpression3 = new DomainExpression<Integer>(3, Domain.singleValue(BIGINT, 3L)); TupleExpression combinedExpression = new NotExpression<Integer>( new OrExpression<Integer>(integerExpression3, new AndExpression<Integer>(integerExpression1, integerExpression2))); TupleExpression<String> transformed = combinedExpression.transform(Object::toString); TupleExpression expression1Transformed = new DomainExpression<String>("1", Domain.singleValue(BIGINT, 1L)); TupleExpression expression2Transformed = new DomainExpression<String>("2", Domain.singleValue(BIGINT, 2L)); TupleExpression expression3Transformed = new DomainExpression<String>("3", Domain.singleValue(BIGINT, 3L)); TupleExpression expectedExpression = new NotExpression<String>( new OrExpression<String>(expression3Transformed, new AndExpression<Integer>(expression1Transformed, expression2Transformed))); assertEquals(transformed, expectedExpression); }
Source:
public void concurrentInvalidate() throws Exception { for (int i = 0; i < 50; i++) { reset(connectionProvider); getConnection(); Latch latch = new Latch(); new Thread(() -> { try { latch.await(); managedConnection.invalidate(); } catch (InterruptedException e) { throw new RuntimeException(e); } }).start(); latch.release(); managedConnection.invalidate(); verify(connectionProvider).disconnect(any()); } }

Target:
public void concurrentInvalidate() throws Exception { for (int i = 0; i < 50; i++) { reset(connectionProvider); getConnection(); Latch latch = new Latch(); Thread t = new Thread(() -> { try { latch.await(); managedConnection.invalidate(); } catch (InterruptedException e) { currentThread().interrupt(); throw new RuntimeException(e); } }); t.start(); try { latch.release(); managedConnection.invalidate(); verify(connectionProvider).disconnect(any()); } finally { t.join(); } } }
Source:
private HashSet<RelSet> getParentSets() { HashSet<RelSet> results = new HashSet<>(); VolcanoPlanner planner = (VolcanoPlanner) this.originalRel.getCluster().getPlanner(); assert planner != null; for (RelNode rel : getParentRels()) { RelSet set = planner.getSet(rel); if (set.id != this.id) { results.add(set); } } return results; }

Target:
private HashSet<RelSet> getParentSets() { HashSet<RelSet> results = new HashSet<>(); VolcanoPlanner planner = (VolcanoPlanner) this.originalRel.getCluster().getPlanner(); assert planner != null; for (RelNode rel : getParentRels()) { RelSet set = planner.getSet(rel); if (set.id != this.id && !planner.isPruned(rel)) { results.add(set); } } return results; }
Source:
public String getShortDescription() { String description = '<a href="' + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; description += this.getDestinationRepositoryName() + "/pull-request/" + this.getPullRequestId(); description += '">#' + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; return description; }

Target:
public String getShortDescription() { String description = "<a href=\"" + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; description += this.getDestinationRepositoryName() + "/pull-request/" + this.getPullRequestId(); description += "\">#" + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; return description; }
Source:
ResourceMonitor getOrCreateResourceMonitor(String resourceName) { try { if (!_resourceMonitorMap.containsKey(resourceName)) { synchronized (_resourceMonitorMap) { if (!_resourceMonitorMap.containsKey(resourceName)) { String beanName = getResourceBeanName(resourceName); ResourceMonitor bean = new ResourceMonitor(_clusterName, resourceName, getObjectName(beanName)); _resourceMonitorMap.put(resourceName, bean); } } } } catch (JMException ex) { LOG.error("Fail to register resource mbean, resource: " + resourceName); } return _resourceMonitorMap.get(resourceName); }

Target:
private ResourceMonitor getOrCreateResourceMonitor(String resourceName) { try { if (!_resourceMonitorMap.containsKey(resourceName)) { synchronized (_resourceMonitorMap) { if (!_resourceMonitorMap.containsKey(resourceName)) { String beanName = getResourceBeanName(resourceName); ResourceMonitor bean = new ResourceMonitor(_clusterName, resourceName, getObjectName(beanName)); _resourceMonitorMap.put(resourceName, bean); } } } } catch (JMException ex) { LOG.error("Fail to register resource mbean, resource: " + resourceName); } return _resourceMonitorMap.get(resourceName); }
Source:
private String requestPath(Uri requestUri) { if (!requestUri.getPath().isEmpty()) return requestUri.getPath(); else return "/"; }

Target:
private String requestPath(Uri requestUri) { return requestUri.getPath().isEmpty() ? "/" : requestUri.getPath(); }
Source:
private static boolean isDeviceDarkThemeEnabled(final Context context) { int deviceTheme = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (deviceTheme) { case Configuration.UI_MODE_NIGHT_YES: return true; case Configuration.UI_MODE_NIGHT_UNDEFINED: case Configuration.UI_MODE_NIGHT_NO: default: return false; } }

Target:
public static boolean isDeviceDarkThemeEnabled(final Context context) { final int deviceTheme = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (deviceTheme) { case Configuration.UI_MODE_NIGHT_YES: return true; case Configuration.UI_MODE_NIGHT_UNDEFINED: case Configuration.UI_MODE_NIGHT_NO: default: return false; } }
Source:
public static void initialize(Props props) { if (props == null) { throw new NullPointerException("props argument can't be null"); } instance = new JobCallbackRequestMaker(props); isInitialized = true; logger.info("Initialization for " + JobCallbackRequestMaker.class.getName() + " is completed"); }

Target:
public static void initialize(Props props) { if (props == null) { throw new NullPointerException("props argument can't be null"); } if (isInitialized) { return; } instance = new JobCallbackRequestMaker(props); isInitialized = true; logger.info("Initialization for " + JobCallbackRequestMaker.class.getName() + " is completed"); }
Source:
private void waitForJoinerView(Address joiner, int joinerViewId, long timeout) throws InterruptedException { if (joinerViewId > viewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { if (trace) { if (joinerViewId > viewId) { log.tracef("Waiting to install view %s before processing join request from %s", joinerViewId, joiner); } else { log.tracef("Waiting to recover cluster status before processing join request from %s", joiner); } } final long endTime = timeService.expectedEndTime(timeout, TimeUnit.MILLISECONDS); long remainingTime = -1; synchronized (clusterManagerLock) { while (viewId < joinerViewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { remainingTime = timeService.remainingTime(endTime, TimeUnit.MILLISECONDS); if (remainingTime == 0 || !clusterManagerStatus.isRunning()) break; clusterManagerLock.wait(remainingTime); } } if (remainingTime == 0) { throw new TimeoutException("Timed out waiting for view " + joinerViewId); } } }

Target:
private void waitForJoinerView(Address joiner, int joinerViewId, long timeout) throws InterruptedException { if (joinerViewId > viewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { if (trace) { if (joinerViewId > viewId) { log.tracef("Waiting to install view %s before processing join request from %s", joinerViewId, joiner); } else { log.tracef("Waiting to recover cluster status before processing join request from %s", joiner); } } long nanosTimeout = TimeUnit.MILLISECONDS.toNanos(timeout); while ((viewId < joinerViewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) && clusterManagerStatus.isRunning()) { if (nanosTimeout <= 0) { throw log.timeoutWaitingForView(joinerViewId); } nanosTimeout = clusterStateChanged.awaitNanos(nanosTimeout); } } }
Source:
private void throwExceptionIfUnknownParameter(List<String> optionalParameters) { List<String> validOptionalParamaters = Arrays.asList("EX", "PX", "NX", "XX", "KEEPTL"); List<String> parametersInQuestion = optionalParameters .stream() .filter(parameter -> (!validOptionalParamaters.contains(parameter))) .collect(Collectors.toList()); parametersInQuestion.forEach(parameter -> throwErrorIfNotANumberInExpectedPosition( parameter, optionalParameters)); }

Target:
private void throwExceptionIfUnknownParameter(List<String> optionalParameters) { List<String> validOptionalParamaters = Arrays.asList("EX", "PX", "NX", "XX"); List<String> parametersInQuestion = optionalParameters .stream() .filter(parameter -> (!validOptionalParamaters.contains(parameter))) .collect(Collectors.toList()); parametersInQuestion.forEach(parameter -> { int index = optionalParameters.indexOf(parameter); if (!isANumber(parameter)) { if (index == 0) { throw new IllegalArgumentException(ERROR_SYNTAX); } String previousParameter = optionalParameters.get(index - 1); if (previousOptionIsValidAndExpectsANumber(previousParameter)) { throw new IllegalArgumentException(ERROR_NOT_INTEGER); } throw new IllegalArgumentException(ERROR_SYNTAX); } }); }
Source:
protected Control createPageControls(Composite parent) { setTitle(Messages.RemoveReviewerDialog_Remove_Reviewer); Label label = new Label(parent, SWT.CENTER); label.setText( NLS.bind(Messages.RemoveReviewerDialog_Are_You_Sure_You_Want_To_Remove, userToRemove.getDisplayName())); return parent; }

Target:
protected Control createPageControls(Composite parent) { setTitle(Messages.RemoveReviewerDialog_Remove_Reviewer); Label label = new Label(parent, SWT.NONE); label.setText( NLS.bind(Messages.RemoveReviewerDialog_Are_You_Sure_You_Want_To_Remove, userToRemove.getDisplayName())); return parent; }
Source:
public boolean hasNext() { if (this.buffer.isEmpty()) { while (this.iterator.hasNext()) { final E object = this.iterator.next(); if (this.condition.fits(object)) { buffer.add(object); } } } return !this.buffer.isEmpty(); }

Target:
public boolean hasNext() { if (this.buffer.isEmpty()) { while (this.iterator.hasNext()) { final E object = this.iterator.next(); if (this.condition.fits(object)) { this.buffer.add(object); break; } } } return !this.buffer.isEmpty(); }
Source:
HardDeleter(StoreConfig config, StoreMetrics metrics, String dataDir, Log log, PersistentIndex index, MessageStoreHardDelete hardDelete, StoreKeyFactory factory, DiskIOScheduler diskIOScheduler, Time time) { this.metrics = metrics; this.dataDir = dataDir; this.log = log; this.index = index; this.hardDelete = hardDelete; this.factory = factory; this.diskIOScheduler = diskIOScheduler; this.time = time; scanSizeInBytes = Math.min(config.storeHardDeleteOperationsBytesPerSec, 1024 * 1024); messageRetentionSeconds = (int) TimeUnit.DAYS.toSeconds(config.storeDeletedMessageRetentionDays); }

Target:
HardDeleter(StoreConfig config, StoreMetrics metrics, String dataDir, Log log, PersistentIndex index, MessageStoreHardDelete hardDelete, StoreKeyFactory factory, DiskIOScheduler diskIOScheduler, Time time) { this.metrics = metrics; this.dataDir = dataDir; this.log = log; this.index = index; this.hardDelete = hardDelete; this.factory = factory; this.diskIOScheduler = diskIOScheduler; this.time = time; scanSizeInBytes = config.storeHardDeleteOperationsBytesPerSec * 10; messageRetentionSeconds = (int) TimeUnit.DAYS.toSeconds(config.storeDeletedMessageRetentionDays); }
Source:
private Predicate<GHHook> log(final String format) { return new Predicate<GHHook>() { @Override public boolean apply(GHHook input) { if (input != null) { LOGGER.debug(format("%s (events: {})", format), input.getUrl(), input.getEvents()); } return true; } }; }

Target:
private Predicate<GHHook> log(final String format) { return new Predicate<GHHook>() { @Override public boolean apply(GHHook input) { final GHHook _input = Validate.notNull(input); LOGGER.debug(format("%s (events: {})", format), _input.getUrl(), _input.getEvents()); return true; } }; }
Source:
public <S extends Sequence> MergeResult<S> merge( SequenceComparator<S> cmp, S base, S ours, S theirs) { return merge(cmp, base, ours, theirs, null); }

Target:
public <S extends Sequence> MergeResult<S> merge( SequenceComparator<S> cmp, S base, S ours, S theirs) { return merge(cmp, base, ours, theirs, new Attributes()); }
Source:
protected void configure() { install(new SingularityServiceModule()); }

Target:
protected void configure() { }
Source:
public int hashCode() { return Objects.hash(idealHeight); }

Target:
public int hashCode() { return Objects.hash(idealHeight, preferredHeight, preferredFps); }
Source:
private void setupPersistedState() throws IOException, ClassNotFoundException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RESTART_ENABLED, GrillConfConstants.DEFAULT_GRILL_SERVER_RESTART_ENABLED)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { ObjectInputStream in = null; try { try { in = new ObjectInputStream(fs.open(getServicePersistPath(service))); } catch (FileNotFoundException fe) { LOG.warn("No persist path available for service:" + service.getName()); continue; } service.readExternal(in); } finally { if (in != null) { in.close(); } } } } }

Target:
private void setupPersistedState() throws IOException, ClassNotFoundException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RECOVER_ON_RESTART, GrillConfConstants.DEFAULT_GRILL_SERVER_RECOVER_ON_RESTART)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { ObjectInputStream in = null; try { try { in = new ObjectInputStream(fs.open(getServicePersistPath(service))); } catch (FileNotFoundException fe) { LOG.warn("No persist path available for service:" + service.getName()); continue; } service.readExternal(in); LOG.info("Recovered service " + service.getName() + " from persisted state"); } finally { if (in != null) { in.close(); } } } } }
Source:
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "file": String fileName = uri.getRawPath(); return new FileInputStream(new File(fileName)); default: throw log.schemeNotSupported(scheme); } }

Target:
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "jar": case "file": String uriAsString = uri.toString(); String fileName = uriAsString.substring(uriAsString.lastIndexOf(":")); return new FileInputStream(new File(fileName)); default: InputStream streamToBeReturned = getAsInputStreamFromClassLoader(uri.toString(), cl); if(streamToBeReturned == null) { throw log.unableToLoadFileUsingScheme(scheme); } return streamToBeReturned; } }
Source:
private void setToCButtonFadedIn(boolean shouldFadeIn) { if (!ApiUtil.hasHoneyComb() || shouldFadeIn == isToCButtonFadedIn) { return; } if (shouldFadeIn) { Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = true; } else { Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = false; } }

Target:
private void setToCButtonFadedIn(boolean shouldFadeIn) { if (!ApiUtil.hasHoneyComb() || shouldFadeIn == isToCButtonFadedIn) { return; } Animation anim = AnimationUtils.loadAnimation(getActivity(), shouldFadeIn ? R.anim.fade_in_toc : R.anim.fade_out_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = shouldFadeIn; }
Source:
private void signalRemoved(Path p, SftpEventListener listener, ServerSession session, boolean isDirectory, Exception e) throws IOException { if (isDirectory) { listener.removedDirectory(session, p, e); } else { listener.removedFile(session, p, e); } }

Target:
protected void signalRemoved( Path p, SftpEventListener listener, ServerSession session, boolean isDirectory, Exception e) throws IOException { if (isDirectory) { listener.removedDirectory(session, p, e); } else { listener.removedFile(session, p, e); } }
Source:
private void executePlayerCommand(String playerCommandLine, Object commandParams) { String[] commandParts = playerCommandLine.split(":"); String playerId = commandParts[0]; String playerCommand = commandParts[1]; MPD daemon = findMPDInstance(playerId); if (daemon == null) { reconnect(playerId); } if (daemon != null) { PlayerCommandTypeMapping pCommand = null; try { pCommand = PlayerCommandTypeMapping.fromString(playerCommand); MPDPlayer player = daemon.getMPDPlayer(); switch (pCommand) { case PAUSE: player.pause(); break; case PLAY: player.play(); break; case STOP: player.stop(); break; case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break; case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break; case NEXT: player.playNext(); break; case PREV: player.playPrev(); break; case VOLUME: logger.warn("Volume adjustment received: '{}' '{}'", pCommand, commandParams); player.setVolume(((PercentType) commandParams).intValue()); break; } } catch (MPDPlayerException pe) { logger.error("error while executing command: " + pe.getMessage(), pCommand); } catch (Exception e) { logger.warn("unknow playerCommand '{}'", playerCommand); } } else { logger.warn("didn't find player configuration instance for playerId '{}'", playerId); } logger.info("executed commandLine '{}' for player '{}'", playerCommand, playerId); }

Target:
private void executePlayerCommand(String playerCommandLine, Object commandParams) { String[] commandParts = playerCommandLine.split(":"); String playerId = commandParts[0]; String playerCommand = commandParts[1]; MPD daemon = findMPDInstance(playerId); if (daemon == null) { reconnect(playerId); } if (daemon != null) { PlayerCommandTypeMapping pCommand = null; try { pCommand = PlayerCommandTypeMapping.fromString(playerCommand); MPDPlayer player = daemon.getMPDPlayer(); switch (pCommand) { case PAUSE: player.pause(); break; case PLAY: player.play(); break; case STOP: player.stop(); break; case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break; case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break; case NEXT: player.playNext(); break; case PREV: player.playPrev(); break; case VOLUME: logger.debug("Volume adjustment received: '{}' '{}'", pCommand, commandParams); player.setVolume(((PercentType) commandParams).intValue()); break; } } catch (MPDPlayerException pe) { logger.error("error while executing command: " + pe.getMessage(), pCommand); } catch (Exception e) { logger.warn("unknow playerCommand '{}'", playerCommand); } } else { logger.warn("didn't find player configuration instance for playerId '{}'", playerId); } logger.info("executed commandLine '{}' for player '{}'", playerCommand, playerId); }
Source:
private static synchronized FileSystemOptions createDefaultFileSystemOptions(UserCredentials credentials) throws FileSystemException { final FileSystemOptions options = new FileSystemOptions(); if (logger.isTraceEnabled()) { logger.trace("CREDENTIALS = " + credentials); } if (credentials != null && !credentials.isEmpty()) { UserAuthenticator auth = new StaticUserAuthenticator(credentials.getDomain(), credentials.getLogin(), credentials.getPassword()); try { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth); } catch (FileSystemException ex) { logger.error("Error when setting user authentication", ex); } } else { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, null); } SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); return options; }

Target:
private static synchronized FileSystemOptions createDefaultFileSystemOptions(UserCredentials credentials) throws FileSystemException { final FileSystemOptions options = new FileSystemOptions(); if (logger.isTraceEnabled()) { logger.trace("CREDENTIALS = " + credentials); } if (credentials != null && !credentials.isEmpty()) { if (Strings.isNullOrEmpty(credentials.getPassword()) && (credentials.getPrivateKey() != null && credentials.getPrivateKey().length > 0)) { try { File tempFile = File.createTempFile("sftp", ""); Files.write(credentials.getPrivateKey(), tempFile); IdentityInfo identityInfo = new IdentityInfo(tempFile); SftpFileSystemConfigBuilder.getInstance().setIdentityInfo(options, identityInfo); } catch (IOException e) { logger.error("Error when setting user authentication", e); } } else { UserAuthenticator auth = new StaticUserAuthenticator(credentials.getDomain(), credentials.getLogin(), credentials.getPassword()); try { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth); } catch (FileSystemException ex) { logger.error("Error when setting user authentication", ex); } } } else { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, null); } SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); return options; }
Source:
void closeResultSets() throws SQLException { closeResultSets(activeResultSets); if (generatedKeysResultSet != null && !generatedKeysResultSet.isClosed()) { generatedKeysResultSet.internalClose(); } generatedKeysResultSet = null; }

Target:
void closeResultSets() throws SQLException { closeResultSets(activeResultSets); generatedKeysResultSet = null; }
Source:
private void initUKRForLogin() { if (shouldGenerateFirstKey()) { SecretKey newKey = CryptUtil.generateSemiRandomKey(); if (newKey == null) { return; } String sandboxId = PropertyUtils.genUUID().replace("-", ""); ukrForLogin = new UserKeyRecord(username, UserKeyRecord.generatePwdHash(password), newKey.getEncoded(), new Date(), new Date(Long.MAX_VALUE), sandboxId); } else { ukrForLogin = UserKeyRecord.getCurrentValidRecordByPassword( CommCareApplication._().getCurrentApp(), username, password, true); if (ukrForLogin == null) { Logger.log(AndroidLogger.TYPE_ERROR_ASSERTION, "Shouldn't be able to not have a valid key record when OTA restoring with a key server"); } } }

Target:
private void initUKRForLogin() { if (shouldGenerateFirstKey()) { SecretKey newKey = CryptUtil.generateSemiRandomKey(); if (newKey == null) { return; } String sandboxId = PropertyUtils.genUUID().replace("-", ""); ukrForLogin = new UserKeyRecord(username, UserKeyRecord.generatePwdHash(password), ByteEncrypter.wrapByteArrayWithString(newKey.getEncoded(), password), new Date(), new Date(Long.MAX_VALUE), sandboxId); } else { ukrForLogin = UserKeyRecord.getCurrentValidRecordByPassword( CommCareApplication._().getCurrentApp(), username, password, true); if (ukrForLogin == null) { Logger.log(AndroidLogger.TYPE_ERROR_ASSERTION, "Shouldn't be able to not have a valid key record when OTA restoring with a key server"); } } }
Source:
LargePackedDeltaObject(long objectOffset, long baseOffset, int headerLength, PackFile pack, FileObjectDatabase db) { this.type = Constants.OBJ_BAD; this.size = -1; this.objectOffset = objectOffset; this.baseOffset = baseOffset; this.headerLength = headerLength; this.pack = pack; this.db = db; }

Target:
LargePackedDeltaObject(long objectOffset, long baseOffset, int headerLength, PackFile pack, FileObjectDatabase db) { this.type = Constants.OBJ_BAD; this.size = SIZE_UNKNOWN; this.objectOffset = objectOffset; this.baseOffset = baseOffset; this.headerLength = headerLength; this.pack = pack; this.db = db; }
Source:
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (clientMode) cfg.setWorkDirectory(TMP_DIR); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); return cfg; }

Target:
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (cfg.isClientMode()) cfg.setWorkDirectory(TMP_DIR); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); return cfg; }
Source:
public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { if (p.getInventory().getItemInMainHand().getType() != Material.SHEARS && p.getInventory().getItemInOffHand().getType() != Material.SHEARS && p.getGameMode() != GameMode.CREATIVE) { FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setFoodLevel(event.getFoodLevel()); } } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }

Target:
public ItemUseHandler getItemHandler() { return e -> { Player p = e.getPlayer(); if (p.getFoodLevel() >= 2) { if (isItem(e.getItem()) && p.getGameMode() != GameMode.CREATIVE) { FoodLevelChangeEvent event = new FoodLevelChangeEvent(p, p.getFoodLevel() - 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { p.setFoodLevel(event.getFoodLevel()); } } p.setVelocity(p.getEyeLocation().getDirection().multiply(4)); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_TNT_PRIMED, 1, 1); p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 1); p.setFallDistance(0F); } else { SlimefunPlugin.getLocalization().sendMessage(p, "messages.hungry", true); } }; }
Source:
public IllegalVerifierStateIssue() { super(Severity.ERROR, CheckType.ILLEGAL_VERIFIER_STATE, new HashSet<Integer>() ); }

Target:
public IllegalVerifierStateIssue() { super(Severity.ERROR, CheckType.ILLEGAL_VERIFIER_STATE, Collections.EMPTY_SET ); }
Source:
protected String getSchedulerVersion(Long agentId) { Instance instance = agentInstanceDao.getInstanceByAgent(agentId); String imageUuid = (String) DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_IMAGE_UUID).get(); DockerImage img = DockerImage.parse(imageUuid); if (!StringUtils.startsWith(img.getFullName(), "rancher/scheduler")) { return "NotApplicable"; } String[] imageParts = img.getFullName().split(":"); if (imageParts.length <= 1) { return ""; } return imageParts[imageParts.length - 1]; }

Target:
protected String getSchedulerVersion(Long agentId) { Instance instance = agentInstanceDao.getInstanceByAgent(agentId); String imageUuid = (String) DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_IMAGE_UUID).get(); DockerImage img = DockerImage.parse(imageUuid); String[] imageParts = img.getFullName().split(":"); if (imageParts.length <= 1) { return ""; } if (!imageParts[0].equals("rancher/scheduler")) { return "NotApplicable"; } return imageParts[imageParts.length - 1]; }
Source:
public static void sendAnalyticsException(@NonNull Throwable t, boolean fatal) { Throwable root = t; while (root.getCause() != null) { root = t.getCause(); } sendAnalyticsException(t.getClass().getSimpleName(), fatal); }

Target:
public static void sendAnalyticsException(@NonNull Throwable t, boolean fatal) { sendAnalyticsException(getCause(t).toString(), fatal); }
Source:
private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } return "images/cityschema/" + (zoomLevel-2) + "/" + (zoomLevel-2) + "-" + (int)normalizedCoord.getY() + "-" + (int)(normalizedCoord.getX()) + ".png"; } }); return ImageMapType.newInstance(opts); }

Target:
private ImageMapType getCitySchemaMapType() { ImageMapTypeOptions opts = ImageMapTypeOptions.newInstance(); opts.setMinZoom(ZOOM_MIN); opts.setMaxZoom(ZOOM_MAX); opts.setName(MAP_TYPE_ID); opts.setTileSize(Size.newInstance(TILE_SIZE, TILE_SIZE)); opts.setTileUrl(new TileUrlCallBack() { @Override public String getTileUrl(Point point, int zoomLevel) { Point normalizedCoord = getNormalizedCoords(point, zoomLevel); if (normalizedCoord == null) { return null; } return TILE_IMAGES_PATH.replace("/", PATH_SEPARATOR) + PATH_SEPARATOR + (zoomLevel - 2) + PATH_SEPARATOR + + (zoomLevel - 2) + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getY() + TILE_IMAGES_FILE_NAME_SEPARATOR + (int) normalizedCoord.getX() + FILE_EXTENSION_SEPARATOR + TILE_IMAGES_FILE_EXTENSION; } }); return ImageMapType.newInstance(opts); }
Source:
private static void popMethod(JoinPoint joinPoint, Object result, long lengthMillis) { Signature signature = joinPoint.getSignature(); String className = signature.getDeclaringType().getSimpleName(); String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("⇠ ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); appendObject(builder, result); } Log.d(className, builder.toString()); }

Target:
private static void popMethod(JoinPoint joinPoint, Object result, long lengthMillis) { Signature signature = joinPoint.getSignature(); Class<?> clazz = signature.getDeclaringType(); String methodName = signature.getName(); boolean hasReturnType = signature instanceof MethodSignature && ((MethodSignature) signature).getReturnType() != void.class; StringBuilder builder = new StringBuilder("⇠ ") .append(methodName) .append(" [") .append(lengthMillis) .append("ms]"); if (hasReturnType) { builder.append(" = "); appendObject(builder, result); } Log.d(asTag(clazz), builder.toString()); }
Source:
protected boolean canDoAction() { if (getGlusterVolume().isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED); return false; } return super.canDoAction(); }

Target:
protected boolean canDoAction() { if(! super.canDoAction()) { return false; } if (getGlusterVolume().isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STARTED); return false; } return true; }
Source:
private void getTagline() { OpenFoodAPIService openFoodAPIService = new OpenFoodAPIClient(getActivity(), "<LINK_0>").getAPIService(); Call<ArrayList<TaglineLanguageModel>> call = openFoodAPIService.getTagline(getString(R.string.app_name) + " " + Utils.getUserAgent("OTHERS")); call.enqueue(new Callback<ArrayList<TaglineLanguageModel>>() { @Override public void onResponse(Call<ArrayList<TaglineLanguageModel>> call, Response<ArrayList<TaglineLanguageModel>> response) { if (response.isSuccessful()) { final Locale locale = LocaleHelper.getLocale(getContext()); String localAsString = locale.toString(); boolean isLanguageFound = false; boolean isExactLanguageFound = false; for (int i = 0; i < response.body().size(); i++) { final String languageCountry = response.body().get(i).getLanguage(); if (!isExactLanguageFound && (languageCountry.equals(localAsString) || languageCountry.contains(localAsString))) { isExactLanguageFound = languageCountry.equals(localAsString); taglineURL = response.body().get(i).getTaglineModel().getUrl(); tvDailyFoodFact.setText(response.body().get(i).getTaglineModel().getMessage()); tvDailyFoodFact.setVisibility(View.VISIBLE); isLanguageFound = true; } } if (!isLanguageFound) { taglineURL = response.body().get(response.body().size() - 1).getTaglineModel().getUrl(); tvDailyFoodFact.setText(response.body().get(response.body().size() - 1).getTaglineModel().getMessage()); tvDailyFoodFact.setVisibility(View.VISIBLE); } } } @Override public void onFailure(Call<ArrayList<TaglineLanguageModel>> call, Throwable t) { } }); }

Target:
private void getTagline() { OpenFoodAPIService openFoodAPIService = new OpenFoodAPIClient(getActivity(), "<LINK_0>").getAPIService(); Call<ArrayList<TaglineLanguageModel>> call = openFoodAPIService.getTagline(Utils.getUserAgent()); call.enqueue(new Callback<ArrayList<TaglineLanguageModel>>() { @Override public void onResponse(Call<ArrayList<TaglineLanguageModel>> call, Response<ArrayList<TaglineLanguageModel>> response) { if (response.isSuccessful()) { final Locale locale = LocaleHelper.getLocale(getContext()); String localAsString = locale.toString(); boolean isLanguageFound = false; boolean isExactLanguageFound = false; for (int i = 0; i < response.body().size(); i++) { final String languageCountry = response.body().get(i).getLanguage(); if (!isExactLanguageFound && (languageCountry.equals(localAsString) || languageCountry.contains(localAsString))) { isExactLanguageFound = languageCountry.equals(localAsString); taglineURL = response.body().get(i).getTaglineModel().getUrl(); tvDailyFoodFact.setText(response.body().get(i).getTaglineModel().getMessage()); tvDailyFoodFact.setVisibility(View.VISIBLE); isLanguageFound = true; } } if (!isLanguageFound) { taglineURL = response.body().get(response.body().size() - 1).getTaglineModel().getUrl(); tvDailyFoodFact.setText(response.body().get(response.body().size() - 1).getTaglineModel().getMessage()); tvDailyFoodFact.setVisibility(View.VISIBLE); } } } @Override public void onFailure(Call<ArrayList<TaglineLanguageModel>> call, Throwable t) { } }); }
Source:
public void afterEach() throws Exception { try { stopRepository(); } catch (Exception e) { } finally { FileUtil.delete("target/persistent_repository"); } }

Target:
public void afterEach() throws Exception { try { stopRepository(); } finally { FileUtil.delete("target/persistent_repository"); } }
Source:
public boolean haveAllRepoUrlsBeenResolved() { if(stackContext == null) { return true; } return stackContext.haveAllRepoTasksCompleted(); }

Target:
public boolean haveAllRepoUrlsBeenResolved() { return stackContext.haveAllRepoTasksCompleted(); }
Source:
public byte[] persistToBytes() { byte[] result = new byte[4]; if (conservative()) { result[0] = (byte) 0x80; } if (dedicatedRow()) { result[0] |= 0x40; } result[0] |= shard() >> 2; result[1] = (byte) (shard() << 6); result[1] |= dedicatedRowNumber(); return result; }

Target:
public byte[] persistToBytes() { byte[] result = new byte[] { 0, 0, 0, 0 }; if (conservative()) { result[0] |= 0x80; } if (dedicatedRow()) { result[0] |= 0x40; } result[0] |= shard() >> 2; result[1] |= shard() << 6; result[1] |= dedicatedRowNumber(); return result; }
Source:
private Set<TaskError> validateTrigger(Task task) { LOGGER.debug("Validating the trigger in the task with name: and ID: {}", task.getName(), task.getId()); TaskTriggerInformation trigger = task.getTrigger(); Channel channel = channelService.getChannel(trigger.getModuleName()); return validateTrigger(task, channel); }

Target:
private Set<TaskError> validateTrigger(Task task) { LOGGER.debug("Validating trigger in task: with ID: {}", task.getName(), task.getId()); TaskTriggerInformation trigger = task.getTrigger(); Channel channel = channelService.getChannel(trigger.getModuleName()); return validateTrigger(task, channel); }
Source:
private void getUnSyncedEntries(Map<String, Object> map) { Object[] healInfos = (Object[]) map.get(BRICKS); for (Object healInfoObj : healInfos) { Map<String, String> healInfo = (Map<String, String>) healInfoObj; String status = (String) healInfo.get(STATUS); Integer entries = null; if ("Connected".equals(status)) { String hostUuid = (String) healInfo.get(HOST_UUID); GlusterServer glusterServer = dbUtils.getServerByUuid(Guid.createGuidFromString(hostUuid)); String brickName = (String) healInfo.get(NAME); String[] brickParts = brickName.split(":", -1); if (brickParts.length != 2) { throw new RuntimeException("Invalid brick representation [" + brickName + "]"); } if (glusterServer == null) { log.warn("Could not fetch heal info for brick '{}' - server uuid '{}' not found", brickName, hostUuid); return; } GlusterBrickEntity brick = dbUtils.getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), brickParts[1]); entries = Integer.valueOf((String) healInfo.get(NO_OF_ENTRIES)); unSyncedEntries.put(brick.getId(), entries); } } }

Target:
private void getUnSyncedEntries(Map<String, Object> map) { Object[] healInfos = (Object[]) map.get(BRICKS); for (Object healInfoObj : healInfos) { Map<String, String> healInfo = (Map<String, String>) healInfoObj; String status = (String) healInfo.get(STATUS); Integer entries = null; if (BRICK_STATUS_CONNECTED.equals(status)) { String hostUuid = (String) healInfo.get(HOST_UUID); GlusterServer glusterServer = dbUtils.getServerByUuid(Guid.createGuidFromString(hostUuid)); String brickName = (String) healInfo.get(NAME); String[] brickParts = brickName.split(":", -1); if (brickParts.length != 2) { log.warn("Invalid brick representation in volume volume {}", brickName); continue; } if (glusterServer == null) { log.warn("Could not fetch heal info for brick '{}' - server uuid '{}' not found", brickName, hostUuid); continue; } GlusterBrickEntity brick = dbUtils.getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), brickParts[1]); entries = Integer.valueOf((String) healInfo.get(NO_OF_ENTRIES)); unSyncedEntries.put(brick.getId(), entries); } } }
Source:
private byte[] getParticipantObjectQueryForResponse(PRPAIN201306UV02 response) throws JAXBException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (response.getControlActProcess() != null && response.getControlActProcess().getQueryByParameter() != null) { getMarshaller().marshal(response.getControlActProcess().getQueryByParameter(), baos); } return baos.toByteArray(); }

Target:
private byte[] getParticipantObjectQueryForResponse(PRPAIN201306UV02 response) throws JAXBException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (response != null && response.getControlActProcess() != null && response.getControlActProcess().getQueryByParameter() != null) { getMarshaller().marshal(response.getControlActProcess().getQueryByParameter(), baos); } return baos.toByteArray(); }