nutch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lewis John McGibbney (JIRA)" <j...@apache.org>
Subject [jira] [Work started] (NUTCH-1709) Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods not defined in source .avsc
Date Sat, 01 Nov 2014 17:54:33 GMT

     [ https://issues.apache.org/jira/browse/NUTCH-1709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Work on NUTCH-1709 started by Lewis John McGibbney.
---------------------------------------------------
> Generated classes o.a.n.storage.Host and o.a.n.storage.ProtocolStatus contain methods
not defined in source .avsc
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: NUTCH-1709
>                 URL: https://issues.apache.org/jira/browse/NUTCH-1709
>             Project: Nutch
>          Issue Type: Improvement
>            Reporter: Lewis John McGibbney
>            Assignee: Lewis John McGibbney
>             Fix For: 2.3
>
>         Attachments: NUTCH-1709.patch
>
>
> When using the GoraCompiler currently packaged with gora-core-0.4-SNAPSHOT, the following
methods are removed from o.a.n.storage.Host or o.a.n.storage.ProtocolStatus
> {code:title=Host.java|borderStyle=solid}
>   public boolean contains(String key) {
>     return metadata.containsKey(new Utf8(key));
>   }
>   
>   public String getValue(String key, String defaultValue) {
>     if (!contains(key)) return defaultValue;
>     return Bytes.toString(metadata.get(new Utf8(key)));
>   }
>   
>   public int getInt(String key, int defaultValue) {
>     if (!contains(key)) return defaultValue;
>     return Integer.parseInt(getValue(key,null));
>   }
>   public long getLong(String key, long defaultValue) {
>     if (!contains(key)) return defaultValue;
>     return Long.parseLong(getValue(key,null));
>   }
> {code}
> {code:title=ProtocolStatus.java|borderStyle=solid}
>   /**
>    * A convenience method which returns a successful {@link ProtocolStatus}.
>    * @return the {@link ProtocolStatus} value for 200 (success).
>    */
>   public boolean isSuccess() {
>     return code == ProtocolStatusUtils.SUCCESS; 
>   }
> {code}
> This results in compilation errors... I am not sure if it is good practice for non-default
methods to be contained within generated Persistent classes. This is certainly the case with
newer versions of Avro when using the Java API.
> compile-core:
>     [javac] Compiling 104 source files to /home/mary/Downloads/apache/2.x/build/classes
>     [javac] warning: [options] bootstrap class path not set in conjunction with -source
1.6
>     [javac] /home/mary/Downloads/apache/2.x/src/java/org/apache/nutch/fetcher/FetcherReducer.java:345:
error: cannot find symbol
>     [javac]                                        host.getInt("q_mt", maxThreads),
>     [javac]                                            ^
>     [javac]   symbol:   method getInt(String,int)
>     [javac]   location: variable host of type Host
>     [javac] /home/mary/Downloads/apache/2.x/src/java/org/apache/nutch/fetcher/FetcherReducer.java:346:
error: cannot find symbol
>     [javac]                                        host.getLong("q_cd", crawlDelay),
>     [javac]                                            ^
>     [javac]   symbol:   method getLong(String,long)
>     [javac]   location: variable host of type Host
>     [javac] /home/mary/Downloads/apache/2.x/src/java/org/apache/nutch/fetcher/FetcherReducer.java:347:
error: cannot find symbol
>     [javac]                                        host.getLong("q_mcd", minCrawlDelay));
>     [javac]                                            ^
>     [javac]   symbol:   method getLong(String,long)
>     [javac]   location: variable host of type Host
>     [javac] /home/mary/Downloads/apache/2.x/src/java/org/apache/nutch/parse/ParserChecker.java:114:
error: cannot find symbol
>     [javac]     if(!protocolOutput.getStatus().isSuccess()) {
>     [javac]                                   ^
>     [javac]   symbol:   method isSuccess()
>     [javac]   location: class ProtocolStatus
>     [javac] Note: /home/mary/Downloads/apache/2.x/src/java/org/apache/nutch/storage/Host.java
uses unchecked or unsafe operations.
>     [javac] Note: Recompile with -Xlint:unchecked for details.
>     [javac] 4 errors
>     [javac] 1 warning
> I think it would be a good idea to find another home for such methods as it will undoubtedly
avoid problems when we do Gora upgrades in the future.
> Right now I don't have a suggestion but will work on a solution non-the-less.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message