auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Test public void injectingView() { final JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import android.view.View;", "import butterknife.InjectView;", "public class Test extends Activity {", " @InjectView(1) View thing;", "}")); ASSERT.about(javaSource()).that(source) .processedWith(butterknifeProcessors()) .compilesWithoutError(); }

Target:
public void injectingView() { final JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import android.view.View;", "import butterknife.InjectView;", "public class Test extends Activity {", " @InjectView(1) View thing;", "}")); ASSERT.about(javaSource()).that(source) .processedWith(butterknifeProcessors()) .compilesWithoutError(); }
Source:
private Deposit publishDepositOnZenodo(ActionsApi actionsApi, int depositionID) { Deposit publishedDeposit; try { publishedDeposit = actionsApi.publishDeposit(depositionID); } catch (ApiException e) { LOG.error("Could not publish DOI on Zenodo. Error is " + e.getMessage()); throw new CustomWebApplicationException("Could not publish DOI on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return publishedDeposit; }

Target:
private Deposit publishDepositOnZenodo(ActionsApi actionsApi, int depositionID) { Deposit publishedDeposit; try { publishedDeposit = actionsApi.publishDeposit(depositionID); } catch (ApiException e) { LOG.error("Could not publish DOI on Zenodo. Error is " + e.getMessage(), e); throw new CustomWebApplicationException("Could not publish DOI on Zenodo." + " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } return publishedDeposit; }
Source:
public void walk(Consumer<Node> consumer) { new TreeVisitor() { @Override public void process(Node node) { consumer.accept(node); } }.visitPreOrder(this); }

Target:
public void walk(Consumer<Node> consumer) { walk(PREORDER, consumer); }
Source:
private AccessibilityManager getAccessibilityManagerInstance() throws Exception { return ReflectionHelpers.callStaticMethod(AccessibilityManager.class, "getInstance", ReflectionHelpers.ClassParameter.from(Context.class, RuntimeEnvironment.application)); }

Target:
private static AccessibilityManager getAccessibilityManagerInstance() throws Exception { return ReflectionHelpers.callStaticMethod(AccessibilityManager.class, "getInstance", ReflectionHelpers.ClassParameter.from(Context.class, RuntimeEnvironment.application)); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _data.hashCode(); return result; }

Target:
public int hashCode() { int hash = getClass().hashCode(); hash += hash * 31 + JodaBeanUtils.hashCode(getData()); return hash; }
Source:
public <K, V, S extends Enum<S>, T extends Enum<T>> org.ehcache.core.statistics.OperationStatistic<T> registerStoreStatistics(Store<K, V> store, String targetName, int tierHeight, String tag, Map<T, Set<S>> translation, String statisticName) { Class<S> outcomeType = getOutcomeType(translation); if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { MappedOperationStatistic<S, T> operationStatistic = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, tag); StatisticsManager.associate(operationStatistic).withParent(store); org.ehcache.core.statistics.OperationStatistic<T> stat = new DelegatedMappedOperationStatistics<>(operationStatistic); return stat; } return ZeroOperationStatistic.get(); }

Target:
public <K, V, S extends Enum<S>, T extends Enum<T>> OperationStatistic<T> registerStoreStatistics(Store<K, V> store, String targetName, int tierHeight, String tag, Map<T, Set<S>> translation, String statisticName) { Class<S> outcomeType = getOutcomeType(translation); if (StatsUtils.hasOperationStat(store, outcomeType, targetName)) { MappedOperationStatistic<S, T> operationStatistic = new MappedOperationStatistic<>(store, translation, statisticName, tierHeight, targetName, tag); StatisticsManager.associate(operationStatistic).withParent(store); return new DelegatedMappedOperationStatistics<>(operationStatistic); } else { return ZeroOperationStatistic.get(); } }
Source:
private static Set<ArtifactRef> handleDependencies( MavenSessionHandler session, Project project, Profile profile, Type type ) throws ManipulationUncheckedException { try { switch (type) { case DEPENDENCIES: { return project.getResolvedDependencies( session ).keySet(); } case MANAGED_DEPENDENCIES: { return project.getResolvedManagedDependencies( session ).keySet(); } case PROFILE_DEPENDENCIES: { return project.getResolvedProfileDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case PROFILE_MANAGED_DEPENDENCIES: { return project.getResolvedProfileManagedDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedDependencies( session ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } case PROFILE_DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedProfileDependencies( session ). getOrDefault( profile, Collections.emptyMap() ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } default: { throw new ManipulationException( "Invalid type {}", type.toString() ); } } } catch ( ManipulationException e ) { throw new ManipulationUncheckedException( e ); } }

Target:
private static Set<ArtifactRef> handleDependencies( MavenSessionHandler session, Project project, Profile profile, Type type ) throws ManipulationUncheckedException { try { switch (type) { case DEPENDENCIES: { return project.getResolvedDependencies( session ).keySet(); } case MANAGED_DEPENDENCIES: { return project.getResolvedManagedDependencies( session ).keySet(); } case PROFILE_DEPENDENCIES: { return project.getResolvedProfileDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case PROFILE_MANAGED_DEPENDENCIES: { return project.getResolvedProfileManagedDependencies( session ).getOrDefault( profile, Collections.emptyMap() ).keySet(); } case DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedDependencies( session ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } case PROFILE_DEPENDENCIES_UNVERSIONED: { return project.getAllResolvedProfileDependencies( session ). getOrDefault( profile, Collections.emptyMap() ). keySet().stream().filter( a -> a.getVersionString().equals( "*" ) ).collect( Collectors.toSet() ); } default: { throw new ManipulationException( "Invalid type {}", type ); } } } catch ( ManipulationException e ) { throw new ManipulationUncheckedException( e ); } }
Source:
public String protocolId() { OLSyntaxNode p = this.protocol; if( p instanceof SumExpressionNode ) { OLSyntaxNode prodVal = ((SumExpressionNode) protocol).operands().iterator().next().value(); p = ((ProductExpressionNode) prodVal).operands().iterator().next().value(); } if( p instanceof InlineTreeExpressionNode ) { return ((InlineTreeExpressionNode) p) .rootExpression().toString(); } else { return p.toString(); } }

Target:
public String protocolId() { return PortInfo.extractProtocolId( this.protocol ); }
Source:
public static Timestamp epoch() { return new Timestamp(0); }

Target:
public static Timestamp epoch() { return Timestamp.fromMicros(-1); }
Source:
public void compactAll(long compactionId, UserCompactionConfig compactionConfig) { boolean updateMetadata = false; synchronized (this) { if (lastCompactID >= compactionId && compactionConfig.getIterators().isEmpty()) return; if (isMinorCompactionRunning()) { if (compactionWaitInfo.compactionID == compactionId) { if (lastFlushID == compactionWaitInfo.flushID) return; } else { compactionWaitInfo.compactionID = compactionId; compactionWaitInfo.flushID = lastFlushID; return; } } if (isClosing() || isClosed() || majorCompactionQueued.contains(MajorCompactionReason.USER) || isMajorCompactionRunning()) return; if (getDatafileManager().getDatafileSizes().size() == 0) { updateMetadata = true; lastCompactID = compactionId; } { CompactionStrategyConfig strategyConfig = compactionConfig.getCompactionStrategy(); CompactionStrategy strategy = createCompactionStrategy(strategyConfig); MajorCompactionRequest request = new MajorCompactionRequest(extent, MajorCompactionReason.USER, getTabletServer().getFileSystem(), tableConfiguration); request.setFiles(getDatafileManager().getDatafileSizes()); try { if (strategy.shouldCompact(request)) { initiateMajorCompaction(MajorCompactionReason.USER); } else { majorCompactionState = CompactionState.IN_PROGRESS; updateMetadata = true; lastCompactID = compactionId; } } catch (IOException e) { throw new RuntimeException(e); } } } if (updateMetadata) { try { MetadataTableUtil.updateTabletCompactID(extent, compactionId, getTabletServer(), getTabletServer().getLock()); } finally { synchronized (this) { majorCompactionState = null; this.notifyAll(); } } } }

Target:
public void compactAll(long compactionId, UserCompactionConfig compactionConfig) { boolean updateMetadata = false; synchronized (this) { if (lastCompactID >= compactionId) return; if (isMinorCompactionRunning()) { if (compactionWaitInfo.compactionID == compactionId) { if (lastFlushID == compactionWaitInfo.flushID) return; } else { compactionWaitInfo.compactionID = compactionId; compactionWaitInfo.flushID = lastFlushID; return; } } if (isClosing() || isClosed() || majorCompactionQueued.contains(MajorCompactionReason.USER) || isMajorCompactionRunning()) return; CompactionStrategyConfig strategyConfig = compactionConfig.getCompactionStrategy(); CompactionStrategy strategy = createCompactionStrategy(strategyConfig); MajorCompactionRequest request = new MajorCompactionRequest(extent, MajorCompactionReason.USER, getTabletServer().getFileSystem(), tableConfiguration); request.setFiles(getDatafileManager().getDatafileSizes()); try { if (strategy.shouldCompact(request)) { initiateMajorCompaction(MajorCompactionReason.USER); } else { majorCompactionState = CompactionState.IN_PROGRESS; updateMetadata = true; lastCompactID = compactionId; } } catch (IOException e) { throw new RuntimeException(e); } } if (updateMetadata) { try { MetadataTableUtil.updateTabletCompactID(extent, compactionId, getTabletServer(), getTabletServer().getLock()); } finally { synchronized (this) { majorCompactionState = null; this.notifyAll(); } } } }
Source:
public MenuItem add(int groupId, int itemId, int order, int titleRes) { return add(groupId, itemId, order, RuntimeEnvironment.application.getResources().getString(titleRes)); }

Target:
public MenuItem add(int groupId, int itemId, int order, int titleRes) { return add(groupId, itemId, order, context.getResources().getString(titleRes)); }
Source:
public void logging(IStatus status, String plugin) { Throwable statusException = status.getException(); if (statusException instanceof AssertionFailedException) { failedAssertions.add((AssertionFailedException) statusException); } }

Target:
public void logging(IStatus status, String plugin) { Throwable statusException = status.getException(); loggedExceptions.add(statusException); }
Source:
public ViewEventRest createViewEvent() throws AuthorizeException, SQLException { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); ViewEventRest viewEventRest = null; try { ServletInputStream input = req.getInputStream(); viewEventRest = mapper.readValue(input, ViewEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } if (viewEventRest.getTargetId() == null || StringUtils.isBlank(viewEventRest.getTargetType()) || !Arrays.asList(Constants.typeText).contains(viewEventRest.getTargetType().toUpperCase())) { throw new DSpaceBadRequestException("The given ViewEvent was invalid, one or more properties are either" + "wrong or missing"); } DSpaceObjectService dSpaceObjectService = ContentServiceFactory.getInstance().getDSpaceObjectService( Constants.getTypeID(viewEventRest.getTargetType().toUpperCase(Locale.getDefault()))); DSpaceObject dSpaceObject = dSpaceObjectService.find(context, viewEventRest.getTargetId()); if (dSpaceObject == null) { throw new UnprocessableEntityException( "The given targetId does not resolve to a DSpaceObject: " + viewEventRest.getTargetId()); } UsageEvent usageEvent = new UsageEvent(UsageEvent.Action.VIEW, req, context, dSpaceObject); eventService.fireEvent(usageEvent); return viewEventRest; }

Target:
public ViewEventRest createViewEvent() throws AuthorizeException, SQLException { Context context = obtainContext(); HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); ViewEventRest viewEventRest = null; try { ServletInputStream input = req.getInputStream(); viewEventRest = mapper.readValue(input, ViewEventRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body", e1); } if (viewEventRest.getTargetId() == null || StringUtils.isBlank(viewEventRest.getTargetType()) || !typeList.contains(viewEventRest.getTargetType().toUpperCase())) { throw new DSpaceBadRequestException("The given ViewEvent was invalid, one or more properties are either" + "wrong or missing"); } DSpaceObjectService dSpaceObjectService = ContentServiceFactory.getInstance().getDSpaceObjectService( Constants.getTypeID(viewEventRest.getTargetType().toUpperCase(Locale.getDefault()))); DSpaceObject dSpaceObject = dSpaceObjectService.find(context, viewEventRest.getTargetId()); if (dSpaceObject == null) { throw new UnprocessableEntityException( "The given targetId does not resolve to a DSpaceObject: " + viewEventRest.getTargetId()); } UsageEvent usageEvent = new UsageEvent(UsageEvent.Action.VIEW, req, context, dSpaceObject); eventService.fireEvent(usageEvent); return viewEventRest; }
Source:
private void reapFiles() { FileReader tmpFileReader = null; try { tmpFileReader = new FileReader(LAUNCHER_TMP_FILE_LIST); List fileList = IOUtils.readLines(tmpFileReader); Set<String> fileSet = new HashSet<>(fileList); for (String fileName : fileSet) { File file = new File(fileName); FileUtils.deleteQuietly(file); File depsDir = new File("data", fileName); FileUtils.deleteQuietly(depsDir); if (!file.exists() && !depsDir.exists()) { fileList.remove(fileName); } } writeToFile(fileList, false); } catch (Exception e) { } finally { IOUtils.closeQuietly(tmpFileReader); } }

Target:
private void reapFiles() { FileReader tmpFileReader = null; try { tmpFileReader = new FileReader(LAUNCHER_TMP_FILE_LIST); List fileList = IOUtils.readLines(tmpFileReader); Set<String> fileSet = new HashSet<>(fileList); for (String fileName : fileSet) { File file = new File(fileName); FileUtils.deleteQuietly(file); File depsDir = new File(FileUtil.TMP_PARENT_DIR, fileName); FileUtils.deleteQuietly(depsDir); if (!file.exists() && !depsDir.exists()) { fileList.remove(fileName); } } writeToFile(fileList, false); } catch (Exception e) { } finally { IOUtils.closeQuietly(tmpFileReader); } }
Source:
private boolean sessionStateUnchangedSinceCallout(CommCareSession session, Intent intent) { boolean dataIdsEqual = session.getNeededData().equals( intent.getStringExtra(KEY_PENDING_SESSION_DATA)); String intentDatum = intent.getStringExtra(KEY_PENDING_SESSION_DATUM_ID); boolean datumIdsEqual = intentDatum == null ? true : intentDatum.equals(session.getNeededDatum().getDataId()); return dataIdsEqual && datumIdsEqual; }

Target:
private boolean sessionStateUnchangedSinceCallout(CommCareSession session, Intent intent) { boolean neededDataUnchanged = session.getNeededData().equals( intent.getStringExtra(KEY_PENDING_SESSION_DATA)); String intentDatum = intent.getStringExtra(KEY_PENDING_SESSION_DATUM_ID); boolean datumIdsUnchanged = intentDatum == null ? true : intentDatum.equals(session.getNeededDatum().getDataId()); return neededDataUnchanged && datumIdsUnchanged; }
Source:
private static boolean isV45PlusInstalled(int minor, IJIWinReg registry, JIPolicyHandle hklm) throws JIException { JIPolicyHandle key = null; try { key = registry.winreg_OpenKey(hklm, PATH4, IJIWinReg.KEY_READ); return RegistryKey.convertBufferToInt((byte[])registry.winreg_QueryValue(key, VALUE_RELEASE, 4)[1]) >= GetV45PlusMinRelease(minor); } finally { if (key != null) { registry.winreg_CloseKey(key); } } }

Target:
private static boolean isV45PlusInstalled(int minor, IJIWinReg registry, JIPolicyHandle hklm) throws JIException { JIPolicyHandle key = null; try { key = registry.winreg_OpenKey(hklm, PATH4, IJIWinReg.KEY_READ); return GetIntValue(registry, key, VALUE_RELEASE) >= GetV45PlusMinRelease(minor); } finally { if (key != null) { registry.winreg_CloseKey(key); } } }
Source:
public void serviceIsNewIfNoDataDirectoriesPresent() { ImmutablePaxosInstallConfiguration.Builder partialConfiguration = createPartialConfiguration( fileSubdirectory, sqliteSubdirectory); assertThatCode(() -> partialConfiguration.isNewService(true).build()).doesNotThrowAnyException(); assertThatThrownBy(() -> partialConfiguration.isNewService(false).build()) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("The timelock data directories do not appear to exist."); }

Target:
public void serviceIsNewIfNoDataDirectoriesPresent() { ImmutablePaxosInstallConfiguration.Builder partialConfiguration = createPartialConfiguration( nonexistentFileDirectory, nonexistentSqliteDirectory); assertIsNewService(partialConfiguration); }
Source:
public void setMobileAnimation(boolean mobileAnimation) { this.mobileAnimation = mobileAnimation; }

Target:
public ChosenOptions setMobileAnimation(boolean mobileAnimation) { this.mobileAnimation = mobileAnimation; return this; }
Source:
public void onAcknowledgement() { removePendingRequest(registrationId, coapRequest); }

Target:
public void onAcknowledgement() { removePendingRequest(requestKey, coapRequest); }
Source:
public TcpSlaveAgentListener(int port) throws IOException { super("TCP agent listener port="+port); try { serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(new InetSocketAddress(port)); } catch (BindException e) { throw (BindException)new BindException("Failed to listen on port "+port+" because it's already in use.").initCause(e); } this.configuredPort = port; setUncaughtExceptionHandler((t, e) -> { LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + t, e); shutdown(); }); LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort()); start(); }

Target:
public TcpSlaveAgentListener(int port) throws IOException { super("TCP agent listener port="+port); try { serverSocket = ServerSocketChannel.open(); serverSocket.socket().bind(new InetSocketAddress(port)); } catch (BindException e) { throw (BindException)new BindException("Failed to listen on port "+port+" because it's already in use.").initCause(e); } this.configuredPort = port; setUncaughtExceptionHandler((t, e) -> { LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + t + ", attempting to reschedule thread", e); shutdown(); TcpSlaveAgentListenerRescheduler.schedule(t, port, e); }); LOGGER.log(Level.FINE, "TCP agent listener started on port {0}", getPort()); start(); }
Source:
protected void visit( final AttributeDescr descr ) { String attr = descr.getName(); switch(attr) { case "salience": case "dialect": return; } PartType type = PartType.getPartTypeFromAttribueDescrName(descr.getName()); switch(type) { case AGENDA_GROUP: case ACTIVATION_GROUP: case RULEFLOW_GROUP: case ENTRY_POINT: SharedPart sharedRef = new SharedPart(descr.getValue(), type); builder.addGenerator( sharedRef ); break; default: throw new UnsupportedOperationException("Unsupported attribute encountered: " + descr.getName() ); } }

Target:
protected void visit( final AttributeDescr descr ) { String attr = descr.getName(); switch(attr) { case "no-loop": case "lock-on-active": case "salience": case "auto-focus": case "dialect": case "date-effective": case "date-expires": case "enabled": case "duration": case "timer": case "calendars": return; } PartType type = PartType.getPartTypeFromAttribueDescrName(descr.getName()); switch(type) { case AGENDA_GROUP: case ACTIVATION_GROUP: case RULEFLOW_GROUP: SharedPart sharedRef = new SharedPart(descr.getValue(), type); builder.addGenerator( sharedRef ); break; default: throw new UnsupportedOperationException("Unsupported attribute encountered: " + descr.getName() ); } }
Source:
public boolean isSymmetric() { if (numRows() == numCols()) { int size = numRows(); for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { double ratio = elementAt(i, j) / elementAt(j, i); if (Math.abs(ratio - 1) > 1e-6) { return false; } } } } return false; }

Target:
public boolean isSymmetric() { if (numRows() == numCols()) { int size = numRows(); for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { double ratio = elementAt(i, j) / elementAt(j, i); if (Util.closeToZero(ratio - 1)) { return false; } } } } return true; }
Source:
public CustomEvent(CustomTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) { super(parentTrace, timestamp, source, type, null, reference); fDefinition = definition; fData = new HashMap<String, String>(); }

Target:
public CustomEvent(CustomTraceDefinition definition, ITmfTrace parentTrace, ITmfTimestamp timestamp, String source, TmfEventType type, String reference) { super(parentTrace, null, source, null, null, reference); fDefinition = definition; fData = new HashMap<String, String>(); customEventTimestamp = timestamp; customEventContent = null; customEventType = type; }
Source:
public FluentIterable<ScalingPolicyResponse> apply(HttpResponse from) { Map<String, List<Map<String, Object>>> singleMap = (Map<String, List<Map<String, Object>>>) json.apply(from); List<Map<String, Object>> result = singleMap.get("policies"); List<ScalingPolicyResponse> scalingPoliciesList = Lists.newArrayList(); for(Map<String, Object> scalingPolicyMap : result) { ScalingPolicyTargetType targetType = null; for(String key : scalingPolicyMap.keySet()) { if(ScalingPolicyTargetType.getByValue(key).isPresent()) { targetType = ScalingPolicyTargetType.getByValue(key).get(); break; } } List<Link> links = Lists.newArrayList(); for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) { Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build(); links.add(link); } Double d = (Double)scalingPolicyMap.get(targetType.toString()); ScalingPolicyResponse scalingPolicyResponse = new ScalingPolicyResponse( (String)scalingPolicyMap.get("name"), ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(), ((Double)scalingPolicyMap.get("cooldown")).intValue(), Math.floor(d) == d ? Integer.toString(d.intValue()) : Double.toString(d), targetType, ImmutableList.copyOf(links), (String) scalingPolicyMap.get("id") ); scalingPoliciesList.add(scalingPolicyResponse); } return FluentIterable.from(scalingPoliciesList); }

Target:
public FluentIterable<ScalingPolicyResponse> apply(HttpResponse from) { Map<String, List<Map<String, Object>>> singleMap = (Map<String, List<Map<String, Object>>>) json.apply(from); List<Map<String, Object>> result = singleMap.get("policies"); ImmutableList.Builder<ScalingPolicyResponse> scalingPoliciesList = ImmutableList.builder(); for(Map<String, Object> scalingPolicyMap : result) { ScalingPolicyTargetType targetType = null; for(String key : scalingPolicyMap.keySet()) { if(ScalingPolicyTargetType.getByValue(key).isPresent()) { targetType = ScalingPolicyTargetType.getByValue(key).get(); break; } } ImmutableList.Builder<Link> links = ImmutableList.builder(); for(Map<String, String> linkMap : (List<Map<String, String>>) scalingPolicyMap.get("links")) { Link link = Link.builder().href(URI.create(linkMap.get("href"))).relation(Relation.fromValue(linkMap.get("rel"))).build(); links.add(link); } Double d = (Double)scalingPolicyMap.get(targetType.toString()); ScalingPolicyResponse scalingPolicyResponse = new ScalingPolicyResponse( (String)scalingPolicyMap.get("name"), ScalingPolicyType.getByValue((String)scalingPolicyMap.get("type")).get(), ((Double)scalingPolicyMap.get("cooldown")).intValue(), DoubleMath.isMathematicalInteger(d) ? Integer.toString(d.intValue()) : Double.toString(d), targetType, ImmutableList.copyOf(links.build()), (String) scalingPolicyMap.get("id") ); scalingPoliciesList.add(scalingPolicyResponse); } return FluentIterable.from(scalingPoliciesList.build()); }
Source:
public Map<RGB, Integer> getHistogram() { Map<RGB, Integer> colors = new HashMap<>(); for (int pixel : fPixels) { RGB pixelColor = getRgbFromRGBPixel(pixel); Integer pixelCount = colors.get(pixelColor); Integer val = pixelCount == null ? 1 : Integer.valueOf(pixelCount.intValue() + 1); colors.put(pixelColor, val); } return colors; }

Target:
public Multiset<RGB> getHistogram() { Multiset<RGB> colors = HashMultiset.create(); for (int pixel : fPixels) { RGB pixelColor = getRgbFromRGBPixel(pixel); colors.add(pixelColor); } return colors; }
Source:
public RecentChangeResponse fetchRecentChanges(Date nextStartTime, Continue lastContinue, int batchSize) throws RetryableException { URI uri = uris.recentChanges(nextStartTime, lastContinue, batchSize); log.debug("Polling for changes from {}", uri); try { return checkApi(getJson(new HttpGet(uri), RecentChangeResponse.class)); } catch (UnknownHostException | SocketException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RetryableException("Error fetching recent changes", e); } }

Target:
public RecentChangeResponse fetchRecentChanges(Date nextStartTime, Continue lastContinue, int batchSize) throws RetryableException { URI uri = uris.recentChanges(nextStartTime, lastContinue, batchSize); log.debug("Polling for changes from {}", uri); try { return checkApi(getJson(new HttpGet(uri), RecentChangeResponse.class)); } catch (UnknownHostException | SocketException e) { throw new RuntimeException(e); } catch (JsonParseException | JsonMappingException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RetryableException("Error fetching recent changes", e); } }
Source:
public Brew(int color, int cost, EffectInstance... effects) { this.color = () -> color; this.cost = cost; this.effects = () -> ImmutableList.copyOf(effects); }

Target:
public Brew(int color, int cost, EffectInstance... effects) { this.color = () -> color; this.cost = cost; List<EffectInstance> savedEffects = ImmutableList.copyOf(effects); this.effects = () -> savedEffects; }
Source:
public static void updateName(final UserProfile profile) { final Site site = profile.getPerson().getHomepage(); if (site != null) { site.setName(new LocalizedString(I18N.getLocale(), profile.getDisplayName())); } }

Target:
public static void updateName(final UserProfile profile) { final Person person = profile.getPerson(); if (person != null) { final Site site = person.getHomepage(); if (site != null) { site.setName(new LocalizedString(I18N.getLocale(), profile.getDisplayName())); } } }
Source:
public DenseLocalDateDoubleTimeSeries filter(ObjDoublePredicate<LocalDate> predicate) { DoubleStream filtered = IntStream.range(0, points.length) .mapToDouble(i -> isValidPoint(points[i]) && predicate.test(dateCalculation.calculateDateFromPosition(startDate, i), points[i]) ? points[i] : Double.NaN); return DenseLocalDateDoubleTimeSeries.of(startDate, filtered, dateCalculation); }

Target:
public LocalDateDoubleTimeSeries filter(ObjDoublePredicate<LocalDate> predicate) { Stream<LocalDateDoublePoint> filteredPoints = stream().filter(pt -> predicate.test(pt.getDate(), pt.getValue())); return new LocalDateDoubleTimeSeriesBuilder(filteredPoints).build(); }
Source:
public void onNext(T t) { List<T> b = buffer; if (b == null) { b = new ArrayList<T>(); buffer = b; } b.add(t); if (b.size() == count) { buffer = null; actual.onNext(b); } }

Target:
public void onNext(T t) { List<T> b = buffer; if (b == null) { b = new ArrayList<T>(count); buffer = b; } b.add(t); if (b.size() == count) { buffer = null; actual.onNext(b); } }
Source:
public int hashCode() { return ingestionSpec.hashCode(); }

Target:
public int hashCode() { int result = ingestionSpec.hashCode(); result = 31 * result + (int) (maxSplitSize ^ (maxSplitSize >>> 32)); result = 31 * result + (segments != null ? segments.hashCode() : 0); return result; }
Source:
public Filter deserialize (JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); ObjectNode root = mapper.readTree(parser); Class<? extends Filter> filterClass = null; List<String> invalidAttributes = new ArrayList<>(); for (String fieldName: ImmutableList.copyOf(root.fieldNames())) { switch(fieldName) { case LinkAttributeFilter.LINK_ATTRIBUTE: if (null != filterClass) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkAttributeFilter.class; break; case LinkNameFilter.LINK_NAME: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; break; case LinkNameFilter.LINK_URL: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; break; case Filter.VISIBLE: break; default: invalidAttributes.add(fieldName); } } if (!invalidAttributes.isEmpty()) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_INVALID_JSON_TAG + invalidAttributes, parser.getCurrentLocation()); } if (null == filterClass) { filterClass = AcceptAllFilter.class; } return mapper.readValue(root.traverse(), filterClass); }

Target:
public Filter deserialize (JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectMapper mapper = (ObjectMapper) parser.getCodec(); ObjectNode root = mapper.readTree(parser); Class<? extends Filter> filterClass = null; List<String> invalidAttributes = new ArrayList<>(); for (String fieldName: ImmutableList.copyOf(root.fieldNames())) { switch(fieldName) { case LinkAttributeFilter.LINK_ATTRIBUTE: if (null != filterClass) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkAttributeFilter.class; break; case LinkNameFilter.LINK_NAME: case LinkNameFilter.LINK_URL: if (null != filterClass && !filterClass.equals(LinkNameFilter.class)) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_AMBIGUOUS_FILTER, parser.getCurrentLocation()); } filterClass = LinkNameFilter.class; break; case Filter.VISIBLE: break; default: invalidAttributes.add(fieldName); } } if (!invalidAttributes.isEmpty()) { throw new JsonParseException(parser, PARSE_ERROR_MESSAGE_INVALID_JSON_TAG + invalidAttributes, parser.getCurrentLocation()); } if (null == filterClass) { filterClass = AcceptAllFilter.class; } return mapper.readValue(root.traverse(), filterClass); }
Source:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { parameterCollector.accept(requireValidFile); super.collectParameters(parameterCollector); }

Target:
protected void collectParameters(Consumer<Parameter<?, ?>> parameterCollector) { if (getXsdResourcePath() != null) { parameterCollector.accept(requireValidFile); } super.collectParameters(parameterCollector); }
Source:
public float getRailMaxSpeed(World world, EntityMinecart cart, BlockPos pos) { TileEntity tile = WorldPlugin.getBlockTile(world, pos); if (tile instanceof TileTrackOutfitted) return ((TileTrackOutfitted) tile).getTrackKitInstance().getRailMaxSpeed(world, cart, pos, ((TileTrackOutfitted) tile).getTrackType()); return 0.4f; }

Target:
public float getRailMaxSpeed(World world, EntityMinecart cart, BlockPos pos) { TileEntity tile = WorldPlugin.getBlockTile(world, pos); if (tile instanceof TileTrackOutfitted) return ((TileTrackOutfitted) tile).getTrackKitInstance().getRailMaxSpeed(world, cart, pos); return 0.4f; }
Source:
public Collection<Field> getFields() { return fields.values(); }

Target:
public Map<String, Field> getFields() { return fields; }
Source:
protected void doExecute() { for (Stereotype stereotype : stereotypes) { element.unapplyStereotype(stereotype); element.eNotify(new NotificationImpl(Notification.SET, true, true, true)); } }

Target:
protected void doExecute() { for (Stereotype stereotype : stereotypes) { element.unapplyStereotype(stereotype); } }
Source:
public static List<String> unwrapJsonishListIfPossible(String input) { try { return unwrapOptionallyQuotedJavaStringList(input); } catch (Exception e) { return MutableList.of(input); } }

Target:
public static List<String> unwrapJsonishListIfPossible(String input) { try { return unwrapOptionallyQuotedJavaStringList(input); } catch (Exception e) { Exceptions.propagateIfFatal(e); if (e instanceof IllegalArgumentException) { if (log.isDebugEnabled()) log.debug("Unable to parse JSON list '"+input+"' ("+e+"); treating as single-element string list"); } else { log.warn("Unable to parse JSON list '"+input+"' ("+e+"); treating as single-element string list", e); } return MutableList.of(input); } }
Source:
public void setEndTime(LocalDateTime endTime) { this.endTime = endTime; if (dayActivity != null) { dayActivity.resetAggregatesComputed(); } }

Target:
public void setEndTime(LocalDateTime endTime) { this.endTime = endTime; dayActivity.resetAggregatesComputed(); }
Source:
public void testLockedStream() throws Throwable { for (int i = 0; i < 10; i++) { cache.put(i, "value" + i); } CyclicBarrier barrier = new CyclicBarrier(2); int key = 4; LockedStream<Object, Object> stream = cache.getAdvancedCache().lockedStream(); Future<?> forEachFuture = fork(() -> stream.forEach((c, e) -> { if (e.getKey().equals(key)) { try { barrier.await(10, TimeUnit.SECONDS); assertEquals("value" + key, c.put(e.getKey(), String.valueOf(e.getValue() + "-other"))); barrier.await(10, TimeUnit.SECONDS); } catch (InterruptedException | BrokenBarrierException | TimeoutException e1) { throw new RuntimeException(e1); } } })); barrier.await(10, TimeUnit.SECONDS); Future<Object> putFuture = fork(() -> cache.put(key, "value" + key + "-new")); try { putFuture.get(50, TimeUnit.MILLISECONDS); fail("Test should have thrown TimeoutException"); } catch (TimeoutException e) { } barrier.await(10, TimeUnit.SECONDS); forEachFuture.get(10, TimeUnit.SECONDS); assertEquals("value" + key + "-other", putFuture.get(10, TimeUnit.SECONDS)); assertEquals("value" + key + "-new", cache.get(key)); LockManager lockManager = cache.getAdvancedCache().getComponentRegistry().getComponent(LockManager.class); assertEquals(0, lockManager.getNumberOfLocksHeld()); }

Target:
public void testLockedStream() throws Throwable { assertLockStream((c, e) -> assertEquals("value" + e.getKey(), c.put(e.getKey(), String.valueOf(e.getValue() + "-other")))); }
Source:
private void readPushOptions() throws IOException { String pushOption = pckIn.readString(); while (pushOption != null) { pushOptions.add(pushOption); } }

Target:
private void readPushOptions() throws IOException { String pushOption = pckIn.readString(); while (pushOption != null) { pushOptions.add(pushOption); pushOption = pckIn.readString(); } }
Source:
private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = new CallOptionsConfig.Builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }

Target:
private static void setClientCallOptions(Configuration configuration, BigtableOptions.Builder bigtableOptionsBuilder) { CallOptionsConfig.Builder clientCallOptionsBuilder = new CallOptionsConfig.Builder(); clientCallOptionsBuilder .setUseTimeout(configuration.getBoolean(BIGTABLE_USE_TIMEOUTS_KEY, USE_TIMEOUT_DEFAULT)); if (configuration.get(BIGTABLE_RPC_TIMEOUT_MS_KEY) != null) { clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(BIGTABLE_RPC_TIMEOUT_MS_KEY, SHORT_TIMEOUT_MS_DEFAULT)); } else { clientCallOptionsBuilder.setShortRpcTimeoutMs( configuration.getInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, SHORT_TIMEOUT_MS_DEFAULT)); } if (configuration.get(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY) != null) { clientCallOptionsBuilder.setLongRpcTimeoutMs( configuration.getInt(BIGTABLE_LONG_RPC_TIMEOUT_MS_KEY, LONG_TIMEOUT_MS_DEFAULT)); } else { clientCallOptionsBuilder.setLongRpcTimeoutMs(configuration .getInt(HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD, LONG_TIMEOUT_MS_DEFAULT)); } bigtableOptionsBuilder.setCallOptionsConfig(clientCallOptionsBuilder.build()); }
Source:
public boolean isStale(GerritConfig cfg) { return lastUpdated > cfg.getCreationTime() || (refreshConfig && site.gerrit_config.lastModified() > cfg.getCreationTime()); }

Target:
public boolean isStale(GerritConfig cfg) { return refreshConfig && site.gerrit_config.lastModified() > cfg.getCreationTime(); }
Source:
public int open() { setTitle("Rename representation"); text.setText(oldName); text.selectAll(); final Button okButton = getButton(IDialogConstants.OK_ID); status = new Status(IStatus.OK, SiriusTransPlugin.PLUGIN_ID, IStatus.OK, "", null); updateStatus(status); okButton.setEnabled(false); return super.open(); }

Target:
public int open() { textChanged(newName); text.selectAll(); return super.open(); }
Source:
public void testChronologizeWithStartTimestampAndEndTimestampAfterAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); for (int i = 0; i < 100000000; i++); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); for (int i = 0; i < 100000000; i++); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize( key, record, startTimestamp, endTimestamp); Set<Object> lastResultSet = Iterables.getLast( result.values()); assertEquals(testSize+1, result.size()); assertEquals(testSize*2, lastResultSet.size()); }

Target:
public void testChronologizeWithStartTimestampAndEndTimestampAfterAnyValuesChangeInKeyInRecord() { long record = Variables.register("record", client.create()); String key = Variables.register("key", TestData.getString()); int testSize = Variables.register("testSize", 5); Set<Object> initValues = Variables.register("initValues", Sets.newHashSet()); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp startTimestamp = Variables.register("startTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Timestamp endTimestamp = Variables.register("endTimestamp", Timestamp.now()); StandardActions.wait(200, TimeUnit.MILLISECONDS); for (int i = 0; i < testSize; i++) { Object value = null; while (value == null || initValues.contains(value)) { value = TestData.getObject(); } initValues.add(value); client.add(key, value, record); } Map<Timestamp, Set<Object>> result = client.chronologize(key, record, startTimestamp, endTimestamp); Set<Object> lastResultSet = Iterables.getLast(result.values()); assertEquals(testSize + 1, result.size()); assertEquals(testSize * 2, lastResultSet.size()); }
Source:
public String verifyCaptureSubmittedEvent() throws JsonProcessingException { ChargeEntity charge = ChargeEntityFixture.aValidChargeEntity() .withTransactionId("gateway_transaction_id") .withCorporateSurcharge(55L) .withCardDetails(anAuthCardDetails().getCardDetailsEntity()) .build(); CaptureSubmitted captureSubmittedEvent = new CaptureSubmitted( resourceId, PaymentDetailsEnteredEventDetails.from(charge), ZonedDateTime.now() ); return captureSubmittedEvent.toJsonString(); }

Target:
public String verifyCaptureSubmittedEvent() throws JsonProcessingException { ChargeEventEntity chargeEventEntity = ChargeEventEntityFixture .aValidChargeEventEntity() .withGatewayEventDate(ZonedDateTime.now()) .build(); CaptureSubmitted captureSubmittedEvent = new CaptureSubmitted( resourceId, CaptureSubmittedEventDetails.from(chargeEventEntity), ZonedDateTime.now() ); return captureSubmittedEvent.toJsonString(); }
Source:
public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Callable<Route>() { @Override public Route call() throws Exception { Collection<Route> matches = Collections2.filter(routes, canHandle(rawtype, method)); logger.debug("Routes matched for is {}", method, matches); return Iterables.getFirst(matches, NULL); } }); logger.debug("Selected route for is {}", method, route); if (route == null || route.equals(NULL)) { throw new RouteNotFoundException("The selected route is invalid for redirection: " + rawtype.getName() + "." + method.getName()); } String url = route.urlFor(type, method, params); logger.debug("Returning URL for {}", url, route); return url; }

Target:
public <T> String urlFor(final Class<T> type, final Method method, Object... params) { final Class<?> rawtype = proxifier.isProxyType(type) ? type.getSuperclass() : type; final Invocation invocation = new Invocation(rawtype, method); Route route = cache.fetch(invocation, new Callable<Route>() { @Override public Route call() throws Exception { Collection<Route> matches = Collections2.filter(routes, canHandle(rawtype, method)); logger.debug("Routes matched for is {}", method, matches); return Iterables.getFirst(matches, NULL); } }); logger.debug("Selected route for is {}", method, route); if (route == NULL) { throw new RouteNotFoundException("The selected route is invalid for redirection: " + rawtype.getName() + "." + method.getName()); } String url = route.urlFor(type, method, params); logger.debug("Returning URL for {}", url, route); return url; }
Source:
public String getXPathNodeName() { return toString(); }

Target:
public String getXPathNodeName() { LOG.warning("getXPathNodeName should be overriden in classes derived from AbstractNode. " + "The implementation is provided for compatibility with existing implementors," + "but could be declared abstract as soon as release " + PMDVersion.getNextMajorRelease() + "."); return toString(); }
Source:
public boolean remove(Runnable task) { Future<?> future = futures.get(task); if (future != null && future.cancel(false)) { running.remove(future); } futures.remove(task); return super.remove(task); }

Target:
public boolean remove(Runnable task) { Future<?> future = futures.get(task); if (future != null && future.cancel(false)) { running.remove(future); } futures.remove(task); return super.remove((Runnable) future); }
Source:
public double get(double q) { rotate(); CKMSQuantiles currentBucket; do { currentBucket = buckets.peek(); } while (currentBucket == null); return currentBucket.get(q); }

Target:
public double get(double q) { return getCurrentBucket().get(q); }
Source:
private Jep createJEPInstance() { JepConfig config = new JepConfig(); Jep jep = null; boolean success = false; try { File delftPath = new File(GrobidProperties.getInstance().getDeLFTFilePath()); if (!delftPath.exists()) { throw new GrobidResourceException("DeLFT installation path does not exist"); } if (!delftPath.isDirectory()) { throw new GrobidResourceException("DeLFT installation path is not a directory"); } config.addIncludePaths(delftPath.getAbsolutePath()); config.setClassLoader(Thread.currentThread().getContextClassLoader()); jep = new Jep(config); jepInstances.put(Thread.currentThread().getId(), jep); jep.eval("import os"); jep.eval("import numpy as np"); jep.eval("import keras.backend as K"); jep.eval("os.chdir('" + delftPath.getAbsolutePath() + "')"); jep.eval("from delft.utilities.Embeddings import Embeddings"); jep.eval("import delft.sequenceLabelling"); jep.eval("from delft.sequenceLabelling import Sequence"); jep.eval("from delft.sequenceLabelling.reader import load_data_and_labels_crf_file"); jep.eval("from delft.sequenceLabelling.reader import load_data_crf_string"); jep.eval("from sklearn.model_selection import train_test_split"); success = true; return jep; } catch(JepException e) { LOGGER.error("JEP initialization failed", e); throw new RuntimeException("JEP initialization failed", e); } catch(GrobidResourceException e) { LOGGER.error("DeLFT installation path invalid, JEP initialization failed", e); throw new RuntimeException("DeLFT installation path invalid, JEP initialization failed", e); } finally { if (!success) { try { jep.close(); } catch (JepException e) { LOGGER.error("failed to close JEP instance", e); } } } }

Target:
private Jep createJEPInstance() { Jep jep = null; boolean success = false; try { File delftPath = this.getAndValidateDelftPath(); JepConfig config = this.getJepConfig( delftPath, PythonEnvironmentConfig.getInstance().getSitePackagesPath() ); jep = new Jep(config); this.initializeJepInstance(jep, delftPath); success = true; return jep; } catch(JepException e) { LOGGER.error("JEP initialization failed", e); throw new RuntimeException("JEP initialization failed", e); } catch(GrobidResourceException e) { LOGGER.error("DeLFT installation path invalid, JEP initialization failed", e); throw new RuntimeException("DeLFT installation path invalid, JEP initialization failed", e); } finally { if (!success && (jep != null)) { try { jep.close(); } catch (JepException e) { LOGGER.error("failed to close JEP instance", e); } } } }
Source:
public void run() { this.logVersion(); this.logTruncatorProperties(); int retryCounter = 0; while (retryCounter < truncatorMaxRetries) { try { this.truncate(); this.restoreControllers(); return; } catch (Exception e) { log.error("truncation failed on retry " + retryCounter + " of " + truncatorMaxRetries); retryCounter++; if (retryCounter >= truncatorMaxRetries) { e.printStackTrace(); return; } } } this.restoreControllers(); }

Target:
public void run() { this.logVersion(); this.logTruncatorProperties(); int retryCounter = 0; while (retryCounter < truncatorMaxRetries) { try { this.truncate(); break; } catch (Exception e) { retryCounter++; log.error("truncation failed on retry " + retryCounter + " of " + truncatorMaxRetries + ", retry again in " + truncatorMaxDelay + "seconds."); if (retryCounter >= truncatorMaxRetries) { e.printStackTrace(); break; } try { Thread.sleep(truncatorMaxDelay); } catch (InterruptedException ie) { break; } } } this.restoreControllers(); }