auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int getLineAtOffset(int offset) { try { return getLineOfOffset(offset); } catch (BadLocationException e) { ConsolePlugin.log(e); return -1; } }

Target:
public int getLineAtOffset(int offset) { try { return getLineOfOffset(offset); } catch (BadLocationException e) { ConsolePlugin.log(e); return offset < 0 ? 0 : widgetLines - 1; } }
Source:
public MapConfiguration() { this.configMap = new ConcurrentHashMap<String, String>(); }

Target:
public MapConfiguration() { configMap = new ConcurrentHashMap<String, String>(); }
Source:
public ConnectionProviderUI(IConfigurationElement element) { super(element); editable = Boolean.parseBoolean(element.getAttribute(EDITABLE)); IConfigurationElement[] children = element.getChildren(); ArrayList<IConfigurationElement> wizardPageList = new ArrayList<IConfigurationElement>(); wizardPageList.addAll(Arrays.asList(children)); labelProviderElement = null; for( int i = 0; i < children.length; i++ ) { if( children[i].getName().equals("connectionLabelProvider")) { wizardPageList.remove(children[i]); labelProviderElement = children[i]; } } wizardPages = (IConfigurationElement[]) wizardPageList.toArray(new IConfigurationElement[wizardPageList.size()]); }

Target:
public ConnectionProviderUI(IConfigurationElement element) { super(element); editable = Boolean.parseBoolean(element.getAttribute(EDITABLE)); IConfigurationElement[] children = element.getChildren(); ArrayList<IConfigurationElement> wizardPageList = new ArrayList<IConfigurationElement>(); labelProviderElement = null; for( int i = 0; i < children.length; i++ ) { if( children[i].getName().equals("wizardPage")) { wizardPageList.add(children[i]); } else if( children[i].getName().equals("connectionLabelProvider")) { labelProviderElement = children[i]; } } wizardPages = (IConfigurationElement[]) wizardPageList.toArray(new IConfigurationElement[wizardPageList.size()]); }
Source:
public static List<String> normalize(List<URL> urls) throws IOException { HashMap<String, String> inoToFile = new HashMap<String, String>(); List<String> normalized = new ArrayList<String>(); for (URL url: urls) { Path path = Paths.get(url.toString()); BasicFileAttributes attr = null; attr = Files.readAttributes(path, BasicFileAttributes.class); Object fileKey = attr.fileKey(); String s = fileKey.toString(); String inode = s.substring(s.indexOf("ino=") + 4, s.indexOf(")")); inoToFile.put(inode, url.toString()); } for(String key : inoToFile.keySet()) { normalized.add(inoToFile.get(key)); } return normalized; }

Target:
public static Set<String> normalize(List<URL> urls) throws IOException { Set<String> normalized = new LinkedHashSet<String>(); for (URL url : urls) { File file = new File(url.toString()); paths.add(file.getCanonicalPath()); } return normalized; }
Source:
public void before() throws TmfTraceException { SWTWorkbenchBot bot = new SWTWorkbenchBot(); bot.closeAllEditors(); for (SWTBotView viewBot : bot.views()) { viewBot.close(); } SWTBotUtils.openView(TimeGraphViewStub.ID); fViewBot = bot.viewById(TimeGraphViewStub.ID); fViewBot.show(); fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(fViewBot.bot()); fViewBot.bot().waitUntil(new TgConditionHelper(t -> tgBot.getEntries().length == 0)); fBounds = getBounds(); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); fViewBot.bot().waitUntil(new TgConditionHelper(t -> tgBot.getEntries().length >= 2)); resetTimeRange(bot); bot.waitUntil(new TgConditionHelper(t -> fViewBot.bot().slider().getThumb() > 1)); fBot = bot; }

Target:
public void before() throws TmfTraceException { fBot = new SWTWorkbenchBot(); fBot.closeAllEditors(); for (SWTBotView viewBot : fBot.views()) { viewBot.close(); } SWTBotUtils.openView(TimeGraphViewStub.ID); fViewBot = fBot.viewById(TimeGraphViewStub.ID); fViewBot.show(); fTrace = new TmfTraceStub() { @Override public @NonNull String getName() { return "Stub"; } @Override public TmfContext seekEvent(ITmfLocation location) { return new TmfContext(); } }; fTrace.setStartTime(TmfTimestamp.fromNanos(0)); fTrace.setEndTime(TmfTimestamp.fromNanos(180)); TmfTraceStub trace = fTrace; trace.initialize(null, "", ITmfEvent.class); assertNotNull(trace); SWTBotTimeGraph tgBot = new SWTBotTimeGraph(fViewBot.bot()); fViewBot.bot().waitUntil(new TgConditionHelper(t -> tgBot.getEntries().length == 0)); fBounds = getBounds(); UIThreadRunnable.syncExec(() -> TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, trace, null))); fViewBot.bot().waitUntil(new TgConditionHelper(t -> tgBot.getEntries().length >= 2)); resetTimeRange(); fBot.waitUntil(new TgConditionHelper(t -> fViewBot.bot().slider().getThumb() > 1)); }
Source:
public long getFilePointer() { try { return currentPageId * pageSize + currentPageOffset - startPosition; } catch ( NullPointerException npe ) { throw new AlreadyClosedException( "Already closed: " + this ); } }

Target:
public long getFilePointer() { return currentPageId * pageSize + currentPageOffset - startPosition; }
Source:
private QName getQName(String name) { final int colon = name == null ? -1 : name.indexOf(':'); final String prefix = name != null && colon > 0 ? name.substring(0, colon) : ""; final String local = name != null && colon > 0 ? (colon + 1 < name.length() ? name.substring(colon + 1) : "") : name; final String namespace = getNamespace(prefix); return new QName(namespace, local, prefix); }

Target:
private QName getQName(String name) { final int colon = name == null ? -1 : name.indexOf(':'); final String prefix = getPrefix(name, colon); final String local = getLocal(name, colon); final String namespace = getNamespace(prefix); return new QName(namespace, local, prefix); }
Source:
public void addRow(final String rowText) { if (insertedRows.contains(rowText)) { return; } final int row = getRowCount(); insertRow(row); setText(row, 0, rowText); insertedRows.add(rowText); final Image upImage = new Image(Gerrit.RESOURCES.removeSelectedProject()); final PushButton removeSelecteProjectButton = new PushButton(upImage); removeSelecteProjectButton.setStylePrimaryName(Gerrit.RESOURCES.css().buttonTrash()); removeSelecteProjectButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteRow(rowText); if (deleteListener != null) { deleteListener.onDeleteRow(rowText); } } }); setWidget(row, 1, removeSelecteProjectButton); final FlexCellFormatter fmt = getFlexCellFormatter(); fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().selectedProjectsDataCell()); fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell()); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().selectedProjectsDataCell()); fmt.setAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); }

Target:
public void addRow(final String rowText) { if (insertedRows.contains(rowText)) { return; } insertedRows.add(rowText); if (insertedRows.size() > 1) { Collections.sort(insertedRows, new Comparator<String>() { public int compare(final String a, final String b) { return a.compareTo(b); } }); } while (1 < getRowCount()) removeRow(getRowCount() - 1); for (final String k : insertedRows) { final int row = getRowCount(); insertRow(row); setText(row, 0, k); final Image upImage = new Image(Gerrit.RESOURCES.removeSelectedProject()); final PushButton removeSelecteProjectButton = new PushButton(upImage); removeSelecteProjectButton.setStylePrimaryName(Gerrit.RESOURCES.css() .buttonTrash()); removeSelecteProjectButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { deleteRow(k); handlerManager.fireEvent(new TableDeleteEvent(k)); } }); setWidget(row, 1, removeSelecteProjectButton); final FlexCellFormatter fmt = getFlexCellFormatter(); fmt.addStyleName(row, 0, Gerrit.RESOURCES.css() .selectedProjectsDataCell()); fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell()); fmt.addStyleName(row, 1, Gerrit.RESOURCES.css() .selectedProjectsDataCell()); fmt.setAlignment(row, 1, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); } }
Source:
public FirebaseListAdapter(Activity activity, Class<T> modelClass, int modelLayout, Query ref) { mModelClass = modelClass; mLayout = modelLayout; mActivity = activity; mSnapshots = new FirebaseArray(ref); mSnapshots.setOnChangedListener(new FirebaseArray.OnChangedListener() { @Override public void onChanged(EventType type, int index, int oldIndex) { notifyDataSetChanged(); } @Override public void onCancelled(DatabaseError databaseError) { FirebaseRecyclerAdapter.this.onCancelled(databaseError); } }); }

Target:
public FirebaseListAdapter(Activity activity, Class<T> modelClass, int modelLayout, Query ref) { mModelClass = modelClass; mLayout = modelLayout; mActivity = activity; mSnapshots = new FirebaseArray(ref); mSnapshots.setOnChangedListener(new FirebaseArray.OnChangedListener() { @Override public void onChanged(EventType type, int index, int oldIndex) { notifyDataSetChanged(); } @Override public void onCancelled(DatabaseError databaseError) { FirebaseListAdapter.this.onCancelled(databaseError); } }); }
Source:
private static RequestMappingContext getMappingForSite(RequestMappingContext mapping, Site site) { Map<String, Object> mappingsConfig = site.getTheme().getConfigMap("mappings"); if (!mapping.isAnnotated(site.isJournalSpecific() ? JOURNAL_SPECIFIC : JOURNAL_NEUTRAL)) { return null; } Map<String, Object> override = (Map<String, Object>) mappingsConfig.get(mapping.getAnnotation().name()); if (override != null) { Boolean disabled = (Boolean) override.get("disabled"); if (disabled != null && disabled) { return null; } String overridePattern = (String) override.get("pattern"); if (overridePattern != null) { mapping = mapping.override(overridePattern); } } if (site.getRequestScheme().hasPathToken()) { mapping = mapping.addSiteToken(); } return mapping; }

Target:
private static RequestMappingContext getMappingForSite(RequestMappingContext mapping, Site site) { Map<String, Object> mappingsConfig = site.getTheme().getConfigMap("mappings"); if (!mapping.hasScope((site instanceof JournalSite) ? JOURNAL_SPECIFIC : JOURNAL_NEUTRAL)) { return null; } Map<String, Object> override = (Map<String, Object>) mappingsConfig.get(mapping.getAnnotation().name()); if (override != null) { Boolean disabled = (Boolean) override.get("disabled"); if (disabled != null && disabled) { return null; } String overridePattern = (String) override.get("pattern"); if (overridePattern != null) { mapping = mapping.override(overridePattern); } } if (site.getRequestScheme().hasPathToken()) { mapping = mapping.addSiteToken(); } return mapping; }
Source:
public Element toElement(ElasticSearchDatastore datastore) { final Element ds = getDocument().createElement("elasticsearch-datastore"); ds.setAttribute("name", datastore.getName()); if (!StringUtils.isNullOrEmpty(datastore.getDescription())) { ds.setAttribute("description", datastore.getDescription()); } appendElement(ds, "hostname", datastore.getHostname()); appendElement(ds, "port", datastore.getPort()); appendElement(ds, "cluster-name", datastore.getClusterName()); appendElement(ds, "index-name", datastore.getIndexName()); appendElement(ds, "username", datastore.getUsername()); appendElement(ds, "password", encodePassword(datastore.getPassword())); appendElement(ds, "ssl", datastore.getSsl()); appendElement(ds, "keystorePath", datastore.getKeystorePath()); appendElement(ds, "keystorePassword", encodePassword(datastore.getKeystorePassword())); return ds; }

Target:
public Element toElement(ElasticSearchDatastore datastore) { final Element ds = getDocument().createElement("elasticsearch-datastore"); ds.setAttribute("name", datastore.getName()); if (!StringUtils.isNullOrEmpty(datastore.getDescription())) { ds.setAttribute("description", datastore.getDescription()); } appendElement(ds, "hostname", datastore.getHostname()); appendElement(ds, "port", datastore.getPort()); appendElement(ds, "cluster-name", datastore.getClusterName()); appendElement(ds, "index-name", datastore.getIndexName()); appendElement(ds, "username", datastore.getUsername()); appendElement(ds, "password", encodePassword(datastore.getPassword())); appendElement(ds, "ssl", datastore.getSsl()); if (datastore.getSsl()) { appendElement(ds, "keystore-path", datastore.getKeystorePath()); appendElement(ds, "keystore-password", encodePassword(datastore.getKeystorePassword())); } return ds; }
Source:
protected int getDeviceID(SimpleBinaryByteBuffer inBuffer) { try { inBuffer.flip(); int receivedID = inBuffer.get(); inBuffer.rewind(); return receivedID; } catch (ModeChangeException ex) { } finally { try { inBuffer.compact(); } catch (ModeChangeException e) { } } return -1; }

Target:
protected int getDeviceID(SimpleBinaryByteBuffer inBuffer) { try { inBuffer.flip(); int receivedID = inBuffer.get(); inBuffer.rewind(); return receivedID; } catch (ModeChangeException ex) { logger.error("{} - Bad operation: {}", this.toString(), ex.getMessage()); } finally { try { inBuffer.compact(); } catch (ModeChangeException ex) { logger.error("{} - Bad operation: {}", this.toString(), ex.getMessage()); } } return -1; }
Source:
public void commitChanges() throws RemoteException { mVold.commitChanges(); }

Target:
public void commitChanges() throws RemoteException { if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) { throw new SecurityException("no permission to commit checkpoint changes"); } mVold.commitChanges(); }
Source:
public ThingTypeConverter() { super(ThingTypeXmlResult.class, "thing-type"); this.attributeMapValidator = new ConverterAttributeMapValidator( new String[][] { { "id", "true" }, { "listed", "false" } }); }

Target:
public ThingTypeConverter() { this(ThingTypeXmlResult.class, "thing-type"); }
Source:
public char getFirstChar() { final String nameOrNumber = getNameOrNumber(); return Util.isNullOrEmpty(nameOrNumber) ? ' ' : Character.toUpperCase(nameOrNumber.charAt(0)); }

Target:
public char getFirstChar() { final String nameOrNumber = getNameOrNumber(); return Util.isNullOrEmpty(nameOrNumber) ? ' ' : Character.toTitleCase(nameOrNumber.charAt(0)); }
Source:
public @Nullable Integer getThreadOnCpuAtTime(int cpu, long time) { ITmfStateSystem stateSystem = getStateSystem(); if (stateSystem == null) { return null; } Integer tid = null; try { int cpuQuark = stateSystem.getQuarkAbsolute(Integer.toString(cpu)); ITmfStateValue value = stateSystem.querySingleState(time, cpuQuark).getStateValue(); if (value.getType().equals(Type.INTEGER)) { tid = value.unboxInt(); } } catch (AttributeNotFoundException | StateSystemDisposedException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } if (tid != null) { return tid; } return null; }

Target:
public @Nullable Integer getThreadOnCpuAtTime(int cpu, long time) { ITmfStateSystem stateSystem = getStateSystem(); if (stateSystem == null) { return null; } Integer tid = null; try { int cpuQuark = stateSystem.getQuarkAbsolute(Integer.toString(cpu)); ITmfStateValue value = stateSystem.querySingleState(time, cpuQuark).getStateValue(); if (value.getType().equals(Type.INTEGER)) { tid = value.unboxInt(); } } catch (AttributeNotFoundException | StateSystemDisposedException e) { Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e); } return tid; }
Source:
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { CouchbaseInputProperties inputProperties = (CouchbaseInputProperties) properties; this.bootstrapNodes = inputProperties.bootstrapNodes.getStringValue(); this.bucket = inputProperties.bucket.getStringValue(); this.password = inputProperties.password.getStringValue(); this.schema = inputProperties.schema.schema.getValue(); return ValidationResult.OK; }

Target:
public ValidationResult initialize(RuntimeContainer container, ComponentProperties properties) { if (properties instanceof CouchbaseInputProperties) { CouchbaseInputProperties inputProperties = (CouchbaseInputProperties) properties; this.bootstrapNodes = inputProperties.bootstrapNodes.getStringValue(); this.bucket = inputProperties.bucket.getStringValue(); this.password = inputProperties.password.getStringValue(); this.schema = inputProperties.schema.schema.getValue(); return ValidationResult.OK; } return new ValidationResult(Result.ERROR, "Wrong component properties, must be instanceof CouchbaseInputProperties class"); }
Source:
public final ExecutionContext context() { return context; }

Target:
final ExecutionContext context() { return context; }
Source:
public edu.gemini.itc.base.Disperser disperser(final int order) { return new GnirsGratingOptics( getDirectory() + "/" + getPrefix(), _grating.get(), _centralWavelength, _detector.getDetectorPixels(), order, isLongCamera() ? LONG_CAMERA_SCALE_FACTOR : 1, 1); }

Target:
public edu.gemini.itc.base.Disperser disperser(final int order) { return new GnirsGratingOptics( getDirectory() + "/" + getPrefix(), getGrating(), _centralWavelength, _detector.getDetectorPixels(), order, isLongCamera() ? LONG_CAMERA_SCALE_FACTOR : 1, 1); }
Source:
public void scanFile(XmlFile file) { int lineNumber = 1; for (String line : Utils.splitLines(file.getContents())) { String trimLine = trimEndOfLine(line); int length = trimLine.length(); if (length > maximumLineLength) { XmlTextRange textRange = new XmlTextRange(lineNumber, 0, lineNumber, trimLine.length()); reportIssue(textRange, "Split this " + length + " characters long line (which is greater than " + maximumLineLength + " authorized).", Collections.emptyList()); } lineNumber++; } }

Target:
public void scanFile(XmlFile file) { int lineNumber = 1; for (String line : Utils.splitLines(file.getContents())) { String trimLine = trimEndOfLine(line); int length = trimLine.length(); if (length > maximumLineLength) { XmlTextRange textRange = new XmlTextRange(lineNumber, 0, lineNumber, trimLine.length()); reportIssue(textRange, String.format("Split this %d characters long line (which is greater than %d authorized).", length, maximumLineLength), Collections.emptyList()); } lineNumber++; } }
Source:
public boolean apply(Game game, Ability source) { int numOfCardsToReveal = 5; boolean tapped = true; Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { Players allPlayers = game.getPlayers(); for (Player player : allPlayers.values()) { if (player != null) { Library library = player.getLibrary(); Cards cardsToReveal = new CardsImpl(); for (int i = 0; i < numOfCardsToReveal; i++) { if (!library.hasCards()) { break; } Card card = library.getFromTop(game); cardsToReveal.add(card); if (card.isLand()) { player.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, true, null); } else { player.moveCards(card, Zone.EXILED, source, game); } } player.revealCards(source, "Revealed cards for " + player.getName(), cardsToReveal, game); } } return true; } return false; }

Target:
public boolean apply(Game game, Ability source) { boolean tapped = true; Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { Player player = game.getPlayer(playerId); if (player != null) { Library library = player.getLibrary(); Cards cardsToReveal = new CardsImpl(); cardsToReveal.addAll(library.getTopCards(game, 5)); if (!cardsToReveal.isEmpty()) { player.revealCards(source, "Revealed cards for " + player.getName(), cardsToReveal, game); Cards cardsToPutOnBattlefield = new CardsImpl(); Cards cardsToExile = new CardsImpl(); for (Card card : cardsToReveal.getCards(game)) { if (card.isLand()) { cardsToPutOnBattlefield.add(card); } else { cardsToExile.add(card); } } player.moveCards(cardsToPutOnBattlefield.getCards(game), Zone.BATTLEFIELD, source, game, tapped, false, true, null); player.moveCards(cardsToExile.getCards(game), Zone.EXILED, source, game); } } } return true; } return false; }
Source:
public void should_include_default_browserTimezoneOffsetMins_for_Gmt_when_timezone_offset_provided_is_invalid (@Nullable String timeZoneOffsetMins) { Clock gmtClock = Clock.fixed(ZonedDateTime.parse("2020-01-01T10:10:10.100Z").toInstant(), ZoneId.of("Europe/London")); var epdqPayloadDefinitionFor3ds2NewOrder = new EpdqPayloadDefinitionForNew3ds2Order(FRONTEND_URL, SupportedLanguage.ENGLISH, gmtClock); authCardDetails.setJsTimezoneOffsetMins(timeZoneOffsetMins); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, is(aParameterBuilder().withBrowserTimezoneOffsetMins("0").build())); }

Target:
public void should_include_default_browserTimezoneOffsetMins_for_Gmt_when_timezone_offset_provided_is_invalid (@Nullable String timeZoneOffsetMins) { var epdqPayloadDefinitionFor3ds2NewOrder = new EpdqPayloadDefinitionForNew3ds2Order(FRONTEND_URL, SupportedLanguage.ENGLISH, GREENWICH_MERIDIAN_TIME_OFFSET_CLOCK); authCardDetails.setJsTimezoneOffsetMins(timeZoneOffsetMins); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, is(aParameterBuilder().withBrowserTimezoneOffsetMins("0").build())); }
Source:
public boolean isCancelled() { synchronized (mCallTrackers) { if (mCallTrackers.isEmpty()) { throw new IllegalStateException("No tracker registered."); } for (CallTracker callTracker : mCallTrackers) { if (callTracker.isCancelled()) { return true; } } return false; } }

Target:
public boolean isCancelled() { return mCallTracker.isCancelled(); }
Source:
String getCookie(URL url){ try { StringBuilder sb = new StringBuilder(); sb.append(url.getProtocol()); sb.append("://"); sb.append(url.getHost()); sb.append(":"); sb.append(url.getPort()); sb.append("/_session"); URL sessionURL = new URL(sb.toString()); HttpConnection conn = Http.POST(sessionURL, "application/json"); conn.responseFilters.clear(); conn.requestFilters.clear(); conn.setRequestBody(cookieRequestBody.getBytes("UTF-8")); String cookieHeader = conn.execute().getConnection().getHeaderField("Set-Cookie"); return cookieHeader.substring(0,cookieHeader.indexOf(";")); } catch (MalformedURLException e) { e.printStackTrace(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }

Target:
private String getCookie(URL url){ try { URL sessionURL = new URL(String.format("%s://%s:%d/_session", url.getProtocol(), url.getHost(), url.getPort())); HttpConnection conn = Http.POST(sessionURL, "application/x-www-form-urlencoded"); conn.setRequestBody(sessionRequestBody); HttpURLConnection connection = conn.execute().getConnection(); String cookieHeader = connection.getHeaderField("Set-Cookie"); int responseCode = connection.getResponseCode(); if(responseCode / 100 == 2){ if(sessionHasStarted(connection.getInputStream())) { return cookieHeader.substring(0, cookieHeader.indexOf(";")); } else { return null; } } else if(responseCode == 401){ shouldAttemptCookieRequest = false; logger.severe("Credentials are incorrect, cookie authentication will not be" + " attempted again by this filter object"); } else if (responseCode / 100 == 5){ logger.log(Level.SEVERE, "Failed to get cookie from server, response code %s, cookie auth", responseCode); } else { logger.log(Level.SEVERE, "Failed to get cookie from server, response code %s, " + "cookie authentication will not be attempted again", responseCode); shouldAttemptCookieRequest = false; } } catch (MalformedURLException e) { logger.log(Level.SEVERE,"Failed to create URL for _session endpoint",e); } catch (UnsupportedEncodingException e) { logger.log(Level.SEVERE, "Failed to encode cookieRequest body", e); } catch (IOException e) { logger.log(Level.SEVERE, "Failed to read cookie response header", e); } return null; }
Source:
private <T> List<T> testReflectDatumRead(String testType, byte[] bytes, T... entityObjs) throws IOException { ReflectDatumReader<T> datumReader = new ReflectDatumReader<>(); SeekableByteArrayInput avroInputStream = new SeekableByteArrayInput(bytes); DataFileReader<T> fileReader = new DataFileReader<>(avroInputStream, datumReader); Schema schema = fileReader.getSchema(); T record = null; List<T> records = new ArrayList<>(); while (fileReader.hasNext()) { records.add(fileReader.next(record)); } fileReader.close(); return records; }

Target:
private <T> List<T> testReflectDatumRead(String testType, byte[] bytes, T... entityObjs) throws IOException { ReflectDatumReader<T> datumReader = new ReflectDatumReader<>(); SeekableByteArrayInput avroInputStream = new SeekableByteArrayInput(bytes); List<T> records = new ArrayList<>(); try (DataFileReader<T> fileReader = new DataFileReader<>(avroInputStream, datumReader)) { Schema schema = fileReader.getSchema(); T record = null; while (fileReader.hasNext()) { records.add(fileReader.next(record)); } } return records; }
Source:
public void testAllDataProviders() throws URISyntaxException, IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException { int i = 0; for (Class testClass : getClasses("picard")) { if (Modifier.isAbstract(testClass.getModifiers())) continue; for (final Method method : testClass.getMethods()) { if (method.isAnnotationPresent(DataProvider.class)) { System.err.println("Method: " + method.getName()); method.invoke(testClass.newInstance()); i++; } } } Assert.assertNotSame(i,0); System.err.println("Found: "+ i + " @DataProviders."); }

Target:
public void testAllDataProviders() throws IllegalAccessException, InstantiationException, InvocationTargetException { int i = 0; final ClassFinder classFinder = new ClassFinder(); classFinder.find("picard", Object.class); for (Class testClass : classFinder.getClasses()) { if (Modifier.isAbstract(testClass.getModifiers())) continue; for (final Method method : testClass.getMethods()) { if (method.isAnnotationPresent(DataProvider.class)) { System.err.println("Method: " + testClass.getName() + ":" + method.getName()); method.invoke(testClass.newInstance()); i++; } } } Assert.assertNotSame(i,0); System.err.println("Found: "+ i + " @DataProviders."); }
Source:
public static void run() { try { while(true) { flushAllChannels(); Thread.sleep(50); } } catch(InterruptedException e) { } }

Target:
public static void run() { try { while(true) { flushAllChannels(); Thread.sleep(flushDelay); } } catch(InterruptedException e) { } }
Source:
private boolean isClobCompatibleCastTarget(String castTargetType) { for (int i = 0; i < clobCompatibleCastTargetTypes.length; i++) { if (castTargetType.equalsIgnoreCase(clobCompatibleCastTargetTypes[i]) || castTargetType.toLowerCase().startsWith(clobCompatibleCastTargetTypes[i] + "(")) { return true; } } return false; }

Target:
private static boolean isClobCompatibleCastTarget(String castTargetType) { for (int i = 0; i < CLOB_COMPATIBLE_CAST_TARGET_TYPES.length; i++) { if (castTargetType.toLowerCase().indexOf(CLOB_COMPATIBLE_CAST_TARGET_TYPES[i]) == 0 && (castTargetType.length() == CLOB_COMPATIBLE_CAST_TARGET_TYPES[i].length() || castTargetType.charAt(CLOB_COMPATIBLE_CAST_TARGET_TYPES[i].length()) == '(') ) { return true; } } return false; }
Source:
public void testNSAndTableQuotaRemoveTableQuotaTableInViolation() throws Exception { final String ns = testName.getMethodName(); NamespaceDescriptor nd = NamespaceDescriptor.create(ns).build(); TEST_UTIL.getAdmin().createNamespace(nd); TableName table1 = helper.createTableInNamespace(nd); TableName table2 = helper.createTableInNamespace(nd); TableName table3 = helper.createTableInNamespace(nd); Put put = new Put(Bytes.toBytes(("to_reject"))); put.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); helper.setQuotaLimit(nd.getName(), SpaceViolationPolicy.NO_WRITES_COMPACTIONS, 4L); helper.setQuotaLimit(table2, SpaceViolationPolicy.NO_WRITES, 2L); helper.writeData(table2, 2L * SpaceQuotaHelperForTests.ONE_MEGABYTE); helper.verifyViolation(SpaceViolationPolicy.NO_WRITES, table2, put); helper.removeQuotaFromtable(table2); helper.writeData(table1, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE); helper.writeData(table3, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE); Put put1 = new Put(Bytes.toBytes(("to_reject1"))); put1.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); helper.verifyViolation(SpaceViolationPolicy.NO_WRITES_COMPACTIONS, table2, put1); try { TEST_UTIL.getAdmin().majorCompact(table2); fail("Expected that invoking the compaction should throw an Exception"); } catch (DoNotRetryIOException e) { } }

Target:
public void testNSAndTableQuotaRemoveTableQuotaTableInViolation() throws Exception { final String ns = testName.getMethodName(); NamespaceDescriptor nd = NamespaceDescriptor.create(ns).build(); TEST_UTIL.getAdmin().createNamespace(nd); TableName table1 = helper.createTableInNamespace(nd); TableName table2 = helper.createTableInNamespace(nd); TableName table3 = helper.createTableInNamespace(nd); Put put = new Put(Bytes.toBytes(("to_reject"))); put.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); helper.setQuotaLimit(nd.getName(), SpaceViolationPolicy.NO_WRITES_COMPACTIONS, 4L); helper.setQuotaLimit(table2, SpaceViolationPolicy.NO_WRITES, 2L); helper.writeData(table2, 2L * SpaceQuotaHelperForTests.ONE_MEGABYTE); helper.verifyViolation(SpaceViolationPolicy.NO_WRITES, table2, put); helper.removeQuotaFromtable(table2); helper.writeData(table1, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE); helper.writeData(table3, 1L * SpaceQuotaHelperForTests.ONE_MEGABYTE); Put put1 = new Put(Bytes.toBytes(("to_reject1"))); put1.addColumn(Bytes.toBytes(SpaceQuotaHelperForTests.F1), Bytes.toBytes("to"), Bytes.toBytes("reject")); helper.verifyViolation(SpaceViolationPolicy.NO_WRITES_COMPACTIONS, table2, put1); try { TEST_UTIL.getAdmin().majorCompact(table2); fail("Expected that invoking the compaction should throw an Exception"); } catch (DoNotRetryIOException e) { assertTrue(e.getMessage() .contains("Compactions on this region are disabled due to a space quota violation")); } }
Source:
Optional<BufferAndAvailability> getNextBuffer() throws IOException { checkError(); checkState(partitionRequestClient != null, "Queried for a buffer before requesting a queue."); final Buffer next; final boolean moreAvailable; synchronized (receivedBuffers) { next = receivedBuffers.poll(); moreAvailable = !receivedBuffers.isEmpty(); } if (next == null) { if (isReleased.get()) { throw new CancelTaskException("Queried for a buffer after channel has been released."); } else { throw new IllegalStateException("There should always have queued buffers for unreleased channel."); } } numBytesIn.inc(next.getSize()); numBuffersIn.inc(); return Optional.of(new BufferAndAvailability(next, moreAvailable, 0)); }

Target:
Optional<BufferAndAvailability> getNextBuffer() throws IOException { checkPartitionRequestQueueInitialized(); final Buffer next; final boolean moreAvailable; synchronized (receivedBuffers) { next = receivedBuffers.poll(); moreAvailable = !receivedBuffers.isEmpty(); } if (next == null) { if (isReleased.get()) { throw new CancelTaskException("Queried for a buffer after channel has been released."); } else { throw new IllegalStateException("There should always have queued buffers for unreleased channel."); } } numBytesIn.inc(next.getSize()); numBuffersIn.inc(); return Optional.of(new BufferAndAvailability(next, moreAvailable, 0)); }
Source:
public void run() { if (!node.isMaster()) { return; } partitionServiceLock.lock(); try { if (!node.getClusterService().getClusterState().isMigrationAllowed()) { triggerRepartitioningWhenClusterStateAllowsMigration = true; if (logger.isFineEnabled()) { logger.fine("Migrations are not allowed yet, " + "repartitioning will be triggered when cluster state allows migrations."); } assignCompletelyLostPartitions(); return; } Address[][] newState = repartition(); if (newState == null) { return; } lastRepartitionTime.set(Clock.currentTimeMillis()); processNewPartitionState(newState); if (ASSERTION_ENABLED) { migrationQueue.add(new AssertPartitionTableTask(partitionService.getMaxAllowedBackupCount())); } migrationQueue.add(new ProcessShutdownRequestsTask()); } finally { partitionServiceLock.unlock(); partitionService.syncPartitionRuntimeState(); } }

Target:
public void run() { if (!node.isMaster()) { return; } partitionServiceLock.lock(); try { triggerRepartitioningWhenClusterStateAllowsMigration = !node.getClusterService().getClusterState().isMigrationAllowed(); if (triggerRepartitioningWhenClusterStateAllowsMigration) { if (logger.isFineEnabled()) { logger.fine("Migrations are not allowed yet, " + "repartitioning will be triggered when cluster state allows migrations."); } assignCompletelyLostPartitions(); return; } Address[][] newState = repartition(); if (newState == null) { return; } lastRepartitionTime.set(Clock.currentTimeMillis()); processNewPartitionState(newState); if (ASSERTION_ENABLED) { migrationQueue.add(new AssertPartitionTableTask(partitionService.getMaxAllowedBackupCount())); } migrationQueue.add(new ProcessShutdownRequestsTask()); } finally { partitionServiceLock.unlock(); partitionService.syncPartitionRuntimeState(); } }
Source:
public boolean deployAPI(String apiId, String gatewayLabel) throws ArtifactSynchronizerException { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled() && gatewayArtifactSynchronizerProperties.getGatewayLabels().contains(gatewayLabel)) { if (artifactRetriever != null) { try { String gatewayRuntimeArtifact = artifactRetriever.retrieveArtifact(apiId, gatewayLabel, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); if (!StringUtils.isEmpty(gatewayRuntimeArtifact)) { GatewayAPIDTO gatewayAPIDTO = new Gson().fromJson(gatewayRuntimeArtifact, GatewayAPIDTO.class); APIGatewayAdminClient apiGatewayAdminClient = new APIGatewayAdminClient(); apiGatewayAdminClient.deployAPI(gatewayAPIDTO); if (debugEnabled) { log.debug("API with " + apiId + " is deployed in gateway with the label of " + gatewayLabel); } return true; } else { String msg = "Error retrieving artifacts for API " + apiId + ". Storage returned null"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } catch (IOException | ArtifactSynchronizerException e) { String msg = "Error deploying" + apiId + "in Gateway"; log.error(msg, e); throw new ArtifactSynchronizerException(msg, e); } } else { String msg = "Artifact retriever not found"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } return false; }

Target:
public boolean deployAPI(String apiId, String gatewayLabel) throws ArtifactSynchronizerException { if (gatewayArtifactSynchronizerProperties.isRetrieveFromStorageEnabled() && gatewayArtifactSynchronizerProperties.getGatewayLabels().contains(gatewayLabel)) { if (artifactRetriever != null) { try { String gatewayRuntimeArtifact = artifactRetriever.retrieveArtifact(apiId, gatewayLabel, APIConstants.GatewayArtifactSynchronizer.GATEWAY_INSTRUCTION_PUBLISH); if (StringUtils.isNotEmpty(gatewayRuntimeArtifact)) { GatewayAPIDTO gatewayAPIDTO = new Gson().fromJson(gatewayRuntimeArtifact, GatewayAPIDTO.class); APIGatewayAdminClient apiGatewayAdminClient = new APIGatewayAdminClient(); apiGatewayAdminClient.deployAPI(gatewayAPIDTO); if (debugEnabled) { log.debug("API with " + apiId + " is deployed in gateway with the label of " + gatewayLabel); } return true; } else { String msg = "Error retrieving artifacts for API " + apiId + ". Storage returned null"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } catch (IOException | ArtifactSynchronizerException e) { String msg = "Error deploying" + apiId + "in Gateway"; log.error(msg, e); throw new ArtifactSynchronizerException(msg, e); } } else { String msg = "Artifact retriever not found"; log.error(msg); throw new ArtifactSynchronizerException(msg); } } return false; }
Source:
private static Set<List<JavaFileScannerContext.Location>> collectFlow(Collection<ExplodedGraph.Node> nodes, boolean conditionIsAlwaysTrue) { return nodes.stream() .map(node -> flowFromNode(node, conditionIsAlwaysTrue)) .collect(HashSet::new, Set::addAll, Set::addAll); }

Target:
private static Set<List<JavaFileScannerContext.Location>> collectFlow(Collection<ExplodedGraph.Node> nodes, boolean conditionIsAlwaysTrue) { return nodes.stream() .map(node -> flowFromNode(node, conditionIsAlwaysTrue)) .flatMap(Set::stream) .collect(Collectors.toSet()); }
Source:
public boolean isSatisfied(Map<String, Object> inputs) { String startTimeConfig = (String) module.getConfiguration().get(START_TIME); String endTimeConfig = (String) module.getConfiguration().get(END_TIME); if (startTimeConfig == null || endTimeConfig == null) { logger.error("Time condition with id is not well configured: startTime={} endTime = {}", module.getId(), startTimeConfig, endTimeConfig); return false; } LocalTime currentTime = LocalTime.now().truncatedTo(ChronoUnit.MINUTES); LocalTime startTime = LocalTime.parse(startTimeConfig).truncatedTo(ChronoUnit.MINUTES); LocalTime endTime = LocalTime.parse(endTimeConfig).truncatedTo(ChronoUnit.MINUTES); if (currentTime.equals(startTime)) { logger.debug("Time condition with id evaluated, that the current time equals the start time: {}", module.getId(), currentTime, startTime); return true; } if (startTime.isBefore(endTime)) { if (currentTime.isAfter(startTime) && currentTime.isBefore(endTime)) { logger.debug("Time condition with id evaluated, that is between and {}.", module.getId(), currentTime, startTime, endTime); return true; } } else if (currentTime.isAfter(LocalTime.MIDNIGHT) && currentTime.isBefore(endTime) || currentTime.isAfter(startTime) && currentTime.isBefore(LocalTime.MAX)) { logger.debug("Time condition with id evaluated, that is between and {}, or between and {}.", module.getId(), currentTime, LocalTime.MIDNIGHT, endTime, startTime, LocalTime.MAX.truncatedTo(ChronoUnit.MINUTES)); return true; } return false; }

Target:
public boolean isSatisfied(Map<String, Object> inputs) { if (startTime == null || endTime == null) { logger.warn("Time condition with id is not well configured: startTime={} endTime = {}", module.getId(), startTime, endTime); return false; } LocalTime currentTime = LocalTime.now().truncatedTo(ChronoUnit.MINUTES); if (currentTime.equals(startTime)) { logger.debug("Time condition with id evaluated, that the current time equals the start time: {}", module.getId(), currentTime, startTime); return true; } if (startTime.isBefore(endTime)) { if (currentTime.isAfter(startTime) && currentTime.isBefore(endTime)) { logger.debug("Time condition with id evaluated, that is between and {}.", module.getId(), currentTime, startTime, endTime); return true; } } else if (currentTime.isAfter(LocalTime.MIDNIGHT) && currentTime.isBefore(endTime) || currentTime.isAfter(startTime) && currentTime.isBefore(LocalTime.MAX)) { logger.debug("Time condition with id evaluated, that is between and {}, or between and {}.", module.getId(), currentTime, LocalTime.MIDNIGHT, endTime, startTime, LocalTime.MAX.truncatedTo(ChronoUnit.MINUTES)); return true; } return false; }
Source:
public void openAboutPage(){ String userGuideUrl = "<LINK_0>"; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(userGuideUrl)); startActivity(intent); }

Target:
public void openAboutPage(){ String userGuideUrl = ApplicationConstants.USER_GUIDE; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(userGuideUrl)); startActivity(intent); }
Source:
public void DeleteAndRestoreMapTests_007_SysOpCanRestoreMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore); selectedMap.verifyMapOpened(); selectedMap.verifyMapDeletedMsg(); selectedMap.restoreMap(); selectedMap.verifyMapDeletedMsgNotVisible(); }

Target:
public void DeleteAndRestoreMapTests_007_SysOpCanRestoreMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore[3]); selectedMap.verifyMapOpened(); selectedMap.restoreMap(); }
Source:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (!baseRequest.isHandled()) { m_log.debug("Failed to process static resource: " + Paths.get(getResourceBase())); } }

Target:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (!baseRequest.isHandled() && m_log.isDebugEnabled()) { m_log.debug("Failed to process static resource: " + Paths.get(getResourceBase())); } }
Source:
static Swagger loadSpecificationFrom(final CamelContext camelContext, final URI uri, SSLContextParameters sslContextParameters) throws IOException { final ObjectMapper mapper = Json.mapper(); final SwaggerParser swaggerParser = new SwaggerParser(); final String uriAsString = uri.toString(); if (sslContextParameters == null) { try (InputStream stream = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uriAsString)) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFalback(swaggerParser, uriAsString, e); } } HttpComponent httpComponent = new HttpComponent(); httpComponent.setSslContextParameters(sslContextParameters); httpComponent.setCamelContext(camelContext); HttpRequestBase httpRequest = createMethod(uriAsString); try (HttpEndpoint e = (HttpEndpoint)httpComponent.createEndpoint(uriAsString); HttpProducer p = (HttpProducer)e.createProducer(); InputStream stream = p.getHttpClient().execute(httpRequest).getEntity().getContent()) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } }

Target:
static Swagger loadSpecificationFrom(final CamelContext camelContext, final URI uri, SSLContextParameters sslContextParameters) throws IOException { final ObjectMapper mapper = Json.mapper(); final SwaggerParser swaggerParser = new SwaggerParser(); final String uriAsString = uri.toString(); if (sslContextParameters == null) { try (InputStream stream = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uriAsString)) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } } HttpComponent httpComponent = new HttpComponent(); httpComponent.setSslContextParameters(sslContextParameters); httpComponent.setCamelContext(camelContext); try (HttpEndpoint e = (HttpEndpoint)httpComponent.createEndpoint(uriAsString); HttpProducer p = (HttpProducer)e.createProducer(); InputStream stream = p.getHttpClient().execute(new HttpGet(uri)).getEntity().getContent()) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } }
Source:
public Volume apply(ServerDrive serverDrive) { VolumeBuilder builder = new VolumeBuilder(); DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid()); builder.id(driveInfo.getUuid()); builder.size(driveInfo.getSize().floatValue()); builder.durable(true); builder.type(Volume.Type.NAS); builder.bootDevice(serverDrive.getBootOrder() > 0); return builder.build(); }

Target:
public Volume apply(ServerDrive serverDrive) { VolumeBuilder builder = new VolumeBuilder(); DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid()); builder.id(driveInfo.getUuid()); builder.size(driveInfo.getSize().floatValue()); builder.durable(true); builder.type(Volume.Type.NAS); builder.bootDevice(serverDrive.getBootOrder() != null); return builder.build(); }
Source:
protected AllTenantOperation(TenantIndex tenantIndex) { this.tenantIndex = tenantIndex; }

Target:
protected AllTenantOperation(TenantIndex tenantIndex) { checkNotNull(tenantIndex); this.tenantIndex = tenantIndex; }
Source:
private void initUnregisteredVM() { VM vmFromConfiguration; ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { OvfHelper ovfHelper = new OvfHelper(); vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } } }

Target:
private void initUnregisteredVM() { VM vmFromConfiguration = null; OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } }
Source:
private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileStatus latestUpdatedStatus = null; FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); if (statuses.length > 0) { for (FileStatus status : statuses) { if (latestUpdatedStatus == null) { latestUpdatedStatus = validDump(status.getPath()) ? status : null; } else if (validDump(status.getPath()) && status.getModificationTime() > latestUpdatedStatus.getModificationTime()) { latestUpdatedStatus = status; } } } } return latestUpdatedStatus != null ? latestUpdatedStatus.getPath() : null; }

Target:
private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileStatus latestValidStatus = null; FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); for (FileStatus status : statuses) { LOG.info("Evaluating previous dump dir path:{}", status.getPath()); if (latestValidStatus == null) { latestValidStatus = validDump(fs, status.getPath()) ? status : null; } else if (validDump(fs, status.getPath()) && status.getModificationTime() > latestValidStatus.getModificationTime()) { latestValidStatus = status; } } } Path latestDumpDir = (latestValidStatus == null) ? null : new Path(latestValidStatus.getPath(), ReplUtils.REPL_HIVE_BASE_DIR); LOG.info("Selecting latest valid dump dir as {}", (latestDumpDir == null) ? "null" : latestDumpDir.toString()); return latestDumpDir; }